diff --git a/filter_search_frame.lua b/filter_search_frame.lua index 05f5627..dbd64b5 100644 --- a/filter_search_frame.lua +++ b/filter_search_frame.lua @@ -467,12 +467,12 @@ function public.on_load() end do local label = Aux.gui.label(AuxFilterSearchFrameFiltersCategoryDropDown, 13) - label:SetPoint('BOTTOMLEFT', AuxFilterSearchFrameFiltersCategoryDropDown, 'TOPLEFT', 20, 1) + label:SetPoint('BOTTOMLEFT', AuxFilterSearchFrameFiltersCategoryDropDown, 'TOPLEFT', -2, -4) label:SetText('Category') end do local label = Aux.gui.label(AuxFilterSearchFrameFiltersQualityDropDown, 13) - label:SetPoint('BOTTOMLEFT', AuxFilterSearchFrameFiltersQualityDropDown, 'TOPLEFT', 20, 1) + label:SetPoint('BOTTOMLEFT', AuxFilterSearchFrameFiltersQualityDropDown, 'TOPLEFT', -2, -4) label:SetText('Rarity') end do @@ -630,6 +630,32 @@ function public.on_load() label:SetPoint('BOTTOMLEFT', AuxFilterSearchFrameFiltersAllPagesCheckButton, 'TOPLEFT', 1, -3) label:SetText('All') end + + -- TODO replace with real gui dropdown +-- CreateFrame('Frame', '$parentCategoryDropDown', AuxFilterSearchFrameFilters, 'UIDropDownMenuTemplate') +-- local dropdown = CreateFrame('Frame', '$parentQualityDropDown', AuxFilterSearchFrameFilters, 'UIDropDownMenuTemplate') + for _, dropdown in ipairs({AuxFilterSearchFrameFiltersCategoryDropDown, AuxFilterSearchFrameFiltersQualityDropDown}) do + dropdown:SetWidth(150) + dropdown:SetHeight(10) + dropdown:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=Aux.gui.config.edge_size, insets={top=5,bottom=5}}) + dropdown:SetBackdropColor(unpack(Aux.gui.config.content_color)) + dropdown:SetBackdropBorderColor(unpack(Aux.gui.config.content_border_color)) + local left = getglobal(dropdown:GetName()..'Left'):Hide() + local middle = getglobal(dropdown:GetName()..'Middle'):Hide() + local right = getglobal(dropdown:GetName()..'Right'):Hide() + + local button = getglobal(dropdown:GetName()..'Button') +-- button:RegisterForClicks('AnyUp') + button:ClearAllPoints() + button:SetPoint('RIGHT', dropdown, 0, 0) + + local text = getglobal(dropdown:GetName()..'Text') + text:ClearAllPoints() + text:SetPoint('RIGHT', button, 'LEFT', -2, 0) + text:SetPoint('LEFT', dropdown, 'LEFT', 8, 0) + text:SetFont(Aux.gui.config.content_font, 13) + text:SetShadowColor(0, 0, 0, 0) + end end function public.stop_search() diff --git a/filter_search_frame.xml b/filter_search_frame.xml index 165004e..a3a2f5c 100644 --- a/filter_search_frame.xml +++ b/filter_search_frame.xml @@ -22,10 +22,10 @@ - + - UIDropDownMenu_SetWidth(140) + UIDropDownMenu_Initialize(this, AuxFilterSearchFrameFiltersCategoryDropDown_Initialize) @@ -35,10 +35,10 @@ - + - UIDropDownMenu_SetWidth(140) + UIDropDownMenu_Initialize(this, AuxFilterSearchFrameFiltersQualityDropDown_Initialize) diff --git a/gui.lua b/gui.lua index c90f6ca..674c039 100644 --- a/gui.lua +++ b/gui.lua @@ -360,4 +360,80 @@ function m.CreateVerticalLine(parent, ofsx, relativeFrame, invertedColor) TSMAPI.Design:SetContentColor(barTex) end return barTex +end + +function m.dropdown() + local count = AceGUI:GetNextWidgetNum(Type) + + local frame = CreateFrame("Frame", nil, UIParent) + local dropdown = CreateFrame("Frame", "TSMDropDown"..count, frame, "UIDropDownMenuTemplate") + + frame:SetScript("OnHide", Dropdown_OnHide) + + dropdown:ClearAllPoints() + dropdown:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -7, 0) + dropdown:SetScript("OnHide", nil) + dropdown:SetScript("OnEnter", Control_OnEnter) + dropdown:SetScript("OnLeave", Control_OnLeave) + dropdown:SetScript("OnMouseUp", function(self, button) Dropdown_TogglePullout(self.obj.button, button) end) + TSMAPI.Design:SetContentColor(dropdown) + + local left = _G[dropdown:GetName().."Left"] + local middle = _G[dropdown:GetName().."Middle"] + local right = _G[dropdown:GetName().."Right"] + + middle:ClearAllPoints() + right:ClearAllPoints() + + middle:SetPoint("LEFT", left, "RIGHT", 0, 0) + middle:SetPoint("RIGHT", right, "LEFT", 0, 0) + right:SetPoint("TOPRIGHT", dropdown, "TOPRIGHT", 0, 17) + + local button = _G[dropdown:GetName().."Button"] + button:RegisterForClicks("AnyUp") + button:SetScript("OnEnter", Control_OnEnter) + button:SetScript("OnLeave", Control_OnLeave) + button:SetScript("OnClick", Dropdown_TogglePullout) + button:ClearAllPoints() + button:SetPoint("RIGHT", dropdown, 0, 0) + + local text = _G[dropdown:GetName().."Text"] + text:ClearAllPoints() + text:SetPoint("RIGHT", button, "LEFT", -2, 0) + text:SetPoint("LEFT", dropdown, "LEFT", 8, 0) + text:SetFont(TSMAPI.Design:GetContentFont("normal")) + text:SetShadowColor(0, 0, 0, 0) + + local label = frame:CreateFontString(nil, "OVERLAY") + label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, 0) + label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, 0) + label:SetJustifyH("LEFT") + label:SetHeight(18) + label:SetFont(TSMAPI.Design:GetContentFont("small")) + label:SetShadowColor(0, 0, 0, 0) + label:Hide() + + left:Hide() + middle:Hide() + right:Hide() + + local widget = { + frame = frame, + label = label, + dropdown = dropdown, + text = text, + button = button, + count = count, + alignoffset = 30, + type = Type, + } + for method, func in pairs(methods) do + widget[method] = func + end + frame.obj = widget + dropdown.obj = widget + text.obj = widget + button.obj = widget + + return AceGUI:RegisterAsWidget(widget) end \ No newline at end of file