From e82cadce7c1c54f53604713931bfd6695df6f6f0 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Tue, 20 Apr 2010 02:38:09 -0400 Subject: [PATCH] Added a sort-type toggle button next to the expand-all button. --- Frame.lua | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/Frame.lua b/Frame.lua index ec413c5..1b24b0d 100644 --- a/Frame.lua +++ b/Frame.lua @@ -1089,13 +1089,14 @@ end ------------------------------------------------------------------------------- -- MainPanel scripts/functions. ------------------------------------------------------------------------------- --- Set the current view mode tab to be the last one actually selected. MainPanel:SetScript("OnShow", function(self) local current_tab = self.tabs[addon.db.profile.current_tab] local on_click = current_tab:GetScript("OnClick") on_click(current_tab) + + self.sort_button:SetTextures() end) MainPanel:SetScript("OnHide", @@ -1450,8 +1451,41 @@ function ExpandButton:Contract() SetTooltipScripts(self, L["EXPANDALL_DESC"]) end +local SortToggle = GenericCreateButton(nil, MainPanel, 16, 16, "GameFontNormalSmall", "GameFontHighlightSmall", "", "CENTER", L["SORTING_DESC"], 2) + +MainPanel.sort_button = SortToggle + +SortToggle:SetPoint("LEFT", ExpandButtonFrame.right, "RIGHT", 5, 0) + +SortToggle:SetScript("OnClick", + function(self, button, down) + local sort_type = addon.db.profile.sorting + + addon.db.profile.sorting = (sort_type == "Ascending" and "Descending" or "Ascending") + + self:SetTextures() + ListFrame:Update(nil, false) + end) + +function SortToggle:SetTextures() + local sort_type = addon.db.profile.sorting + + if sort_type == "Ascending" then + self:SetNormalTexture("Interface\\BUTTONS\\Arrow-Down-Up") + self:SetPushedTexture("Interface\\BUTTONS\\Arrow-Down-Down") + self:SetHighlightTexture("Interface\\BUTTONS\\GLOWSTAR") + self:SetDisabledTexture("Interface\\BUTTONS\\Arrow-Down-Disabled") + else + self:SetNormalTexture("Interface\\BUTTONS\\Arrow-Up-Up") + self:SetPushedTexture("Interface\\BUTTONS\\Arrow-Up-Down") + self:SetHighlightTexture("Interface\\BUTTONS\\GLOWSTAR") + self:SetDisabledTexture("Interface\\BUTTONS\\Arrow-Up-Disabled") + end +end + + ------------------------------------------------------------------------------- --- The search button, clear button, and search entry box. +-- The search entry box and associated methods. ------------------------------------------------------------------------------- local SearchRecipes do -- 1.7.9.5