Mercurial > wow > ouroloot
diff AceGUIWidget-DoTimerEditBoxDropDown.lua @ 54:6d5fcbdc0590
DoTimerEditBoxDropDown widget to ver 5, warn (once) about missing item cache entries in the filter list dropdown.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Sat, 07 Apr 2012 04:59:27 +0000 |
parents | 822b6ca3ef89 |
children |
line wrap: on
line diff
--- a/AceGUIWidget-DoTimerEditBoxDropDown.lua Fri Apr 06 18:23:22 2012 +0000 +++ b/AceGUIWidget-DoTimerEditBoxDropDown.lua Sat Apr 07 04:59:27 2012 +0000 @@ -1,4 +1,4 @@ -local Type, Version = "EditBoxDropDown", 3 +local Type, Version = "EditBoxDropDown", 5 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -20,7 +20,7 @@ Version 3 adds the EditBoxDropDownOptionControl variant, specifically for use as a 'dialogControl' in AceConfig option tables. Details follow; the more -disappointing restrictions are because AceConfig never gives the end user any +disappointing restrictions are because AceConfig never gives the programmer any direct link to the widgets in use. - 'desc' option field ignored - 'name' field may contain an embedded tab ('\t') followed by more text to be @@ -29,10 +29,10 @@ OnTextEnterPressed callback; this is typically how new entries should be added to data - 'values' field must be a function, returning the usual list of entries, PLUS - the callback used for 'get', e.g., + the callback used for 'get' as a key, e.g., values = function() - local ret = build_real_dropdown_values() - ret[get_callback] = true -- assuming "function get_callback (widget, event, text)" + local ret = build_real_dropdown_table() + ret[get_callback] = true -- assuming "function get_callback (widget, event, text) .... end" return ret end The callback will be immediately removed from the table, but is required to @@ -40,6 +40,10 @@ - 'set' receives the key of the dropdown table, but that entry will already be removed by the time the 'set' function is called +Version 4 was never released. + +Version 5 adds the OnDropdownShown callback. + EditBoxDropDown API @@ -73,8 +77,11 @@ similar to a Dropdown widget's OnValueChanged, the key and value from the table given to :SetList are passed +OnDropdownShown + when the down arrow is clicked to display the list -farmbuyer + +farmbuyer@gmail.com ]] local button_hover_text_default = "Click on entries to remove them." @@ -142,6 +149,7 @@ local t = BuildList(button.obj) EasyMenu (t, button.obj.dropdown, button.obj.frame, 0, 0, "MENU") PlaySound("igMainMenuOptionCheckBoxOn") + button.obj:Fire("OnDropdownShown") end end @@ -153,6 +161,7 @@ end +--local base_SetWidth = AceGUI.WidgetBase.SetWidth local methods = { ["OnAcquire"] = function (self) self:SetHeight(20) @@ -164,7 +173,17 @@ maps = maps or {} maps[self.editbox.editbox] = self end, +--[=[ + ["SetWidth"] = function (self, width) + print("got",width) + base_SetWidth(self, width) + self.frame.width = width + 45 + end, + ["GetWidth"] = function (self) + return self.frame:GetWidth() + 45 + end, +]=] ["OnRelease"] = function (self) self.frame:ClearAllPoints() self.frame:Hide() @@ -239,7 +258,8 @@ local frame = editbox.frame editbox:SetHeight(20) editbox:SetWidth(100) - frame:SetWidth(frame:GetWidth()+6) + --frame:SetWidth(frame:GetWidth()+15) + --frame.width = frame:GetWidth() + 15 editbox:SetCallback("OnEnter", ddEditBox_OnMouseEnter) editbox:SetCallback("OnLeave", ddEditBox_OnMouseLeave) editbox:SetCallback("OnEnterPressed", ddEditBox_OnEnterPressed)