Mercurial > wow > hansgar_and_franzok_assist
comparison Libs/DF/button.lua @ 49:7d5934415ad0 r49-release
- framework update.
| author | Tercio |
|---|---|
| date | Wed, 05 Jul 2017 15:20:21 -0300 |
| parents | 7944c081e5b4 |
| children | 307f5af3ad02 |
comparison
equal
deleted
inserted
replaced
| 48:a671a2cf52ee | 49:7d5934415ad0 |
|---|---|
| 392 return self.button:SetFrameLevel (framelevel) | 392 return self.button:SetFrameLevel (framelevel) |
| 393 end | 393 end |
| 394 end | 394 end |
| 395 | 395 |
| 396 -- icon | 396 -- icon |
| 397 function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding, textheight) | 397 function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding, textheight, short_method) |
| 398 if (not self.icon) then | 398 if (not self.icon) then |
| 399 self.icon = self:CreateTexture (nil, "artwork") | 399 self.icon = self:CreateTexture (nil, "artwork") |
| 400 self.icon:SetSize (self.height*0.8, self.height*0.8) | 400 self.icon:SetSize (self.height*0.8, self.height*0.8) |
| 401 self.icon:SetPoint ("left", self.widget, "left", 4 + (leftpadding or 0), 0) | 401 self.icon:SetPoint ("left", self.widget, "left", 4 + (leftpadding or 0), 0) |
| 402 self.icon.leftpadding = leftpadding or 0 | 402 self.icon.leftpadding = leftpadding or 0 |
| 425 | 425 |
| 426 local w = self.button:GetWidth() | 426 local w = self.button:GetWidth() |
| 427 local iconw = self.icon:GetWidth() | 427 local iconw = self.icon:GetWidth() |
| 428 local text_width = self.button.text:GetStringWidth() | 428 local text_width = self.button.text:GetStringWidth() |
| 429 if (text_width > w-15-iconw) then | 429 if (text_width > w-15-iconw) then |
| 430 if (not short_method) then | 430 |
| 431 if (short_method == false) then | |
| 432 | |
| 433 elseif (not short_method) then | |
| 431 local new_width = text_width+15+iconw | 434 local new_width = text_width+15+iconw |
| 432 self.button:SetWidth (new_width) | 435 self.button:SetWidth (new_width) |
| 436 | |
| 433 elseif (short_method == 1) then | 437 elseif (short_method == 1) then |
| 434 local loop = true | 438 local loop = true |
| 435 local textsize = 11 | 439 local textsize = 11 |
| 436 while (loop) do | 440 while (loop) do |
| 437 if (text_width+15+iconw < w or textsize < 8) then | 441 if (text_width+15+iconw < w or textsize < 8) then |
| 441 DF:SetFontSize (self.button.text, textsize) | 445 DF:SetFontSize (self.button.text, textsize) |
| 442 text_width = self.button.text:GetStringWidth() | 446 text_width = self.button.text:GetStringWidth() |
| 443 textsize = textsize - 1 | 447 textsize = textsize - 1 |
| 444 end | 448 end |
| 445 end | 449 end |
| 450 | |
| 446 end | 451 end |
| 447 end | 452 end |
| 448 | 453 |
| 449 end | 454 end |
| 450 | 455 |
| 1013 DF:SetFontSize (ButtonObject.button.text, textsize) | 1018 DF:SetFontSize (ButtonObject.button.text, textsize) |
| 1014 text_width = ButtonObject.button.text:GetStringWidth() | 1019 text_width = ButtonObject.button.text:GetStringWidth() |
| 1015 textsize = textsize - 1 | 1020 textsize = textsize - 1 |
| 1016 end | 1021 end |
| 1017 end | 1022 end |
| 1023 | |
| 1024 elseif (short_method == 2) then | |
| 1025 | |
| 1018 end | 1026 end |
| 1019 end | 1027 end |
| 1020 | 1028 |
| 1021 ButtonObject.func = func or cleanfunction | 1029 ButtonObject.func = func or cleanfunction |
| 1022 ButtonObject.funcright = cleanfunction | 1030 ButtonObject.funcright = cleanfunction |
