From 8197723186f56be5bfd7d53e36109ff5f426218e Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Tue, 20 Apr 2010 23:25:50 -0400 Subject: [PATCH] Moved the sort-mode toggle button to the right-top of the ListFrame. --- Frame.lua | 69 ++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/Frame.lua b/Frame.lua index 98f8776..fcfb009 100644 --- a/Frame.lua +++ b/Frame.lua @@ -1447,39 +1447,6 @@ function ExpandButton:Contract() SetTooltipScripts(self, L["EXPANDALL_DESC"]) end -local SortToggle = GenericCreateButton(nil, MainPanel, 24, 24, "GameFontNormalSmall", "GameFontHighlightSmall", "", "CENTER", L["SORTING_DESC"], 2) - -MainPanel.sort_button = SortToggle - -SortToggle:SetPoint("LEFT", ExpandButtonFrame.right, "RIGHT", -2, -2) - -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\\CHATFRAME\\UI-ChatIcon-ScrollDown-Up") - self:SetPushedTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollDown-Down") - self:SetHighlightTexture("Interface\\CHATFRAME\\UI-ChatIcon-BlinkHilight") - self:SetDisabledTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollDown-Disabled") - else - self:SetNormalTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollUp-Up") - self:SetPushedTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollUp-Down") - self:SetHighlightTexture("Interface\\CHATFRAME\\UI-ChatIcon-BlinkHilight") - self:SetDisabledTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollUp-Disabled") - end -end - - ------------------------------------------------------------------------------- -- The search entry box and associated methods. ------------------------------------------------------------------------------- @@ -2669,6 +2636,42 @@ ListFrame.state_buttons = {} ListFrame.entry_buttons = {} ------------------------------------------------------------------------------- +-- Sort-mode toggle button. +------------------------------------------------------------------------------- +local SortToggle = GenericCreateButton(nil, MainPanel, 24, 24, "GameFontNormalSmall", "GameFontHighlightSmall", "", "CENTER", L["SORTING_DESC"], 2) + +MainPanel.sort_button = SortToggle + +-- SortToggle:SetPoint("LEFT", ExpandButtonFrame.right, "RIGHT", -2, -2) +SortToggle:SetPoint("BOTTOMRIGHT", ListFrame, "TOPRIGHT", 3, 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\\CHATFRAME\\UI-ChatIcon-ScrollDown-Up") + self:SetPushedTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollDown-Down") + self:SetHighlightTexture("Interface\\CHATFRAME\\UI-ChatIcon-BlinkHilight") + self:SetDisabledTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollDown-Disabled") + else + self:SetNormalTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollUp-Up") + self:SetPushedTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollUp-Down") + self:SetHighlightTexture("Interface\\CHATFRAME\\UI-ChatIcon-BlinkHilight") + self:SetDisabledTexture("Interface\\CHATFRAME\\UI-ChatIcon-ScrollUp-Disabled") + end +end + +------------------------------------------------------------------------------- -- Create ListFrame.scroll_bar, and set its scripts. ------------------------------------------------------------------------------- local ScrollBar = CreateFrame("Slider", nil, ListFrame) -- 1.7.9.5