Mercurial > wow > hansgar_and_franzok_assist
comparison Libs/DF/button.lua @ 55:307f5af3ad02
- Framework update.
| author | Tercio |
|---|---|
| date | Sat, 09 Dec 2017 11:49:01 -0200 |
| parents | 7d5934415ad0 |
| children | 0682d738499b |
comparison
equal
deleted
inserted
replaced
| 54:def82fea66d4 | 55:307f5af3ad02 |
|---|---|
| 153 end | 153 end |
| 154 --> function | 154 --> function |
| 155 local smember_function = function (_object, _value) | 155 local smember_function = function (_object, _value) |
| 156 return _rawset (_object, "func", _value) | 156 return _rawset (_object, "func", _value) |
| 157 end | 157 end |
| 158 --> param1 | |
| 159 local smember_param1 = function (_object, _value) | |
| 160 return _rawset (_object, "param1", _value) | |
| 161 end | |
| 162 --> param2 | |
| 163 local smember_param2 = function (_object, _value) | |
| 164 return _rawset (_object, "param2", _value) | |
| 165 end | |
| 158 --> text color | 166 --> text color |
| 159 local smember_textcolor = function (_object, _value) | 167 local smember_textcolor = function (_object, _value) |
| 160 local _value1, _value2, _value3, _value4 = DF:ParseColors (_value) | 168 local _value1, _value2, _value3, _value4 = DF:ParseColors (_value) |
| 161 return _object.button.text:SetTextColor (_value1, _value2, _value3, _value4) | 169 return _object.button.text:SetTextColor (_value1, _value2, _value3, _value4) |
| 162 end | 170 end |
| 223 ButtonMetaFunctions.SetMembers ["hide"] = smember_hide | 231 ButtonMetaFunctions.SetMembers ["hide"] = smember_hide |
| 224 ButtonMetaFunctions.SetMembers ["width"] = smember_width | 232 ButtonMetaFunctions.SetMembers ["width"] = smember_width |
| 225 ButtonMetaFunctions.SetMembers ["height"] = smember_height | 233 ButtonMetaFunctions.SetMembers ["height"] = smember_height |
| 226 ButtonMetaFunctions.SetMembers ["text"] = smember_text | 234 ButtonMetaFunctions.SetMembers ["text"] = smember_text |
| 227 ButtonMetaFunctions.SetMembers ["clickfunction"] = smember_function | 235 ButtonMetaFunctions.SetMembers ["clickfunction"] = smember_function |
| 236 ButtonMetaFunctions.SetMembers ["param1"] = smember_param1 | |
| 237 ButtonMetaFunctions.SetMembers ["param2"] = smember_param2 | |
| 228 ButtonMetaFunctions.SetMembers ["textcolor"] = smember_textcolor | 238 ButtonMetaFunctions.SetMembers ["textcolor"] = smember_textcolor |
| 229 ButtonMetaFunctions.SetMembers ["textfont"] = smember_textfont | 239 ButtonMetaFunctions.SetMembers ["textfont"] = smember_textfont |
| 230 ButtonMetaFunctions.SetMembers ["textsize"] = smember_textsize | 240 ButtonMetaFunctions.SetMembers ["textsize"] = smember_textsize |
| 231 ButtonMetaFunctions.SetMembers ["texture"] = smember_texture | 241 ButtonMetaFunctions.SetMembers ["texture"] = smember_texture |
| 232 ButtonMetaFunctions.SetMembers ["locked"] = smember_locked | 242 ButtonMetaFunctions.SetMembers ["locked"] = smember_locked |
| 859 if ( | 869 if ( |
| 860 (x == button.x and y == button.y) or | 870 (x == button.x and y == button.y) or |
| 861 (button.mouse_down+0.5 > GetTime() and button:IsMouseOver()) | 871 (button.mouse_down+0.5 > GetTime() and button:IsMouseOver()) |
| 862 ) then | 872 ) then |
| 863 if (buttontype == "LeftButton") then | 873 if (buttontype == "LeftButton") then |
| 864 button.MyObject.func (button, buttontype, button.MyObject.param1, button.MyObject.param2) | 874 |
| 875 local success, errorText = pcall (button.MyObject.func, button, buttontype, button.MyObject.param1, button.MyObject.param2) | |
| 876 if (not success) then | |
| 877 error ("Details! Framework: button " .. button:GetName() .. " error: " .. errorText) | |
| 878 end | |
| 879 | |
| 880 --button.MyObject.func (button, buttontype, button.MyObject.param1, button.MyObject.param2) | |
| 865 else | 881 else |
| 866 button.MyObject.funcright (button, buttontype, button.MyObject.param1, button.MyObject.param2) | 882 |
| 883 local success, errorText = pcall (button.MyObject.funcright, button, buttontype, button.MyObject.param1, button.MyObject.param2) | |
| 884 if (not success) then | |
| 885 error ("Details! Framework: button " .. button:GetName() .. " error: " .. errorText) | |
| 886 end | |
| 887 | |
| 888 --button.MyObject.funcright (button, buttontype, button.MyObject.param1, button.MyObject.param2) | |
| 867 end | 889 end |
| 868 end | 890 end |
| 869 end | 891 end |
| 870 | 892 |
| 871 ------------------------------------------------------------------------------------------------------------ | 893 ------------------------------------------------------------------------------------------------------------ |
| 916 if (template.icon) then | 938 if (template.icon) then |
| 917 local i = template.icon | 939 local i = template.icon |
| 918 self:SetIcon (i.texture, i.width, i.height, i.layout, i.texcoord, i.color, i.textdistance, i.leftpadding) | 940 self:SetIcon (i.texture, i.width, i.height, i.layout, i.texcoord, i.color, i.textdistance, i.leftpadding) |
| 919 end | 941 end |
| 920 | 942 |
| 943 if (template.textsize) then | |
| 944 self.textsize = template.textsize | |
| 945 end | |
| 946 | |
| 947 if (template.textfont) then | |
| 948 self.textfont = template.textfont | |
| 949 end | |
| 950 | |
| 951 if (template.textcolor) then | |
| 952 self.textcolor = template.textcolor | |
| 953 end | |
| 954 | |
| 955 if (template.textalign) then | |
| 956 self.textalign = template.textalign | |
| 957 end | |
| 921 end | 958 end |
| 922 | 959 |
| 923 ------------------------------------------------------------------------------------------------------------ | 960 ------------------------------------------------------------------------------------------------------------ |
| 924 --> object constructor | 961 --> object constructor |
| 925 | 962 |
