Mercurial > wow > ouroloot
comparison gui.lua @ 47:1070a14cfee4
Updated lib-st widget from WRDW. Properly notice new generating tabs. Updated help text.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Sat, 28 Jan 2012 18:24:22 +0000 |
parents | 0b1e703a6954 |
children | fd3dd12f96ce |
comparison
equal
deleted
inserted
replaced
46:0b1e703a6954 | 47:1070a14cfee4 |
---|---|
43 local flib = LibStub("LibFarmbuyer") | 43 local flib = LibStub("LibFarmbuyer") |
44 | 44 |
45 local g_loot = nil | 45 local g_loot = nil |
46 local g_generated = nil | 46 local g_generated = nil |
47 local window_title = "Ouro Loot" | 47 local window_title = "Ouro Loot" |
48 local dirty_tabs = nil | |
48 | 49 |
49 local pairs, ipairs, tinsert, tremove, tonumber = pairs, ipairs, table.insert, table.remove, tonumber | 50 local pairs, ipairs, tinsert, tremove, tonumber = pairs, ipairs, table.insert, table.remove, tonumber |
50 | 51 |
51 local pprint, tabledump = addon.pprint, flib.tabledump | 52 local pprint, tabledump = addon.pprint, flib.tabledump |
52 local GetItemInfo, ITEM_QUALITY_COLORS = GetItemInfo, ITEM_QUALITY_COLORS | 53 local GetItemInfo, ITEM_QUALITY_COLORS = GetItemInfo, ITEM_QUALITY_COLORS |
106 _tabtexts[text_type] = { title=title, desc=description } | 107 _tabtexts[text_type] = { title=title, desc=description } |
107 tinsert (_taborder, next_insertion_position, text_type) | 108 tinsert (_taborder, next_insertion_position, text_type) |
108 next_insertion_position = next_insertion_position + 1 | 109 next_insertion_position = next_insertion_position + 1 |
109 text_gen_funcs[text_type] = generator | 110 text_gen_funcs[text_type] = generator |
110 specials_gen_funcs[text_type] = opt_specgen | 111 specials_gen_funcs[text_type] = opt_specgen |
112 dirty_tabs = true | |
111 end | 113 end |
112 | 114 |
113 -- Called by tabs_generated_text_OGS | 115 -- Called by tabs_generated_text_OGS |
114 function _generate_text (text_type) | 116 function _generate_text (text_type) |
115 local f = text_gen_funcs[text_type] | 117 local f = text_gen_funcs[text_type] |
370 -- By default, tabs are editboxes with generated text | 372 -- By default, tabs are editboxes with generated text |
371 if not tabs_OnGroupSelected[v] then | 373 if not tabs_OnGroupSelected[v] then |
372 tabs_OnGroupSelected[v] = tabs_generated_text_OGS | 374 tabs_OnGroupSelected[v] = tabs_generated_text_OGS |
373 end | 375 end |
374 end | 376 end |
377 dirty_tabs = nil | |
375 end | 378 end |
376 | 379 |
377 --[[ | 380 --[[ |
378 Dropdown menu handling | 381 Dropdown menu handling |
379 ]] | 382 ]] |
1788 if not label then | 1791 if not label then |
1789 opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_widget_type, opt_key | 1792 opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_widget_type, opt_key |
1790 elseif not status then | 1793 elseif not status then |
1791 opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_key, label | 1794 opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_key, label |
1792 end | 1795 end |
1793 local button = GUI:Create(opt_widget_type) | 1796 local button = assert(GUI:Create(opt_widget_type)) |
1794 if button.SetText then button:SetText(tostring(label)) end | 1797 if button.SetText then button:SetText(tostring(label)) end |
1795 status = status:gsub("[%+<>]",replacement_colors) | 1798 status = status:gsub("[%+<>]",replacement_colors) |
1796 button:SetCallback("OnEnter", function() setstatus(status) end) -- maybe factor that closure out | 1799 button:SetCallback("OnEnter", function() setstatus(status) end) -- maybe factor that closure out |
1797 button:SetCallback("OnLeave", statusy_OnLeave) | 1800 button:SetCallback("OnLeave", statusy_OnLeave) |
1798 -- retrieval key may be specified as nil if all the parameters are given | 1801 -- retrieval key may be specified as nil if all the parameters are given |
1812 | 1815 |
1813 -- This probably causes taint... hm. | 1816 -- This probably causes taint... hm. |
1814 local prev_fade_time = UIDROPDOWNMENU_SHOW_TIME | 1817 local prev_fade_time = UIDROPDOWNMENU_SHOW_TIME |
1815 UIDROPDOWNMENU_SHOW_TIME = 4 | 1818 UIDROPDOWNMENU_SHOW_TIME = 4 |
1816 | 1819 |
1820 if dirty_tabs then | |
1821 self:gui_init(g_loot) -- pointer known to be good by now | |
1822 self:zero_printed_fenceposts() | |
1823 end | |
1824 | |
1817 local display = GUI:Create("Frame") | 1825 local display = GUI:Create("Frame") |
1818 if _d then | 1826 if _d then |
1819 display:SetUserData("eoiST",_d) -- warning! warning! kludge detected! | 1827 display:SetUserData("eoiST",_d) -- warning! warning! kludge detected! |
1820 end | 1828 end |
1821 _d = display | 1829 _d = display |
1822 self.display = display | 1830 self.display = display |
1823 display:SetTitle(window_title) | 1831 display:SetTitle(window_title) |
1824 display:SetStatusText(self.status_text) | 1832 display:SetStatusText(self.status_text) |
1825 display:SetLayout("Flow") | 1833 display:SetLayout("Flow") |
1826 display:SetStatusTable{width=900,height=550} -- default height is 500 | 1834 display:SetStatusTable{width=900,height=550} -- default height is 500 |
1827 if display.EnableResize then -- FIXME after next Ace3 release, this can be assumed | 1835 display:EnableResize(false) |
1828 display:EnableResize(false) | |
1829 end | |
1830 display:SetCallback("OnClose", function(_display) | 1836 display:SetCallback("OnClose", function(_display) |
1831 UIDROPDOWNMENU_SHOW_TIME = prev_fade_time | 1837 UIDROPDOWNMENU_SHOW_TIME = prev_fade_time |
1832 _d = _display:GetUserData("eoiST") | 1838 _d = _display:GetUserData("eoiST") |
1833 self.display = nil | 1839 self.display = nil |
1834 GUI:Release(_display) | 1840 GUI:Release(_display) |