├── .gitignore
├── LICENSE.txt
├── README.md
├── RetailUI
├── Atlas.lua
├── Config.lua
├── Core.lua
├── Libs.xml
├── Libs
│ ├── AceAddon-3.0
│ │ ├── AceAddon-3.0.lua
│ │ └── AceAddon-3.0.xml
│ ├── AceConfig-3.0
│ │ ├── AceConfig-3.0.lua
│ │ ├── AceConfig-3.0.xml
│ │ ├── AceConfigCmd-3.0
│ │ │ ├── AceConfigCmd-3.0.lua
│ │ │ └── AceConfigCmd-3.0.xml
│ │ ├── AceConfigDialog-3.0
│ │ │ ├── AceConfigDialog-3.0.lua
│ │ │ └── AceConfigDialog-3.0.xml
│ │ └── AceConfigRegistry-3.0
│ │ │ ├── AceConfigRegistry-3.0.lua
│ │ │ └── AceConfigRegistry-3.0.xml
│ ├── AceConsole-3.0
│ │ ├── AceConsole-3.0.lua
│ │ └── AceConsole-3.0.xml
│ ├── AceDB-3.0
│ │ ├── AceDB-3.0.lua
│ │ └── AceDB-3.0.xml
│ ├── AceEvent-3.0
│ │ ├── AceEvent-3.0.lua
│ │ └── AceEvent-3.0.xml
│ ├── AceGUI-3.0
│ │ ├── AceGUI-3.0.lua
│ │ ├── AceGUI-3.0.xml
│ │ └── widgets
│ │ │ ├── AceGUIContainer-BlizOptionsGroup.lua
│ │ │ ├── AceGUIContainer-DropDownGroup.lua
│ │ │ ├── AceGUIContainer-Frame.lua
│ │ │ ├── AceGUIContainer-InlineGroup.lua
│ │ │ ├── AceGUIContainer-ScrollFrame.lua
│ │ │ ├── AceGUIContainer-SimpleGroup.lua
│ │ │ ├── AceGUIContainer-TabGroup.lua
│ │ │ ├── AceGUIContainer-TreeGroup.lua
│ │ │ ├── AceGUIContainer-Window.lua
│ │ │ ├── AceGUIWidget-Button.lua
│ │ │ ├── AceGUIWidget-CheckBox.lua
│ │ │ ├── AceGUIWidget-ColorPicker.lua
│ │ │ ├── AceGUIWidget-DropDown-Items.lua
│ │ │ ├── AceGUIWidget-DropDown.lua
│ │ │ ├── AceGUIWidget-EditBox.lua
│ │ │ ├── AceGUIWidget-Heading.lua
│ │ │ ├── AceGUIWidget-Icon.lua
│ │ │ ├── AceGUIWidget-InteractiveLabel.lua
│ │ │ ├── AceGUIWidget-Keybinding.lua
│ │ │ ├── AceGUIWidget-Label.lua
│ │ │ ├── AceGUIWidget-MultiLineEditBox.lua
│ │ │ └── AceGUIWidget-Slider.lua
│ ├── AceHook-3.0
│ │ ├── AceHook-3.0.lua
│ │ └── AceHook-3.0.xml
│ ├── CallbackHandler-1.0
│ │ ├── CallbackHandler-1.0.lua
│ │ └── CallbackHandler-1.0.xml
│ ├── LibDBIcon-1.0
│ │ ├── LibDBIcon-1.0.lua
│ │ └── LibDBIcon-1.0.xml
│ ├── LibDataBroker-1.1
│ │ └── LibDataBroker-1.1.lua
│ └── LibStub
│ │ └── LibStub.lua
├── Modules
│ ├── ActionBar.lua
│ ├── BuffFrame.lua
│ ├── CastingBar.lua
│ ├── EditorMode.lua
│ ├── Minimap.lua
│ ├── QuestLog.lua
│ ├── QuestTracker.lua
│ └── UnitFrame.lua
├── NineSlice.lua
├── RetailUI.toc
└── Textures
│ ├── Minimap
│ ├── Calendar.blp
│ ├── EyeGroupFinderFlipbook.blp
│ ├── GuildBanner.blp
│ └── MinimapBorder.blp
│ ├── PlayerFrame
│ ├── ClassOverlayComboPoints.BLP
│ ├── ClassOverlayDeathKnightRunes.BLP
│ ├── LFGRoleIcons.blp
│ └── PlayerRestFlipbook.blp
│ ├── TargetFrame
│ ├── BossFrame.blp
│ └── NameBackground.blp
│ └── UI
│ ├── ActionBar.blp
│ ├── ActionBarHorizontal.blp
│ ├── ActionBarVertical.blp
│ ├── BagSlots.blp
│ ├── BagSlotsKey.blp
│ ├── CastingBar.blp
│ ├── CollapseButton.blp
│ ├── EditorGrid.blp
│ ├── ExperienceBar.blp
│ ├── MicroMenu.blp
│ ├── Minimap.blp
│ ├── QuestTracker.BLP
│ └── UnitFrame.blp
└── media
├── RUI-1.png
├── RUI-2.png
├── RUI-3.png
├── RUI-4.png
└── RUI-5.png
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Dmitriy
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Retail UI
2 |
3 |   
4 |
5 | UI inspired by the Retail version. This addon retextures the existing interface.
6 |
7 | 
8 |
9 | ## Features
10 |
11 | - Action Bars
12 | - Unit Frames
13 | - Minimap
14 | - Casting Bars
15 | - Vehicle UI
16 | - Grid Layout to adjust the possition of UI elements
17 | - Target Health Bar class colored
18 | - scaling the UI
19 |
20 | ## Quick Start
21 |
22 | Type ``/rui edit`` for open grid layout.
23 |
24 | Type ``/rui default`` for reset settings.
25 |
26 | ## Screenshots
27 |
28 | 
29 | 
30 | 
31 | 
32 |
33 | ## Contributing
34 |
35 | If you are interested in improving this addon, please pull request your changes.
36 | When making a pull request, please adhere to the style and structure of the source code.
37 |
--------------------------------------------------------------------------------
/RetailUI/Config.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) Dmitriy. All rights reserved.
3 | Licensed under the MIT license. See LICENSE file in the project root for details.
4 | ]]
5 |
6 | local RUI = LibStub('AceAddon-3.0'):GetAddon('RetailUI')
7 |
8 | RUI.optionsSlash = {
9 | name = "RetailUI Commands",
10 | order = 0,
11 | type = "group",
12 | args = {
13 | edit = {
14 | name = "Enable Edit Mode",
15 | type = 'execute',
16 | order = 0,
17 | func = function()
18 | local EditorMode = RUI:GetModule('EditorMode')
19 | if EditorMode:IsShown() then
20 | EditorMode:Hide()
21 | else
22 | EditorMode:Show()
23 | end
24 | end,
25 | dialogHidden = true
26 | },
27 | scale = {
28 | name = "Scale",
29 | order = 1,
30 | type = "group",
31 | args = {
32 | player = {
33 | name = "Player Frame Scale",
34 | type = 'input',
35 | order = 0,
36 | set = function(info, input)
37 | SaveUIFrameScale(input, "player")
38 | end,
39 | dialogHidden = true
40 | },
41 | target = {
42 | name = "Target Frame Scale",
43 | type = 'input',
44 | order = 1,
45 | set = function(info, input)
46 | SaveUIFrameScale(input, "target")
47 | end,
48 | dialogHidden = true
49 | },
50 | focus = {
51 | name = "Focus Frame Scale",
52 | type = 'input',
53 | order = 1,
54 | set = function(info, input)
55 | SaveUIFrameScale(input, "focus")
56 | end,
57 | dialogHidden = true
58 | },
59 | tot = {
60 | name = "Target of Target Frame Scale",
61 | type = 'input',
62 | order = 1,
63 | set = function(info, input)
64 | SaveUIFrameScale(input, "targetOfTarget")
65 | end,
66 | dialogHidden = true
67 | },
68 | pet = {
69 | name = "Pet Frame Scale",
70 | type = 'input',
71 | order = 1,
72 | set = function(info, input)
73 | SaveUIFrameScale(input, "pet")
74 | end,
75 | dialogHidden = true
76 | },
77 | }
78 | },
79 | default = {
80 | name = "Load Default Settings",
81 | type = 'execute',
82 | order = 0,
83 | func = function()
84 | local UnitFrameModule = RUI:GetModule("UnitFrame")
85 | local CastingBarModule = RUI:GetModule("CastingBar")
86 | local ActionBarModule = RUI:GetModule("ActionBar")
87 | local MinimapModule = RUI:GetModule("Minimap")
88 | local QuestTrackerModule = RUI:GetModule("QuestTracker")
89 | local BuffFrameModule = RUI:GetModule("BuffFrame")
90 |
91 | ActionBarModule:LoadDefaultSettings()
92 | ActionBarModule:UpdateWidgets()
93 |
94 | UnitFrameModule:LoadDefaultSettings()
95 | UnitFrameModule:UpdateWidgets()
96 |
97 | CastingBarModule:LoadDefaultSettings()
98 | CastingBarModule:UpdateWidgets()
99 |
100 | MinimapModule:LoadDefaultSettings()
101 | MinimapModule:UpdateWidgets()
102 |
103 | QuestTrackerModule:LoadDefaultSettings()
104 | QuestTrackerModule:UpdateWidgets()
105 |
106 | BuffFrameModule:LoadDefaultSettings()
107 | BuffFrameModule:UpdateWidgets()
108 | end,
109 | dialogHidden = true
110 | }
111 | }
112 | }
113 |
114 | RUI.default = {
115 | profile = {
116 | widgets = {}
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/RetailUI/Core.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) Dmitriy. All rights reserved.
3 | Licensed under the MIT license. See LICENSE file in the project root for details.
4 | ]]
5 |
6 | local RUI = LibStub('AceAddon-3.0'):NewAddon('RetailUI', 'AceConsole-3.0')
7 | local AceConfig = LibStub("AceConfig-3.0")
8 | local AceDB = LibStub("AceDB-3.0")
9 |
10 | RUI.InterfaceVersion = select(4, GetBuildInfo())
11 | RUI.Wrath = (RUI.InterfaceVersion >= 30300)
12 | RUI.DB = nil
13 |
14 | function RUI:OnInitialize()
15 | RUI.DB = AceDB:New("RetailUIDB", RUI.default, true)
16 | AceConfig:RegisterOptionsTable("RUI Commands", RUI.optionsSlash, "rui")
17 | end
18 |
19 | function RUI:OnEnable() end
20 |
21 | function RUI:OnDisable() end
22 |
23 | function CreateUIFrame(width, height, frameName)
24 | local frame = CreateFrame("Frame", 'RUI_' .. frameName, UIParent)
25 | frame:SetSize(width, height)
26 |
27 | frame:RegisterForDrag("LeftButton")
28 | frame:EnableMouse(false)
29 | frame:SetMovable(false)
30 | frame:SetScript("OnDragStart", function(self, button)
31 | self:StartMoving()
32 | end)
33 | frame:SetScript("OnDragStop", function(self)
34 | self:StopMovingOrSizing()
35 | end)
36 |
37 | frame:SetFrameLevel(100)
38 | frame:SetFrameStrata('FULLSCREEN')
39 |
40 | do
41 | local texture = frame:CreateTexture(nil, 'BACKGROUND')
42 | texture:SetAllPoints(frame)
43 | texture:SetTexture("Interface\\AddOns\\RetailUI\\Textures\\UI\\ActionBarHorizontal.blp")
44 | texture:SetTexCoord(0, 512 / 512, 14 / 2048, 85 / 2048)
45 | texture:Hide()
46 |
47 | frame.editorTexture = texture
48 | end
49 |
50 | do
51 | local fontString = frame:CreateFontString(nil, "BORDER", 'GameFontNormal')
52 | fontString:SetAllPoints(frame)
53 | fontString:SetText(frameName)
54 | fontString:Hide()
55 |
56 | frame.editorText = fontString
57 | end
58 |
59 | return frame
60 | end
61 |
62 | RUI.frames = {}
63 |
64 | function ShowUIFrame(frame)
65 | frame:SetMovable(false)
66 | frame:EnableMouse(false)
67 |
68 | frame.editorTexture:Hide()
69 | frame.editorText:Hide()
70 |
71 | for _, target in pairs(RUI.frames[frame]) do
72 | target:SetAlpha(1)
73 | end
74 |
75 | RUI.frames[frame] = nil
76 | end
77 |
78 | function HideUIFrame(frame, exclude)
79 | frame:SetMovable(true)
80 | frame:EnableMouse(true)
81 |
82 | frame.editorTexture:Show()
83 | frame.editorText:Show()
84 |
85 | RUI.frames[frame] = {}
86 |
87 | exclude = exclude or {}
88 |
89 | for _, target in pairs(exclude) do
90 | target:SetAlpha(0)
91 | tinsert(RUI.frames[frame], target)
92 | end
93 | end
94 |
95 | function SaveUIFramePosition(frame, widgetName)
96 | local _, _, relativePoint, posX, posY = frame:GetPoint('CENTER')
97 | RUI.DB.profile.widgets[widgetName].anchor = relativePoint
98 | RUI.DB.profile.widgets[widgetName].posX = posX
99 | RUI.DB.profile.widgets[widgetName].posY = posY
100 | end
101 |
102 | function SaveUIFrameScale(input, widgetName)
103 | local scale = tonumber(input) -- Convert input to a number
104 | if not scale or scale <= 0 then -- validate
105 | print("Invalid scale. Please provide a positive number.")
106 | return
107 | end
108 |
109 | RUI.DB.profile.widgets[widgetName].scale = scale -- save the scale
110 |
111 | local UnitFrameModule = RUI:GetModule("UnitFrame") -- update the UI to reflect the changes
112 | UnitFrameModule:UpdateWidgets()
113 | print(widgetName .. " Frame Scale saved as " .. GetUIFrameScale(widgetName)) -- print confirmation to a user
114 | end
115 |
116 | function GetUIFrameScale(widgetName)
117 | return RUI.DB.profile.widgets[widgetName].scale
118 | end
119 |
120 | function CheckSettingsExists(self, widgets)
121 | for _, widget in pairs(widgets) do
122 | if RUI.DB.profile.widgets[widget] == nil then
123 | self:LoadDefaultSettings()
124 | break
125 | end
126 | end
127 | self:UpdateWidgets()
128 | end
129 |
--------------------------------------------------------------------------------
/RetailUI/Libs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceAddon-3.0/AceAddon-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceConfig-3.0/AceConfig-3.0.lua:
--------------------------------------------------------------------------------
1 | --- AceConfig-3.0 wrapper library.
2 | -- Provides an API to register an options table with the config registry,
3 | -- as well as associate it with a slash command.
4 | -- @class file
5 | -- @name AceConfig-3.0
6 | -- @release $Id: AceConfig-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
7 |
8 | --[[
9 | AceConfig-3.0
10 |
11 | Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole.
12 |
13 | ]]
14 |
15 | local cfgreg = LibStub("AceConfigRegistry-3.0")
16 | local cfgcmd = LibStub("AceConfigCmd-3.0")
17 |
18 | local MAJOR, MINOR = "AceConfig-3.0", 3
19 | local AceConfig = LibStub:NewLibrary(MAJOR, MINOR)
20 |
21 | if not AceConfig then return end
22 |
23 | --TODO: local cfgdlg = LibStub("AceConfigDialog-3.0", true)
24 | --TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0", true)
25 |
26 | -- Lua APIs
27 | local pcall, error, type, pairs = pcall, error, type, pairs
28 |
29 | -- -------------------------------------------------------------------
30 | -- :RegisterOptionsTable(appName, options, slashcmd, persist)
31 | --
32 | -- - appName - (string) application name
33 | -- - options - table or function ref, see AceConfigRegistry
34 | -- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command
35 |
36 | --- Register a option table with the AceConfig registry.
37 | -- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly.
38 | -- @paramsig appName, options [, slashcmd]
39 | -- @param appName The application name for the config table.
40 | -- @param options The option table (or a function to generate one on demand). http://www.wowace.com/addons/ace3/pages/ace-config-3-0-options-tables/
41 | -- @param slashcmd A slash command to register for the option table, or a table of slash commands.
42 | -- @usage
43 | -- local AceConfig = LibStub("AceConfig-3.0")
44 | -- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"})
45 | function AceConfig:RegisterOptionsTable(appName, options, slashcmd)
46 | local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options)
47 | if not ok then error(msg, 2) end
48 |
49 | if slashcmd then
50 | if type(slashcmd) == "table" then
51 | for _,cmd in pairs(slashcmd) do
52 | cfgcmd:CreateChatCommand(cmd, appName)
53 | end
54 | else
55 | cfgcmd:CreateChatCommand(slashcmd, appName)
56 | end
57 | end
58 | end
59 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceConfig-3.0/AceConfig-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceConsole-3.0/AceConsole-3.0.lua:
--------------------------------------------------------------------------------
1 | --- **AceConsole-3.0** provides registration facilities for slash commands.
2 | -- You can register slash commands to your custom functions and use the `GetArgs` function to parse them
3 | -- to your addons individual needs.
4 | --
5 | -- **AceConsole-3.0** can be embeded into your addon, either explicitly by calling AceConsole:Embed(MyAddon) or by
6 | -- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
7 | -- and can be accessed directly, without having to explicitly call AceConsole itself.\\
8 | -- It is recommended to embed AceConsole, otherwise you'll have to specify a custom `self` on all calls you
9 | -- make into AceConsole.
10 | -- @class file
11 | -- @name AceConsole-3.0
12 | -- @release $Id$
13 | local MAJOR,MINOR = "AceConsole-3.0", 7
14 |
15 | local AceConsole, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
16 |
17 | if not AceConsole then return end -- No upgrade needed
18 |
19 | AceConsole.embeds = AceConsole.embeds or {} -- table containing objects AceConsole is embedded in.
20 | AceConsole.commands = AceConsole.commands or {} -- table containing commands registered
21 | AceConsole.weakcommands = AceConsole.weakcommands or {} -- table containing self, command => func references for weak commands that don't persist through enable/disable
22 |
23 | -- Lua APIs
24 | local tconcat, tostring, select = table.concat, tostring, select
25 | local type, pairs, error = type, pairs, error
26 | local format, strfind, strsub = string.format, string.find, string.sub
27 | local max = math.max
28 |
29 | -- WoW APIs
30 | local _G = _G
31 |
32 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
33 | -- List them here for Mikk's FindGlobals script
34 | -- GLOBALS: DEFAULT_CHAT_FRAME, SlashCmdList, hash_SlashCmdList
35 |
36 | local tmp={}
37 | local function Print(self,frame,...)
38 | local n=0
39 | if self ~= AceConsole then
40 | n=n+1
41 | tmp[n] = "|cff33ff99"..tostring( self ).."|r:"
42 | end
43 | for i=1, select("#", ...) do
44 | n=n+1
45 | tmp[n] = tostring(select(i, ...))
46 | end
47 | frame:AddMessage( tconcat(tmp," ",1,n) )
48 | end
49 |
50 | --- Print to DEFAULT_CHAT_FRAME or given ChatFrame (anything with an .AddMessage function)
51 | -- @paramsig [chatframe ,] ...
52 | -- @param chatframe Custom ChatFrame to print to (or any frame with an .AddMessage function)
53 | -- @param ... List of any values to be printed
54 | function AceConsole:Print(...)
55 | local frame = ...
56 | if type(frame) == "table" and frame.AddMessage then -- Is first argument something with an .AddMessage member?
57 | return Print(self, frame, select(2,...))
58 | else
59 | return Print(self, DEFAULT_CHAT_FRAME, ...)
60 | end
61 | end
62 |
63 |
64 | --- Formatted (using format()) print to DEFAULT_CHAT_FRAME or given ChatFrame (anything with an .AddMessage function)
65 | -- @paramsig [chatframe ,] "format"[, ...]
66 | -- @param chatframe Custom ChatFrame to print to (or any frame with an .AddMessage function)
67 | -- @param format Format string - same syntax as standard Lua format()
68 | -- @param ... Arguments to the format string
69 | function AceConsole:Printf(...)
70 | local frame = ...
71 | if type(frame) == "table" and frame.AddMessage then -- Is first argument something with an .AddMessage member?
72 | return Print(self, frame, format(select(2,...)))
73 | else
74 | return Print(self, DEFAULT_CHAT_FRAME, format(...))
75 | end
76 | end
77 |
78 |
79 |
80 |
81 | --- Register a simple chat command
82 | -- @param command Chat command to be registered WITHOUT leading "/"
83 | -- @param func Function to call when the slash command is being used (funcref or methodname)
84 | -- @param persist if false, the command will be soft disabled/enabled when aceconsole is used as a mixin (default: true)
85 | function AceConsole:RegisterChatCommand( command, func, persist )
86 | if type(command)~="string" then error([[Usage: AceConsole:RegisterChatCommand( "command", func[, persist ]): 'command' - expected a string]], 2) end
87 |
88 | if persist==nil then persist=true end -- I'd rather have my addon's "/addon enable" around if the author screws up. Having some extra slash regged when it shouldnt be isn't as destructive. True is a better default. /Mikk
89 |
90 | local name = "ACECONSOLE_"..command:upper()
91 |
92 | if type( func ) == "string" then
93 | SlashCmdList[name] = function(input, editBox)
94 | self[func](self, input, editBox)
95 | end
96 | else
97 | SlashCmdList[name] = func
98 | end
99 | _G["SLASH_"..name.."1"] = "/"..command:lower()
100 | AceConsole.commands[command] = name
101 | -- non-persisting commands are registered for enabling disabling
102 | if not persist then
103 | if not AceConsole.weakcommands[self] then AceConsole.weakcommands[self] = {} end
104 | AceConsole.weakcommands[self][command] = func
105 | end
106 | return true
107 | end
108 |
109 | --- Unregister a chatcommand
110 | -- @param command Chat command to be unregistered WITHOUT leading "/"
111 | function AceConsole:UnregisterChatCommand( command )
112 | local name = AceConsole.commands[command]
113 | if name then
114 | SlashCmdList[name] = nil
115 | _G["SLASH_" .. name .. "1"] = nil
116 | hash_SlashCmdList["/" .. command:upper()] = nil
117 | AceConsole.commands[command] = nil
118 | end
119 | end
120 |
121 | --- Get an iterator over all Chat Commands registered with AceConsole
122 | -- @return Iterator (pairs) over all commands
123 | function AceConsole:IterateChatCommands() return pairs(AceConsole.commands) end
124 |
125 |
126 | local function nils(n, ...)
127 | if n>1 then
128 | return nil, nils(n-1, ...)
129 | elseif n==1 then
130 | return nil, ...
131 | else
132 | return ...
133 | end
134 | end
135 |
136 |
137 | --- Retreive one or more space-separated arguments from a string.
138 | -- Treats quoted strings and itemlinks as non-spaced.
139 | -- @param str The raw argument string
140 | -- @param numargs How many arguments to get (default 1)
141 | -- @param startpos Where in the string to start scanning (default 1)
142 | -- @return Returns arg1, arg2, ..., nextposition\\
143 | -- Missing arguments will be returned as nils. 'nextposition' is returned as 1e9 at the end of the string.
144 | function AceConsole:GetArgs(str, numargs, startpos)
145 | numargs = numargs or 1
146 | startpos = max(startpos or 1, 1)
147 |
148 | local pos=startpos
149 |
150 | -- find start of new arg
151 | pos = strfind(str, "[^ ]", pos)
152 | if not pos then -- whoops, end of string
153 | return nils(numargs, 1e9)
154 | end
155 |
156 | if numargs<1 then
157 | return pos
158 | end
159 |
160 | -- quoted or space separated? find out which pattern to use
161 | local delim_or_pipe
162 | local ch = strsub(str, pos, pos)
163 | if ch=='"' then
164 | pos = pos + 1
165 | delim_or_pipe='([|"])'
166 | elseif ch=="'" then
167 | pos = pos + 1
168 | delim_or_pipe="([|'])"
169 | else
170 | delim_or_pipe="([| ])"
171 | end
172 |
173 | startpos = pos
174 |
175 | while true do
176 | -- find delimiter or hyperlink
177 | local ch,_
178 | pos,_,ch = strfind(str, delim_or_pipe, pos)
179 |
180 | if not pos then break end
181 |
182 | if ch=="|" then
183 | -- some kind of escape
184 |
185 | if strsub(str,pos,pos+1)=="|H" then
186 | -- It's a |H....|hhyper link!|h
187 | pos=strfind(str, "|h", pos+2) -- first |h
188 | if not pos then break end
189 |
190 | pos=strfind(str, "|h", pos+2) -- second |h
191 | if not pos then break end
192 | elseif strsub(str,pos, pos+1) == "|T" then
193 | -- It's a |T....|t texture
194 | pos=strfind(str, "|t", pos+2)
195 | if not pos then break end
196 | end
197 |
198 | pos=pos+2 -- skip past this escape (last |h if it was a hyperlink)
199 |
200 | else
201 | -- found delimiter, done with this arg
202 | return strsub(str, startpos, pos-1), AceConsole:GetArgs(str, numargs-1, pos+1)
203 | end
204 |
205 | end
206 |
207 | -- search aborted, we hit end of string. return it all as one argument. (yes, even if it's an unterminated quote or hyperlink)
208 | return strsub(str, startpos), nils(numargs-1, 1e9)
209 | end
210 |
211 |
212 | --- embedding and embed handling
213 |
214 | local mixins = {
215 | "Print",
216 | "Printf",
217 | "RegisterChatCommand",
218 | "UnregisterChatCommand",
219 | "GetArgs",
220 | }
221 |
222 | -- Embeds AceConsole into the target object making the functions from the mixins list available on target:..
223 | -- @param target target object to embed AceBucket in
224 | function AceConsole:Embed( target )
225 | for k, v in pairs( mixins ) do
226 | target[v] = self[v]
227 | end
228 | self.embeds[target] = true
229 | return target
230 | end
231 |
232 | function AceConsole:OnEmbedEnable( target )
233 | if AceConsole.weakcommands[target] then
234 | for command, func in pairs( AceConsole.weakcommands[target] ) do
235 | target:RegisterChatCommand( command, func, false, true ) -- nonpersisting and silent registry
236 | end
237 | end
238 | end
239 |
240 | function AceConsole:OnEmbedDisable( target )
241 | if AceConsole.weakcommands[target] then
242 | for command, func in pairs( AceConsole.weakcommands[target] ) do
243 | target:UnregisterChatCommand( command ) -- TODO: this could potentially unregister a command from another application in case of command conflicts. Do we care?
244 | end
245 | end
246 | end
247 |
248 | for addon in pairs(AceConsole.embeds) do
249 | AceConsole:Embed(addon)
250 | end
251 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceConsole-3.0/AceConsole-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceDB-3.0/AceDB-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceEvent-3.0/AceEvent-3.0.lua:
--------------------------------------------------------------------------------
1 | --- AceEvent-3.0 provides event registration and secure dispatching.
2 | -- All dispatching is done using **CallbackHandler-1.0**. AceEvent is a simple wrapper around
3 | -- CallbackHandler, and dispatches all game events or addon message to the registrees.
4 | --
5 | -- **AceEvent-3.0** can be embeded into your addon, either explicitly by calling AceEvent:Embed(MyAddon) or by
6 | -- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
7 | -- and can be accessed directly, without having to explicitly call AceEvent itself.\\
8 | -- It is recommended to embed AceEvent, otherwise you'll have to specify a custom `self` on all calls you
9 | -- make into AceEvent.
10 | -- @class file
11 | -- @name AceEvent-3.0
12 | -- @release $Id$
13 | local CallbackHandler = LibStub("CallbackHandler-1.0")
14 |
15 | local MAJOR, MINOR = "AceEvent-3.0", 4
16 | local AceEvent = LibStub:NewLibrary(MAJOR, MINOR)
17 |
18 | if not AceEvent then return end
19 |
20 | -- Lua APIs
21 | local pairs = pairs
22 |
23 | AceEvent.frame = AceEvent.frame or CreateFrame("Frame", "AceEvent30Frame") -- our event frame
24 | AceEvent.embeds = AceEvent.embeds or {} -- what objects embed this lib
25 |
26 | -- APIs and registry for blizzard events, using CallbackHandler lib
27 | if not AceEvent.events then
28 | AceEvent.events = CallbackHandler:New(AceEvent,
29 | "RegisterEvent", "UnregisterEvent", "UnregisterAllEvents")
30 | end
31 |
32 | function AceEvent.events:OnUsed(target, eventname)
33 | AceEvent.frame:RegisterEvent(eventname)
34 | end
35 |
36 | function AceEvent.events:OnUnused(target, eventname)
37 | AceEvent.frame:UnregisterEvent(eventname)
38 | end
39 |
40 |
41 | -- APIs and registry for IPC messages, using CallbackHandler lib
42 | if not AceEvent.messages then
43 | AceEvent.messages = CallbackHandler:New(AceEvent,
44 | "RegisterMessage", "UnregisterMessage", "UnregisterAllMessages"
45 | )
46 | AceEvent.SendMessage = AceEvent.messages.Fire
47 | end
48 |
49 | --- embedding and embed handling
50 | local mixins = {
51 | "RegisterEvent", "UnregisterEvent",
52 | "RegisterMessage", "UnregisterMessage",
53 | "SendMessage",
54 | "UnregisterAllEvents", "UnregisterAllMessages",
55 | }
56 |
57 | --- Register for a Blizzard Event.
58 | -- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied)
59 | -- Any arguments to the event will be passed on after that.
60 | -- @name AceEvent:RegisterEvent
61 | -- @class function
62 | -- @paramsig event[, callback [, arg]]
63 | -- @param event The event to register for
64 | -- @param callback The callback function to call when the event is triggered (funcref or method, defaults to a method with the event name)
65 | -- @param arg An optional argument to pass to the callback function
66 |
67 | --- Unregister an event.
68 | -- @name AceEvent:UnregisterEvent
69 | -- @class function
70 | -- @paramsig event
71 | -- @param event The event to unregister
72 |
73 | --- Register for a custom AceEvent-internal message.
74 | -- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied)
75 | -- Any arguments to the event will be passed on after that.
76 | -- @name AceEvent:RegisterMessage
77 | -- @class function
78 | -- @paramsig message[, callback [, arg]]
79 | -- @param message The message to register for
80 | -- @param callback The callback function to call when the message is triggered (funcref or method, defaults to a method with the event name)
81 | -- @param arg An optional argument to pass to the callback function
82 |
83 | --- Unregister a message
84 | -- @name AceEvent:UnregisterMessage
85 | -- @class function
86 | -- @paramsig message
87 | -- @param message The message to unregister
88 |
89 | --- Send a message over the AceEvent-3.0 internal message system to other addons registered for this message.
90 | -- @name AceEvent:SendMessage
91 | -- @class function
92 | -- @paramsig message, ...
93 | -- @param message The message to send
94 | -- @param ... Any arguments to the message
95 |
96 |
97 | -- Embeds AceEvent into the target object making the functions from the mixins list available on target:..
98 | -- @param target target object to embed AceEvent in
99 | function AceEvent:Embed(target)
100 | for k, v in pairs(mixins) do
101 | target[v] = self[v]
102 | end
103 | self.embeds[target] = true
104 | return target
105 | end
106 |
107 | -- AceEvent:OnEmbedDisable( target )
108 | -- target (object) - target object that is being disabled
109 | --
110 | -- Unregister all events messages etc when the target disables.
111 | -- this method should be called by the target manually or by an addon framework
112 | function AceEvent:OnEmbedDisable(target)
113 | target:UnregisterAllEvents()
114 | target:UnregisterAllMessages()
115 | end
116 |
117 | -- Script to fire blizzard events into the event listeners
118 | local events = AceEvent.events
119 | AceEvent.frame:SetScript("OnEvent", function(this, event, ...)
120 | events:Fire(event, ...)
121 | end)
122 |
123 | --- Finally: upgrade our old embeds
124 | for target, v in pairs(AceEvent.embeds) do
125 | AceEvent:Embed(target)
126 | end
127 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceEvent-3.0/AceEvent-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/AceGUI-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIContainer-BlizOptionsGroup.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | BlizOptionsGroup Container
3 | Simple container widget for the integration of AceGUI into the Blizzard Interface Options
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "BlizOptionsGroup", 21
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local pairs = pairs
11 |
12 | -- WoW APIs
13 | local CreateFrame = CreateFrame
14 |
15 | --[[-----------------------------------------------------------------------------
16 | Scripts
17 | -------------------------------------------------------------------------------]]
18 |
19 | local function OnShow(frame)
20 | frame.obj:Fire("OnShow")
21 | end
22 |
23 | local function OnHide(frame)
24 | frame.obj:Fire("OnHide")
25 | end
26 |
27 | --[[-----------------------------------------------------------------------------
28 | Support functions
29 | -------------------------------------------------------------------------------]]
30 |
31 | local function okay(frame)
32 | frame.obj:Fire("okay")
33 | end
34 |
35 | local function cancel(frame)
36 | frame.obj:Fire("cancel")
37 | end
38 |
39 | local function default(frame)
40 | frame.obj:Fire("default")
41 | end
42 |
43 | local function refresh(frame)
44 | frame.obj:Fire("refresh")
45 | end
46 |
47 | --[[-----------------------------------------------------------------------------
48 | Methods
49 | -------------------------------------------------------------------------------]]
50 |
51 | local methods = {
52 | ["OnAcquire"] = function(self)
53 | self:SetName()
54 | self:SetTitle()
55 | end,
56 |
57 | -- ["OnRelease"] = nil,
58 |
59 | ["OnWidthSet"] = function(self, width)
60 | local content = self.content
61 | local contentwidth = width - 63
62 | if contentwidth < 0 then
63 | contentwidth = 0
64 | end
65 | content:SetWidth(contentwidth)
66 | content.width = contentwidth
67 | end,
68 |
69 | ["OnHeightSet"] = function(self, height)
70 | local content = self.content
71 | local contentheight = height - 26
72 | if contentheight < 0 then
73 | contentheight = 0
74 | end
75 | content:SetHeight(contentheight)
76 | content.height = contentheight
77 | end,
78 |
79 | ["SetName"] = function(self, name, parent)
80 | self.frame.name = name
81 | self.frame.parent = parent
82 | end,
83 |
84 | ["SetTitle"] = function(self, title)
85 | local content = self.content
86 | content:ClearAllPoints()
87 | if not title or title == "" then
88 | content:SetPoint("TOPLEFT", 10, -10)
89 | self.label:SetText("")
90 | else
91 | content:SetPoint("TOPLEFT", 10, -40)
92 | self.label:SetText(title)
93 | end
94 | content:SetPoint("BOTTOMRIGHT", -10, 10)
95 | end
96 | }
97 |
98 | --[[-----------------------------------------------------------------------------
99 | Constructor
100 | -------------------------------------------------------------------------------]]
101 | local function Constructor()
102 | local frame = CreateFrame("Frame")
103 | frame:Hide()
104 |
105 | -- support functions for the Blizzard Interface Options
106 | frame.okay = okay
107 | frame.cancel = cancel
108 | frame.default = default
109 | frame.refresh = refresh
110 |
111 | frame:SetScript("OnHide", OnHide)
112 | frame:SetScript("OnShow", OnShow)
113 |
114 | local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
115 | label:SetPoint("TOPLEFT", 10, -15)
116 | label:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 10, -45)
117 | label:SetJustifyH("LEFT")
118 | label:SetJustifyV("TOP")
119 |
120 | --Container Support
121 | local content = CreateFrame("Frame", nil, frame)
122 | content:SetPoint("TOPLEFT", 10, -10)
123 | content:SetPoint("BOTTOMRIGHT", -10, 10)
124 |
125 | local widget = {
126 | label = label,
127 | frame = frame,
128 | content = content,
129 | type = Type
130 | }
131 | for method, func in pairs(methods) do
132 | widget[method] = func
133 | end
134 |
135 | return AceGUI:RegisterAsContainer(widget)
136 | end
137 |
138 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
139 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIContainer-DropDownGroup.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | DropdownGroup Container
3 | Container controlled by a dropdown on the top.
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "DropdownGroup", 21
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local assert, pairs, type = assert, pairs, type
11 |
12 | -- WoW APIs
13 | local CreateFrame = CreateFrame
14 |
15 | --[[-----------------------------------------------------------------------------
16 | Scripts
17 | -------------------------------------------------------------------------------]]
18 | local function SelectedGroup(self, event, value)
19 | local group = self.parentgroup
20 | local status = group.status or group.localstatus
21 | status.selected = value
22 | self.parentgroup:Fire("OnGroupSelected", value)
23 | end
24 |
25 | --[[-----------------------------------------------------------------------------
26 | Methods
27 | -------------------------------------------------------------------------------]]
28 | local methods = {
29 | ["OnAcquire"] = function(self)
30 | self.dropdown:SetText("")
31 | self:SetDropdownWidth(200)
32 | self:SetTitle("")
33 | end,
34 |
35 | ["OnRelease"] = function(self)
36 | self.dropdown.list = nil
37 | self.status = nil
38 | for k in pairs(self.localstatus) do
39 | self.localstatus[k] = nil
40 | end
41 | end,
42 |
43 | ["SetTitle"] = function(self, title)
44 | self.titletext:SetText(title)
45 | self.dropdown.frame:ClearAllPoints()
46 | if title and title ~= "" then
47 | self.dropdown.frame:SetPoint("TOPRIGHT", -2, 0)
48 | else
49 | self.dropdown.frame:SetPoint("TOPLEFT", -1, 0)
50 | end
51 | end,
52 |
53 | ["SetGroupList"] = function(self,list,order)
54 | self.dropdown:SetList(list,order)
55 | end,
56 |
57 | ["SetStatusTable"] = function(self, status)
58 | assert(type(status) == "table")
59 | self.status = status
60 | end,
61 |
62 | ["SetGroup"] = function(self,group)
63 | self.dropdown:SetValue(group)
64 | local status = self.status or self.localstatus
65 | status.selected = group
66 | self:Fire("OnGroupSelected", group)
67 | end,
68 |
69 | ["OnWidthSet"] = function(self, width)
70 | local content = self.content
71 | local contentwidth = width - 26
72 | if contentwidth < 0 then
73 | contentwidth = 0
74 | end
75 | content:SetWidth(contentwidth)
76 | content.width = contentwidth
77 | end,
78 |
79 | ["OnHeightSet"] = function(self, height)
80 | local content = self.content
81 | local contentheight = height - 63
82 | if contentheight < 0 then
83 | contentheight = 0
84 | end
85 | content:SetHeight(contentheight)
86 | content.height = contentheight
87 | end,
88 |
89 | ["LayoutFinished"] = function(self, width, height)
90 | self:SetHeight((height or 0) + 63)
91 | end,
92 |
93 | ["SetDropdownWidth"] = function(self, width)
94 | self.dropdown:SetWidth(width)
95 | end
96 | }
97 |
98 | --[[-----------------------------------------------------------------------------
99 | Constructor
100 | -------------------------------------------------------------------------------]]
101 | local PaneBackdrop = {
102 | bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
103 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
104 | tile = true, tileSize = 16, edgeSize = 16,
105 | insets = { left = 3, right = 3, top = 5, bottom = 3 }
106 | }
107 |
108 | local function Constructor()
109 | local frame = CreateFrame("Frame")
110 | frame:SetHeight(100)
111 | frame:SetWidth(100)
112 | frame:SetFrameStrata("FULLSCREEN_DIALOG")
113 |
114 | local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
115 | titletext:SetPoint("TOPLEFT", 4, -5)
116 | titletext:SetPoint("TOPRIGHT", -4, -5)
117 | titletext:SetJustifyH("LEFT")
118 | titletext:SetHeight(18)
119 |
120 | local dropdown = AceGUI:Create("Dropdown")
121 | dropdown.frame:SetParent(frame)
122 | dropdown.frame:SetFrameLevel(dropdown.frame:GetFrameLevel() + 2)
123 | dropdown:SetCallback("OnValueChanged", SelectedGroup)
124 | dropdown.frame:SetPoint("TOPLEFT", -1, 0)
125 | dropdown.frame:Show()
126 | dropdown:SetLabel("")
127 |
128 | local border = CreateFrame("Frame", nil, frame)
129 | border:SetPoint("TOPLEFT", 0, -26)
130 | border:SetPoint("BOTTOMRIGHT", 0, 3)
131 | border:SetBackdrop(PaneBackdrop)
132 | border:SetBackdropColor(0.1,0.1,0.1,0.5)
133 | border:SetBackdropBorderColor(0.4,0.4,0.4)
134 |
135 | --Container Support
136 | local content = CreateFrame("Frame", nil, border)
137 | content:SetPoint("TOPLEFT", 10, -10)
138 | content:SetPoint("BOTTOMRIGHT", -10, 10)
139 |
140 | local widget = {
141 | frame = frame,
142 | localstatus = {},
143 | titletext = titletext,
144 | dropdown = dropdown,
145 | border = border,
146 | content = content,
147 | type = Type
148 | }
149 | for method, func in pairs(methods) do
150 | widget[method] = func
151 | end
152 | dropdown.parentgroup = widget
153 |
154 | return AceGUI:RegisterAsContainer(widget)
155 | end
156 |
157 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
158 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIContainer-Frame.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | Frame Container
3 | -------------------------------------------------------------------------------]]
4 | local Type, Version = "Frame", 25
5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
7 |
8 | -- Lua APIs
9 | local pairs, assert, type = pairs, assert, type
10 | local wipe = table.wipe
11 |
12 | -- WoW APIs
13 | local PlaySound = PlaySound
14 | local CreateFrame, UIParent = CreateFrame, UIParent
15 |
16 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
17 | -- List them here for Mikk's FindGlobals script
18 | -- GLOBALS: CLOSE
19 |
20 | --[[-----------------------------------------------------------------------------
21 | Scripts
22 | -------------------------------------------------------------------------------]]
23 | local function Button_OnClick(frame)
24 | PlaySound("gsTitleOptionExit")
25 | frame.obj:Hide()
26 | end
27 |
28 | local function Frame_OnShow(frame)
29 | frame.obj:Fire("OnShow")
30 | end
31 |
32 | local function Frame_OnClose(frame)
33 | frame.obj:Fire("OnClose")
34 | end
35 |
36 | local function Frame_OnMouseDown(frame)
37 | AceGUI:ClearFocus()
38 | end
39 |
40 | local function Title_OnMouseDown(frame)
41 | frame:GetParent():StartMoving()
42 | AceGUI:ClearFocus()
43 | end
44 |
45 | local function MoverSizer_OnMouseUp(mover)
46 | local frame = mover:GetParent()
47 | frame:StopMovingOrSizing()
48 | local self = frame.obj
49 | local status = self.status or self.localstatus
50 | status.width = frame:GetWidth()
51 | status.height = frame:GetHeight()
52 | status.top = frame:GetTop()
53 | status.left = frame:GetLeft()
54 | end
55 |
56 | local function SizerSE_OnMouseDown(frame)
57 | frame:GetParent():StartSizing("BOTTOMRIGHT")
58 | AceGUI:ClearFocus()
59 | end
60 |
61 | local function SizerS_OnMouseDown(frame)
62 | frame:GetParent():StartSizing("BOTTOM")
63 | AceGUI:ClearFocus()
64 | end
65 |
66 | local function SizerE_OnMouseDown(frame)
67 | frame:GetParent():StartSizing("RIGHT")
68 | AceGUI:ClearFocus()
69 | end
70 |
71 | local function StatusBar_OnEnter(frame)
72 | frame.obj:Fire("OnEnterStatusBar")
73 | end
74 |
75 | local function StatusBar_OnLeave(frame)
76 | frame.obj:Fire("OnLeaveStatusBar")
77 | end
78 |
79 | --[[-----------------------------------------------------------------------------
80 | Methods
81 | -------------------------------------------------------------------------------]]
82 | local methods = {
83 | ["OnAcquire"] = function(self)
84 | self.frame:SetParent(UIParent)
85 | self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
86 | self:SetTitle()
87 | self:SetStatusText()
88 | self:ApplyStatus()
89 | self:Show()
90 | self:EnableResize(true)
91 | end,
92 |
93 | ["OnRelease"] = function(self)
94 | self.status = nil
95 | wipe(self.localstatus)
96 | end,
97 |
98 | ["OnWidthSet"] = function(self, width)
99 | local content = self.content
100 | local contentwidth = width - 34
101 | if contentwidth < 0 then
102 | contentwidth = 0
103 | end
104 | content:SetWidth(contentwidth)
105 | content.width = contentwidth
106 | end,
107 |
108 | ["OnHeightSet"] = function(self, height)
109 | local content = self.content
110 | local contentheight = height - 57
111 | if contentheight < 0 then
112 | contentheight = 0
113 | end
114 | content:SetHeight(contentheight)
115 | content.height = contentheight
116 | end,
117 |
118 | ["SetTitle"] = function(self, title)
119 | self.titletext:SetText(title)
120 | self.titlebg:SetWidth((self.titletext:GetWidth() or 0) + 10)
121 | end,
122 |
123 | ["SetStatusText"] = function(self, text)
124 | self.statustext:SetText(text)
125 | end,
126 |
127 | ["Hide"] = function(self)
128 | self.frame:Hide()
129 | end,
130 |
131 | ["Show"] = function(self)
132 | self.frame:Show()
133 | end,
134 |
135 | ["EnableResize"] = function(self, state)
136 | local func = state and "Show" or "Hide"
137 | self.sizer_se[func](self.sizer_se)
138 | self.sizer_s[func](self.sizer_s)
139 | self.sizer_e[func](self.sizer_e)
140 | end,
141 |
142 | -- called to set an external table to store status in
143 | ["SetStatusTable"] = function(self, status)
144 | assert(type(status) == "table")
145 | self.status = status
146 | self:ApplyStatus()
147 | end,
148 |
149 | ["ApplyStatus"] = function(self)
150 | local status = self.status or self.localstatus
151 | local frame = self.frame
152 | self:SetWidth(status.width or 700)
153 | self:SetHeight(status.height or 500)
154 | frame:ClearAllPoints()
155 | if status.top and status.left then
156 | frame:SetPoint("TOP", UIParent, "BOTTOM", 0, status.top)
157 | frame:SetPoint("LEFT", UIParent, "LEFT", status.left, 0)
158 | else
159 | frame:SetPoint("CENTER")
160 | end
161 | end
162 | }
163 |
164 | --[[-----------------------------------------------------------------------------
165 | Constructor
166 | -------------------------------------------------------------------------------]]
167 | local FrameBackdrop = {
168 | bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
169 | edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
170 | tile = true, tileSize = 32, edgeSize = 32,
171 | insets = { left = 8, right = 8, top = 8, bottom = 8 }
172 | }
173 |
174 | local PaneBackdrop = {
175 | bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
176 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
177 | tile = true, tileSize = 16, edgeSize = 16,
178 | insets = { left = 3, right = 3, top = 5, bottom = 3 }
179 | }
180 |
181 | local function Constructor()
182 | local frame = CreateFrame("Frame", nil, UIParent)
183 | frame:Hide()
184 |
185 | frame:EnableMouse(true)
186 | frame:SetMovable(true)
187 | frame:SetResizable(true)
188 | frame:SetFrameStrata("FULLSCREEN_DIALOG")
189 | frame:SetBackdrop(FrameBackdrop)
190 | frame:SetBackdropColor(0, 0, 0, 1)
191 | frame:SetMinResize(400, 200)
192 | frame:SetToplevel(true)
193 | frame:SetScript("OnShow", Frame_OnShow)
194 | frame:SetScript("OnHide", Frame_OnClose)
195 | frame:SetScript("OnMouseDown", Frame_OnMouseDown)
196 |
197 | local closebutton = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
198 | closebutton:SetScript("OnClick", Button_OnClick)
199 | closebutton:SetPoint("BOTTOMRIGHT", -27, 17)
200 | closebutton:SetHeight(20)
201 | closebutton:SetWidth(100)
202 | closebutton:SetText(CLOSE)
203 |
204 | local statusbg = CreateFrame("Button", nil, frame)
205 | statusbg:SetPoint("BOTTOMLEFT", 15, 15)
206 | statusbg:SetPoint("BOTTOMRIGHT", -132, 15)
207 | statusbg:SetHeight(24)
208 | statusbg:SetBackdrop(PaneBackdrop)
209 | statusbg:SetBackdropColor(0.1,0.1,0.1)
210 | statusbg:SetBackdropBorderColor(0.4,0.4,0.4)
211 | statusbg:SetScript("OnEnter", StatusBar_OnEnter)
212 | statusbg:SetScript("OnLeave", StatusBar_OnLeave)
213 |
214 | local statustext = statusbg:CreateFontString(nil, "OVERLAY", "GameFontNormal")
215 | statustext:SetPoint("TOPLEFT", 7, -2)
216 | statustext:SetPoint("BOTTOMRIGHT", -7, 2)
217 | statustext:SetHeight(20)
218 | statustext:SetJustifyH("LEFT")
219 | statustext:SetText("")
220 |
221 | local titlebg = frame:CreateTexture(nil, "OVERLAY")
222 | titlebg:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
223 | titlebg:SetTexCoord(0.31, 0.67, 0, 0.63)
224 | titlebg:SetPoint("TOP", 0, 12)
225 | titlebg:SetWidth(100)
226 | titlebg:SetHeight(40)
227 |
228 | local title = CreateFrame("Frame", nil, frame)
229 | title:EnableMouse(true)
230 | title:SetScript("OnMouseDown", Title_OnMouseDown)
231 | title:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
232 | title:SetAllPoints(titlebg)
233 |
234 | local titletext = title:CreateFontString(nil, "OVERLAY", "GameFontNormal")
235 | titletext:SetPoint("TOP", titlebg, "TOP", 0, -14)
236 |
237 | local titlebg_l = frame:CreateTexture(nil, "OVERLAY")
238 | titlebg_l:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
239 | titlebg_l:SetTexCoord(0.21, 0.31, 0, 0.63)
240 | titlebg_l:SetPoint("RIGHT", titlebg, "LEFT")
241 | titlebg_l:SetWidth(30)
242 | titlebg_l:SetHeight(40)
243 |
244 | local titlebg_r = frame:CreateTexture(nil, "OVERLAY")
245 | titlebg_r:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
246 | titlebg_r:SetTexCoord(0.67, 0.77, 0, 0.63)
247 | titlebg_r:SetPoint("LEFT", titlebg, "RIGHT")
248 | titlebg_r:SetWidth(30)
249 | titlebg_r:SetHeight(40)
250 |
251 | local sizer_se = CreateFrame("Frame", nil, frame)
252 | sizer_se:SetPoint("BOTTOMRIGHT")
253 | sizer_se:SetWidth(25)
254 | sizer_se:SetHeight(25)
255 | sizer_se:EnableMouse()
256 | sizer_se:SetScript("OnMouseDown",SizerSE_OnMouseDown)
257 | sizer_se:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
258 |
259 | local line1 = sizer_se:CreateTexture(nil, "BACKGROUND")
260 | line1:SetWidth(14)
261 | line1:SetHeight(14)
262 | line1:SetPoint("BOTTOMRIGHT", -8, 8)
263 | line1:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
264 | local x = 0.1 * 14/17
265 | line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
266 |
267 | local line2 = sizer_se:CreateTexture(nil, "BACKGROUND")
268 | line2:SetWidth(8)
269 | line2:SetHeight(8)
270 | line2:SetPoint("BOTTOMRIGHT", -8, 8)
271 | line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
272 | local x = 0.1 * 8/17
273 | line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
274 |
275 | local sizer_s = CreateFrame("Frame", nil, frame)
276 | sizer_s:SetPoint("BOTTOMRIGHT", -25, 0)
277 | sizer_s:SetPoint("BOTTOMLEFT")
278 | sizer_s:SetHeight(25)
279 | sizer_s:EnableMouse(true)
280 | sizer_s:SetScript("OnMouseDown", SizerS_OnMouseDown)
281 | sizer_s:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
282 |
283 | local sizer_e = CreateFrame("Frame", nil, frame)
284 | sizer_e:SetPoint("BOTTOMRIGHT", 0, 25)
285 | sizer_e:SetPoint("TOPRIGHT")
286 | sizer_e:SetWidth(25)
287 | sizer_e:EnableMouse(true)
288 | sizer_e:SetScript("OnMouseDown", SizerE_OnMouseDown)
289 | sizer_e:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
290 |
291 | --Container Support
292 | local content = CreateFrame("Frame", nil, frame)
293 | content:SetPoint("TOPLEFT", 17, -27)
294 | content:SetPoint("BOTTOMRIGHT", -17, 40)
295 |
296 | local widget = {
297 | localstatus = {},
298 | titletext = titletext,
299 | statustext = statustext,
300 | titlebg = titlebg,
301 | sizer_se = sizer_se,
302 | sizer_s = sizer_s,
303 | sizer_e = sizer_e,
304 | content = content,
305 | frame = frame,
306 | type = Type
307 | }
308 | for method, func in pairs(methods) do
309 | widget[method] = func
310 | end
311 | closebutton.obj, statusbg.obj = widget, widget
312 |
313 | return AceGUI:RegisterAsContainer(widget)
314 | end
315 |
316 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
317 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIContainer-InlineGroup.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | InlineGroup Container
3 | Simple container widget that creates a visible "box" with an optional title.
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "InlineGroup", 21
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local pairs = pairs
11 |
12 | -- WoW APIs
13 | local CreateFrame, UIParent = CreateFrame, UIParent
14 |
15 | --[[-----------------------------------------------------------------------------
16 | Methods
17 | -------------------------------------------------------------------------------]]
18 | local methods = {
19 | ["OnAcquire"] = function(self)
20 | self:SetWidth(300)
21 | self:SetHeight(100)
22 | self:SetTitle("")
23 | end,
24 |
25 | -- ["OnRelease"] = nil,
26 |
27 | ["SetTitle"] = function(self,title)
28 | self.titletext:SetText(title)
29 | end,
30 |
31 |
32 | ["LayoutFinished"] = function(self, width, height)
33 | if self.noAutoHeight then return end
34 | self:SetHeight((height or 0) + 40)
35 | end,
36 |
37 | ["OnWidthSet"] = function(self, width)
38 | local content = self.content
39 | local contentwidth = width - 20
40 | if contentwidth < 0 then
41 | contentwidth = 0
42 | end
43 | content:SetWidth(contentwidth)
44 | content.width = contentwidth
45 | end,
46 |
47 | ["OnHeightSet"] = function(self, height)
48 | local content = self.content
49 | local contentheight = height - 20
50 | if contentheight < 0 then
51 | contentheight = 0
52 | end
53 | content:SetHeight(contentheight)
54 | content.height = contentheight
55 | end
56 | }
57 |
58 | --[[-----------------------------------------------------------------------------
59 | Constructor
60 | -------------------------------------------------------------------------------]]
61 | local PaneBackdrop = {
62 | bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
63 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
64 | tile = true, tileSize = 16, edgeSize = 16,
65 | insets = { left = 3, right = 3, top = 5, bottom = 3 }
66 | }
67 |
68 | local function Constructor()
69 | local frame = CreateFrame("Frame", nil, UIParent)
70 | frame:SetFrameStrata("FULLSCREEN_DIALOG")
71 |
72 | local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
73 | titletext:SetPoint("TOPLEFT", 14, 0)
74 | titletext:SetPoint("TOPRIGHT", -14, 0)
75 | titletext:SetJustifyH("LEFT")
76 | titletext:SetHeight(18)
77 |
78 | local border = CreateFrame("Frame", nil, frame)
79 | border:SetPoint("TOPLEFT", 0, -17)
80 | border:SetPoint("BOTTOMRIGHT", -1, 3)
81 | border:SetBackdrop(PaneBackdrop)
82 | border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
83 | border:SetBackdropBorderColor(0.4, 0.4, 0.4)
84 |
85 | --Container Support
86 | local content = CreateFrame("Frame", nil, border)
87 | content:SetPoint("TOPLEFT", 10, -10)
88 | content:SetPoint("BOTTOMRIGHT", -10, 10)
89 |
90 | local widget = {
91 | frame = frame,
92 | content = content,
93 | titletext = titletext,
94 | type = Type
95 | }
96 | for method, func in pairs(methods) do
97 | widget[method] = func
98 | end
99 |
100 | return AceGUI:RegisterAsContainer(widget)
101 | end
102 |
103 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
104 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIContainer-ScrollFrame.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | ScrollFrame Container
3 | Plain container that scrolls its content and doesn't grow in height.
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "ScrollFrame", 26
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local pairs, assert, type = pairs, assert, type
11 | local min, max, floor = math.min, math.max, math.floor
12 |
13 | -- WoW APIs
14 | local CreateFrame, UIParent = CreateFrame, UIParent
15 |
16 | --[[-----------------------------------------------------------------------------
17 | Support functions
18 | -------------------------------------------------------------------------------]]
19 | local function FixScrollOnUpdate(frame)
20 | frame:SetScript("OnUpdate", nil)
21 | frame.obj:FixScroll()
22 | end
23 |
24 | --[[-----------------------------------------------------------------------------
25 | Scripts
26 | -------------------------------------------------------------------------------]]
27 | local function ScrollFrame_OnMouseWheel(frame, value)
28 | frame.obj:MoveScroll(value)
29 | end
30 |
31 | local function ScrollFrame_OnSizeChanged(frame)
32 | frame:SetScript("OnUpdate", FixScrollOnUpdate)
33 | end
34 |
35 | local function ScrollBar_OnScrollValueChanged(frame, value)
36 | frame.obj:SetScroll(value)
37 | end
38 |
39 | --[[-----------------------------------------------------------------------------
40 | Methods
41 | -------------------------------------------------------------------------------]]
42 | local methods = {
43 | ["OnAcquire"] = function(self)
44 | self:SetScroll(0)
45 | self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate)
46 | end,
47 |
48 | ["OnRelease"] = function(self)
49 | self.status = nil
50 | for k in pairs(self.localstatus) do
51 | self.localstatus[k] = nil
52 | end
53 | self.scrollframe:SetPoint("BOTTOMRIGHT")
54 | self.scrollbar:Hide()
55 | self.scrollBarShown = nil
56 | self.content.height, self.content.width, self.content.original_width = nil, nil, nil
57 | end,
58 |
59 | ["SetScroll"] = function(self, value)
60 | local status = self.status or self.localstatus
61 | local viewheight = self.scrollframe:GetHeight()
62 | local height = self.content:GetHeight()
63 | local offset
64 |
65 | if viewheight > height then
66 | offset = 0
67 | else
68 | offset = floor((height - viewheight) / 1000.0 * value)
69 | end
70 | self.content:ClearAllPoints()
71 | self.content:SetPoint("TOPLEFT", 0, offset)
72 | self.content:SetPoint("TOPRIGHT", 0, offset)
73 | status.offset = offset
74 | status.scrollvalue = value
75 | end,
76 |
77 | ["MoveScroll"] = function(self, value)
78 | local status = self.status or self.localstatus
79 | local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
80 |
81 | if self.scrollBarShown then
82 | local diff = height - viewheight
83 | local delta = 1
84 | if value < 0 then
85 | delta = -1
86 | end
87 | self.scrollbar:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
88 | end
89 | end,
90 |
91 | ["FixScroll"] = function(self)
92 | if self.updateLock then return end
93 | self.updateLock = true
94 | local status = self.status or self.localstatus
95 | local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
96 | local offset = status.offset or 0
97 | -- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys
98 | -- No-one is going to miss 2 pixels at the bottom of the frame, anyhow!
99 | if viewheight < height + 2 then
100 | if self.scrollBarShown then
101 | self.scrollBarShown = nil
102 | self.scrollbar:Hide()
103 | self.scrollbar:SetValue(0)
104 | self.scrollframe:SetPoint("BOTTOMRIGHT")
105 | if self.content.original_width then
106 | self.content.width = self.content.original_width
107 | end
108 | self:DoLayout()
109 | end
110 | else
111 | if not self.scrollBarShown then
112 | self.scrollBarShown = true
113 | self.scrollbar:Show()
114 | self.scrollframe:SetPoint("BOTTOMRIGHT", -20, 0)
115 | if self.content.original_width then
116 | self.content.width = self.content.original_width - 20
117 | end
118 | self:DoLayout()
119 | end
120 | local value = (offset / (viewheight - height) * 1000)
121 | if value > 1000 then value = 1000 end
122 | self.scrollbar:SetValue(value)
123 | self:SetScroll(value)
124 | if value < 1000 then
125 | self.content:ClearAllPoints()
126 | self.content:SetPoint("TOPLEFT", 0, offset)
127 | self.content:SetPoint("TOPRIGHT", 0, offset)
128 | status.offset = offset
129 | end
130 | end
131 | self.updateLock = nil
132 | end,
133 |
134 | ["LayoutFinished"] = function(self, width, height)
135 | self.content:SetHeight(height or 0 + 20)
136 |
137 | -- update the scrollframe
138 | self:FixScroll()
139 |
140 | -- schedule another update when everything has "settled"
141 | self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate)
142 | end,
143 |
144 | ["SetStatusTable"] = function(self, status)
145 | assert(type(status) == "table")
146 | self.status = status
147 | if not status.scrollvalue then
148 | status.scrollvalue = 0
149 | end
150 | end,
151 |
152 | ["OnWidthSet"] = function(self, width)
153 | local content = self.content
154 | content.width = width - (self.scrollBarShown and 20 or 0)
155 | content.original_width = width
156 | end,
157 |
158 | ["OnHeightSet"] = function(self, height)
159 | local content = self.content
160 | content.height = height
161 | end
162 | }
163 | --[[-----------------------------------------------------------------------------
164 | Constructor
165 | -------------------------------------------------------------------------------]]
166 | local function Constructor()
167 | local frame = CreateFrame("Frame", nil, UIParent)
168 | local num = AceGUI:GetNextWidgetNum(Type)
169 |
170 | local scrollframe = CreateFrame("ScrollFrame", nil, frame)
171 | scrollframe:SetPoint("TOPLEFT")
172 | scrollframe:SetPoint("BOTTOMRIGHT")
173 | scrollframe:EnableMouseWheel(true)
174 | scrollframe:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel)
175 | scrollframe:SetScript("OnSizeChanged", ScrollFrame_OnSizeChanged)
176 |
177 | local scrollbar = CreateFrame("Slider", ("AceConfigDialogScrollFrame%dScrollBar"):format(num), scrollframe, "UIPanelScrollBarTemplate")
178 | scrollbar:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 4, -16)
179 | scrollbar:SetPoint("BOTTOMLEFT", scrollframe, "BOTTOMRIGHT", 4, 16)
180 | scrollbar:SetMinMaxValues(0, 1000)
181 | scrollbar:SetValueStep(1)
182 | scrollbar:SetValue(0)
183 | scrollbar:SetWidth(16)
184 | scrollbar:Hide()
185 | -- set the script as the last step, so it doesn't fire yet
186 | scrollbar:SetScript("OnValueChanged", ScrollBar_OnScrollValueChanged)
187 |
188 | local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
189 | scrollbg:SetAllPoints(scrollbar)
190 | scrollbg:SetTexture(0, 0, 0, 0.4)
191 |
192 | --Container Support
193 | local content = CreateFrame("Frame", nil, scrollframe)
194 | content:SetPoint("TOPLEFT")
195 | content:SetPoint("TOPRIGHT")
196 | content:SetHeight(400)
197 | scrollframe:SetScrollChild(content)
198 |
199 | local widget = {
200 | localstatus = { scrollvalue = 0 },
201 | scrollframe = scrollframe,
202 | scrollbar = scrollbar,
203 | content = content,
204 | frame = frame,
205 | type = Type
206 | }
207 | for method, func in pairs(methods) do
208 | widget[method] = func
209 | end
210 | scrollframe.obj, scrollbar.obj = widget, widget
211 |
212 | return AceGUI:RegisterAsContainer(widget)
213 | end
214 |
215 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
216 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIContainer-SimpleGroup.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | SimpleGroup Container
3 | Simple container widget that just groups widgets.
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "SimpleGroup", 20
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local pairs = pairs
11 |
12 | -- WoW APIs
13 | local CreateFrame, UIParent = CreateFrame, UIParent
14 |
15 |
16 | --[[-----------------------------------------------------------------------------
17 | Methods
18 | -------------------------------------------------------------------------------]]
19 | local methods = {
20 | ["OnAcquire"] = function(self)
21 | self:SetWidth(300)
22 | self:SetHeight(100)
23 | end,
24 |
25 | -- ["OnRelease"] = nil,
26 |
27 | ["LayoutFinished"] = function(self, width, height)
28 | if self.noAutoHeight then return end
29 | self:SetHeight(height or 0)
30 | end,
31 |
32 | ["OnWidthSet"] = function(self, width)
33 | local content = self.content
34 | content:SetWidth(width)
35 | content.width = width
36 | end,
37 |
38 | ["OnHeightSet"] = function(self, height)
39 | local content = self.content
40 | content:SetHeight(height)
41 | content.height = height
42 | end
43 | }
44 |
45 | --[[-----------------------------------------------------------------------------
46 | Constructor
47 | -------------------------------------------------------------------------------]]
48 | local function Constructor()
49 | local frame = CreateFrame("Frame", nil, UIParent)
50 | frame:SetFrameStrata("FULLSCREEN_DIALOG")
51 |
52 | --Container Support
53 | local content = CreateFrame("Frame", nil, frame)
54 | content:SetPoint("TOPLEFT")
55 | content:SetPoint("BOTTOMRIGHT")
56 |
57 | local widget = {
58 | frame = frame,
59 | content = content,
60 | type = Type
61 | }
62 | for method, func in pairs(methods) do
63 | widget[method] = func
64 | end
65 |
66 | return AceGUI:RegisterAsContainer(widget)
67 | end
68 |
69 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
70 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIContainer-TabGroup.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | TabGroup Container
3 | Container that uses tabs on top to switch between groups.
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "TabGroup", 31
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe
11 |
12 | -- WoW APIs
13 | local PlaySound = PlaySound
14 | local CreateFrame, UIParent = CreateFrame, UIParent
15 | local _G = _G
16 |
17 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
18 | -- List them here for Mikk's FindGlobals script
19 | -- GLOBALS: PanelTemplates_TabResize, PanelTemplates_SetDisabledTabState, PanelTemplates_SelectTab, PanelTemplates_DeselectTab
20 |
21 | -- local upvalue storage used by BuildTabs
22 | local widths = {}
23 | local rowwidths = {}
24 | local rowends = {}
25 |
26 | --[[-----------------------------------------------------------------------------
27 | Support functions
28 | -------------------------------------------------------------------------------]]
29 | local function UpdateTabLook(frame)
30 | if frame.disabled then
31 | PanelTemplates_SetDisabledTabState(frame)
32 | elseif frame.selected then
33 | PanelTemplates_SelectTab(frame)
34 | else
35 | PanelTemplates_DeselectTab(frame)
36 | end
37 | end
38 |
39 | local function Tab_SetText(frame, text)
40 | frame:_SetText(text)
41 | local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0
42 | PanelTemplates_TabResize(frame, 0, nil, width)
43 | end
44 |
45 | local function Tab_SetSelected(frame, selected)
46 | frame.selected = selected
47 | UpdateTabLook(frame)
48 | end
49 |
50 | local function Tab_SetDisabled(frame, disabled)
51 | frame.disabled = disabled
52 | UpdateTabLook(frame)
53 | end
54 |
55 | local function BuildTabsOnUpdate(frame)
56 | local self = frame.obj
57 | self:BuildTabs()
58 | frame:SetScript("OnUpdate", nil)
59 | end
60 |
61 | --[[-----------------------------------------------------------------------------
62 | Scripts
63 | -------------------------------------------------------------------------------]]
64 | local function Tab_OnClick(frame)
65 | if not (frame.selected or frame.disabled) then
66 | PlaySound("igCharacterInfoTab")
67 | frame.obj:SelectTab(frame.value)
68 | end
69 | end
70 |
71 | local function Tab_OnEnter(frame)
72 | local self = frame.obj
73 | self:Fire("OnTabEnter", self.tabs[frame.id].value, frame)
74 | end
75 |
76 | local function Tab_OnLeave(frame)
77 | local self = frame.obj
78 | self:Fire("OnTabLeave", self.tabs[frame.id].value, frame)
79 | end
80 |
81 | local function Tab_OnShow(frame)
82 | _G[frame:GetName().."HighlightTexture"]:SetWidth(frame:GetTextWidth() + 30)
83 | end
84 |
85 | --[[-----------------------------------------------------------------------------
86 | Methods
87 | -------------------------------------------------------------------------------]]
88 | local methods = {
89 | ["OnAcquire"] = function(self)
90 | self:SetTitle()
91 | end,
92 |
93 | ["OnRelease"] = function(self)
94 | self.status = nil
95 | for k in pairs(self.localstatus) do
96 | self.localstatus[k] = nil
97 | end
98 | self.tablist = nil
99 | for _, tab in pairs(self.tabs) do
100 | tab:Hide()
101 | end
102 | end,
103 |
104 | ["CreateTab"] = function(self, id)
105 | local tabname = ("AceGUITabGroup%dTab%d"):format(self.num, id)
106 | local tab = CreateFrame("Button", tabname, self.border, "OptionsFrameTabButtonTemplate")
107 | tab.obj = self
108 | tab.id = id
109 |
110 | tab.text = _G[tabname .. "Text"]
111 | tab.text:ClearAllPoints()
112 | tab.text:SetPoint("LEFT", 14, -3)
113 | tab.text:SetPoint("RIGHT", -12, -3)
114 |
115 | tab:SetScript("OnClick", Tab_OnClick)
116 | tab:SetScript("OnEnter", Tab_OnEnter)
117 | tab:SetScript("OnLeave", Tab_OnLeave)
118 | tab:SetScript("OnShow", Tab_OnShow)
119 |
120 | tab._SetText = tab.SetText
121 | tab.SetText = Tab_SetText
122 | tab.SetSelected = Tab_SetSelected
123 | tab.SetDisabled = Tab_SetDisabled
124 |
125 | return tab
126 | end,
127 |
128 | ["SetTitle"] = function(self, text)
129 | self.titletext:SetText(text or "")
130 | if text and text ~= "" then
131 | self.alignoffset = 25
132 | else
133 | self.alignoffset = 18
134 | end
135 | self:BuildTabs()
136 | end,
137 |
138 | ["SetStatusTable"] = function(self, status)
139 | assert(type(status) == "table")
140 | self.status = status
141 | end,
142 |
143 | ["SelectTab"] = function(self, value)
144 | local status = self.status or self.localstatus
145 | local found
146 | for i, v in ipairs(self.tabs) do
147 | if v.value == value then
148 | v:SetSelected(true)
149 | found = true
150 | else
151 | v:SetSelected(false)
152 | end
153 | end
154 | status.selected = value
155 | if found then
156 | self:Fire("OnGroupSelected",value)
157 | end
158 | end,
159 |
160 | ["SetTabs"] = function(self, tabs)
161 | self.tablist = tabs
162 | self:BuildTabs()
163 | end,
164 |
165 |
166 | ["BuildTabs"] = function(self)
167 | local hastitle = (self.titletext:GetText() and self.titletext:GetText() ~= "")
168 | local tablist = self.tablist
169 | local tabs = self.tabs
170 |
171 | if not tablist then return end
172 |
173 | local width = self.frame.width or self.frame:GetWidth() or 0
174 |
175 | wipe(widths)
176 | wipe(rowwidths)
177 | wipe(rowends)
178 |
179 | --Place Text into tabs and get thier initial width
180 | for i, v in ipairs(tablist) do
181 | local tab = tabs[i]
182 | if not tab then
183 | tab = self:CreateTab(i)
184 | tabs[i] = tab
185 | end
186 |
187 | tab:Show()
188 | tab:SetText(v.text)
189 | tab:SetDisabled(v.disabled)
190 | tab.value = v.value
191 |
192 | widths[i] = tab:GetWidth() - 6 --tabs are anchored 10 pixels from the right side of the previous one to reduce spacing, but add a fixed 4px padding for the text
193 | end
194 |
195 | for i = (#tablist)+1, #tabs, 1 do
196 | tabs[i]:Hide()
197 | end
198 |
199 | --First pass, find the minimum number of rows needed to hold all tabs and the initial tab layout
200 | local numtabs = #tablist
201 | local numrows = 1
202 | local usedwidth = 0
203 |
204 | for i = 1, #tablist do
205 | --If this is not the first tab of a row and there isn't room for it
206 | if usedwidth ~= 0 and (width - usedwidth - widths[i]) < 0 then
207 | rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
208 | rowends[numrows] = i - 1
209 | numrows = numrows + 1
210 | usedwidth = 0
211 | end
212 | usedwidth = usedwidth + widths[i]
213 | end
214 | rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
215 | rowends[numrows] = #tablist
216 |
217 | --Fix for single tabs being left on the last row, move a tab from the row above if applicable
218 | if numrows > 1 then
219 | --if the last row has only one tab
220 | if rowends[numrows-1] == numtabs-1 then
221 | --if there are more than 2 tabs in the 2nd last row
222 | if (numrows == 2 and rowends[numrows-1] > 2) or (rowends[numrows] - rowends[numrows-1] > 2) then
223 | --move 1 tab from the second last row to the last, if there is enough space
224 | if (rowwidths[numrows] + widths[numtabs-1]) <= width then
225 | rowends[numrows-1] = rowends[numrows-1] - 1
226 | rowwidths[numrows] = rowwidths[numrows] + widths[numtabs-1]
227 | rowwidths[numrows-1] = rowwidths[numrows-1] - widths[numtabs-1]
228 | end
229 | end
230 | end
231 | end
232 |
233 | --anchor the rows as defined and resize tabs to fill thier row
234 | local starttab = 1
235 | for row, endtab in ipairs(rowends) do
236 | local first = true
237 | for tabno = starttab, endtab do
238 | local tab = tabs[tabno]
239 | tab:ClearAllPoints()
240 | if first then
241 | tab:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 0, -(hastitle and 14 or 7)-(row-1)*20 )
242 | first = false
243 | else
244 | tab:SetPoint("LEFT", tabs[tabno-1], "RIGHT", -10, 0)
245 | end
246 | end
247 |
248 | -- equal padding for each tab to fill the available width,
249 | -- if the used space is above 75% already
250 | -- the 18 pixel is the typical width of a scrollbar, so we can have a tab group inside a scrolling frame,
251 | -- and not have the tabs jump around funny when switching between tabs that need scrolling and those that don't
252 | local padding = 0
253 | if not (numrows == 1 and rowwidths[1] < width*0.75 - 18) then
254 | padding = (width - rowwidths[row]) / (endtab - starttab+1)
255 | end
256 |
257 | for i = starttab, endtab do
258 | PanelTemplates_TabResize(tabs[i], padding + 4, nil, width)
259 | end
260 | starttab = endtab + 1
261 | end
262 |
263 | self.borderoffset = (hastitle and 17 or 10)+((numrows)*20)
264 | self.border:SetPoint("TOPLEFT", 1, -self.borderoffset)
265 | end,
266 |
267 | ["OnWidthSet"] = function(self, width)
268 | local content = self.content
269 | local contentwidth = width - 60
270 | if contentwidth < 0 then
271 | contentwidth = 0
272 | end
273 | content:SetWidth(contentwidth)
274 | content.width = contentwidth
275 | self:BuildTabs(self)
276 | self.frame:SetScript("OnUpdate", BuildTabsOnUpdate)
277 | end,
278 |
279 | ["OnHeightSet"] = function(self, height)
280 | local content = self.content
281 | local contentheight = height - (self.borderoffset + 23)
282 | if contentheight < 0 then
283 | contentheight = 0
284 | end
285 | content:SetHeight(contentheight)
286 | content.height = contentheight
287 | end,
288 |
289 | ["LayoutFinished"] = function(self, width, height)
290 | if self.noAutoHeight then return end
291 | self:SetHeight((height or 0) + (self.borderoffset + 23))
292 | end
293 | }
294 |
295 | --[[-----------------------------------------------------------------------------
296 | Constructor
297 | -------------------------------------------------------------------------------]]
298 | local PaneBackdrop = {
299 | bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
300 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
301 | tile = true, tileSize = 16, edgeSize = 16,
302 | insets = { left = 3, right = 3, top = 5, bottom = 3 }
303 | }
304 |
305 | local function Constructor()
306 | local num = AceGUI:GetNextWidgetNum(Type)
307 | local frame = CreateFrame("Frame",nil,UIParent)
308 | frame:SetHeight(100)
309 | frame:SetWidth(100)
310 | frame:SetFrameStrata("FULLSCREEN_DIALOG")
311 |
312 | local titletext = frame:CreateFontString(nil,"OVERLAY","GameFontNormal")
313 | titletext:SetPoint("TOPLEFT", 14, 0)
314 | titletext:SetPoint("TOPRIGHT", -14, 0)
315 | titletext:SetJustifyH("LEFT")
316 | titletext:SetHeight(18)
317 | titletext:SetText("")
318 |
319 | local border = CreateFrame("Frame", nil, frame)
320 | border:SetPoint("TOPLEFT", 1, -27)
321 | border:SetPoint("BOTTOMRIGHT", -1, 3)
322 | border:SetBackdrop(PaneBackdrop)
323 | border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
324 | border:SetBackdropBorderColor(0.4, 0.4, 0.4)
325 |
326 | local content = CreateFrame("Frame", nil, border)
327 | content:SetPoint("TOPLEFT", 10, -7)
328 | content:SetPoint("BOTTOMRIGHT", -10, 7)
329 |
330 | local widget = {
331 | num = num,
332 | frame = frame,
333 | localstatus = {},
334 | alignoffset = 18,
335 | titletext = titletext,
336 | border = border,
337 | borderoffset = 27,
338 | tabs = {},
339 | content = content,
340 | type = Type
341 | }
342 | for method, func in pairs(methods) do
343 | widget[method] = func
344 | end
345 |
346 | return AceGUI:RegisterAsContainer(widget)
347 | end
348 |
349 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
350 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIContainer-Window.lua:
--------------------------------------------------------------------------------
1 | local AceGUI = LibStub("AceGUI-3.0")
2 |
3 | -- Lua APIs
4 | local pairs, assert, type = pairs, assert, type
5 |
6 | -- WoW APIs
7 | local PlaySound = PlaySound
8 | local CreateFrame, UIParent = CreateFrame, UIParent
9 |
10 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
11 | -- List them here for Mikk's FindGlobals script
12 | -- GLOBALS: GameFontNormal
13 |
14 | ----------------
15 | -- Main Frame --
16 | ----------------
17 | --[[
18 | Events :
19 | OnClose
20 |
21 | ]]
22 | do
23 | local Type = "Window"
24 | local Version = 5
25 |
26 | local function frameOnShow(this)
27 | this.obj:Fire("OnShow")
28 | end
29 |
30 | local function frameOnClose(this)
31 | this.obj:Fire("OnClose")
32 | end
33 |
34 | local function closeOnClick(this)
35 | PlaySound("gsTitleOptionExit")
36 | this.obj:Hide()
37 | end
38 |
39 | local function frameOnMouseDown(this)
40 | AceGUI:ClearFocus()
41 | end
42 |
43 | local function titleOnMouseDown(this)
44 | this:GetParent():StartMoving()
45 | AceGUI:ClearFocus()
46 | end
47 |
48 | local function frameOnMouseUp(this)
49 | local frame = this:GetParent()
50 | frame:StopMovingOrSizing()
51 | local self = frame.obj
52 | local status = self.status or self.localstatus
53 | status.width = frame:GetWidth()
54 | status.height = frame:GetHeight()
55 | status.top = frame:GetTop()
56 | status.left = frame:GetLeft()
57 | end
58 |
59 | local function sizerseOnMouseDown(this)
60 | this:GetParent():StartSizing("BOTTOMRIGHT")
61 | AceGUI:ClearFocus()
62 | end
63 |
64 | local function sizersOnMouseDown(this)
65 | this:GetParent():StartSizing("BOTTOM")
66 | AceGUI:ClearFocus()
67 | end
68 |
69 | local function sizereOnMouseDown(this)
70 | this:GetParent():StartSizing("RIGHT")
71 | AceGUI:ClearFocus()
72 | end
73 |
74 | local function sizerOnMouseUp(this)
75 | this:GetParent():StopMovingOrSizing()
76 | end
77 |
78 | local function SetTitle(self,title)
79 | self.titletext:SetText(title)
80 | end
81 |
82 | local function SetStatusText(self,text)
83 | -- self.statustext:SetText(text)
84 | end
85 |
86 | local function Hide(self)
87 | self.frame:Hide()
88 | end
89 |
90 | local function Show(self)
91 | self.frame:Show()
92 | end
93 |
94 | local function OnAcquire(self)
95 | self.frame:SetParent(UIParent)
96 | self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
97 | self:ApplyStatus()
98 | self:EnableResize(true)
99 | self:Show()
100 | end
101 |
102 | local function OnRelease(self)
103 | self.status = nil
104 | for k in pairs(self.localstatus) do
105 | self.localstatus[k] = nil
106 | end
107 | end
108 |
109 | -- called to set an external table to store status in
110 | local function SetStatusTable(self, status)
111 | assert(type(status) == "table")
112 | self.status = status
113 | self:ApplyStatus()
114 | end
115 |
116 | local function ApplyStatus(self)
117 | local status = self.status or self.localstatus
118 | local frame = self.frame
119 | self:SetWidth(status.width or 700)
120 | self:SetHeight(status.height or 500)
121 | if status.top and status.left then
122 | frame:SetPoint("TOP",UIParent,"BOTTOM",0,status.top)
123 | frame:SetPoint("LEFT",UIParent,"LEFT",status.left,0)
124 | else
125 | frame:SetPoint("CENTER",UIParent,"CENTER")
126 | end
127 | end
128 |
129 | local function OnWidthSet(self, width)
130 | local content = self.content
131 | local contentwidth = width - 34
132 | if contentwidth < 0 then
133 | contentwidth = 0
134 | end
135 | content:SetWidth(contentwidth)
136 | content.width = contentwidth
137 | end
138 |
139 |
140 | local function OnHeightSet(self, height)
141 | local content = self.content
142 | local contentheight = height - 57
143 | if contentheight < 0 then
144 | contentheight = 0
145 | end
146 | content:SetHeight(contentheight)
147 | content.height = contentheight
148 | end
149 |
150 | local function EnableResize(self, state)
151 | local func = state and "Show" or "Hide"
152 | self.sizer_se[func](self.sizer_se)
153 | self.sizer_s[func](self.sizer_s)
154 | self.sizer_e[func](self.sizer_e)
155 | end
156 |
157 | local function Constructor()
158 | local frame = CreateFrame("Frame",nil,UIParent)
159 | local self = {}
160 | self.type = "Window"
161 |
162 | self.Hide = Hide
163 | self.Show = Show
164 | self.SetTitle = SetTitle
165 | self.OnRelease = OnRelease
166 | self.OnAcquire = OnAcquire
167 | self.SetStatusText = SetStatusText
168 | self.SetStatusTable = SetStatusTable
169 | self.ApplyStatus = ApplyStatus
170 | self.OnWidthSet = OnWidthSet
171 | self.OnHeightSet = OnHeightSet
172 | self.EnableResize = EnableResize
173 |
174 | self.localstatus = {}
175 |
176 | self.frame = frame
177 | frame.obj = self
178 | frame:SetWidth(700)
179 | frame:SetHeight(500)
180 | frame:SetPoint("CENTER",UIParent,"CENTER",0,0)
181 | frame:EnableMouse()
182 | frame:SetMovable(true)
183 | frame:SetResizable(true)
184 | frame:SetFrameStrata("FULLSCREEN_DIALOG")
185 | frame:SetScript("OnMouseDown", frameOnMouseDown)
186 |
187 | frame:SetScript("OnShow",frameOnShow)
188 | frame:SetScript("OnHide",frameOnClose)
189 | frame:SetMinResize(240,240)
190 | frame:SetToplevel(true)
191 |
192 | local titlebg = frame:CreateTexture(nil, "BACKGROUND")
193 | titlebg:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Title-Background]])
194 | titlebg:SetPoint("TOPLEFT", 9, -6)
195 | titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24)
196 |
197 | local dialogbg = frame:CreateTexture(nil, "BACKGROUND")
198 | dialogbg:SetTexture([[Interface\Tooltips\UI-Tooltip-Background]])
199 | dialogbg:SetPoint("TOPLEFT", 8, -24)
200 | dialogbg:SetPoint("BOTTOMRIGHT", -6, 8)
201 | dialogbg:SetVertexColor(0, 0, 0, .75)
202 |
203 | local topleft = frame:CreateTexture(nil, "BORDER")
204 | topleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
205 | topleft:SetWidth(64)
206 | topleft:SetHeight(64)
207 | topleft:SetPoint("TOPLEFT")
208 | topleft:SetTexCoord(0.501953125, 0.625, 0, 1)
209 |
210 | local topright = frame:CreateTexture(nil, "BORDER")
211 | topright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
212 | topright:SetWidth(64)
213 | topright:SetHeight(64)
214 | topright:SetPoint("TOPRIGHT")
215 | topright:SetTexCoord(0.625, 0.75, 0, 1)
216 |
217 | local top = frame:CreateTexture(nil, "BORDER")
218 | top:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
219 | top:SetHeight(64)
220 | top:SetPoint("TOPLEFT", topleft, "TOPRIGHT")
221 | top:SetPoint("TOPRIGHT", topright, "TOPLEFT")
222 | top:SetTexCoord(0.25, 0.369140625, 0, 1)
223 |
224 | local bottomleft = frame:CreateTexture(nil, "BORDER")
225 | bottomleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
226 | bottomleft:SetWidth(64)
227 | bottomleft:SetHeight(64)
228 | bottomleft:SetPoint("BOTTOMLEFT")
229 | bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1)
230 |
231 | local bottomright = frame:CreateTexture(nil, "BORDER")
232 | bottomright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
233 | bottomright:SetWidth(64)
234 | bottomright:SetHeight(64)
235 | bottomright:SetPoint("BOTTOMRIGHT")
236 | bottomright:SetTexCoord(0.875, 1, 0, 1)
237 |
238 | local bottom = frame:CreateTexture(nil, "BORDER")
239 | bottom:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
240 | bottom:SetHeight(64)
241 | bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT")
242 | bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT")
243 | bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1)
244 |
245 | local left = frame:CreateTexture(nil, "BORDER")
246 | left:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
247 | left:SetWidth(64)
248 | left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT")
249 | left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT")
250 | left:SetTexCoord(0.001953125, 0.125, 0, 1)
251 |
252 | local right = frame:CreateTexture(nil, "BORDER")
253 | right:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
254 | right:SetWidth(64)
255 | right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT")
256 | right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT")
257 | right:SetTexCoord(0.1171875, 0.2421875, 0, 1)
258 |
259 | local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
260 | close:SetPoint("TOPRIGHT", 2, 1)
261 | close:SetScript("OnClick", closeOnClick)
262 | self.closebutton = close
263 | close.obj = self
264 |
265 | local titletext = frame:CreateFontString(nil, "ARTWORK")
266 | titletext:SetFontObject(GameFontNormal)
267 | titletext:SetPoint("TOPLEFT", 12, -8)
268 | titletext:SetPoint("TOPRIGHT", -32, -8)
269 | self.titletext = titletext
270 |
271 | local title = CreateFrame("Button", nil, frame)
272 | title:SetPoint("TOPLEFT", titlebg)
273 | title:SetPoint("BOTTOMRIGHT", titlebg)
274 | title:EnableMouse()
275 | title:SetScript("OnMouseDown",titleOnMouseDown)
276 | title:SetScript("OnMouseUp", frameOnMouseUp)
277 | self.title = title
278 |
279 | local sizer_se = CreateFrame("Frame",nil,frame)
280 | sizer_se:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,0)
281 | sizer_se:SetWidth(25)
282 | sizer_se:SetHeight(25)
283 | sizer_se:EnableMouse()
284 | sizer_se:SetScript("OnMouseDown",sizerseOnMouseDown)
285 | sizer_se:SetScript("OnMouseUp", sizerOnMouseUp)
286 | self.sizer_se = sizer_se
287 |
288 | local line1 = sizer_se:CreateTexture(nil, "BACKGROUND")
289 | self.line1 = line1
290 | line1:SetWidth(14)
291 | line1:SetHeight(14)
292 | line1:SetPoint("BOTTOMRIGHT", -8, 8)
293 | line1:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
294 | local x = 0.1 * 14/17
295 | line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
296 |
297 | local line2 = sizer_se:CreateTexture(nil, "BACKGROUND")
298 | self.line2 = line2
299 | line2:SetWidth(8)
300 | line2:SetHeight(8)
301 | line2:SetPoint("BOTTOMRIGHT", -8, 8)
302 | line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
303 | local x = 0.1 * 8/17
304 | line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
305 |
306 | local sizer_s = CreateFrame("Frame",nil,frame)
307 | sizer_s:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-25,0)
308 | sizer_s:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",0,0)
309 | sizer_s:SetHeight(25)
310 | sizer_s:EnableMouse()
311 | sizer_s:SetScript("OnMouseDown",sizersOnMouseDown)
312 | sizer_s:SetScript("OnMouseUp", sizerOnMouseUp)
313 | self.sizer_s = sizer_s
314 |
315 | local sizer_e = CreateFrame("Frame",nil,frame)
316 | sizer_e:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,25)
317 | sizer_e:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,0)
318 | sizer_e:SetWidth(25)
319 | sizer_e:EnableMouse()
320 | sizer_e:SetScript("OnMouseDown",sizereOnMouseDown)
321 | sizer_e:SetScript("OnMouseUp", sizerOnMouseUp)
322 | self.sizer_e = sizer_e
323 |
324 | --Container Support
325 | local content = CreateFrame("Frame",nil,frame)
326 | self.content = content
327 | content.obj = self
328 | content:SetPoint("TOPLEFT",frame,"TOPLEFT",12,-32)
329 | content:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-12,13)
330 |
331 | AceGUI:RegisterAsContainer(self)
332 | return self
333 | end
334 |
335 | AceGUI:RegisterWidgetType(Type,Constructor,Version)
336 | end
337 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-Button.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | Button Widget
3 | Graphical Button.
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "Button", 23
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local pairs = pairs
11 |
12 | -- WoW APIs
13 | local _G = _G
14 | local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent
15 |
16 | --[[-----------------------------------------------------------------------------
17 | Scripts
18 | -------------------------------------------------------------------------------]]
19 | local function Button_OnClick(frame, ...)
20 | AceGUI:ClearFocus()
21 | PlaySound("igMainMenuOption")
22 | frame.obj:Fire("OnClick", ...)
23 | end
24 |
25 | local function Control_OnEnter(frame)
26 | frame.obj:Fire("OnEnter")
27 | end
28 |
29 | local function Control_OnLeave(frame)
30 | frame.obj:Fire("OnLeave")
31 | end
32 |
33 | --[[-----------------------------------------------------------------------------
34 | Methods
35 | -------------------------------------------------------------------------------]]
36 | local methods = {
37 | ["OnAcquire"] = function(self)
38 | -- restore default values
39 | self:SetHeight(24)
40 | self:SetWidth(200)
41 | self:SetDisabled(false)
42 | self:SetAutoWidth(false)
43 | self:SetText()
44 | end,
45 |
46 | -- ["OnRelease"] = nil,
47 |
48 | ["SetText"] = function(self, text)
49 | self.text:SetText(text)
50 | if self.autoWidth then
51 | self:SetWidth(self.text:GetStringWidth() + 30)
52 | end
53 | end,
54 |
55 | ["SetAutoWidth"] = function(self, autoWidth)
56 | self.autoWidth = autoWidth
57 | if self.autoWidth then
58 | self:SetWidth(self.text:GetStringWidth() + 30)
59 | end
60 | end,
61 |
62 | ["SetDisabled"] = function(self, disabled)
63 | self.disabled = disabled
64 | if disabled then
65 | self.frame:Disable()
66 | else
67 | self.frame:Enable()
68 | end
69 | end
70 | }
71 |
72 | --[[-----------------------------------------------------------------------------
73 | Constructor
74 | -------------------------------------------------------------------------------]]
75 | local function Constructor()
76 | local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
77 | local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2")
78 | frame:Hide()
79 |
80 | frame:EnableMouse(true)
81 | frame:SetScript("OnClick", Button_OnClick)
82 | frame:SetScript("OnEnter", Control_OnEnter)
83 | frame:SetScript("OnLeave", Control_OnLeave)
84 |
85 | local text = frame:GetFontString()
86 | text:ClearAllPoints()
87 | text:SetPoint("TOPLEFT", 15, -1)
88 | text:SetPoint("BOTTOMRIGHT", -15, 1)
89 | text:SetJustifyV("MIDDLE")
90 |
91 | local widget = {
92 | text = text,
93 | frame = frame,
94 | type = Type
95 | }
96 | for method, func in pairs(methods) do
97 | widget[method] = func
98 | end
99 |
100 | return AceGUI:RegisterAsWidget(widget)
101 | end
102 |
103 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
104 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | Checkbox Widget
3 | -------------------------------------------------------------------------------]]
4 | local Type, Version = "CheckBox", 26
5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
7 |
8 | -- Lua APIs
9 | local select, pairs = select, pairs
10 |
11 | -- WoW APIs
12 | local PlaySound = PlaySound
13 | local CreateFrame, UIParent = CreateFrame, UIParent
14 |
15 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
16 | -- List them here for Mikk's FindGlobals script
17 | -- GLOBALS: SetDesaturation, GameFontHighlight
18 |
19 | --[[-----------------------------------------------------------------------------
20 | Support functions
21 | -------------------------------------------------------------------------------]]
22 | local function AlignImage(self)
23 | local img = self.image:GetTexture()
24 | self.text:ClearAllPoints()
25 | if not img then
26 | self.text:SetPoint("LEFT", self.checkbg, "RIGHT")
27 | self.text:SetPoint("RIGHT")
28 | else
29 | self.text:SetPoint("LEFT", self.image, "RIGHT", 1, 0)
30 | self.text:SetPoint("RIGHT")
31 | end
32 | end
33 |
34 | --[[-----------------------------------------------------------------------------
35 | Scripts
36 | -------------------------------------------------------------------------------]]
37 | local function Control_OnEnter(frame)
38 | frame.obj:Fire("OnEnter")
39 | end
40 |
41 | local function Control_OnLeave(frame)
42 | frame.obj:Fire("OnLeave")
43 | end
44 |
45 | local function CheckBox_OnMouseDown(frame)
46 | local self = frame.obj
47 | if not self.disabled then
48 | if self.image:GetTexture() then
49 | self.text:SetPoint("LEFT", self.image,"RIGHT", 2, -1)
50 | else
51 | self.text:SetPoint("LEFT", self.checkbg, "RIGHT", 1, -1)
52 | end
53 | end
54 | AceGUI:ClearFocus()
55 | end
56 |
57 | local function CheckBox_OnMouseUp(frame)
58 | local self = frame.obj
59 | if not self.disabled then
60 | self:ToggleChecked()
61 |
62 | if self.checked then
63 | PlaySound("igMainMenuOptionCheckBoxOn")
64 | else -- for both nil and false (tristate)
65 | PlaySound("igMainMenuOptionCheckBoxOff")
66 | end
67 |
68 | self:Fire("OnValueChanged", self.checked)
69 | AlignImage(self)
70 | end
71 | end
72 |
73 | --[[-----------------------------------------------------------------------------
74 | Methods
75 | -------------------------------------------------------------------------------]]
76 | local methods = {
77 | ["OnAcquire"] = function(self)
78 | self:SetType()
79 | self:SetValue(false)
80 | self:SetTriState(nil)
81 | -- height is calculated from the width and required space for the description
82 | self:SetWidth(200)
83 | self:SetImage()
84 | self:SetDisabled(nil)
85 | self:SetDescription(nil)
86 | end,
87 |
88 | -- ["OnRelease"] = nil,
89 |
90 | ["OnWidthSet"] = function(self, width)
91 | if self.desc then
92 | self.desc:SetWidth(width - 30)
93 | if self.desc:GetText() and self.desc:GetText() ~= "" then
94 | self:SetHeight(28 + self.desc:GetStringHeight())
95 | end
96 | end
97 | end,
98 |
99 | ["SetDisabled"] = function(self, disabled)
100 | self.disabled = disabled
101 | if disabled then
102 | self.frame:Disable()
103 | self.text:SetTextColor(0.5, 0.5, 0.5)
104 | SetDesaturation(self.check, true)
105 | if self.desc then
106 | self.desc:SetTextColor(0.5, 0.5, 0.5)
107 | end
108 | else
109 | self.frame:Enable()
110 | self.text:SetTextColor(1, 1, 1)
111 | if self.tristate and self.checked == nil then
112 | SetDesaturation(self.check, true)
113 | else
114 | SetDesaturation(self.check, false)
115 | end
116 | if self.desc then
117 | self.desc:SetTextColor(1, 1, 1)
118 | end
119 | end
120 | end,
121 |
122 | ["SetValue"] = function(self, value)
123 | local check = self.check
124 | self.checked = value
125 | if value then
126 | SetDesaturation(check, false)
127 | check:Show()
128 | else
129 | --Nil is the unknown tristate value
130 | if self.tristate and value == nil then
131 | SetDesaturation(check, true)
132 | check:Show()
133 | else
134 | SetDesaturation(check, false)
135 | check:Hide()
136 | end
137 | end
138 | self:SetDisabled(self.disabled)
139 | end,
140 |
141 | ["GetValue"] = function(self)
142 | return self.checked
143 | end,
144 |
145 | ["SetTriState"] = function(self, enabled)
146 | self.tristate = enabled
147 | self:SetValue(self:GetValue())
148 | end,
149 |
150 | ["SetType"] = function(self, type)
151 | local checkbg = self.checkbg
152 | local check = self.check
153 | local highlight = self.highlight
154 |
155 | local size
156 | if type == "radio" then
157 | size = 16
158 | checkbg:SetTexture("Interface\\Buttons\\UI-RadioButton")
159 | checkbg:SetTexCoord(0, 0.25, 0, 1)
160 | check:SetTexture("Interface\\Buttons\\UI-RadioButton")
161 | check:SetTexCoord(0.25, 0.5, 0, 1)
162 | check:SetBlendMode("ADD")
163 | highlight:SetTexture("Interface\\Buttons\\UI-RadioButton")
164 | highlight:SetTexCoord(0.5, 0.75, 0, 1)
165 | else
166 | size = 24
167 | checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up")
168 | checkbg:SetTexCoord(0, 1, 0, 1)
169 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
170 | check:SetTexCoord(0, 1, 0, 1)
171 | check:SetBlendMode("BLEND")
172 | highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight")
173 | highlight:SetTexCoord(0, 1, 0, 1)
174 | end
175 | checkbg:SetHeight(size)
176 | checkbg:SetWidth(size)
177 | end,
178 |
179 | ["ToggleChecked"] = function(self)
180 | local value = self:GetValue()
181 | if self.tristate then
182 | --cycle in true, nil, false order
183 | if value then
184 | self:SetValue(nil)
185 | elseif value == nil then
186 | self:SetValue(false)
187 | else
188 | self:SetValue(true)
189 | end
190 | else
191 | self:SetValue(not self:GetValue())
192 | end
193 | end,
194 |
195 | ["SetLabel"] = function(self, label)
196 | self.text:SetText(label)
197 | end,
198 |
199 | ["SetDescription"] = function(self, desc)
200 | if desc then
201 | if not self.desc then
202 | local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
203 | desc:ClearAllPoints()
204 | desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
205 | desc:SetWidth(self.frame.width - 30)
206 | desc:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
207 | desc:SetJustifyH("LEFT")
208 | desc:SetJustifyV("TOP")
209 | self.desc = desc
210 | end
211 | self.desc:Show()
212 | --self.text:SetFontObject(GameFontNormal)
213 | self.desc:SetText(desc)
214 | self:SetHeight(28 + self.desc:GetStringHeight())
215 | else
216 | if self.desc then
217 | self.desc:SetText("")
218 | self.desc:Hide()
219 | end
220 | --self.text:SetFontObject(GameFontHighlight)
221 | self:SetHeight(24)
222 | end
223 | end,
224 |
225 | ["SetImage"] = function(self, path, ...)
226 | local image = self.image
227 | image:SetTexture(path)
228 |
229 | if image:GetTexture() then
230 | local n = select("#", ...)
231 | if n == 4 or n == 8 then
232 | image:SetTexCoord(...)
233 | else
234 | image:SetTexCoord(0, 1, 0, 1)
235 | end
236 | end
237 | AlignImage(self)
238 | end
239 | }
240 |
241 | --[[-----------------------------------------------------------------------------
242 | Constructor
243 | -------------------------------------------------------------------------------]]
244 | local function Constructor()
245 | local frame = CreateFrame("Button", nil, UIParent)
246 | frame:Hide()
247 |
248 | frame:EnableMouse(true)
249 | frame:SetScript("OnEnter", Control_OnEnter)
250 | frame:SetScript("OnLeave", Control_OnLeave)
251 | frame:SetScript("OnMouseDown", CheckBox_OnMouseDown)
252 | frame:SetScript("OnMouseUp", CheckBox_OnMouseUp)
253 |
254 | local checkbg = frame:CreateTexture(nil, "ARTWORK")
255 | checkbg:SetWidth(24)
256 | checkbg:SetHeight(24)
257 | checkbg:SetPoint("TOPLEFT")
258 | checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up")
259 |
260 | local check = frame:CreateTexture(nil, "OVERLAY")
261 | check:SetAllPoints(checkbg)
262 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
263 |
264 | local text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
265 | text:SetJustifyH("LEFT")
266 | text:SetHeight(18)
267 | text:SetPoint("LEFT", checkbg, "RIGHT")
268 | text:SetPoint("RIGHT")
269 |
270 | local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
271 | highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight")
272 | highlight:SetBlendMode("ADD")
273 | highlight:SetAllPoints(checkbg)
274 |
275 | local image = frame:CreateTexture(nil, "OVERLAY")
276 | image:SetHeight(16)
277 | image:SetWidth(16)
278 | image:SetPoint("LEFT", checkbg, "RIGHT", 1, 0)
279 |
280 | local widget = {
281 | checkbg = checkbg,
282 | check = check,
283 | text = text,
284 | highlight = highlight,
285 | image = image,
286 | frame = frame,
287 | type = Type
288 | }
289 | for method, func in pairs(methods) do
290 | widget[method] = func
291 | end
292 |
293 | return AceGUI:RegisterAsWidget(widget)
294 | end
295 |
296 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
297 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | ColorPicker Widget
3 | -------------------------------------------------------------------------------]]
4 | local Type, Version = "ColorPicker", 25
5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
7 |
8 | -- Lua APIs
9 | local pairs = pairs
10 |
11 | -- WoW APIs
12 | local CreateFrame, UIParent = CreateFrame, UIParent
13 |
14 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
15 | -- List them here for Mikk's FindGlobals script
16 | -- GLOBALS: ColorPickerFrame, OpacitySliderFrame
17 |
18 | --[[-----------------------------------------------------------------------------
19 | Support functions
20 | -------------------------------------------------------------------------------]]
21 | local function ColorCallback(self, r, g, b, a, isAlpha)
22 | if not self.HasAlpha then
23 | a = 1
24 | end
25 | self:SetColor(r, g, b, a)
26 | if ColorPickerFrame:IsVisible() then
27 | --colorpicker is still open
28 | self:Fire("OnValueChanged", r, g, b, a)
29 | else
30 | --colorpicker is closed, color callback is first, ignore it,
31 | --alpha callback is the final call after it closes so confirm now
32 | if isAlpha then
33 | self:Fire("OnValueConfirmed", r, g, b, a)
34 | end
35 | end
36 | end
37 |
38 | --[[-----------------------------------------------------------------------------
39 | Scripts
40 | -------------------------------------------------------------------------------]]
41 | local function Control_OnEnter(frame)
42 | frame.obj:Fire("OnEnter")
43 | end
44 |
45 | local function Control_OnLeave(frame)
46 | frame.obj:Fire("OnLeave")
47 | end
48 |
49 | local function ColorSwatch_OnClick(frame)
50 | ColorPickerFrame:Hide()
51 | local self = frame.obj
52 | if not self.disabled then
53 | ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG")
54 | ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
55 | ColorPickerFrame:SetClampedToScreen(true)
56 |
57 | ColorPickerFrame.func = function()
58 | local r, g, b = ColorPickerFrame:GetColorRGB()
59 | local a = 1 - OpacitySliderFrame:GetValue()
60 | ColorCallback(self, r, g, b, a)
61 | end
62 |
63 | ColorPickerFrame.hasOpacity = self.HasAlpha
64 | ColorPickerFrame.opacityFunc = function()
65 | local r, g, b = ColorPickerFrame:GetColorRGB()
66 | local a = 1 - OpacitySliderFrame:GetValue()
67 | ColorCallback(self, r, g, b, a, true)
68 | end
69 |
70 | local r, g, b, a = self.r, self.g, self.b, self.a
71 | if self.HasAlpha then
72 | ColorPickerFrame.opacity = 1 - (a or 0)
73 | end
74 | ColorPickerFrame:SetColorRGB(r, g, b)
75 |
76 | ColorPickerFrame.cancelFunc = function()
77 | ColorCallback(self, r, g, b, a, true)
78 | end
79 |
80 | ColorPickerFrame:Show()
81 | end
82 | AceGUI:ClearFocus()
83 | end
84 |
85 | --[[-----------------------------------------------------------------------------
86 | Methods
87 | -------------------------------------------------------------------------------]]
88 | local methods = {
89 | ["OnAcquire"] = function(self)
90 | self:SetHeight(24)
91 | self:SetWidth(200)
92 | self:SetHasAlpha(false)
93 | self:SetColor(0, 0, 0, 1)
94 | self:SetDisabled(nil)
95 | self:SetLabel(nil)
96 | end,
97 |
98 | -- ["OnRelease"] = nil,
99 |
100 | ["SetLabel"] = function(self, text)
101 | self.text:SetText(text)
102 | end,
103 |
104 | ["SetColor"] = function(self, r, g, b, a)
105 | self.r = r
106 | self.g = g
107 | self.b = b
108 | self.a = a or 1
109 | self.colorSwatch:SetVertexColor(r, g, b, a)
110 | end,
111 |
112 | ["SetHasAlpha"] = function(self, HasAlpha)
113 | self.HasAlpha = HasAlpha
114 | end,
115 |
116 | ["SetDisabled"] = function(self, disabled)
117 | self.disabled = disabled
118 | if self.disabled then
119 | self.frame:Disable()
120 | self.text:SetTextColor(0.5, 0.5, 0.5)
121 | else
122 | self.frame:Enable()
123 | self.text:SetTextColor(1, 1, 1)
124 | end
125 | end
126 | }
127 |
128 | --[[-----------------------------------------------------------------------------
129 | Constructor
130 | -------------------------------------------------------------------------------]]
131 | local function Constructor()
132 | local frame = CreateFrame("Button", nil, UIParent)
133 | frame:Hide()
134 |
135 | frame:EnableMouse(true)
136 | frame:SetScript("OnEnter", Control_OnEnter)
137 | frame:SetScript("OnLeave", Control_OnLeave)
138 | frame:SetScript("OnClick", ColorSwatch_OnClick)
139 |
140 | local colorSwatch = frame:CreateTexture(nil, "OVERLAY")
141 | colorSwatch:SetWidth(19)
142 | colorSwatch:SetHeight(19)
143 | colorSwatch:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch")
144 | colorSwatch:SetPoint("LEFT")
145 |
146 | local texture = frame:CreateTexture(nil, "BACKGROUND")
147 | colorSwatch.background = texture
148 | texture:SetWidth(16)
149 | texture:SetHeight(16)
150 | texture:SetTexture(1, 1, 1)
151 | texture:SetPoint("CENTER", colorSwatch)
152 | texture:Show()
153 |
154 | local checkers = frame:CreateTexture(nil, "BACKGROUND")
155 | colorSwatch.checkers = checkers
156 | checkers:SetWidth(14)
157 | checkers:SetHeight(14)
158 | checkers:SetTexture("Tileset\\Generic\\Checkers")
159 | checkers:SetTexCoord(.25, 0, 0.5, .25)
160 | checkers:SetDesaturated(true)
161 | checkers:SetVertexColor(1, 1, 1, 0.75)
162 | checkers:SetPoint("CENTER", colorSwatch)
163 | checkers:Show()
164 |
165 | local text = frame:CreateFontString(nil,"OVERLAY","GameFontHighlight")
166 | text:SetHeight(24)
167 | text:SetJustifyH("LEFT")
168 | text:SetTextColor(1, 1, 1)
169 | text:SetPoint("LEFT", colorSwatch, "RIGHT", 2, 0)
170 | text:SetPoint("RIGHT")
171 |
172 | --local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
173 | --highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
174 | --highlight:SetBlendMode("ADD")
175 | --highlight:SetAllPoints(frame)
176 |
177 | local widget = {
178 | colorSwatch = colorSwatch,
179 | text = text,
180 | frame = frame,
181 | type = Type
182 | }
183 | for method, func in pairs(methods) do
184 | widget[method] = func
185 | end
186 |
187 | return AceGUI:RegisterAsWidget(widget)
188 | end
189 |
190 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
191 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua:
--------------------------------------------------------------------------------
1 | --[[ $Id$ ]]--
2 |
3 | local AceGUI = LibStub("AceGUI-3.0")
4 |
5 | -- Lua APIs
6 | local select, assert = select, assert
7 |
8 | -- WoW APIs
9 | local PlaySound = PlaySound
10 | local CreateFrame = CreateFrame
11 |
12 | local function fixlevels(parent,...)
13 | local i = 1
14 | local child = select(i, ...)
15 | while child do
16 | child:SetFrameLevel(parent:GetFrameLevel()+1)
17 | fixlevels(child, child:GetChildren())
18 | i = i + 1
19 | child = select(i, ...)
20 | end
21 | end
22 |
23 | local function fixstrata(strata, parent, ...)
24 | local i = 1
25 | local child = select(i, ...)
26 | parent:SetFrameStrata(strata)
27 | while child do
28 | fixstrata(strata, child, child:GetChildren())
29 | i = i + 1
30 | child = select(i, ...)
31 | end
32 | end
33 |
34 | -- ItemBase is the base "class" for all dropdown items.
35 | -- Each item has to use ItemBase.Create(widgetType) to
36 | -- create an initial 'self' value.
37 | -- ItemBase will add common functions and ui event handlers.
38 | -- Be sure to keep basic usage when you override functions.
39 |
40 | local ItemBase = {
41 | -- NOTE: The ItemBase version is added to each item's version number
42 | -- to ensure proper updates on ItemBase changes.
43 | -- Use at least 1000er steps.
44 | version = 1000,
45 | counter = 0,
46 | }
47 |
48 | function ItemBase.Frame_OnEnter(this)
49 | local self = this.obj
50 |
51 | if self.useHighlight then
52 | self.highlight:Show()
53 | end
54 | self:Fire("OnEnter")
55 |
56 | if self.specialOnEnter then
57 | self.specialOnEnter(self)
58 | end
59 | end
60 |
61 | function ItemBase.Frame_OnLeave(this)
62 | local self = this.obj
63 |
64 | self.highlight:Hide()
65 | self:Fire("OnLeave")
66 |
67 | if self.specialOnLeave then
68 | self.specialOnLeave(self)
69 | end
70 | end
71 |
72 | -- exported, AceGUI callback
73 | function ItemBase.OnAcquire(self)
74 | self.frame:SetToplevel(true)
75 | self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
76 | end
77 |
78 | -- exported, AceGUI callback
79 | function ItemBase.OnRelease(self)
80 | self:SetDisabled(false)
81 | self.pullout = nil
82 | self.frame:SetParent(nil)
83 | self.frame:ClearAllPoints()
84 | self.frame:Hide()
85 | end
86 |
87 | -- exported
88 | -- NOTE: this is called by a Dropdown-Pullout.
89 | -- Do not call this method directly
90 | function ItemBase.SetPullout(self, pullout)
91 | self.pullout = pullout
92 |
93 | self.frame:SetParent(nil)
94 | self.frame:SetParent(pullout.itemFrame)
95 | self.parent = pullout.itemFrame
96 | fixlevels(pullout.itemFrame, pullout.itemFrame:GetChildren())
97 | end
98 |
99 | -- exported
100 | function ItemBase.SetText(self, text)
101 | self.text:SetText(text or "")
102 | end
103 |
104 | -- exported
105 | function ItemBase.GetText(self)
106 | return self.text:GetText()
107 | end
108 |
109 | -- exported
110 | function ItemBase.SetPoint(self, ...)
111 | self.frame:SetPoint(...)
112 | end
113 |
114 | -- exported
115 | function ItemBase.Show(self)
116 | self.frame:Show()
117 | end
118 |
119 | -- exported
120 | function ItemBase.Hide(self)
121 | self.frame:Hide()
122 | end
123 |
124 | -- exported
125 | function ItemBase.SetDisabled(self, disabled)
126 | self.disabled = disabled
127 | if disabled then
128 | self.useHighlight = false
129 | self.text:SetTextColor(.5, .5, .5)
130 | else
131 | self.useHighlight = true
132 | self.text:SetTextColor(1, 1, 1)
133 | end
134 | end
135 |
136 | -- exported
137 | -- NOTE: this is called by a Dropdown-Pullout.
138 | -- Do not call this method directly
139 | function ItemBase.SetOnLeave(self, func)
140 | self.specialOnLeave = func
141 | end
142 |
143 | -- exported
144 | -- NOTE: this is called by a Dropdown-Pullout.
145 | -- Do not call this method directly
146 | function ItemBase.SetOnEnter(self, func)
147 | self.specialOnEnter = func
148 | end
149 |
150 | function ItemBase.Create(type)
151 | -- NOTE: Most of the following code is copied from AceGUI-3.0/Dropdown widget
152 | local count = AceGUI:GetNextWidgetNum(type)
153 | local frame = CreateFrame("Button", "AceGUI30DropDownItem"..count)
154 | local self = {}
155 | self.frame = frame
156 | frame.obj = self
157 | self.type = type
158 |
159 | self.useHighlight = true
160 |
161 | frame:SetHeight(17)
162 | frame:SetFrameStrata("FULLSCREEN_DIALOG")
163 |
164 | local text = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
165 | text:SetTextColor(1,1,1)
166 | text:SetJustifyH("LEFT")
167 | text:SetPoint("TOPLEFT",frame,"TOPLEFT",18,0)
168 | text:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-8,0)
169 | self.text = text
170 |
171 | local highlight = frame:CreateTexture(nil, "OVERLAY")
172 | highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
173 | highlight:SetBlendMode("ADD")
174 | highlight:SetHeight(14)
175 | highlight:ClearAllPoints()
176 | highlight:SetPoint("RIGHT",frame,"RIGHT",-3,0)
177 | highlight:SetPoint("LEFT",frame,"LEFT",5,0)
178 | highlight:Hide()
179 | self.highlight = highlight
180 |
181 | local check = frame:CreateTexture("OVERLAY")
182 | check:SetWidth(16)
183 | check:SetHeight(16)
184 | check:SetPoint("LEFT",frame,"LEFT",3,-1)
185 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
186 | check:Hide()
187 | self.check = check
188 |
189 | local sub = frame:CreateTexture("OVERLAY")
190 | sub:SetWidth(16)
191 | sub:SetHeight(16)
192 | sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
193 | sub:SetTexture("Interface\\ChatFrame\\ChatFrameExpandArrow")
194 | sub:Hide()
195 | self.sub = sub
196 |
197 | frame:SetScript("OnEnter", ItemBase.Frame_OnEnter)
198 | frame:SetScript("OnLeave", ItemBase.Frame_OnLeave)
199 |
200 | self.OnAcquire = ItemBase.OnAcquire
201 | self.OnRelease = ItemBase.OnRelease
202 |
203 | self.SetPullout = ItemBase.SetPullout
204 | self.GetText = ItemBase.GetText
205 | self.SetText = ItemBase.SetText
206 | self.SetDisabled = ItemBase.SetDisabled
207 |
208 | self.SetPoint = ItemBase.SetPoint
209 | self.Show = ItemBase.Show
210 | self.Hide = ItemBase.Hide
211 |
212 | self.SetOnLeave = ItemBase.SetOnLeave
213 | self.SetOnEnter = ItemBase.SetOnEnter
214 |
215 | return self
216 | end
217 |
218 | -- Register a dummy LibStub library to retrieve the ItemBase, so other addons can use it.
219 | local IBLib = LibStub:NewLibrary("AceGUI-3.0-DropDown-ItemBase", ItemBase.version)
220 | if IBLib then
221 | IBLib.GetItemBase = function() return ItemBase end
222 | end
223 |
224 | --[[
225 | Template for items:
226 |
227 | -- Item:
228 | --
229 | do
230 | local widgetType = "Dropdown-Item-"
231 | local widgetVersion = 1
232 |
233 | local function Constructor()
234 | local self = ItemBase.Create(widgetType)
235 |
236 | AceGUI:RegisterAsWidget(self)
237 | return self
238 | end
239 |
240 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
241 | end
242 | --]]
243 |
244 | -- Item: Header
245 | -- A single text entry.
246 | -- Special: Different text color and no highlight
247 | do
248 | local widgetType = "Dropdown-Item-Header"
249 | local widgetVersion = 1
250 |
251 | local function OnEnter(this)
252 | local self = this.obj
253 | self:Fire("OnEnter")
254 |
255 | if self.specialOnEnter then
256 | self.specialOnEnter(self)
257 | end
258 | end
259 |
260 | local function OnLeave(this)
261 | local self = this.obj
262 | self:Fire("OnLeave")
263 |
264 | if self.specialOnLeave then
265 | self.specialOnLeave(self)
266 | end
267 | end
268 |
269 | -- exported, override
270 | local function SetDisabled(self, disabled)
271 | ItemBase.SetDisabled(self, disabled)
272 | if not disabled then
273 | self.text:SetTextColor(1, 1, 0)
274 | end
275 | end
276 |
277 | local function Constructor()
278 | local self = ItemBase.Create(widgetType)
279 |
280 | self.SetDisabled = SetDisabled
281 |
282 | self.frame:SetScript("OnEnter", OnEnter)
283 | self.frame:SetScript("OnLeave", OnLeave)
284 |
285 | self.text:SetTextColor(1, 1, 0)
286 |
287 | AceGUI:RegisterAsWidget(self)
288 | return self
289 | end
290 |
291 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
292 | end
293 |
294 | -- Item: Execute
295 | -- A simple button
296 | do
297 | local widgetType = "Dropdown-Item-Execute"
298 | local widgetVersion = 1
299 |
300 | local function Frame_OnClick(this, button)
301 | local self = this.obj
302 | if self.disabled then return end
303 | self:Fire("OnClick")
304 | if self.pullout then
305 | self.pullout:Close()
306 | end
307 | end
308 |
309 | local function Constructor()
310 | local self = ItemBase.Create(widgetType)
311 |
312 | self.frame:SetScript("OnClick", Frame_OnClick)
313 |
314 | AceGUI:RegisterAsWidget(self)
315 | return self
316 | end
317 |
318 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
319 | end
320 |
321 | -- Item: Toggle
322 | -- Some sort of checkbox for dropdown menus.
323 | -- Does not close the pullout on click.
324 | do
325 | local widgetType = "Dropdown-Item-Toggle"
326 | local widgetVersion = 3
327 |
328 | local function UpdateToggle(self)
329 | if self.value then
330 | self.check:Show()
331 | else
332 | self.check:Hide()
333 | end
334 | end
335 |
336 | local function OnRelease(self)
337 | ItemBase.OnRelease(self)
338 | self:SetValue(nil)
339 | end
340 |
341 | local function Frame_OnClick(this, button)
342 | local self = this.obj
343 | if self.disabled then return end
344 | self.value = not self.value
345 | if self.value then
346 | PlaySound("igMainMenuOptionCheckBoxOn")
347 | else
348 | PlaySound("igMainMenuOptionCheckBoxOff")
349 | end
350 | UpdateToggle(self)
351 | self:Fire("OnValueChanged", self.value)
352 | end
353 |
354 | -- exported
355 | local function SetValue(self, value)
356 | self.value = value
357 | UpdateToggle(self)
358 | end
359 |
360 | -- exported
361 | local function GetValue(self)
362 | return self.value
363 | end
364 |
365 | local function Constructor()
366 | local self = ItemBase.Create(widgetType)
367 |
368 | self.frame:SetScript("OnClick", Frame_OnClick)
369 |
370 | self.SetValue = SetValue
371 | self.GetValue = GetValue
372 | self.OnRelease = OnRelease
373 |
374 | AceGUI:RegisterAsWidget(self)
375 | return self
376 | end
377 |
378 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
379 | end
380 |
381 | -- Item: Menu
382 | -- Shows a submenu on mouse over
383 | -- Does not close the pullout on click
384 | do
385 | local widgetType = "Dropdown-Item-Menu"
386 | local widgetVersion = 2
387 |
388 | local function OnEnter(this)
389 | local self = this.obj
390 | self:Fire("OnEnter")
391 |
392 | if self.specialOnEnter then
393 | self.specialOnEnter(self)
394 | end
395 |
396 | self.highlight:Show()
397 |
398 | if not self.disabled and self.submenu then
399 | self.submenu:Open("TOPLEFT", self.frame, "TOPRIGHT", self.pullout:GetRightBorderWidth(), 0, self.frame:GetFrameLevel() + 100)
400 | end
401 | end
402 |
403 | local function OnHide(this)
404 | local self = this.obj
405 | if self.submenu then
406 | self.submenu:Close()
407 | end
408 | end
409 |
410 | -- exported
411 | local function SetMenu(self, menu)
412 | assert(menu.type == "Dropdown-Pullout")
413 | self.submenu = menu
414 | end
415 |
416 | -- exported
417 | local function CloseMenu(self)
418 | self.submenu:Close()
419 | end
420 |
421 | local function Constructor()
422 | local self = ItemBase.Create(widgetType)
423 |
424 | self.sub:Show()
425 |
426 | self.frame:SetScript("OnEnter", OnEnter)
427 | self.frame:SetScript("OnHide", OnHide)
428 |
429 | self.SetMenu = SetMenu
430 | self.CloseMenu = CloseMenu
431 |
432 | AceGUI:RegisterAsWidget(self)
433 | return self
434 | end
435 |
436 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
437 | end
438 |
439 | -- Item: Separator
440 | -- A single line to separate items
441 | do
442 | local widgetType = "Dropdown-Item-Separator"
443 | local widgetVersion = 1
444 |
445 | -- exported, override
446 | local function SetDisabled(self, disabled)
447 | ItemBase.SetDisabled(self, disabled)
448 | self.useHighlight = false
449 | end
450 |
451 | local function Constructor()
452 | local self = ItemBase.Create(widgetType)
453 |
454 | self.SetDisabled = SetDisabled
455 |
456 | local line = self.frame:CreateTexture(nil, "OVERLAY")
457 | line:SetHeight(1)
458 | line:SetTexture(.5, .5, .5)
459 | line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
460 | line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
461 |
462 | self.text:Hide()
463 |
464 | self.useHighlight = false
465 |
466 | AceGUI:RegisterAsWidget(self)
467 | return self
468 | end
469 |
470 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
471 | end
472 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | EditBox Widget
3 | -------------------------------------------------------------------------------]]
4 | local Type, Version = "EditBox", 28
5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
7 |
8 | -- Lua APIs
9 | local tostring, pairs = tostring, pairs
10 |
11 | -- WoW APIs
12 | local PlaySound = PlaySound
13 | local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo
14 | local CreateFrame, UIParent = CreateFrame, UIParent
15 | local _G = _G
16 |
17 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
18 | -- List them here for Mikk's FindGlobals script
19 | -- GLOBALS: AceGUIEditBoxInsertLink, ChatFontNormal, OKAY
20 |
21 | --[[-----------------------------------------------------------------------------
22 | Support functions
23 | -------------------------------------------------------------------------------]]
24 | if not AceGUIEditBoxInsertLink then
25 | -- upgradeable hook
26 | hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
27 | end
28 |
29 | function _G.AceGUIEditBoxInsertLink(text)
30 | for i = 1, AceGUI:GetWidgetCount(Type) do
31 | local editbox = _G["AceGUI-3.0EditBox"..i]
32 | if editbox and editbox:IsVisible() and editbox:HasFocus() then
33 | editbox:Insert(text)
34 | return true
35 | end
36 | end
37 | end
38 |
39 | local function ShowButton(self)
40 | if not self.disablebutton then
41 | self.button:Show()
42 | self.editbox:SetTextInsets(0, 20, 3, 3)
43 | end
44 | end
45 |
46 | local function HideButton(self)
47 | self.button:Hide()
48 | self.editbox:SetTextInsets(0, 0, 3, 3)
49 | end
50 |
51 | --[[-----------------------------------------------------------------------------
52 | Scripts
53 | -------------------------------------------------------------------------------]]
54 | local function Control_OnEnter(frame)
55 | frame.obj:Fire("OnEnter")
56 | end
57 |
58 | local function Control_OnLeave(frame)
59 | frame.obj:Fire("OnLeave")
60 | end
61 |
62 | local function Frame_OnShowFocus(frame)
63 | frame.obj.editbox:SetFocus()
64 | frame:SetScript("OnShow", nil)
65 | end
66 |
67 | local function EditBox_OnEscapePressed(frame)
68 | AceGUI:ClearFocus()
69 | end
70 |
71 | local function EditBox_OnEnterPressed(frame)
72 | local self = frame.obj
73 | local value = frame:GetText()
74 | local cancel = self:Fire("OnEnterPressed", value)
75 | if not cancel then
76 | PlaySound("igMainMenuOptionCheckBoxOn")
77 | HideButton(self)
78 | end
79 | end
80 |
81 | local function EditBox_OnReceiveDrag(frame)
82 | local self = frame.obj
83 | local type, id, info = GetCursorInfo()
84 | local name
85 | if type == "item" then
86 | name = info
87 | elseif type == "spell" then
88 | name = GetSpellInfo(id, info)
89 | elseif type == "macro" then
90 | name = GetMacroInfo(id)
91 | end
92 | if name then
93 | self:SetText(name)
94 | self:Fire("OnEnterPressed", name)
95 | ClearCursor()
96 | HideButton(self)
97 | AceGUI:ClearFocus()
98 | end
99 | end
100 |
101 | local function EditBox_OnTextChanged(frame)
102 | local self = frame.obj
103 | local value = frame:GetText()
104 | if tostring(value) ~= tostring(self.lasttext) then
105 | self:Fire("OnTextChanged", value)
106 | self.lasttext = value
107 | ShowButton(self)
108 | end
109 | end
110 |
111 | local function EditBox_OnFocusGained(frame)
112 | AceGUI:SetFocus(frame.obj)
113 | end
114 |
115 | local function Button_OnClick(frame)
116 | local editbox = frame.obj.editbox
117 | editbox:ClearFocus()
118 | EditBox_OnEnterPressed(editbox)
119 | end
120 |
121 | --[[-----------------------------------------------------------------------------
122 | Methods
123 | -------------------------------------------------------------------------------]]
124 | local methods = {
125 | ["OnAcquire"] = function(self)
126 | -- height is controlled by SetLabel
127 | self:SetWidth(200)
128 | self:SetDisabled(false)
129 | self:SetLabel()
130 | self:SetText()
131 | self:DisableButton(false)
132 | self:SetMaxLetters(0)
133 | end,
134 |
135 | ["OnRelease"] = function(self)
136 | self:ClearFocus()
137 | end,
138 |
139 | ["SetDisabled"] = function(self, disabled)
140 | self.disabled = disabled
141 | if disabled then
142 | self.editbox:EnableMouse(false)
143 | self.editbox:ClearFocus()
144 | self.editbox:SetTextColor(0.5,0.5,0.5)
145 | self.label:SetTextColor(0.5,0.5,0.5)
146 | else
147 | self.editbox:EnableMouse(true)
148 | self.editbox:SetTextColor(1,1,1)
149 | self.label:SetTextColor(1,.82,0)
150 | end
151 | end,
152 |
153 | ["SetText"] = function(self, text)
154 | self.lasttext = text or ""
155 | self.editbox:SetText(text or "")
156 | self.editbox:SetCursorPosition(0)
157 | HideButton(self)
158 | end,
159 |
160 | ["GetText"] = function(self, text)
161 | return self.editbox:GetText()
162 | end,
163 |
164 | ["SetLabel"] = function(self, text)
165 | if text and text ~= "" then
166 | self.label:SetText(text)
167 | self.label:Show()
168 | self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,-18)
169 | self:SetHeight(44)
170 | self.alignoffset = 30
171 | else
172 | self.label:SetText("")
173 | self.label:Hide()
174 | self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,0)
175 | self:SetHeight(26)
176 | self.alignoffset = 12
177 | end
178 | end,
179 |
180 | ["DisableButton"] = function(self, disabled)
181 | self.disablebutton = disabled
182 | if disabled then
183 | HideButton(self)
184 | end
185 | end,
186 |
187 | ["SetMaxLetters"] = function (self, num)
188 | self.editbox:SetMaxLetters(num or 0)
189 | end,
190 |
191 | ["ClearFocus"] = function(self)
192 | self.editbox:ClearFocus()
193 | self.frame:SetScript("OnShow", nil)
194 | end,
195 |
196 | ["SetFocus"] = function(self)
197 | self.editbox:SetFocus()
198 | if not self.frame:IsShown() then
199 | self.frame:SetScript("OnShow", Frame_OnShowFocus)
200 | end
201 | end,
202 |
203 | ["HighlightText"] = function(self, from, to)
204 | self.editbox:HighlightText(from, to)
205 | end
206 | }
207 |
208 | --[[-----------------------------------------------------------------------------
209 | Constructor
210 | -------------------------------------------------------------------------------]]
211 | local function Constructor()
212 | local num = AceGUI:GetNextWidgetNum(Type)
213 | local frame = CreateFrame("Frame", nil, UIParent)
214 | frame:Hide()
215 |
216 | local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "InputBoxTemplate")
217 | editbox:SetAutoFocus(false)
218 | editbox:SetFontObject(ChatFontNormal)
219 | editbox:SetScript("OnEnter", Control_OnEnter)
220 | editbox:SetScript("OnLeave", Control_OnLeave)
221 | editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed)
222 | editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed)
223 | editbox:SetScript("OnTextChanged", EditBox_OnTextChanged)
224 | editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag)
225 | editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag)
226 | editbox:SetScript("OnEditFocusGained", EditBox_OnFocusGained)
227 | editbox:SetTextInsets(0, 0, 3, 3)
228 | editbox:SetMaxLetters(256)
229 | editbox:SetPoint("BOTTOMLEFT", 6, 0)
230 | editbox:SetPoint("BOTTOMRIGHT")
231 | editbox:SetHeight(19)
232 |
233 | local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
234 | label:SetPoint("TOPLEFT", 0, -2)
235 | label:SetPoint("TOPRIGHT", 0, -2)
236 | label:SetJustifyH("LEFT")
237 | label:SetHeight(18)
238 |
239 | local button = CreateFrame("Button", nil, editbox, "UIPanelButtonTemplate")
240 | button:SetWidth(40)
241 | button:SetHeight(20)
242 | button:SetPoint("RIGHT", -2, 0)
243 | button:SetText(OKAY)
244 | button:SetScript("OnClick", Button_OnClick)
245 | button:Hide()
246 |
247 | local widget = {
248 | alignoffset = 30,
249 | editbox = editbox,
250 | label = label,
251 | button = button,
252 | frame = frame,
253 | type = Type
254 | }
255 | for method, func in pairs(methods) do
256 | widget[method] = func
257 | end
258 | editbox.obj, button.obj = widget, widget
259 |
260 | return AceGUI:RegisterAsWidget(widget)
261 | end
262 |
263 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
264 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-Heading.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | Heading Widget
3 | -------------------------------------------------------------------------------]]
4 | local Type, Version = "Heading", 20
5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
7 |
8 | -- Lua APIs
9 | local pairs = pairs
10 |
11 | -- WoW APIs
12 | local CreateFrame, UIParent = CreateFrame, UIParent
13 |
14 | --[[-----------------------------------------------------------------------------
15 | Methods
16 | -------------------------------------------------------------------------------]]
17 | local methods = {
18 | ["OnAcquire"] = function(self)
19 | self:SetText()
20 | self:SetFullWidth()
21 | self:SetHeight(18)
22 | end,
23 |
24 | -- ["OnRelease"] = nil,
25 |
26 | ["SetText"] = function(self, text)
27 | self.label:SetText(text or "")
28 | if text and text ~= "" then
29 | self.left:SetPoint("RIGHT", self.label, "LEFT", -5, 0)
30 | self.right:Show()
31 | else
32 | self.left:SetPoint("RIGHT", -3, 0)
33 | self.right:Hide()
34 | end
35 | end
36 | }
37 |
38 | --[[-----------------------------------------------------------------------------
39 | Constructor
40 | -------------------------------------------------------------------------------]]
41 | local function Constructor()
42 | local frame = CreateFrame("Frame", nil, UIParent)
43 | frame:Hide()
44 |
45 | local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
46 | label:SetPoint("TOP")
47 | label:SetPoint("BOTTOM")
48 | label:SetJustifyH("CENTER")
49 |
50 | local left = frame:CreateTexture(nil, "BACKGROUND")
51 | left:SetHeight(8)
52 | left:SetPoint("LEFT", 3, 0)
53 | left:SetPoint("RIGHT", label, "LEFT", -5, 0)
54 | left:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
55 | left:SetTexCoord(0.81, 0.94, 0.5, 1)
56 |
57 | local right = frame:CreateTexture(nil, "BACKGROUND")
58 | right:SetHeight(8)
59 | right:SetPoint("RIGHT", -3, 0)
60 | right:SetPoint("LEFT", label, "RIGHT", 5, 0)
61 | right:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
62 | right:SetTexCoord(0.81, 0.94, 0.5, 1)
63 |
64 | local widget = {
65 | label = label,
66 | left = left,
67 | right = right,
68 | frame = frame,
69 | type = Type
70 | }
71 | for method, func in pairs(methods) do
72 | widget[method] = func
73 | end
74 |
75 | return AceGUI:RegisterAsWidget(widget)
76 | end
77 |
78 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
79 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | Icon Widget
3 | -------------------------------------------------------------------------------]]
4 | local Type, Version = "Icon", 21
5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
7 |
8 | -- Lua APIs
9 | local select, pairs, print = select, pairs, print
10 |
11 | -- WoW APIs
12 | local CreateFrame, UIParent = CreateFrame, UIParent
13 |
14 | --[[-----------------------------------------------------------------------------
15 | Scripts
16 | -------------------------------------------------------------------------------]]
17 | local function Control_OnEnter(frame)
18 | frame.obj:Fire("OnEnter")
19 | end
20 |
21 | local function Control_OnLeave(frame)
22 | frame.obj:Fire("OnLeave")
23 | end
24 |
25 | local function Button_OnClick(frame, button)
26 | frame.obj:Fire("OnClick", button)
27 | AceGUI:ClearFocus()
28 | end
29 |
30 | --[[-----------------------------------------------------------------------------
31 | Methods
32 | -------------------------------------------------------------------------------]]
33 | local methods = {
34 | ["OnAcquire"] = function(self)
35 | self:SetHeight(110)
36 | self:SetWidth(110)
37 | self:SetLabel()
38 | self:SetImage(nil)
39 | self:SetImageSize(64, 64)
40 | self:SetDisabled(false)
41 | end,
42 |
43 | -- ["OnRelease"] = nil,
44 |
45 | ["SetLabel"] = function(self, text)
46 | if text and text ~= "" then
47 | self.label:Show()
48 | self.label:SetText(text)
49 | self:SetHeight(self.image:GetHeight() + 25)
50 | else
51 | self.label:Hide()
52 | self:SetHeight(self.image:GetHeight() + 10)
53 | end
54 | end,
55 |
56 | ["SetImage"] = function(self, path, ...)
57 | local image = self.image
58 | image:SetTexture(path)
59 |
60 | if image:GetTexture() then
61 | local n = select("#", ...)
62 | if n == 4 or n == 8 then
63 | image:SetTexCoord(...)
64 | else
65 | image:SetTexCoord(0, 1, 0, 1)
66 | end
67 | end
68 | end,
69 |
70 | ["SetImageSize"] = function(self, width, height)
71 | self.image:SetWidth(width)
72 | self.image:SetHeight(height)
73 | --self.frame:SetWidth(width + 30)
74 | if self.label:IsShown() then
75 | self:SetHeight(height + 25)
76 | else
77 | self:SetHeight(height + 10)
78 | end
79 | end,
80 |
81 | ["SetDisabled"] = function(self, disabled)
82 | self.disabled = disabled
83 | if disabled then
84 | self.frame:Disable()
85 | self.label:SetTextColor(0.5, 0.5, 0.5)
86 | self.image:SetVertexColor(0.5, 0.5, 0.5, 0.5)
87 | else
88 | self.frame:Enable()
89 | self.label:SetTextColor(1, 1, 1)
90 | self.image:SetVertexColor(1, 1, 1, 1)
91 | end
92 | end
93 | }
94 |
95 | --[[-----------------------------------------------------------------------------
96 | Constructor
97 | -------------------------------------------------------------------------------]]
98 | local function Constructor()
99 | local frame = CreateFrame("Button", nil, UIParent)
100 | frame:Hide()
101 |
102 | frame:EnableMouse(true)
103 | frame:SetScript("OnEnter", Control_OnEnter)
104 | frame:SetScript("OnLeave", Control_OnLeave)
105 | frame:SetScript("OnClick", Button_OnClick)
106 |
107 | local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight")
108 | label:SetPoint("BOTTOMLEFT")
109 | label:SetPoint("BOTTOMRIGHT")
110 | label:SetJustifyH("CENTER")
111 | label:SetJustifyV("TOP")
112 | label:SetHeight(18)
113 |
114 | local image = frame:CreateTexture(nil, "BACKGROUND")
115 | image:SetWidth(64)
116 | image:SetHeight(64)
117 | image:SetPoint("TOP", 0, -5)
118 |
119 | local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
120 | highlight:SetAllPoints(image)
121 | highlight:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight")
122 | highlight:SetTexCoord(0, 1, 0.23, 0.77)
123 | highlight:SetBlendMode("ADD")
124 |
125 | local widget = {
126 | label = label,
127 | image = image,
128 | frame = frame,
129 | type = Type
130 | }
131 | for method, func in pairs(methods) do
132 | widget[method] = func
133 | end
134 |
135 | widget.SetText = widget.SetLabel
136 |
137 | return AceGUI:RegisterAsWidget(widget)
138 | end
139 |
140 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
141 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | InteractiveLabel Widget
3 | -------------------------------------------------------------------------------]]
4 | local Type, Version = "InteractiveLabel", 21
5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
7 |
8 | -- Lua APIs
9 | local select, pairs = select, pairs
10 |
11 | --[[-----------------------------------------------------------------------------
12 | Scripts
13 | -------------------------------------------------------------------------------]]
14 | local function Control_OnEnter(frame)
15 | frame.obj:Fire("OnEnter")
16 | end
17 |
18 | local function Control_OnLeave(frame)
19 | frame.obj:Fire("OnLeave")
20 | end
21 |
22 | local function Label_OnClick(frame, button)
23 | frame.obj:Fire("OnClick", button)
24 | AceGUI:ClearFocus()
25 | end
26 |
27 | --[[-----------------------------------------------------------------------------
28 | Methods
29 | -------------------------------------------------------------------------------]]
30 | local methods = {
31 | ["OnAcquire"] = function(self)
32 | self:LabelOnAcquire()
33 | self:SetHighlight()
34 | self:SetHighlightTexCoord()
35 | self:SetDisabled(false)
36 | end,
37 |
38 | -- ["OnRelease"] = nil,
39 |
40 | ["SetHighlight"] = function(self, ...)
41 | self.highlight:SetTexture(...)
42 | end,
43 |
44 | ["SetHighlightTexCoord"] = function(self, ...)
45 | local c = select("#", ...)
46 | if c == 4 or c == 8 then
47 | self.highlight:SetTexCoord(...)
48 | else
49 | self.highlight:SetTexCoord(0, 1, 0, 1)
50 | end
51 | end,
52 |
53 | ["SetDisabled"] = function(self,disabled)
54 | self.disabled = disabled
55 | if disabled then
56 | self.frame:EnableMouse(false)
57 | self.label:SetTextColor(0.5, 0.5, 0.5)
58 | else
59 | self.frame:EnableMouse(true)
60 | self.label:SetTextColor(1, 1, 1)
61 | end
62 | end
63 | }
64 |
65 | --[[-----------------------------------------------------------------------------
66 | Constructor
67 | -------------------------------------------------------------------------------]]
68 | local function Constructor()
69 | -- create a Label type that we will hijack
70 | local label = AceGUI:Create("Label")
71 |
72 | local frame = label.frame
73 | frame:EnableMouse(true)
74 | frame:SetScript("OnEnter", Control_OnEnter)
75 | frame:SetScript("OnLeave", Control_OnLeave)
76 | frame:SetScript("OnMouseDown", Label_OnClick)
77 |
78 | local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
79 | highlight:SetTexture(nil)
80 | highlight:SetAllPoints()
81 | highlight:SetBlendMode("ADD")
82 |
83 | label.highlight = highlight
84 | label.type = Type
85 | label.LabelOnAcquire = label.OnAcquire
86 | for method, func in pairs(methods) do
87 | label[method] = func
88 | end
89 |
90 | return label
91 | end
92 |
93 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
94 |
95 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | Keybinding Widget
3 | Set Keybindings in the Config UI.
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "Keybinding", 25
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local pairs = pairs
11 |
12 | -- WoW APIs
13 | local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
14 | local CreateFrame, UIParent = CreateFrame, UIParent
15 |
16 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
17 | -- List them here for Mikk's FindGlobals script
18 | -- GLOBALS: NOT_BOUND
19 |
20 | --[[-----------------------------------------------------------------------------
21 | Scripts
22 | -------------------------------------------------------------------------------]]
23 |
24 | local function Control_OnEnter(frame)
25 | frame.obj:Fire("OnEnter")
26 | end
27 |
28 | local function Control_OnLeave(frame)
29 | frame.obj:Fire("OnLeave")
30 | end
31 |
32 | local function Keybinding_OnClick(frame, button)
33 | if button == "LeftButton" or button == "RightButton" then
34 | local self = frame.obj
35 | if self.waitingForKey then
36 | frame:EnableKeyboard(false)
37 | frame:EnableMouseWheel(false)
38 | self.msgframe:Hide()
39 | frame:UnlockHighlight()
40 | self.waitingForKey = nil
41 | else
42 | frame:EnableKeyboard(true)
43 | frame:EnableMouseWheel(true)
44 | self.msgframe:Show()
45 | frame:LockHighlight()
46 | self.waitingForKey = true
47 | end
48 | end
49 | AceGUI:ClearFocus()
50 | end
51 |
52 | local ignoreKeys = {
53 | ["BUTTON1"] = true, ["BUTTON2"] = true,
54 | ["UNKNOWN"] = true,
55 | ["LSHIFT"] = true, ["LCTRL"] = true, ["LALT"] = true,
56 | ["RSHIFT"] = true, ["RCTRL"] = true, ["RALT"] = true,
57 | }
58 | local function Keybinding_OnKeyDown(frame, key)
59 | local self = frame.obj
60 | if self.waitingForKey then
61 | local keyPressed = key
62 | if keyPressed == "ESCAPE" then
63 | keyPressed = ""
64 | else
65 | if ignoreKeys[keyPressed] then return end
66 | if IsShiftKeyDown() then
67 | keyPressed = "SHIFT-"..keyPressed
68 | end
69 | if IsControlKeyDown() then
70 | keyPressed = "CTRL-"..keyPressed
71 | end
72 | if IsAltKeyDown() then
73 | keyPressed = "ALT-"..keyPressed
74 | end
75 | end
76 |
77 | frame:EnableKeyboard(false)
78 | frame:EnableMouseWheel(false)
79 | self.msgframe:Hide()
80 | frame:UnlockHighlight()
81 | self.waitingForKey = nil
82 |
83 | if not self.disabled then
84 | self:SetKey(keyPressed)
85 | self:Fire("OnKeyChanged", keyPressed)
86 | end
87 | end
88 | end
89 |
90 | local function Keybinding_OnMouseDown(frame, button)
91 | if button == "LeftButton" or button == "RightButton" then
92 | return
93 | elseif button == "MiddleButton" then
94 | button = "BUTTON3"
95 | elseif button == "Button4" then
96 | button = "BUTTON4"
97 | elseif button == "Button5" then
98 | button = "BUTTON5"
99 | end
100 | Keybinding_OnKeyDown(frame, button)
101 | end
102 |
103 | local function Keybinding_OnMouseWheel(frame, direction)
104 | local button
105 | if direction >= 0 then
106 | button = "MOUSEWHEELUP"
107 | else
108 | button = "MOUSEWHEELDOWN"
109 | end
110 | Keybinding_OnKeyDown(frame, button)
111 | end
112 |
113 | --[[-----------------------------------------------------------------------------
114 | Methods
115 | -------------------------------------------------------------------------------]]
116 | local methods = {
117 | ["OnAcquire"] = function(self)
118 | self:SetWidth(200)
119 | self:SetLabel("")
120 | self:SetKey("")
121 | self.waitingForKey = nil
122 | self.msgframe:Hide()
123 | self:SetDisabled(false)
124 | self.button:EnableKeyboard(false)
125 | self.button:EnableMouseWheel(false)
126 | end,
127 |
128 | -- ["OnRelease"] = nil,
129 |
130 | ["SetDisabled"] = function(self, disabled)
131 | self.disabled = disabled
132 | if disabled then
133 | self.button:Disable()
134 | self.label:SetTextColor(0.5,0.5,0.5)
135 | else
136 | self.button:Enable()
137 | self.label:SetTextColor(1,1,1)
138 | end
139 | end,
140 |
141 | ["SetKey"] = function(self, key)
142 | if (key or "") == "" then
143 | self.button:SetText(NOT_BOUND)
144 | self.button:SetNormalFontObject("GameFontNormal")
145 | else
146 | self.button:SetText(key)
147 | self.button:SetNormalFontObject("GameFontHighlight")
148 | end
149 | end,
150 |
151 | ["GetKey"] = function(self)
152 | local key = self.button:GetText()
153 | if key == NOT_BOUND then
154 | key = nil
155 | end
156 | return key
157 | end,
158 |
159 | ["SetLabel"] = function(self, label)
160 | self.label:SetText(label or "")
161 | if (label or "") == "" then
162 | self.alignoffset = nil
163 | self:SetHeight(24)
164 | else
165 | self.alignoffset = 30
166 | self:SetHeight(44)
167 | end
168 | end,
169 | }
170 |
171 | --[[-----------------------------------------------------------------------------
172 | Constructor
173 | -------------------------------------------------------------------------------]]
174 |
175 | local ControlBackdrop = {
176 | bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
177 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
178 | tile = true, tileSize = 16, edgeSize = 16,
179 | insets = { left = 3, right = 3, top = 3, bottom = 3 }
180 | }
181 |
182 | local function keybindingMsgFixWidth(frame)
183 | frame:SetWidth(frame.msg:GetWidth() + 10)
184 | frame:SetScript("OnUpdate", nil)
185 | end
186 |
187 | local function Constructor()
188 | local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
189 |
190 | local frame = CreateFrame("Frame", nil, UIParent)
191 | local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate2")
192 |
193 | button:EnableMouse(true)
194 | button:EnableMouseWheel(false)
195 | button:RegisterForClicks("AnyDown")
196 | button:SetScript("OnEnter", Control_OnEnter)
197 | button:SetScript("OnLeave", Control_OnLeave)
198 | button:SetScript("OnClick", Keybinding_OnClick)
199 | button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
200 | button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
201 | button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
202 | button:SetPoint("BOTTOMLEFT")
203 | button:SetPoint("BOTTOMRIGHT")
204 | button:SetHeight(24)
205 | button:EnableKeyboard(false)
206 |
207 | local text = button:GetFontString()
208 | text:SetPoint("LEFT", 7, 0)
209 | text:SetPoint("RIGHT", -7, 0)
210 |
211 | local label = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
212 | label:SetPoint("TOPLEFT")
213 | label:SetPoint("TOPRIGHT")
214 | label:SetJustifyH("CENTER")
215 | label:SetHeight(18)
216 |
217 | local msgframe = CreateFrame("Frame", nil, UIParent)
218 | msgframe:SetHeight(30)
219 | msgframe:SetBackdrop(ControlBackdrop)
220 | msgframe:SetBackdropColor(0,0,0)
221 | msgframe:SetFrameStrata("FULLSCREEN_DIALOG")
222 | msgframe:SetFrameLevel(1000)
223 | msgframe:SetToplevel(true)
224 |
225 | local msg = msgframe:CreateFontString(nil, "OVERLAY", "GameFontNormal")
226 | msg:SetText("Press a key to bind, ESC to clear the binding or click the button again to cancel.")
227 | msgframe.msg = msg
228 | msg:SetPoint("TOPLEFT", 5, -5)
229 | msgframe:SetScript("OnUpdate", keybindingMsgFixWidth)
230 | msgframe:SetPoint("BOTTOM", button, "TOP")
231 | msgframe:Hide()
232 |
233 | local widget = {
234 | button = button,
235 | label = label,
236 | msgframe = msgframe,
237 | frame = frame,
238 | alignoffset = 30,
239 | type = Type
240 | }
241 | for method, func in pairs(methods) do
242 | widget[method] = func
243 | end
244 | button.obj = widget
245 |
246 | return AceGUI:RegisterAsWidget(widget)
247 | end
248 |
249 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
250 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | Label Widget
3 | Displays text and optionally an icon.
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "Label", 26
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local max, select, pairs = math.max, select, pairs
11 |
12 | -- WoW APIs
13 | local CreateFrame, UIParent = CreateFrame, UIParent
14 |
15 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
16 | -- List them here for Mikk's FindGlobals script
17 | -- GLOBALS: GameFontHighlightSmall
18 |
19 | --[[-----------------------------------------------------------------------------
20 | Support functions
21 | -------------------------------------------------------------------------------]]
22 |
23 | local function UpdateImageAnchor(self)
24 | if self.resizing then return end
25 | local frame = self.frame
26 | local width = frame.width or frame:GetWidth() or 0
27 | local image = self.image
28 | local label = self.label
29 | local height
30 |
31 | label:ClearAllPoints()
32 | image:ClearAllPoints()
33 |
34 | if self.imageshown then
35 | local imagewidth = image:GetWidth()
36 | if (width - imagewidth) < 200 or (label:GetText() or "") == "" then
37 | -- image goes on top centered when less than 200 width for the text, or if there is no text
38 | image:SetPoint("TOP")
39 | label:SetPoint("TOP", image, "BOTTOM")
40 | label:SetPoint("LEFT")
41 | label:SetWidth(width)
42 | height = image:GetHeight() + label:GetStringHeight()
43 | else
44 | -- image on the left
45 | image:SetPoint("TOPLEFT")
46 | if image:GetHeight() > label:GetStringHeight() then
47 | label:SetPoint("LEFT", image, "RIGHT", 4, 0)
48 | else
49 | label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0)
50 | end
51 | label:SetWidth(width - imagewidth - 4)
52 | height = max(image:GetHeight(), label:GetStringHeight())
53 | end
54 | else
55 | -- no image shown
56 | label:SetPoint("TOPLEFT")
57 | label:SetWidth(width)
58 | height = label:GetStringHeight()
59 | end
60 |
61 | -- avoid zero-height labels, since they can used as spacers
62 | if not height or height == 0 then
63 | height = 1
64 | end
65 |
66 | self.resizing = true
67 | frame:SetHeight(height)
68 | frame.height = height
69 | self.resizing = nil
70 | end
71 |
72 | --[[-----------------------------------------------------------------------------
73 | Methods
74 | -------------------------------------------------------------------------------]]
75 | local methods = {
76 | ["OnAcquire"] = function(self)
77 | -- set the flag to stop constant size updates
78 | self.resizing = true
79 | -- height is set dynamically by the text and image size
80 | self:SetWidth(200)
81 | self:SetText()
82 | self:SetImage(nil)
83 | self:SetImageSize(16, 16)
84 | self:SetColor()
85 | self:SetFontObject()
86 | self:SetJustifyH("LEFT")
87 | self:SetJustifyV("TOP")
88 |
89 | -- reset the flag
90 | self.resizing = nil
91 | -- run the update explicitly
92 | UpdateImageAnchor(self)
93 | end,
94 |
95 | -- ["OnRelease"] = nil,
96 |
97 | ["OnWidthSet"] = function(self, width)
98 | UpdateImageAnchor(self)
99 | end,
100 |
101 | ["SetText"] = function(self, text)
102 | self.label:SetText(text)
103 | UpdateImageAnchor(self)
104 | end,
105 |
106 | ["SetColor"] = function(self, r, g, b)
107 | if not (r and g and b) then
108 | r, g, b = 1, 1, 1
109 | end
110 | self.label:SetVertexColor(r, g, b)
111 | end,
112 |
113 | ["SetImage"] = function(self, path, ...)
114 | local image = self.image
115 | image:SetTexture(path)
116 |
117 | if image:GetTexture() then
118 | self.imageshown = true
119 | local n = select("#", ...)
120 | if n == 4 or n == 8 then
121 | image:SetTexCoord(...)
122 | else
123 | image:SetTexCoord(0, 1, 0, 1)
124 | end
125 | else
126 | self.imageshown = nil
127 | end
128 | UpdateImageAnchor(self)
129 | end,
130 |
131 | ["SetFont"] = function(self, font, height, flags)
132 | self.label:SetFont(font, height, flags)
133 | end,
134 |
135 | ["SetFontObject"] = function(self, font)
136 | self:SetFont((font or GameFontHighlightSmall):GetFont())
137 | end,
138 |
139 | ["SetImageSize"] = function(self, width, height)
140 | self.image:SetWidth(width)
141 | self.image:SetHeight(height)
142 | UpdateImageAnchor(self)
143 | end,
144 |
145 | ["SetJustifyH"] = function(self, justifyH)
146 | self.label:SetJustifyH(justifyH)
147 | end,
148 |
149 | ["SetJustifyV"] = function(self, justifyV)
150 | self.label:SetJustifyV(justifyV)
151 | end,
152 | }
153 |
154 | --[[-----------------------------------------------------------------------------
155 | Constructor
156 | -------------------------------------------------------------------------------]]
157 | local function Constructor()
158 | local frame = CreateFrame("Frame", nil, UIParent)
159 | frame:Hide()
160 |
161 | local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
162 | local image = frame:CreateTexture(nil, "BACKGROUND")
163 |
164 | -- create widget
165 | local widget = {
166 | label = label,
167 | image = image,
168 | frame = frame,
169 | type = Type
170 | }
171 | for method, func in pairs(methods) do
172 | widget[method] = func
173 | end
174 |
175 | return AceGUI:RegisterAsWidget(widget)
176 | end
177 |
178 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
179 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua:
--------------------------------------------------------------------------------
1 | local Type, Version = "MultiLineEditBox", 28
2 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
3 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
4 |
5 | -- Lua APIs
6 | local pairs = pairs
7 |
8 | -- WoW APIs
9 | local GetCursorInfo, GetSpellInfo, ClearCursor = GetCursorInfo, GetSpellInfo, ClearCursor
10 | local CreateFrame, UIParent = CreateFrame, UIParent
11 | local _G = _G
12 |
13 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
14 | -- List them here for Mikk's FindGlobals script
15 | -- GLOBALS: ACCEPT, ChatFontNormal
16 |
17 | --[[-----------------------------------------------------------------------------
18 | Support functions
19 | -------------------------------------------------------------------------------]]
20 |
21 | if not AceGUIMultiLineEditBoxInsertLink then
22 | -- upgradeable hook
23 | hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
24 | end
25 |
26 | function _G.AceGUIMultiLineEditBoxInsertLink(text)
27 | for i = 1, AceGUI:GetWidgetCount(Type) do
28 | local editbox = _G[("MultiLineEditBox%uEdit"):format(i)]
29 | if editbox and editbox:IsVisible() and editbox:HasFocus() then
30 | editbox:Insert(text)
31 | return true
32 | end
33 | end
34 | end
35 |
36 |
37 | local function Layout(self)
38 | self:SetHeight(self.numlines * 14 + (self.disablebutton and 19 or 41) + self.labelHeight)
39 |
40 | if self.labelHeight == 0 then
41 | self.scrollBar:SetPoint("TOP", self.frame, "TOP", 0, -23)
42 | else
43 | self.scrollBar:SetPoint("TOP", self.label, "BOTTOM", 0, -19)
44 | end
45 |
46 | if self.disablebutton then
47 | self.scrollBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 21)
48 | self.scrollBG:SetPoint("BOTTOMLEFT", 0, 4)
49 | else
50 | self.scrollBar:SetPoint("BOTTOM", self.button, "TOP", 0, 18)
51 | self.scrollBG:SetPoint("BOTTOMLEFT", self.button, "TOPLEFT")
52 | end
53 | end
54 |
55 | --[[-----------------------------------------------------------------------------
56 | Scripts
57 | -------------------------------------------------------------------------------]]
58 | local function OnClick(self) -- Button
59 | self = self.obj
60 | self.editBox:ClearFocus()
61 | if not self:Fire("OnEnterPressed", self.editBox:GetText()) then
62 | self.button:Disable()
63 | end
64 | end
65 |
66 | local function OnCursorChanged(self, _, y, _, cursorHeight) -- EditBox
67 | self, y = self.obj.scrollFrame, -y
68 | local offset = self:GetVerticalScroll()
69 | if y < offset then
70 | self:SetVerticalScroll(y)
71 | else
72 | y = y + cursorHeight - self:GetHeight()
73 | if y > offset then
74 | self:SetVerticalScroll(y)
75 | end
76 | end
77 | end
78 |
79 | local function OnEditFocusLost(self) -- EditBox
80 | self:HighlightText(0, 0)
81 | self.obj:Fire("OnEditFocusLost")
82 | end
83 |
84 | local function OnEnter(self) -- EditBox / ScrollFrame
85 | self = self.obj
86 | if not self.entered then
87 | self.entered = true
88 | self:Fire("OnEnter")
89 | end
90 | end
91 |
92 | local function OnLeave(self) -- EditBox / ScrollFrame
93 | self = self.obj
94 | if self.entered then
95 | self.entered = nil
96 | self:Fire("OnLeave")
97 | end
98 | end
99 |
100 | local function OnMouseUp(self) -- ScrollFrame
101 | self = self.obj.editBox
102 | self:SetFocus()
103 | self:SetCursorPosition(self:GetNumLetters())
104 | end
105 |
106 | local function OnReceiveDrag(self) -- EditBox / ScrollFrame
107 | local type, id, info = GetCursorInfo()
108 | if type == "spell" then
109 | info = GetSpellInfo(id, info)
110 | elseif type ~= "item" then
111 | return
112 | end
113 | ClearCursor()
114 | self = self.obj
115 | local editBox = self.editBox
116 | if not editBox:HasFocus() then
117 | editBox:SetFocus()
118 | editBox:SetCursorPosition(editBox:GetNumLetters())
119 | end
120 | editBox:Insert(info)
121 | self.button:Enable()
122 | end
123 |
124 | local function OnSizeChanged(self, width, height) -- ScrollFrame
125 | self.obj.editBox:SetWidth(width)
126 | end
127 |
128 | local function OnTextChanged(self, userInput) -- EditBox
129 | if userInput then
130 | self = self.obj
131 | self:Fire("OnTextChanged", self.editBox:GetText())
132 | self.button:Enable()
133 | end
134 | end
135 |
136 | local function OnTextSet(self) -- EditBox
137 | self:HighlightText(0, 0)
138 | self:SetCursorPosition(self:GetNumLetters())
139 | self:SetCursorPosition(0)
140 | self.obj.button:Disable()
141 | end
142 |
143 | local function OnVerticalScroll(self, offset) -- ScrollFrame
144 | local editBox = self.obj.editBox
145 | editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight())
146 | end
147 |
148 | local function OnShowFocus(frame)
149 | frame.obj.editBox:SetFocus()
150 | frame:SetScript("OnShow", nil)
151 | end
152 |
153 | local function OnEditFocusGained(frame)
154 | AceGUI:SetFocus(frame.obj)
155 | frame.obj:Fire("OnEditFocusGained")
156 | end
157 |
158 | --[[-----------------------------------------------------------------------------
159 | Methods
160 | -------------------------------------------------------------------------------]]
161 | local methods = {
162 | ["OnAcquire"] = function(self)
163 | self.editBox:SetText("")
164 | self:SetDisabled(false)
165 | self:SetWidth(200)
166 | self:DisableButton(false)
167 | self:SetNumLines()
168 | self.entered = nil
169 | self:SetMaxLetters(0)
170 | end,
171 |
172 | ["OnRelease"] = function(self)
173 | self:ClearFocus()
174 | end,
175 |
176 | ["SetDisabled"] = function(self, disabled)
177 | local editBox = self.editBox
178 | if disabled then
179 | editBox:ClearFocus()
180 | editBox:EnableMouse(false)
181 | editBox:SetTextColor(0.5, 0.5, 0.5)
182 | self.label:SetTextColor(0.5, 0.5, 0.5)
183 | self.scrollFrame:EnableMouse(false)
184 | self.button:Disable()
185 | else
186 | editBox:EnableMouse(true)
187 | editBox:SetTextColor(1, 1, 1)
188 | self.label:SetTextColor(1, 0.82, 0)
189 | self.scrollFrame:EnableMouse(true)
190 | end
191 | end,
192 |
193 | ["SetLabel"] = function(self, text)
194 | if text and text ~= "" then
195 | self.label:SetText(text)
196 | if self.labelHeight ~= 10 then
197 | self.labelHeight = 10
198 | self.label:Show()
199 | end
200 | elseif self.labelHeight ~= 0 then
201 | self.labelHeight = 0
202 | self.label:Hide()
203 | end
204 | Layout(self)
205 | end,
206 |
207 | ["SetNumLines"] = function(self, value)
208 | if not value or value < 4 then
209 | value = 4
210 | end
211 | self.numlines = value
212 | Layout(self)
213 | end,
214 |
215 | ["SetText"] = function(self, text)
216 | self.editBox:SetText(text)
217 | end,
218 |
219 | ["GetText"] = function(self)
220 | return self.editBox:GetText()
221 | end,
222 |
223 | ["SetMaxLetters"] = function (self, num)
224 | self.editBox:SetMaxLetters(num or 0)
225 | end,
226 |
227 | ["DisableButton"] = function(self, disabled)
228 | self.disablebutton = disabled
229 | if disabled then
230 | self.button:Hide()
231 | else
232 | self.button:Show()
233 | end
234 | Layout(self)
235 | end,
236 |
237 | ["ClearFocus"] = function(self)
238 | self.editBox:ClearFocus()
239 | self.frame:SetScript("OnShow", nil)
240 | end,
241 |
242 | ["SetFocus"] = function(self)
243 | self.editBox:SetFocus()
244 | if not self.frame:IsShown() then
245 | self.frame:SetScript("OnShow", OnShowFocus)
246 | end
247 | end,
248 |
249 | ["HighlightText"] = function(self, from, to)
250 | self.editBox:HighlightText(from, to)
251 | end,
252 |
253 | ["GetCursorPosition"] = function(self)
254 | return self.editBox:GetCursorPosition()
255 | end,
256 |
257 | ["SetCursorPosition"] = function(self, ...)
258 | return self.editBox:SetCursorPosition(...)
259 | end,
260 |
261 |
262 | }
263 |
264 | --[[-----------------------------------------------------------------------------
265 | Constructor
266 | -------------------------------------------------------------------------------]]
267 | local backdrop = {
268 | bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
269 | edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 16,
270 | insets = { left = 4, right = 3, top = 4, bottom = 3 }
271 | }
272 |
273 | local function Constructor()
274 | local frame = CreateFrame("Frame", nil, UIParent)
275 | frame:Hide()
276 |
277 | local widgetNum = AceGUI:GetNextWidgetNum(Type)
278 |
279 | local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
280 | label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4)
281 | label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -4)
282 | label:SetJustifyH("LEFT")
283 | label:SetText(ACCEPT)
284 | label:SetHeight(10)
285 |
286 | local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate2")
287 | button:SetPoint("BOTTOMLEFT", 0, 4)
288 | button:SetHeight(22)
289 | button:SetWidth(label:GetStringWidth() + 24)
290 | button:SetText(ACCEPT)
291 | button:SetScript("OnClick", OnClick)
292 | button:Disable()
293 |
294 | local text = button:GetFontString()
295 | text:ClearAllPoints()
296 | text:SetPoint("TOPLEFT", button, "TOPLEFT", 5, -5)
297 | text:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -5, 1)
298 | text:SetJustifyV("MIDDLE")
299 |
300 | local scrollBG = CreateFrame("Frame", nil, frame)
301 | scrollBG:SetBackdrop(backdrop)
302 | scrollBG:SetBackdropColor(0, 0, 0)
303 | scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
304 |
305 | local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate")
306 |
307 | local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"]
308 | scrollBar:ClearAllPoints()
309 | scrollBar:SetPoint("TOP", label, "BOTTOM", 0, -19)
310 | scrollBar:SetPoint("BOTTOM", button, "TOP", 0, 18)
311 | scrollBar:SetPoint("RIGHT", frame, "RIGHT")
312 |
313 | scrollBG:SetPoint("TOPRIGHT", scrollBar, "TOPLEFT", 0, 19)
314 | scrollBG:SetPoint("BOTTOMLEFT", button, "TOPLEFT")
315 |
316 | scrollFrame:SetPoint("TOPLEFT", scrollBG, "TOPLEFT", 5, -6)
317 | scrollFrame:SetPoint("BOTTOMRIGHT", scrollBG, "BOTTOMRIGHT", -4, 4)
318 | scrollFrame:SetScript("OnEnter", OnEnter)
319 | scrollFrame:SetScript("OnLeave", OnLeave)
320 | scrollFrame:SetScript("OnMouseUp", OnMouseUp)
321 | scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag)
322 | scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
323 | scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll)
324 |
325 | local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame)
326 | editBox:SetAllPoints()
327 | editBox:SetFontObject(ChatFontNormal)
328 | editBox:SetMultiLine(true)
329 | editBox:EnableMouse(true)
330 | editBox:SetAutoFocus(false)
331 | editBox:SetCountInvisibleLetters(false)
332 | editBox:SetScript("OnCursorChanged", OnCursorChanged)
333 | editBox:SetScript("OnEditFocusLost", OnEditFocusLost)
334 | editBox:SetScript("OnEnter", OnEnter)
335 | editBox:SetScript("OnEscapePressed", editBox.ClearFocus)
336 | editBox:SetScript("OnLeave", OnLeave)
337 | editBox:SetScript("OnMouseDown", OnReceiveDrag)
338 | editBox:SetScript("OnReceiveDrag", OnReceiveDrag)
339 | editBox:SetScript("OnTextChanged", OnTextChanged)
340 | editBox:SetScript("OnTextSet", OnTextSet)
341 | editBox:SetScript("OnEditFocusGained", OnEditFocusGained)
342 |
343 |
344 | scrollFrame:SetScrollChild(editBox)
345 |
346 | local widget = {
347 | button = button,
348 | editBox = editBox,
349 | frame = frame,
350 | label = label,
351 | labelHeight = 10,
352 | numlines = 4,
353 | scrollBar = scrollBar,
354 | scrollBG = scrollBG,
355 | scrollFrame = scrollFrame,
356 | type = Type
357 | }
358 | for method, func in pairs(methods) do
359 | widget[method] = func
360 | end
361 | button.obj, editBox.obj, scrollFrame.obj = widget, widget, widget
362 |
363 | return AceGUI:RegisterAsWidget(widget)
364 | end
365 |
366 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
367 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | Slider Widget
3 | Graphical Slider, like, for Range values.
4 | -------------------------------------------------------------------------------]]
5 | local Type, Version = "Slider", 20
6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 |
9 | -- Lua APIs
10 | local min, max, floor = math.min, math.max, math.floor
11 | local tonumber, pairs = tonumber, pairs
12 |
13 | -- WoW APIs
14 | local PlaySound = PlaySound
15 | local CreateFrame, UIParent = CreateFrame, UIParent
16 |
17 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
18 | -- List them here for Mikk's FindGlobals script
19 | -- GLOBALS: GameFontHighlightSmall
20 |
21 | --[[-----------------------------------------------------------------------------
22 | Support functions
23 | -------------------------------------------------------------------------------]]
24 | local function UpdateText(self)
25 | local value = self.value or 0
26 | if self.ispercent then
27 | self.editbox:SetText(("%s%%"):format(floor(value * 1000 + 0.5) / 10))
28 | else
29 | self.editbox:SetText(floor(value * 100 + 0.5) / 100)
30 | end
31 | end
32 |
33 | local function UpdateLabels(self)
34 | local min, max = (self.min or 0), (self.max or 100)
35 | if self.ispercent then
36 | self.lowtext:SetFormattedText("%s%%", (min * 100))
37 | self.hightext:SetFormattedText("%s%%", (max * 100))
38 | else
39 | self.lowtext:SetText(min)
40 | self.hightext:SetText(max)
41 | end
42 | end
43 |
44 | --[[-----------------------------------------------------------------------------
45 | Scripts
46 | -------------------------------------------------------------------------------]]
47 | local function Control_OnEnter(frame)
48 | frame.obj:Fire("OnEnter")
49 | end
50 |
51 | local function Control_OnLeave(frame)
52 | frame.obj:Fire("OnLeave")
53 | end
54 |
55 | local function Frame_OnMouseDown(frame)
56 | frame.obj.slider:EnableMouseWheel(true)
57 | AceGUI:ClearFocus()
58 | end
59 |
60 | local function Slider_OnValueChanged(frame, newvalue)
61 | local self = frame.obj
62 | if not frame.setup then
63 | if newvalue ~= self.value and not self.disabled then
64 | self.value = newvalue
65 | self:Fire("OnValueChanged", newvalue)
66 | end
67 | if self.value then
68 | UpdateText(self)
69 | end
70 | end
71 | end
72 |
73 | local function Slider_OnMouseUp(frame)
74 | local self = frame.obj
75 | self:Fire("OnMouseUp", self.value)
76 | end
77 |
78 | local function Slider_OnMouseWheel(frame, v)
79 | local self = frame.obj
80 | if not self.disabled then
81 | local value = self.value
82 | if v > 0 then
83 | value = min(value + (self.step or 1), self.max)
84 | else
85 | value = max(value - (self.step or 1), self.min)
86 | end
87 | self.slider:SetValue(value)
88 | end
89 | end
90 |
91 | local function EditBox_OnEscapePressed(frame)
92 | frame:ClearFocus()
93 | end
94 |
95 | local function EditBox_OnEnterPressed(frame)
96 | local self = frame.obj
97 | local value = frame:GetText()
98 | if self.ispercent then
99 | value = value:gsub('%%', '')
100 | value = tonumber(value) / 100
101 | else
102 | value = tonumber(value)
103 | end
104 |
105 | if value then
106 | PlaySound("igMainMenuOptionCheckBoxOn")
107 | self.slider:SetValue(value)
108 | self:Fire("OnMouseUp", value)
109 | end
110 | end
111 |
112 | local function EditBox_OnEnter(frame)
113 | frame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
114 | end
115 |
116 | local function EditBox_OnLeave(frame)
117 | frame:SetBackdropBorderColor(0.3, 0.3, 0.3, 0.8)
118 | end
119 |
120 | --[[-----------------------------------------------------------------------------
121 | Methods
122 | -------------------------------------------------------------------------------]]
123 | local methods = {
124 | ["OnAcquire"] = function(self)
125 | self:SetWidth(200)
126 | self:SetHeight(44)
127 | self:SetDisabled(false)
128 | self:SetIsPercent(nil)
129 | self:SetSliderValues(0,100,1)
130 | self:SetValue(0)
131 | self.slider:EnableMouseWheel(false)
132 | end,
133 |
134 | -- ["OnRelease"] = nil,
135 |
136 | ["SetDisabled"] = function(self, disabled)
137 | self.disabled = disabled
138 | if disabled then
139 | self.slider:EnableMouse(false)
140 | self.label:SetTextColor(.5, .5, .5)
141 | self.hightext:SetTextColor(.5, .5, .5)
142 | self.lowtext:SetTextColor(.5, .5, .5)
143 | --self.valuetext:SetTextColor(.5, .5, .5)
144 | self.editbox:SetTextColor(.5, .5, .5)
145 | self.editbox:EnableMouse(false)
146 | self.editbox:ClearFocus()
147 | else
148 | self.slider:EnableMouse(true)
149 | self.label:SetTextColor(1, .82, 0)
150 | self.hightext:SetTextColor(1, 1, 1)
151 | self.lowtext:SetTextColor(1, 1, 1)
152 | --self.valuetext:SetTextColor(1, 1, 1)
153 | self.editbox:SetTextColor(1, 1, 1)
154 | self.editbox:EnableMouse(true)
155 | end
156 | end,
157 |
158 | ["SetValue"] = function(self, value)
159 | self.slider.setup = true
160 | self.slider:SetValue(value)
161 | self.value = value
162 | UpdateText(self)
163 | self.slider.setup = nil
164 | end,
165 |
166 | ["GetValue"] = function(self)
167 | return self.value
168 | end,
169 |
170 | ["SetLabel"] = function(self, text)
171 | self.label:SetText(text)
172 | end,
173 |
174 | ["SetSliderValues"] = function(self, min, max, step)
175 | local frame = self.slider
176 | frame.setup = true
177 | self.min = min
178 | self.max = max
179 | self.step = step
180 | frame:SetMinMaxValues(min or 0,max or 100)
181 | UpdateLabels(self)
182 | frame:SetValueStep(step or 1)
183 | if self.value then
184 | frame:SetValue(self.value)
185 | end
186 | frame.setup = nil
187 | end,
188 |
189 | ["SetIsPercent"] = function(self, value)
190 | self.ispercent = value
191 | UpdateLabels(self)
192 | UpdateText(self)
193 | end
194 | }
195 |
196 | --[[-----------------------------------------------------------------------------
197 | Constructor
198 | -------------------------------------------------------------------------------]]
199 | local SliderBackdrop = {
200 | bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
201 | edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
202 | tile = true, tileSize = 8, edgeSize = 8,
203 | insets = { left = 3, right = 3, top = 6, bottom = 6 }
204 | }
205 |
206 | local ManualBackdrop = {
207 | bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
208 | edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
209 | tile = true, edgeSize = 1, tileSize = 5,
210 | }
211 |
212 | local function Constructor()
213 | local frame = CreateFrame("Frame", nil, UIParent)
214 |
215 | frame:EnableMouse(true)
216 | frame:SetScript("OnMouseDown", Frame_OnMouseDown)
217 |
218 | local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
219 | label:SetPoint("TOPLEFT")
220 | label:SetPoint("TOPRIGHT")
221 | label:SetJustifyH("CENTER")
222 | label:SetHeight(15)
223 |
224 | local slider = CreateFrame("Slider", nil, frame)
225 | slider:SetOrientation("HORIZONTAL")
226 | slider:SetHeight(15)
227 | slider:SetHitRectInsets(0, 0, -10, 0)
228 | slider:SetBackdrop(SliderBackdrop)
229 | slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal")
230 | slider:SetPoint("TOP", label, "BOTTOM")
231 | slider:SetPoint("LEFT", 3, 0)
232 | slider:SetPoint("RIGHT", -3, 0)
233 | slider:SetValue(0)
234 | slider:SetScript("OnValueChanged",Slider_OnValueChanged)
235 | slider:SetScript("OnEnter", Control_OnEnter)
236 | slider:SetScript("OnLeave", Control_OnLeave)
237 | slider:SetScript("OnMouseUp", Slider_OnMouseUp)
238 | slider:SetScript("OnMouseWheel", Slider_OnMouseWheel)
239 |
240 | local lowtext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
241 | lowtext:SetPoint("TOPLEFT", slider, "BOTTOMLEFT", 2, 3)
242 |
243 | local hightext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
244 | hightext:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", -2, 3)
245 |
246 | local editbox = CreateFrame("EditBox", nil, frame)
247 | editbox:SetAutoFocus(false)
248 | editbox:SetFontObject(GameFontHighlightSmall)
249 | editbox:SetPoint("TOP", slider, "BOTTOM")
250 | editbox:SetHeight(14)
251 | editbox:SetWidth(70)
252 | editbox:SetJustifyH("CENTER")
253 | editbox:EnableMouse(true)
254 | editbox:SetBackdrop(ManualBackdrop)
255 | editbox:SetBackdropColor(0, 0, 0, 0.5)
256 | editbox:SetBackdropBorderColor(0.3, 0.3, 0.30, 0.80)
257 | editbox:SetScript("OnEnter", EditBox_OnEnter)
258 | editbox:SetScript("OnLeave", EditBox_OnLeave)
259 | editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed)
260 | editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed)
261 |
262 | local widget = {
263 | label = label,
264 | slider = slider,
265 | lowtext = lowtext,
266 | hightext = hightext,
267 | editbox = editbox,
268 | alignoffset = 25,
269 | frame = frame,
270 | type = Type
271 | }
272 | for method, func in pairs(methods) do
273 | widget[method] = func
274 | end
275 | slider.obj, editbox.obj = widget, widget
276 |
277 | return AceGUI:RegisterAsWidget(widget)
278 | end
279 |
280 | AceGUI:RegisterWidgetType(Type,Constructor,Version)
281 |
--------------------------------------------------------------------------------
/RetailUI/Libs/AceHook-3.0/AceHook-3.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/RetailUI/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:
--------------------------------------------------------------------------------
1 | --[[ $Id: CallbackHandler-1.0.lua 14 2010-08-09 00:43:38Z mikk $ ]]
2 | local MAJOR, MINOR = "CallbackHandler-1.0", 6
3 | local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
4 |
5 | if not CallbackHandler then return end -- No upgrade needed
6 |
7 | local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
8 |
9 | -- Lua APIs
10 | local tconcat = table.concat
11 | local assert, error, loadstring = assert, error, loadstring
12 | local setmetatable, rawset, rawget = setmetatable, rawset, rawget
13 | local next, select, pairs, type, tostring = next, select, pairs, type, tostring
14 |
15 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
16 | -- List them here for Mikk's FindGlobals script
17 | -- GLOBALS: geterrorhandler
18 |
19 | local xpcall = xpcall
20 |
21 | local function errorhandler(err)
22 | return geterrorhandler()(err)
23 | end
24 |
25 | local function CreateDispatcher(argCount)
26 | local code =[[
27 | local next, xpcall, eh = ...
28 |
29 | local method, ARGS
30 | local function call() method(ARGS) end
31 |
32 | local function dispatch(handlers, ...)
33 | local index
34 | index, method = next(handlers)
35 | if not method then return end
36 | local OLD_ARGS = ARGS
37 | ARGS = ...
38 | repeat
39 | xpcall(call, eh)
40 | index, method = next(handlers, index)
41 | until not method
42 | ARGS = OLD_ARGS
43 | end
44 |
45 | return dispatch
46 | ]]
47 |
48 | local ARGS, OLD_ARGS = {}, {}
49 | for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end
50 | code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", "))
51 | return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
52 | end
53 |
54 | local Dispatchers = setmetatable({}, {__index=function(self, argCount)
55 | local dispatcher = CreateDispatcher(argCount)
56 | rawset(self, argCount, dispatcher)
57 | return dispatcher
58 | end})
59 |
60 | --------------------------------------------------------------------------
61 | -- CallbackHandler:New
62 | --
63 | -- target - target object to embed public APIs in
64 | -- RegisterName - name of the callback registration API, default "RegisterCallback"
65 | -- UnregisterName - name of the callback unregistration API, default "UnregisterCallback"
66 | -- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API.
67 |
68 | function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused)
69 | -- TODO: Remove this after beta has gone out
70 | assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused")
71 |
72 | RegisterName = RegisterName or "RegisterCallback"
73 | UnregisterName = UnregisterName or "UnregisterCallback"
74 | if UnregisterAllName==nil then -- false is used to indicate "don't want this method"
75 | UnregisterAllName = "UnregisterAllCallbacks"
76 | end
77 |
78 | -- we declare all objects and exported APIs inside this closure to quickly gain access
79 | -- to e.g. function names, the "target" parameter, etc
80 |
81 |
82 | -- Create the registry object
83 | local events = setmetatable({}, meta)
84 | local registry = { recurse=0, events=events }
85 |
86 | -- registry:Fire() - fires the given event/message into the registry
87 | function registry:Fire(eventname, ...)
88 | if not rawget(events, eventname) or not next(events[eventname]) then return end
89 | local oldrecurse = registry.recurse
90 | registry.recurse = oldrecurse + 1
91 |
92 | Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...)
93 |
94 | registry.recurse = oldrecurse
95 |
96 | if registry.insertQueue and oldrecurse==0 then
97 | -- Something in one of our callbacks wanted to register more callbacks; they got queued
98 | for eventname,callbacks in pairs(registry.insertQueue) do
99 | local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
100 | for self,func in pairs(callbacks) do
101 | events[eventname][self] = func
102 | -- fire OnUsed callback?
103 | if first and registry.OnUsed then
104 | registry.OnUsed(registry, target, eventname)
105 | first = nil
106 | end
107 | end
108 | end
109 | registry.insertQueue = nil
110 | end
111 | end
112 |
113 | -- Registration of a callback, handles:
114 | -- self["method"], leads to self["method"](self, ...)
115 | -- self with function ref, leads to functionref(...)
116 | -- "addonId"(instead of self) with function ref, leads to functionref(...)
117 | -- all with an optional arg, which, if present, gets passed as first argument(after self if present)
118 | target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]])
119 | if type(eventname) ~= "string" then
120 | error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2)
121 | end
122 |
123 | method = method or eventname
124 |
125 | local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
126 |
127 | if type(method) ~= "string" and type(method) ~= "function" then
128 | error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2)
129 | end
130 |
131 | local regfunc
132 |
133 | if type(method) == "string" then
134 | -- self["method"] calling style
135 | if type(self) ~= "table" then
136 | error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2)
137 | elseif self==target then
138 | error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2)
139 | elseif type(self[method]) ~= "function" then
140 | error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2)
141 | end
142 |
143 | if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
144 | local arg=select(1,...)
145 | regfunc = function(...) self[method](self,arg,...) end
146 | else
147 | regfunc = function(...) self[method](self,...) end
148 | end
149 | else
150 | -- function ref with self=object or self="addonId" or self=thread
151 | if type(self)~="table" and type(self)~="string" and type(self)~="thread" then
152 | error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2)
153 | end
154 |
155 | if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
156 | local arg=select(1,...)
157 | regfunc = function(...) method(arg,...) end
158 | else
159 | regfunc = method
160 | end
161 | end
162 |
163 |
164 | if events[eventname][self] or registry.recurse<1 then
165 | -- if registry.recurse<1 then
166 | -- we're overwriting an existing entry, or not currently recursing. just set it.
167 | events[eventname][self] = regfunc
168 | -- fire OnUsed callback?
169 | if registry.OnUsed and first then
170 | registry.OnUsed(registry, target, eventname)
171 | end
172 | else
173 | -- we're currently processing a callback in this registry, so delay the registration of this new entry!
174 | -- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency
175 | registry.insertQueue = registry.insertQueue or setmetatable({},meta)
176 | registry.insertQueue[eventname][self] = regfunc
177 | end
178 | end
179 |
180 | -- Unregister a callback
181 | target[UnregisterName] = function(self, eventname)
182 | if not self or self==target then
183 | error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2)
184 | end
185 | if type(eventname) ~= "string" then
186 | error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2)
187 | end
188 | if rawget(events, eventname) and events[eventname][self] then
189 | events[eventname][self] = nil
190 | -- Fire OnUnused callback?
191 | if registry.OnUnused and not next(events[eventname]) then
192 | registry.OnUnused(registry, target, eventname)
193 | end
194 | end
195 | if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then
196 | registry.insertQueue[eventname][self] = nil
197 | end
198 | end
199 |
200 | -- OPTIONAL: Unregister all callbacks for given selfs/addonIds
201 | if UnregisterAllName then
202 | target[UnregisterAllName] = function(...)
203 | if select("#",...)<1 then
204 | error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2)
205 | end
206 | if select("#",...)==1 and ...==target then
207 | error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2)
208 | end
209 |
210 |
211 | for i=1,select("#",...) do
212 | local self = select(i,...)
213 | if registry.insertQueue then
214 | for eventname, callbacks in pairs(registry.insertQueue) do
215 | if callbacks[self] then
216 | callbacks[self] = nil
217 | end
218 | end
219 | end
220 | for eventname, callbacks in pairs(events) do
221 | if callbacks[self] then
222 | callbacks[self] = nil
223 | -- Fire OnUnused callback?
224 | if registry.OnUnused and not next(callbacks) then
225 | registry.OnUnused(registry, target, eventname)
226 | end
227 | end
228 | end
229 | end
230 | end
231 | end
232 |
233 | return registry
234 | end
235 |
236 |
237 | -- CallbackHandler purposefully does NOT do explicit embedding. Nor does it
238 | -- try to upgrade old implicit embeds since the system is selfcontained and
239 | -- relies on closures to work.
240 |
241 |
--------------------------------------------------------------------------------
/RetailUI/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/RetailUI/Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Name: DBIcon-1.0
3 | Revision: $Rev: 15 $
4 | Author(s): Rabbit (rabbit.magtheridon@gmail.com)
5 | Description: Allows addons to register to recieve a lightweight minimap icon as an alternative to more heavy LDB displays.
6 | Dependencies: LibStub
7 | License: GPL v2 or later.
8 | ]]
9 |
10 | --[[
11 | Copyright (C) 2008-2010 Rabbit
12 |
13 | This program is free software; you can redistribute it and/or
14 | modify it under the terms of the GNU General Public License
15 | as published by the Free Software Foundation; either version 2
16 | of the License, or (at your option) any later version.
17 |
18 | This program is distributed in the hope that it will be useful,
19 | but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | GNU General Public License for more details.
22 |
23 | You should have received a copy of the GNU General Public License
24 | along with this program; if not, write to the Free Software
25 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 | ]]
27 |
28 | -----------------------------------------------------------------------
29 | -- DBIcon-1.0
30 | --
31 | -- Disclaimer: Most of this code was ripped from Barrel but fixed, streamlined
32 | -- and cleaned up a lot so that it no longer sucks.
33 | --
34 |
35 | local DBICON10 = "LibDBIcon-1.0"
36 | local DBICON10_MINOR = tonumber(("$Rev: 21 $"):match("(%d+)"))
37 | if not LibStub then error(DBICON10 .. " requires LibStub.") end
38 | local ldb = LibStub("LibDataBroker-1.1", true)
39 | if not ldb then error(DBICON10 .. " requires LibDataBroker-1.1.") end
40 | local lib, oldminor = LibStub:NewLibrary(DBICON10, DBICON10_MINOR)
41 | if not lib then return end
42 |
43 | lib.disabled = lib.disabled or nil
44 | lib.objects = lib.objects or {}
45 | lib.callbackRegistered = lib.callbackRegistered or nil
46 | lib.notCreated = lib.notCreated or {}
47 |
48 | function lib:IconCallback(event, name, key, value, dataobj)
49 | if lib.objects[name] then
50 | if key == "icon" then
51 | lib.objects[name].icon:SetTexture(dataobj and dataobj.icon or value)
52 | elseif key == "iconCoords" then
53 | lib.objects[name].icon:UpdateCoord()
54 | elseif key == "iconR" then
55 | local _, g, b = lib.objects[name].icon:GetVertexColor()
56 | lib.objects[name].icon:SetVertexColor(value, g, b)
57 | elseif key == "iconG" then
58 | local r, _, b = lib.objects[name].icon:GetVertexColor()
59 | lib.objects[name].icon:SetVertexColor(r, value, b)
60 | elseif key == "iconB" then
61 | local r, g = lib.objects[name].icon:GetVertexColor()
62 | lib.objects[name].icon:SetVertexColor(r, g, value)
63 | end
64 | end
65 | end
66 |
67 | if oldminor and oldminor < 21 then
68 | if not lib.newCallbackRegistered then
69 | ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__iconCoords", "IconCallback")
70 | ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__iconR", "IconCallback")
71 | ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__iconG", "IconCallback")
72 | ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__iconB", "IconCallback")
73 | lib.newCallbackRegistered = true
74 | end
75 | end
76 |
77 | if not lib.callbackRegistered then
78 | ldb.RegisterCallback(lib, "LibDataBroker_AttributeChanged__icon", "IconCallback")
79 | lib.callbackRegistered = true
80 | end
81 |
82 | -- Tooltip code ripped from StatBlockCore by Funkydude
83 | local function getAnchors(frame)
84 | local x, y = frame:GetCenter()
85 | if not x or not y then return "CENTER" end
86 | local hhalf = (x > UIParent:GetWidth()*2/3) and "RIGHT" or (x < UIParent:GetWidth()/3) and "LEFT" or ""
87 | local vhalf = (y > UIParent:GetHeight()/2) and "TOP" or "BOTTOM"
88 | return vhalf..hhalf, frame, (vhalf == "TOP" and "BOTTOM" or "TOP")..hhalf
89 | end
90 |
91 | local function onEnter(self)
92 | if self.isMoving then return end
93 | local obj = self.dataObject
94 | if obj.OnTooltipShow then
95 | GameTooltip:SetOwner(self, "ANCHOR_NONE")
96 | GameTooltip:SetPoint(getAnchors(self))
97 | obj.OnTooltipShow(GameTooltip)
98 | GameTooltip:Show()
99 | elseif obj.OnEnter then
100 | obj.OnEnter(self)
101 | end
102 | end
103 |
104 | local function onLeave(self)
105 | local obj = self.dataObject
106 | GameTooltip:Hide()
107 | if obj.OnLeave then obj.OnLeave(self) end
108 | end
109 |
110 | --------------------------------------------------------------------------------
111 |
112 | local minimapShapes = {
113 | ["ROUND"] = {true, true, true, true},
114 | ["SQUARE"] = {false, false, false, false},
115 | ["CORNER-TOPLEFT"] = {true, false, false, false},
116 | ["CORNER-TOPRIGHT"] = {false, false, true, false},
117 | ["CORNER-BOTTOMLEFT"] = {false, true, false, false},
118 | ["CORNER-BOTTOMRIGHT"] = {false, false, false, true},
119 | ["SIDE-LEFT"] = {true, true, false, false},
120 | ["SIDE-RIGHT"] = {false, false, true, true},
121 | ["SIDE-TOP"] = {true, false, true, false},
122 | ["SIDE-BOTTOM"] = {false, true, false, true},
123 | ["TRICORNER-TOPLEFT"] = {true, true, true, false},
124 | ["TRICORNER-TOPRIGHT"] = {true, false, true, true},
125 | ["TRICORNER-BOTTOMLEFT"] = {true, true, false, true},
126 | ["TRICORNER-BOTTOMRIGHT"] = {false, true, true, true},
127 | }
128 |
129 | local function updatePosition(button)
130 | local angle = math.rad(button.db and button.db.minimapPos or button.minimapPos or 225)
131 | local x, y, q = math.cos(angle), math.sin(angle), 1
132 | if x < 0 then q = q + 1 end
133 | if y > 0 then q = q + 2 end
134 | local minimapShape = GetMinimapShape and GetMinimapShape() or "ROUND"
135 | local quadTable = minimapShapes[minimapShape]
136 | if quadTable[q] then
137 | x, y = x*80, y*80
138 | else
139 | local diagRadius = 103.13708498985 --math.sqrt(2*(80)^2)-10
140 | x = math.max(-80, math.min(x*diagRadius, 80))
141 | y = math.max(-80, math.min(y*diagRadius, 80))
142 | end
143 | button:SetPoint("CENTER", Minimap, "CENTER", x, y)
144 | end
145 |
146 | local function onClick(self, b) if self.dataObject.OnClick then self.dataObject.OnClick(self, b) end end
147 | local function onMouseDown(self) self.icon:SetTexCoord(0, 1, 0, 1) end
148 | local function onMouseUp(self) self.icon:SetTexCoord(0.05, 0.95, 0.05, 0.95) end
149 |
150 | local function onUpdate(self)
151 | local mx, my = Minimap:GetCenter()
152 | local px, py = GetCursorPosition()
153 | local scale = Minimap:GetEffectiveScale()
154 | px, py = px / scale, py / scale
155 | if self.db then
156 | self.db.minimapPos = math.deg(math.atan2(py - my, px - mx)) % 360
157 | else
158 | self.minimapPos = math.deg(math.atan2(py - my, px - mx)) % 360
159 | end
160 | updatePosition(self)
161 | end
162 |
163 | local function onDragStart(self)
164 | self:LockHighlight()
165 | self.icon:SetTexCoord(0, 1, 0, 1)
166 | self:SetScript("OnUpdate", onUpdate)
167 | self.isMoving = true
168 | GameTooltip:Hide()
169 | end
170 |
171 | local function onDragStop(self)
172 | self:SetScript("OnUpdate", nil)
173 | self.icon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
174 | self:UnlockHighlight()
175 | self.isMoving = nil
176 | end
177 |
178 | local function createButton(name, object, db)
179 | local button = CreateFrame("Button", "LibDBIcon10_"..name, Minimap)
180 | button.dataObject = object
181 | button.db = db
182 | button:SetFrameStrata("MEDIUM")
183 | button:SetWidth(31); button:SetHeight(31)
184 | button:SetFrameLevel(8)
185 | button:RegisterForClicks("anyUp")
186 | button:RegisterForDrag("LeftButton")
187 | button:SetHighlightTexture("Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight")
188 | local overlay = button:CreateTexture(nil, "OVERLAY")
189 | overlay:SetWidth(53); overlay:SetHeight(53)
190 | overlay:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder")
191 | overlay:SetPoint("TOPLEFT")
192 | local background = button:CreateTexture(nil, "BACKGROUND")
193 | background:SetSize(20, 20)
194 | background:SetTexture("Interface\\Minimap\\UI-Minimap-Background")
195 | background:SetPoint("TOPLEFT", 7, -5)
196 | local icon = button:CreateTexture(nil, "ARTWORK")
197 | icon:SetWidth(20); icon:SetHeight(20)
198 | icon:SetTexture(object.icon)
199 | icon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
200 | icon:SetPoint("TOPLEFT", 7, -5)
201 | button.icon = icon
202 |
203 | button:SetScript("OnEnter", onEnter)
204 | button:SetScript("OnLeave", onLeave)
205 | button:SetScript("OnClick", onClick)
206 | button:SetScript("OnDragStart", onDragStart)
207 | button:SetScript("OnDragStop", onDragStop)
208 | button:SetScript("OnMouseDown", onMouseDown)
209 | button:SetScript("OnMouseUp", onMouseUp)
210 |
211 | lib.objects[name] = button
212 |
213 | if lib.loggedIn then
214 | updatePosition(button)
215 | if not db or not db.hide then button:Show()
216 | else button:Hide() end
217 | end
218 | end
219 |
220 | -- We could use a metatable.__index on lib.objects, but then we'd create
221 | -- the icons when checking things like :IsRegistered, which is not necessary.
222 | local function check(name)
223 | if lib.notCreated[name] then
224 | createButton(name, lib.notCreated[name][1], lib.notCreated[name][2])
225 | lib.notCreated[name] = nil
226 | end
227 | end
228 |
229 | lib.loggedIn = lib.loggedIn or false
230 | -- Wait a bit with the initial positioning to let any GetMinimapShape addons
231 | -- load up.
232 | if not lib.loggedIn then
233 | local f = CreateFrame("Frame")
234 | f:SetScript("OnEvent", function()
235 | for _, object in pairs(lib.objects) do
236 | updatePosition(object)
237 | if not lib.disabled and (not object.db or not object.db.hide) then object:Show()
238 | else object:Hide() end
239 | end
240 | lib.loggedIn = true
241 | f:SetScript("OnEvent", nil)
242 | f = nil
243 | end)
244 | f:RegisterEvent("PLAYER_LOGIN")
245 | end
246 |
247 | function lib:Register(name, object, db)
248 | if lib.disabled then return end
249 | if not object.icon then error("Can't register LDB objects without icons set!") end
250 | if lib.objects[name] or lib.notCreated[name] then error("Already registered, nubcake.") end
251 | if not db or not db.hide then
252 | createButton(name, object, db)
253 | else
254 | lib.notCreated[name] = {object, db}
255 | end
256 | end
257 |
258 | function lib:Hide(name)
259 | if not lib.objects[name] then return end
260 | lib.objects[name]:Hide()
261 | end
262 | function lib:Show(name)
263 | if lib.disabled then return end
264 | check(name)
265 | lib.objects[name]:Show()
266 | updatePosition(lib.objects[name])
267 | end
268 | function lib:IsRegistered(name)
269 | return (lib.objects[name] or lib.notCreated[name]) and true or false
270 | end
271 | function lib:Refresh(name, db)
272 | if lib.disabled then return end
273 | check(name)
274 | local button = lib.objects[name]
275 | if db then button.db = db end
276 | updatePosition(button)
277 | if not db or not db.hide then
278 | button:Show()
279 | else
280 | button:Hide()
281 | end
282 | end
283 |
284 | function lib:EnableLibrary()
285 | lib.disabled = nil
286 | for name, object in pairs(lib.objects) do
287 | if not object.db or (object.db and not object.db.hide) then
288 | object:Show()
289 | updatePosition(object)
290 | end
291 | end
292 | end
293 |
294 | function lib:DisableLibrary()
295 | lib.disabled = true
296 | for name, object in pairs(lib.objects) do
297 | object:Hide()
298 | end
299 | end
300 |
301 |
--------------------------------------------------------------------------------
/RetailUI/Libs/LibDBIcon-1.0/LibDBIcon-1.0.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/RetailUI/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua:
--------------------------------------------------------------------------------
1 |
2 | assert(LibStub, "LibDataBroker-1.1 requires LibStub")
3 | assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0")
4 |
5 | local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 4)
6 | if not lib then return end
7 | oldminor = oldminor or 0
8 |
9 |
10 | lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib)
11 | lib.attributestorage, lib.namestorage, lib.proxystorage = lib.attributestorage or {}, lib.namestorage or {}, lib.proxystorage or {}
12 | local attributestorage, namestorage, callbacks = lib.attributestorage, lib.namestorage, lib.callbacks
13 |
14 | if oldminor < 2 then
15 | lib.domt = {
16 | __metatable = "access denied",
17 | __index = function(self, key) return attributestorage[self] and attributestorage[self][key] end,
18 | }
19 | end
20 |
21 | if oldminor < 3 then
22 | lib.domt.__newindex = function(self, key, value)
23 | if not attributestorage[self] then attributestorage[self] = {} end
24 | if attributestorage[self][key] == value then return end
25 | attributestorage[self][key] = value
26 | local name = namestorage[self]
27 | if not name then return end
28 | callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self)
29 | callbacks:Fire("LibDataBroker_AttributeChanged_"..name, name, key, value, self)
30 | callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_"..key, name, key, value, self)
31 | callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self)
32 | end
33 | end
34 |
35 | if oldminor < 2 then
36 | function lib:NewDataObject(name, dataobj)
37 | if self.proxystorage[name] then return end
38 |
39 | if dataobj then
40 | assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table")
41 | self.attributestorage[dataobj] = {}
42 | for i,v in pairs(dataobj) do
43 | self.attributestorage[dataobj][i] = v
44 | dataobj[i] = nil
45 | end
46 | end
47 | dataobj = setmetatable(dataobj or {}, self.domt)
48 | self.proxystorage[name], self.namestorage[dataobj] = dataobj, name
49 | self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj)
50 | return dataobj
51 | end
52 | end
53 |
54 | if oldminor < 1 then
55 | function lib:DataObjectIterator()
56 | return pairs(self.proxystorage)
57 | end
58 |
59 | function lib:GetDataObjectByName(dataobjectname)
60 | return self.proxystorage[dataobjectname]
61 | end
62 |
63 | function lib:GetNameByDataObject(dataobject)
64 | return self.namestorage[dataobject]
65 | end
66 | end
67 |
68 | if oldminor < 4 then
69 | local next = pairs(attributestorage)
70 | function lib:pairs(dataobject_or_name)
71 | local t = type(dataobject_or_name)
72 | assert(t == "string" or t == "table", "Usage: ldb:pairs('dataobjectname') or ldb:pairs(dataobject)")
73 |
74 | local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name
75 | assert(attributestorage[dataobj], "Data object not found")
76 |
77 | return next, attributestorage[dataobj], nil
78 | end
79 |
80 | local ipairs_iter = ipairs(attributestorage)
81 | function lib:ipairs(dataobject_or_name)
82 | local t = type(dataobject_or_name)
83 | assert(t == "string" or t == "table", "Usage: ldb:ipairs('dataobjectname') or ldb:ipairs(dataobject)")
84 |
85 | local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name
86 | assert(attributestorage[dataobj], "Data object not found")
87 |
88 | return ipairs_iter, attributestorage[dataobj], 0
89 | end
90 | end
91 |
--------------------------------------------------------------------------------
/RetailUI/Libs/LibStub/LibStub.lua:
--------------------------------------------------------------------------------
1 | -- $Id: LibStub.lua 76 2007-09-03 01:50:17Z mikk $
2 | -- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
3 | -- LibStub is hereby placed in the Public Domain
4 | -- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
5 | local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
6 | local LibStub = _G[LIBSTUB_MAJOR]
7 |
8 | -- Check to see is this version of the stub is obsolete
9 | if not LibStub or LibStub.minor < LIBSTUB_MINOR then
10 | LibStub = LibStub or {libs = {}, minors = {} }
11 | _G[LIBSTUB_MAJOR] = LibStub
12 | LibStub.minor = LIBSTUB_MINOR
13 |
14 | -- LibStub:NewLibrary(major, minor)
15 | -- major(string) - the major version of the library
16 | -- minor(string or number ) - the minor version of the library
17 | --
18 | -- returns nil if a newer or same version of the lib is already present
19 | -- returns empty library object or old library object if upgrade is needed
20 | function LibStub:NewLibrary(major, minor)
21 | assert(type(major) == "string", "Bad argument #2 to `NewLibrary'(string expected)")
22 | minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
23 |
24 | local oldminor = self.minors[major]
25 | if oldminor and oldminor >= minor then return nil end
26 | self.minors[major], self.libs[major] = minor, self.libs[major] or {}
27 | return self.libs[major], oldminor
28 | end
29 |
30 | -- LibStub:GetLibrary(major,[silent])
31 | -- major(string) - the major version of the library
32 | -- silent(boolean) - if true, library is optional, silently return nil if its not found
33 | --
34 | -- throws an error if the library can not be found(except silent is set)
35 | -- returns the library object if found
36 | function LibStub:GetLibrary(major, silent)
37 | if not self.libs[major] and not silent then
38 | error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
39 | end
40 | return self.libs[major], self.minors[major]
41 | end
42 |
43 | -- LibStub:IterateLibraries()
44 | --
45 | -- Returns an iterator for the currently registered libraries
46 | function LibStub:IterateLibraries()
47 | return pairs(self.libs)
48 | end
49 |
50 | setmetatable(LibStub, { __call = LibStub.GetLibrary })
51 | end
52 |
--------------------------------------------------------------------------------
/RetailUI/Modules/BuffFrame.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) Dmitriy. All rights reserved.
3 | Licensed under the MIT license. See LICENSE file in the project root for details.
4 | ]]
5 |
6 | local RUI = LibStub('AceAddon-3.0'):GetAddon('RetailUI')
7 | local moduleName = 'BuffFrame'
8 | local Module = RUI:NewModule(moduleName, 'AceConsole-3.0', 'AceHook-3.0', 'AceEvent-3.0')
9 |
10 | Module.buffFrame = nil
11 |
12 | local function ReplaceBlizzardFrame(frame)
13 | frame.toggleButton = frame.toggleButton or CreateFrame('Button', nil, UIParent)
14 | local toggleButton = frame.toggleButton
15 | toggleButton.toggle = true
16 | toggleButton:SetPoint("RIGHT", frame, "RIGHT", 0, -3)
17 | toggleButton:SetSize(9, 17)
18 | toggleButton:SetHitRectInsets(0, 0, 0, 0)
19 |
20 | local normalTexture = toggleButton:GetNormalTexture() or toggleButton:CreateTexture(nil, "BORDER")
21 | normalTexture:SetAllPoints(toggleButton)
22 | SetAtlasTexture(normalTexture, 'CollapseButton-Right')
23 |
24 | toggleButton:SetNormalTexture(normalTexture)
25 |
26 | local highlightTexture = toggleButton:GetHighlightTexture() or toggleButton:CreateTexture(nil, "HIGHLIGHT")
27 | highlightTexture:SetAllPoints(toggleButton)
28 | SetAtlasTexture(highlightTexture, 'CollapseButton-Right')
29 |
30 | toggleButton:SetHighlightTexture(highlightTexture)
31 |
32 | toggleButton:SetScript("OnClick", function(self)
33 | if self.toggle then
34 | local normalTexture = self:GetNormalTexture()
35 | SetAtlasTexture(normalTexture, 'CollapseButton-Left')
36 |
37 | local highlightTexture = toggleButton:GetHighlightTexture()
38 | SetAtlasTexture(highlightTexture, 'CollapseButton-Left')
39 |
40 | for index = 1, BUFF_ACTUAL_DISPLAY do
41 | local button = _G['BuffButton' .. index]
42 | if button then
43 | button:Hide()
44 | end
45 | end
46 | else
47 | local normalTexture = self:GetNormalTexture()
48 | SetAtlasTexture(normalTexture, 'CollapseButton-Right')
49 |
50 | local highlightTexture = toggleButton:GetHighlightTexture()
51 | SetAtlasTexture(highlightTexture, 'CollapseButton-Right')
52 |
53 | for index = 1, BUFF_ACTUAL_DISPLAY do
54 | local button = _G['BuffButton' .. index]
55 | if button then
56 | button:Show()
57 | end
58 | end
59 | end
60 |
61 | self.toggle = not self.toggle
62 | end)
63 |
64 | local consolidatedBuffFrame = ConsolidatedBuffs
65 | consolidatedBuffFrame:SetMovable(true)
66 | consolidatedBuffFrame:SetUserPlaced(true)
67 | consolidatedBuffFrame:ClearAllPoints()
68 | consolidatedBuffFrame:SetPoint("RIGHT", toggleButton, "LEFT", -6, 0)
69 | end
70 |
71 | local function ShowToggleButtonIf(condition)
72 | if condition then
73 | Module.buffFrame.toggleButton:Show()
74 | else
75 | Module.buffFrame.toggleButton:Hide()
76 | end
77 | end
78 |
79 | local function GetUnitBuffCount(unit, range)
80 | local count = 0
81 | for index = 1, range do
82 | local name = UnitBuff(unit, index)
83 | if name then
84 | count = count + 1
85 | end
86 | end
87 | return count
88 | end
89 |
90 | function Module:OnEnable()
91 | self:RegisterEvent("PLAYER_ENTERING_WORLD")
92 | self:RegisterEvent("UNIT_AURA")
93 | self:RegisterEvent("UNIT_ENTERED_VEHICLE")
94 | self:RegisterEvent("UNIT_EXITED_VEHICLE")
95 |
96 | self.buffFrame = CreateUIFrame(BuffFrame:GetWidth(), BuffFrame:GetHeight(), "BuffFrame")
97 | end
98 |
99 | function Module:OnDisable()
100 | self:UnregisterEvent("PLAYER_ENTERING_WORLD")
101 | self:UnregisterEvent("UNIT_AURA")
102 | self:UnregisterEvent("UNIT_ENTERED_VEHICLE")
103 | self:UnregisterEvent("UNIT_EXITED_VEHICLE")
104 | end
105 |
106 | function Module:PLAYER_ENTERING_WORLD()
107 | ReplaceBlizzardFrame(self.buffFrame)
108 |
109 | ShowToggleButtonIf(GetUnitBuffCount("player", 16) > 0)
110 |
111 | CheckSettingsExists(Module, { 'buffs' })
112 | end
113 |
114 | function Module:UNIT_AURA(eventName, unit)
115 | if unit == 'vehicle' then
116 | ShowToggleButtonIf(GetUnitBuffCount("vehicle", 16) > 0)
117 | elseif unit == 'player' then
118 | ShowToggleButtonIf(GetUnitBuffCount("player", 16) > 0)
119 | end
120 | end
121 |
122 | function Module:UNIT_ENTERED_VEHICLE(eventName, unit)
123 | if unit ~= 'player' then return end
124 |
125 | ShowToggleButtonIf(GetUnitBuffCount("vehicle", 16) > 0)
126 | end
127 |
128 | function Module:UNIT_EXITED_VEHICLE(eventName, unit)
129 | if unit ~= 'player' then return end
130 |
131 | ShowToggleButtonIf(GetUnitBuffCount("player", 16) > 0)
132 | end
133 |
134 | function Module:LoadDefaultSettings()
135 | RUI.DB.profile.widgets.buffs = { anchor = "TOPRIGHT", posX = -260, posY = -20 }
136 | end
137 |
138 | function Module:UpdateWidgets()
139 | local widgetOptions = RUI.DB.profile.widgets.buffs
140 | self.buffFrame:SetPoint(widgetOptions.anchor, widgetOptions.posX, widgetOptions.posY)
141 | end
142 |
143 | function Module:ShowEditorTest()
144 | HideUIFrame(self.buffFrame)
145 | end
146 |
147 | function Module:HideEditorTest(refresh)
148 | ShowUIFrame(self.buffFrame)
149 | SaveUIFramePosition(self.buffFrame, 'buffs')
150 |
151 | if refresh then
152 | self:UpdateWidgets()
153 | end
154 | end
155 |
--------------------------------------------------------------------------------
/RetailUI/Modules/EditorMode.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) Dmitriy. All rights reserved.
3 | Licensed under the MIT license. See LICENSE file in the project root for details.
4 | ]]
5 |
6 | local RUI = LibStub('AceAddon-3.0'):GetAddon('RetailUI')
7 | local moduleName = 'EditorMode'
8 | local Module = RUI:NewModule(moduleName, 'AceConsole-3.0', 'AceHook-3.0', 'AceEvent-3.0')
9 |
10 | local UnitFrameModule, CastingBarModule, ActionBarModule, MinimapModule, QuestTrackerModule, BuffFrameModule
11 |
12 | Module.editorGridFrame = nil
13 |
14 | local function CreateEditorGridFrame()
15 | local editorGridFrame = CreateFrame("Frame", 'RUI_EditorGridFrame', UIParent)
16 | editorGridFrame:SetPoint("TOPLEFT", 0, 0)
17 | editorGridFrame:SetSize(GetScreenWidth(), GetScreenHeight())
18 | editorGridFrame:SetFrameLevel(0)
19 | editorGridFrame:SetFrameStrata("BACKGROUND")
20 |
21 | do
22 | local texture = editorGridFrame:CreateTexture(nil, "BACKGROUND")
23 | texture:SetAllPoints(editorGridFrame)
24 | texture:SetTexture("Interface\\AddOns\\RetailUI\\Textures\\UI\\EditorGrid.blp", "REPEAT", "REPEAT")
25 | texture:SetTexCoord(0, 1, 0, 1)
26 | texture:SetVertTile(true)
27 | texture:SetHorizTile(true)
28 | texture:SetSize(32, 32)
29 | texture:SetAlpha(0.4)
30 | end
31 |
32 | editorGridFrame:Hide()
33 | return editorGridFrame
34 | end
35 |
36 | function Module:OnEnable()
37 | UnitFrameModule = RUI:GetModule("UnitFrame")
38 | CastingBarModule = RUI:GetModule("CastingBar")
39 | ActionBarModule = RUI:GetModule("ActionBar")
40 | MinimapModule = RUI:GetModule("Minimap")
41 | QuestTrackerModule = RUI:GetModule("QuestTracker")
42 | BuffFrameModule = RUI:GetModule("BuffFrame")
43 |
44 | self.editorGridFrame = CreateEditorGridFrame()
45 | end
46 |
47 | function Module:OnDisable() end
48 |
49 | function Module:Show()
50 | if InCombatLockdown() then
51 | self:Printf(DEFAULT_CHAT_FRAME, "Cannot open settings while in combat")
52 | return
53 | end
54 |
55 | self.editorGridFrame:Show()
56 |
57 | ActionBarModule:ShowEditorTest()
58 | UnitFrameModule:ShowEditorTest()
59 | CastingBarModule:ShowEditorTest()
60 | MinimapModule:ShowEditorTest()
61 | QuestTrackerModule:ShowEditorTest()
62 | BuffFrameModule:ShowEditorTest()
63 | end
64 |
65 | function Module:Hide()
66 | self.editorGridFrame:Hide()
67 |
68 | ActionBarModule:HideEditorTest(true)
69 | UnitFrameModule:HideEditorTest(true)
70 | CastingBarModule:HideEditorTest(true)
71 | MinimapModule:HideEditorTest(true)
72 | QuestTrackerModule:HideEditorTest(true)
73 | BuffFrameModule:HideEditorTest(true)
74 | end
75 |
76 | function Module:IsShown()
77 | return self.editorGridFrame:IsShown()
78 | end
79 |
--------------------------------------------------------------------------------
/RetailUI/Modules/QuestLog.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) Dmitriy. All rights reserved.
3 | Licensed under the MIT license. See LICENSE file in the project root for details.
4 | ]]
5 |
6 | local RUI = LibStub('AceAddon-3.0'):GetAddon('RetailUI')
7 | local moduleName = 'QuestLog'
8 | local Module = RUI:NewModule(moduleName, 'AceConsole-3.0', 'AceHook-3.0', 'AceEvent-3.0')
9 |
10 | Module.questLogFrame = nil
11 |
12 | local function ReplaceBlizzardFrame(frame)
13 | local watchFrame = WatchFrame
14 | watchFrame:SetMovable(true)
15 | watchFrame:SetUserPlaced(true)
16 | watchFrame:ClearAllPoints()
17 | watchFrame:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, 0)
18 | end
19 |
20 | function Module:OnEnable()
21 | self:RegisterEvent("PLAYER_ENTERING_WORLD")
22 |
23 | self.questLogFrame = CreateUIFrame(230, 500, "QuestLogFrame")
24 | end
25 |
26 | function Module:OnDisable()
27 | self:UnregisterEvent("PLAYER_ENTERING_WORLD")
28 | end
29 |
30 | function Module:PLAYER_ENTERING_WORLD()
31 | ReplaceBlizzardFrame(self.questLogFrame)
32 |
33 | CheckSettingsExists(Module, { 'questLog' })
34 | end
35 |
36 | function Module:LoadDefaultSettings()
37 | RUI.DB.profile.widgets.questLog = { anchor = "RIGHT", posX = -100, posY = -37 }
38 | end
39 |
40 | function Module:UpdateWidgets()
41 | local widgetOptions = RUI.DB.profile.widgets.questLog
42 | self.questLogFrame:SetPoint(widgetOptions.anchor, widgetOptions.posX, widgetOptions.posY)
43 | end
44 |
45 | function Module:ShowEditorTest()
46 | HideUIFrame(self.questLogFrame)
47 | end
48 |
49 | function Module:HideEditorTest(refresh)
50 | ShowUIFrame(self.questLogFrame)
51 | SaveUIFramePosition(self.questLogFrame, 'questLog')
52 |
53 | if refresh then
54 | self:UpdateWidgets()
55 | end
56 | end
57 |
--------------------------------------------------------------------------------
/RetailUI/Modules/QuestTracker.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) Dmitriy. All rights reserved.
3 | Licensed under the MIT license. See LICENSE file in the project root for details.
4 | ]]
5 |
6 | local RUI = LibStub('AceAddon-3.0'):GetAddon('RetailUI')
7 | local moduleName = 'QuestTracker'
8 | local Module = RUI:NewModule(moduleName, 'AceConsole-3.0', 'AceHook-3.0', 'AceEvent-3.0')
9 |
10 | Module.questTrackerFrame = nil
11 |
12 | local function ReplaceBlizzardFrame(frame)
13 | local watchFrame = WatchFrame
14 | watchFrame:SetMovable(true)
15 | watchFrame:SetUserPlaced(true)
16 | watchFrame:ClearAllPoints()
17 | watchFrame:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, 0)
18 |
19 | WatchFrameLines:SetPoint("TOPLEFT", WatchFrameHeader, 'BOTTOMLEFT', 0, -15)
20 | end
21 |
22 | local function WatchFrame_Collapse(self)
23 | self:SetWidth(WATCHFRAME_EXPANDEDWIDTH)
24 | end
25 |
26 | local function WatchFrame_Update(self)
27 | local pixelsUsed = 0
28 | local totalOffset = WATCHFRAME_INITIAL_OFFSET
29 | local lineFrame = WatchFrameLines
30 | local maxHeight = (WatchFrame:GetTop() - WatchFrame:GetBottom())
31 |
32 | local maxFrameWidth = WATCHFRAME_MAXLINEWIDTH
33 | local maxLineWidth
34 | local numObjectives
35 | local totalObjectives = 0
36 |
37 | for i = 1, #WATCHFRAME_OBJECTIVEHANDLERS do
38 | pixelsUsed, maxLineWidth, numObjectives = WATCHFRAME_OBJECTIVEHANDLERS[i](lineFrame, totalOffset, maxHeight,
39 | maxFrameWidth)
40 | totalObjectives = totalObjectives + numObjectives
41 | end
42 |
43 | local watchFrame = WatchFrame
44 | watchFrame.background = watchFrame.background or watchFrame:CreateTexture(nil, 'BACKGROUND')
45 | local background = watchFrame.background
46 | background:SetPoint('RIGHT', WatchFrameCollapseExpandButton, 'RIGHT', 0, 0)
47 | SetAtlasTexture(background, 'QuestTracker-Header')
48 | background:SetSize(watchFrame:GetWidth(), 36)
49 |
50 | if totalObjectives > 0 then
51 | background:Show()
52 | else
53 | background:Hide()
54 | end
55 | end
56 |
57 | function Module:OnEnable()
58 | self:RegisterEvent("PLAYER_ENTERING_WORLD")
59 |
60 | self:SecureHook('WatchFrame_Collapse', WatchFrame_Collapse)
61 | self:SecureHook('WatchFrame_Update', WatchFrame_Update)
62 |
63 | self.questTrackerFrame = CreateUIFrame(230, 500, "QuestTrackerFrame")
64 | end
65 |
66 | function Module:OnDisable()
67 | self:UnregisterEvent("PLAYER_ENTERING_WORLD")
68 |
69 | self:Unhook('WatchFrame_Collapse', WatchFrame_Collapse)
70 | self:Unhook('WatchFrame_Update', WatchFrame_Update)
71 | end
72 |
73 | function Module:PLAYER_ENTERING_WORLD()
74 | ReplaceBlizzardFrame(self.questTrackerFrame)
75 |
76 | CheckSettingsExists(Module, { 'questTracker' })
77 | end
78 |
79 | function Module:LoadDefaultSettings()
80 | RUI.DB.profile.widgets.questTracker = { anchor = "RIGHT", posX = -100, posY = -37 }
81 | end
82 |
83 | function Module:UpdateWidgets()
84 | local widgetOptions = RUI.DB.profile.widgets.questTracker
85 | self.questTrackerFrame:SetPoint(widgetOptions.anchor, widgetOptions.posX, widgetOptions.posY)
86 | end
87 |
88 | function Module:ShowEditorTest()
89 | HideUIFrame(self.questTrackerFrame)
90 | end
91 |
92 | function Module:HideEditorTest(refresh)
93 | ShowUIFrame(self.questTrackerFrame)
94 | SaveUIFramePosition(self.questTrackerFrame, 'questTracker')
95 |
96 | if refresh then
97 | self:UpdateWidgets()
98 | end
99 | end
100 |
--------------------------------------------------------------------------------
/RetailUI/NineSlice.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) Dmitriy. All rights reserved.
3 | Licensed under the MIT license. See LICENSE file in the project root for details.
4 | ]]
5 |
6 | function CreateNineSliceFrame(width, height, textureInfos, scale)
7 | local frame = CreateFrame("Frame", nil, UIParent)
8 | frame:SetSize(width, height)
9 |
10 | -- TOP
11 | do
12 | local texture = frame:CreateTexture(nil, "BORDER")
13 | texture:SetPoint("TOP", 0, 5)
14 | SetAtlasTexture(texture, textureInfos['TOP'])
15 | texture:SetHorizTile(true)
16 | texture:SetSize(width - texture:GetWidth(), texture:GetHeight() * scale)
17 | end
18 |
19 | -- BOTTOM
20 | do
21 | local texture = frame:CreateTexture(nil, "BORDER")
22 | texture:SetPoint("BOTTOM", 0, -5)
23 | SetAtlasTexture(texture, textureInfos['BOTTOM'])
24 | texture:SetHorizTile(true)
25 | texture:SetSize(width - texture:GetWidth(), texture:GetHeight() * scale)
26 | end
27 |
28 | -- TOPLEFT
29 | do
30 | local texture = frame:CreateTexture(nil, "BORDER")
31 | texture:SetPoint("TOPLEFT", -4, 5)
32 | SetAtlasTexture(texture, textureInfos['TOPLEFT'])
33 | texture:SetSize(texture:GetWidth() * scale, texture:GetHeight() * scale)
34 | end
35 |
36 | -- TOPRIGHT
37 | do
38 | local texture = frame:CreateTexture(nil, "BORDER")
39 | texture:SetPoint("TOPRIGHT", 4, 5)
40 | SetAtlasTexture(texture, textureInfos['TOPRIGHT'])
41 | texture:SetSize(texture:GetWidth() * scale, texture:GetHeight() * scale)
42 | end
43 |
44 | -- BOTTOMRIGHT
45 | do
46 | local texture = frame:CreateTexture(nil, "BORDER")
47 | texture:SetPoint("BOTTOMRIGHT", 4, -5)
48 | SetAtlasTexture(texture, textureInfos['BOTTOMRIGHT'])
49 | texture:SetSize(texture:GetWidth() * scale, texture:GetHeight() * scale)
50 | end
51 |
52 | -- BOTTOMLEFT
53 | do
54 | local texture = frame:CreateTexture(nil, "BORDER")
55 | texture:SetPoint("BOTTOMLEFT", -4, -5)
56 | SetAtlasTexture(texture, textureInfos['BOTTOMLEFT'])
57 | texture:SetSize(texture:GetWidth() * scale, texture:GetHeight() * scale)
58 | end
59 |
60 | -- LEFT
61 | do
62 | local texture = frame:CreateTexture(nil, "BORDER")
63 | texture:SetPoint("LEFT", -4, 0)
64 | SetAtlasTexture(texture, textureInfos['LEFT'])
65 | texture:SetSize(texture:GetWidth() * scale, height - texture:GetHeight())
66 | end
67 |
68 | -- RIGHT
69 | do
70 | local texture = frame:CreateTexture(nil, "BORDER")
71 | texture:SetPoint("RIGHT", 4, 0)
72 | SetAtlasTexture(texture, textureInfos['RIGHT'])
73 | texture:SetSize(texture:GetWidth() * scale, height - texture:GetHeight())
74 | end
75 |
76 | return frame
77 | end
78 |
--------------------------------------------------------------------------------
/RetailUI/RetailUI.toc:
--------------------------------------------------------------------------------
1 | ## Interface: 30300
2 | ## Title: RetailUI
3 | ## Notes: Changes your UI to look like Retail
4 | ## Author: delayy
5 | ## Version: 1.4.0
6 | ## SavedVariables: RetailUIDB
7 |
8 | Libs.xml
9 |
10 | Core.lua
11 | Config.lua
12 | Atlas.lua
13 | NineSlice.lua
14 |
15 | Modules\ActionBar.lua
16 | Modules\UnitFrame.lua
17 | Modules\EditorMode.lua
18 | Modules\CastingBar.lua
19 | Modules\Minimap.lua
20 | Modules\QuestTracker.lua
21 | Modules\BuffFrame.lua
--------------------------------------------------------------------------------
/RetailUI/Textures/Minimap/Calendar.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/Minimap/Calendar.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/Minimap/EyeGroupFinderFlipbook.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/Minimap/EyeGroupFinderFlipbook.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/Minimap/GuildBanner.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/Minimap/GuildBanner.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/Minimap/MinimapBorder.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/Minimap/MinimapBorder.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/PlayerFrame/ClassOverlayComboPoints.BLP:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/PlayerFrame/ClassOverlayComboPoints.BLP
--------------------------------------------------------------------------------
/RetailUI/Textures/PlayerFrame/ClassOverlayDeathKnightRunes.BLP:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/PlayerFrame/ClassOverlayDeathKnightRunes.BLP
--------------------------------------------------------------------------------
/RetailUI/Textures/PlayerFrame/LFGRoleIcons.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/PlayerFrame/LFGRoleIcons.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/PlayerFrame/PlayerRestFlipbook.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/PlayerFrame/PlayerRestFlipbook.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/TargetFrame/BossFrame.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/TargetFrame/BossFrame.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/TargetFrame/NameBackground.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/TargetFrame/NameBackground.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/ActionBar.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/ActionBar.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/ActionBarHorizontal.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/ActionBarHorizontal.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/ActionBarVertical.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/ActionBarVertical.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/BagSlots.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/BagSlots.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/BagSlotsKey.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/BagSlotsKey.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/CastingBar.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/CastingBar.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/CollapseButton.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/CollapseButton.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/EditorGrid.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/EditorGrid.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/ExperienceBar.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/ExperienceBar.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/MicroMenu.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/MicroMenu.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/Minimap.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/Minimap.blp
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/QuestTracker.BLP:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/QuestTracker.BLP
--------------------------------------------------------------------------------
/RetailUI/Textures/UI/UnitFrame.blp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/RetailUI/Textures/UI/UnitFrame.blp
--------------------------------------------------------------------------------
/media/RUI-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/media/RUI-1.png
--------------------------------------------------------------------------------
/media/RUI-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/media/RUI-2.png
--------------------------------------------------------------------------------
/media/RUI-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/media/RUI-3.png
--------------------------------------------------------------------------------
/media/RUI-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/media/RUI-4.png
--------------------------------------------------------------------------------
/media/RUI-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a3st/RetailUI/71282f6081ba3e3a38ddce08a2eeeeb7d6e410b8/media/RUI-5.png
--------------------------------------------------------------------------------