diff --git a/Aux-AddOn.toc b/Aux-AddOn.toc index 715a232..bf93a66 100644 --- a/Aux-AddOn.toc +++ b/Aux-AddOn.toc @@ -6,6 +6,7 @@ slash.lua core.xml +gui.lua control.xml persistence.lua util.lua diff --git a/auctions_frame.xml b/auctions_frame.xml index f924027..eceee7e 100644 --- a/auctions_frame.xml +++ b/auctions_frame.xml @@ -9,12 +9,6 @@ - - - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) - - diff --git a/bids_frame.xml b/bids_frame.xml index 3d61832..4886d87 100644 --- a/bids_frame.xml +++ b/bids_frame.xml @@ -9,12 +9,6 @@ - - - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) - - diff --git a/core.lua b/core.lua index b30968f..f0f9805 100644 --- a/core.lua +++ b/core.lua @@ -58,6 +58,18 @@ function Aux_OnLoad() end end) end + + local tab_group = Aux.gui.tab_group(AuxFrame, 'BOTTOM') + tab_group:create_tab('Item Search') + tab_group:create_tab('Filter Search') + tab_group:create_tab('Post') + tab_group:create_tab('Auctions') + tab_group:create_tab('Bids') + tab_group.on_select = Aux.on_tab_click + tab_group:set_tab(1) + + Aux.item_search_frame.on_load() + Aux.filter_search_frame.on_load() end function Aux_OnEvent() @@ -217,10 +229,6 @@ function Aux.on_tab_click(index) Aux.bids_frame.on_close() Aux.history_frame.on_close() - for i=1,5 do - getglobal('AuxTab'..i):SetAlpha(i == index and 1 or 0.5) - end - AuxItemSearchFrame:Hide() AuxFilterSearchFrame:Hide() AuxSellFrame:Hide() diff --git a/core.xml b/core.xml index 9806151..d982f32 100644 --- a/core.xml +++ b/core.xml @@ -204,30 +204,27 @@ - + - + - + - - - - - - + + + - - - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) - - + + + + + + @@ -349,7 +346,6 @@ - this:SetBackdropBorderColor(0.4, 0.4, 0.4) this:RegisterForDrag('LeftButton') @@ -366,16 +362,14 @@ this:StopMovingOrSizing() - - - - - - - + - + + + + + - - - - - - + @@ -513,8 +422,6 @@ this:SetWidth(floor(this:GetParent():GetWidth()/2)) - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) diff --git a/filter_search_frame.lua b/filter_search_frame.lua index e282646..75d94b3 100644 --- a/filter_search_frame.lua +++ b/filter_search_frame.lua @@ -524,10 +524,37 @@ function public.on_close() end function public.on_open() - public.set_view(aux_view) update_sheet() end +function public.on_load() + do + local btn = Aux.gui.button(AuxFilterSearchFrameFilters, 15, '$parentSearchButton') + btn:SetPoint('BOTTOMLEFT', 8, 15) + btn:SetWidth(75) + btn:SetHeight(24) + btn:SetText('Search') + btn:SetScript('OnClick', Aux.filter_search_frame.start_search) + end + do + local btn = Aux.gui.button(AuxFilterSearchFrameFilters, 15, '$parentStopButton') + btn:SetPoint('BOTTOMLEFT', 8, 15) + btn:SetWidth(75) + btn:SetHeight(24) + btn:SetText('Stop') + btn:SetScript('OnClick', Aux.filter_search_frame.stop_search) + btn:Hide() + end + do + local tab_group = Aux.gui.tab_group(AuxFilterSearchFrameResults, 'TOP') + tab_group:create_tab('Buy') + tab_group:create_tab('Bid') + tab_group:create_tab('Full') + tab_group.on_select = Aux.filter_search_frame.set_view + tab_group:set_tab(aux_view) + end +end + function public.dialog_cancel() Aux.scan.abort() AuxFilterSearchFrameResultsConfirmation:Hide() @@ -576,9 +603,6 @@ function hide_sheet() end function public.set_view(view) - for i=1,3 do - getglobal('AuxFilterSearchFrameResultsTab'..i):SetAlpha(i == view and 1 or 0.5) - end aux_view = view update_sheet() end diff --git a/filter_search_frame.xml b/filter_search_frame.xml index e873660..99afc17 100644 --- a/filter_search_frame.xml +++ b/filter_search_frame.xml @@ -17,8 +17,6 @@ - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) getglobal(this:GetName().."Title"):SetText('Filters') @@ -242,24 +240,6 @@ - - @@ -298,66 +278,13 @@ - + - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) - - - diff --git a/gui.lua b/gui.lua new file mode 100644 index 0000000..44c2899 --- /dev/null +++ b/gui.lua @@ -0,0 +1,201 @@ +local m = {} +Aux.gui = m + +m.config = { + edge_size = 1.5, + frame_color = {24/255, 24/255, 24/255, 1}, + frame_border_color = {1, 1, 1, .03}, + content_color = {42/255, 42/255, 42/255, 1}, + content_border_color = {0, 0, 0, 0}, + content_font = [[Fonts\ARIALN.TTF]], +} + +function m.button(parent, text_height, name) + local button = CreateFrame('Button', name, parent) + button:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size}) + button:SetBackdropColor(unpack(m.config.content_color)) + button:SetBackdropBorderColor(unpack(m.config.content_border_color)) + local highlight = button:CreateTexture(nil, 'HIGHLIGHT') + highlight:SetAllPoints() + highlight:SetTexture(1, 1, 1, .2) + highlight:SetBlendMode('BLEND') + button.highlight = highlight + button:Show() + local label = button:CreateFontString() + label:SetFont(m.config.content_font, text_height) + label:SetPoint('CENTER', 0, 0) + label:SetJustifyH('CENTER') + label:SetJustifyV('CENTER') + label:SetHeight(text_height) + label:SetTextColor(255/255, 254/255, 250/255) +-- TSM:Hook(button, "Enable", function() TSMAPI.Design:SetWidgetTextColor(label) end, true) +-- TSM:Hook(button, "Disable", function() TSMAPI.Design:SetWidgetTextColor(label, true) end, true) + button:SetFontString(label) + return button +end + + +function m.resize_tab(tab, width, padding) + tab:SetWidth(width + padding + 8) +end + +function m.update_tab(tab) + +end + +do + local id = 0 + function m.tab_group(parent, position) + id = id + 1 + + local frame = CreateFrame('Frame', nil, parent) + frame:SetHeight(100) + frame:SetWidth(100) +-- frame:SetFrameStrata('FULLSCREEN_DIALOG') + +-- local border = CreateFrame('Frame', nil, frame) +-- border:SetPoint('TOPLEFT', 1, -30) +-- border:SetPoint('BOTTOMRIGHT', -1, 3) +-- border:SetBackdrop({ bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size }) +-- border:SetBackdropColor(unpack(m.config.frame_color)) +-- border:SetBackdropBorderColor(unpack(m.config.frame_border_color)) + +-- local content = CreateFrame('Frame', nil, border) +-- content:SetPoint('TOPLEFT', 8, -8) +-- content:SetPoint('BOTTOMRIGHT', -8, 8) + + local self = { + id = id, + frame = parent, +-- border = border, + tabs = {}, + on_select = function() end, + } + + function self:create_tab(text) + local id = getn(self.tabs) + 1 + + local tab = CreateFrame('Button', 'aux_tab_group'..self.id..'_tab'..id, self.frame) + tab.id = id + tab.group = self + tab:SetHeight(24) + tab:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size}) + tab:SetBackdropColor(0, 0, 0, 0) + tab:SetBackdropBorderColor(unpack(m.config.frame_border_color)) + local image = tab:CreateTexture(nil, 'BACKGROUND') + image:SetAllPoints() + image:SetTexture(unpack(m.config.content_color)) + tab.image = image + local bottom = tab:CreateTexture(nil, 'OVERLAY') + bottom:SetHeight(2) + bottom:SetPoint('BOTTOMLEFT', 1, -1) + bottom:SetPoint('BOTTOMRIGHT', -1, -1) + bottom:SetTexture(unpack(m.config.frame_color)) + tab.bottom = bottom + local highlight = tab:CreateTexture(nil, 'HIGHLIGHT') + highlight:SetAllPoints() + highlight:SetTexture(1, 1, 1, .2) + highlight:SetBlendMode('BLEND') + tab.highlight = highlight + + tab.text = tab:CreateFontString() + tab.text:SetPoint('LEFT', 3, -1) + tab.text:SetPoint('RIGHT', -3, -1) + tab.text:SetJustifyH('CENTER') + tab.text:SetJustifyV('CENTER') + tab.text:SetFont(m.config.content_font, 18) + tab:SetFontString(tab.text) + + tab:SetText(text) + + tab:SetScript('OnClick', function() + if this.id ~= this.group.selected then +-- PlaySound('igCharacterInfoTab') + this.group:set_tab(this.id) + end + end) + + if getn(self.tabs) == 0 then + if position == 'TOP' then + tab:SetPoint('BOTTOMLEFT', self.frame, 'TOPLEFT', 4, -1) + else + tab:SetPoint('TOPLEFT', self.frame, 'BOTTOMLEFT', 4, 1) + end + else + if position == 'TOP' then + tab:SetPoint('BOTTOMLEFT', self.tabs[getn(self.tabs)], 'BOTTOMRIGHT', 4, 0) + else + tab:SetPoint('TOPLEFT', self.tabs[getn(self.tabs)], 'TOPRIGHT', 4, 0) + end + end + + m.resize_tab(tab, tab:GetFontString():GetStringWidth(), 4) + + -- tab:Show() + tinsert(self.tabs, tab) + end + + function self:set_tab(id) + self.selected = id + + self.update_tabs() + + self.on_select(id) + end + + function self.update_tabs() + for _, tab in ipairs(self.tabs) do + -- if tab.disabled then + -- TSMAPI.Design:SetWidgetLabelColor(tab.text, true) + -- tab:Disable() + -- tab.text = tab:GetText() + -- tab.bottom:Hide() + if tab.group.selected == tab.id then +-- TSMAPI.Design:SetWidgetLabelColor(tab.text) + tab.text:SetTextColor(255/255, 254/255, 250/255) -- TODO + tab:Disable() + tab.image:SetTexture(unpack(m.config.frame_color)) + tab.bottom:Show() + tab:SetHeight(29) + else +-- TSMAPI.Design:SetWidgetTextColor(tab.text) + tab.text:SetTextColor(255/255, 254/255, 250/255) -- TODO + tab:Enable() + tab.image:SetTexture(unpack(m.config.content_color)) + tab.bottom:Hide() + tab:SetHeight(24) + end + end + end + + +-- ["OnWidthSet"] = function(self, width) +-- local content = self.content +-- local contentwidth = width - 60 +-- if contentwidth < 0 then +-- contentwidth = 0 +-- end +-- content:SetWidth(contentwidth) +-- content.width = contentwidth +-- self:BuildTabs(self) +-- self.frame:SetScript("OnUpdate", BuildTabsOnUpdate) +-- end, +-- +-- ["OnHeightSet"] = function(self, height) +-- local content = self.content +-- local contentheight = height - 30 +-- if contentheight < 0 then +-- contentheight = 0 +-- end +-- content:SetHeight(contentheight) +-- content.height = contentheight +-- end, +-- +-- ["LayoutFinished"] = function(self, width, height) +-- if self.noAutoHeight then return end +-- self:SetHeight((height or 0) + 30) +-- end + + return self + end +end \ No newline at end of file diff --git a/item_search_frame.lua b/item_search_frame.lua index 9e2fd22..0ac5449 100644 --- a/item_search_frame.lua +++ b/item_search_frame.lua @@ -463,7 +463,6 @@ function public.on_close() end function public.on_open() - public.set_view(aux_view) public.update_item() private.update_recently_searched() update_listing() @@ -472,6 +471,34 @@ function public.on_open() end end +function public.on_load() + do + local btn = Aux.gui.button(AuxItemSearchFrameItem, 15, '$parentRefreshButton') + btn:SetPoint('BOTTOMLEFT', 8, 15) + btn:SetWidth(75) + btn:SetHeight(24) + btn:SetText('Refresh') + btn:SetScript('OnClick', Aux.item_search_frame.start_search) + end + do + local btn = Aux.gui.button(AuxItemSearchFrameItem, 15, '$parentStopButton') + btn:SetPoint('BOTTOMLEFT', 8, 15) + btn:SetWidth(75) + btn:SetHeight(24) + btn:SetText('Stop') + btn:SetScript('OnClick', Aux.item_search_frame.stop_search) + btn:Hide() + end + do + local tab_group = Aux.gui.tab_group(AuxItemSearchFrameAuctions, 'TOP') + tab_group:create_tab('Buy') + tab_group:create_tab('Bid') + tab_group:create_tab('Full') + tab_group.on_select = Aux.item_search_frame.set_view + tab_group:set_tab(aux_view) + end +end + function public.dialog_cancel() Aux.scan.abort() AuxItemSearchFrameAuctionsConfirmation:Hide() @@ -520,9 +547,6 @@ function hide_sheet() end function public.set_view(view) - for i=1,3 do - getglobal('AuxItemSearchFrameAuctionsTab'..i):SetAlpha(i == view and 1 or 0.5) - end aux_view = view update_listing() end diff --git a/item_search_frame.xml b/item_search_frame.xml index 0974860..31b7304 100644 --- a/item_search_frame.xml +++ b/item_search_frame.xml @@ -17,8 +17,6 @@ - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) getglobal(this:GetName().."Title"):SetText('Item') @@ -78,24 +76,24 @@ - - + + + + + + + + + + + + + + + + + + @@ -138,8 +136,6 @@ - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) getglobal(this:GetName().."Title"):SetText('Recently Searched') @@ -170,66 +166,13 @@ - + - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) - - - diff --git a/post_frame.xml b/post_frame.xml index 1ac2671..a875a5e 100644 --- a/post_frame.xml +++ b/post_frame.xml @@ -13,8 +13,6 @@ - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) getglobal(this:GetName().."Title"):SetText('Inventory') @@ -43,11 +41,9 @@ - + - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) getglobal(this:GetName().."Title"):SetText('Parameters') @@ -268,11 +264,9 @@ - + - this:SetBackdropBorderColor(0.4, 0.4, 0.4) - this:SetBackdropColor(0.15, 0.15, 0.15) getglobal(this:GetName().."Title"):SetText('Existing Auctions')