Mercurial > wow > hansgar_and_franzok_assist
comparison Libs/DF/fw.lua @ 49:7d5934415ad0 r49-release
- framework update.
| author | Tercio |
|---|---|
| date | Wed, 05 Jul 2017 15:20:21 -0300 |
| parents | ed3decee0d5d |
| children | 36b4d9559b69 |
comparison
equal
deleted
inserted
replaced
| 48:a671a2cf52ee | 49:7d5934415ad0 |
|---|---|
| 1 | 1 |
| 2 local dversion = 50 | 2 local dversion = 54 |
| 3 local major, minor = "DetailsFramework-1.0", dversion | 3 local major, minor = "DetailsFramework-1.0", dversion |
| 4 local DF, oldminor = LibStub:NewLibrary (major, minor) | 4 local DF, oldminor = LibStub:NewLibrary (major, minor) |
| 5 | 5 |
| 6 if (not DF) then | 6 if (not DF) then |
| 7 DetailsFrameworkCanLoad = false | 7 DetailsFrameworkCanLoad = false |
| 302 function DF:GetFontFace (fontString) | 302 function DF:GetFontFace (fontString) |
| 303 local fontface = fontString:GetFont() | 303 local fontface = fontString:GetFont() |
| 304 return fontface | 304 return fontface |
| 305 end | 305 end |
| 306 | 306 |
| 307 local ValidOutlines = { | |
| 308 ["NONE"] = true, | |
| 309 ["MONOCHROME"] = true, | |
| 310 ["OUTLINE"] = true, | |
| 311 ["THICKOUTLINE"] = true, | |
| 312 } | |
| 307 function DF:SetFontOutline (fontString, outline) | 313 function DF:SetFontOutline (fontString, outline) |
| 308 local fonte, size = fontString:GetFont() | 314 local fonte, size = fontString:GetFont() |
| 309 if (outline) then | 315 if (outline) then |
| 310 if (_type (outline) == "boolean" and outline) then | 316 if (ValidOutlines [outline]) then |
| 317 outline = outline | |
| 318 elseif (_type (outline) == "boolean" and outline) then | |
| 311 outline = "OUTLINE" | 319 outline = "OUTLINE" |
| 312 elseif (outline == 1) then | 320 elseif (outline == 1) then |
| 313 outline = "OUTLINE" | 321 outline = "OUTLINE" |
| 314 elseif (outline == 2) then | 322 elseif (outline == 2) then |
| 315 outline = "THICKOUTLINE" | 323 outline = "THICKOUTLINE" |
| 648 tinsert (parent.widget_list, colorpick) | 656 tinsert (parent.widget_list, colorpick) |
| 649 widget_created = colorpick | 657 widget_created = colorpick |
| 650 | 658 |
| 651 elseif (widget_table.type == "execute" or widget_table.type == "button") then | 659 elseif (widget_table.type == "execute" or widget_table.type == "button") then |
| 652 | 660 |
| 653 local button = DF:NewButton (parent, nil, "$parentWidget" .. index, nil, 120, 18, widget_table.func, widget_table.param1, widget_table.param2, nil, widget_table.name, nil, button_template) | 661 local button = DF:NewButton (parent, nil, "$parentWidget" .. index, nil, 120, 18, widget_table.func, widget_table.param1, widget_table.param2, nil, widget_table.name, nil, button_template, text_template) |
| 654 if (not button_template) then | 662 if (not button_template) then |
| 655 button:InstallCustomTexture() | 663 button:InstallCustomTexture() |
| 656 end | 664 end |
| 657 | 665 |
| 658 button:SetPoint (cur_x, cur_y) | 666 button:SetPoint (cur_x, cur_y) |
| 664 max_x = size | 672 max_x = size |
| 665 end | 673 end |
| 666 | 674 |
| 667 tinsert (parent.widget_list, button) | 675 tinsert (parent.widget_list, button) |
| 668 widget_created = button | 676 widget_created = button |
| 677 | |
| 678 | |
| 679 elseif (widget_table.type == "textentry") then | |
| 680 local textentry = DF:CreateTextEntry (parent, widget_table.func, 120, 18, nil, "$parentWidget" .. index, nil, button_template) | |
| 681 textentry.tooltip = widget_table.desc | |
| 682 textentry.text = widget_table.get() | |
| 683 textentry._get = widget_table.get | |
| 684 textentry.widget_type = "textentry" | |
| 685 textentry:SetHook ("OnEnterPressed", widget_table.set) | |
| 686 textentry:SetHook ("OnEditFocusLost", widget_table.set) | |
| 687 | |
| 688 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12) | |
| 689 textentry:SetPoint ("left", label, "right", 2) | |
| 690 label:SetPoint (cur_x, cur_y) | |
| 691 | |
| 692 local size = label.widget:GetStringWidth() + 60 + 4 | |
| 693 if (size > max_x) then | |
| 694 max_x = size | |
| 695 end | |
| 696 | |
| 697 tinsert (parent.widget_list, textentry) | |
| 698 widget_created = textentry | |
| 669 | 699 |
| 670 end | 700 end |
| 671 | 701 |
| 672 if (widget_table.nocombat) then | 702 if (widget_table.nocombat) then |
| 673 tinsert (disable_on_combat, widget_created) | 703 tinsert (disable_on_combat, widget_created) |
| 838 end | 868 end |
| 839 elseif (widget.widget_type == "select") then | 869 elseif (widget.widget_type == "select") then |
| 840 widget:Select (widget._get()) | 870 widget:Select (widget._get()) |
| 841 elseif (widget.widget_type == "toggle" or widget.widget_type == "range") then | 871 elseif (widget.widget_type == "toggle" or widget.widget_type == "range") then |
| 842 widget:SetValue (widget._get()) | 872 widget:SetValue (widget._get()) |
| 873 elseif (widget.widget_type == "textentry") then | |
| 874 widget:SetText (widget._get()) | |
| 843 elseif (widget.widget_type == "color") then | 875 elseif (widget.widget_type == "color") then |
| 844 local default_value, g, b, a = widget._get() | 876 local default_value, g, b, a = widget._get() |
| 845 if (type (default_value) == "table") then | 877 if (type (default_value) == "table") then |
| 846 widget:SetColor (unpack (default_value)) | 878 widget:SetColor (unpack (default_value)) |
| 847 else | 879 else |
