comparison Libs/AceGUI-3.0/widgets/AceGUIWidget-Button.lua @ 18:a0dcdcaec1ea v7.3.0.018

- toc update. - libs update.
author Tercio
date Tue, 17 Oct 2017 10:02:01 -0200
parents ce416064d8a1
children
comparison
equal deleted inserted replaced
17:da84a5064a5a 18:a0dcdcaec1ea
1 --[[----------------------------------------------------------------------------- 1 --[[-----------------------------------------------------------------------------
2 Button Widget 2 Button Widget
3 Graphical Button. 3 Graphical Button.
4 -------------------------------------------------------------------------------]] 4 -------------------------------------------------------------------------------]]
5 local Type, Version = "Button", 23 5 local Type, Version = "Button", 24
6 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 6 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 7 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
8 8
9 -- Lua APIs 9 -- Lua APIs
10 local pairs = pairs 10 local pairs = pairs
11 11
12 -- WoW APIs 12 -- WoW APIs
13 local _G = _G 13 local _G = _G
14 local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent 14 local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent
15 15
16 local wowMoP
17 do
18 local _, _, _, interface = GetBuildInfo()
19 wowMoP = (interface >= 50000)
20 end
21
22 --[[----------------------------------------------------------------------------- 16 --[[-----------------------------------------------------------------------------
23 Scripts 17 Scripts
24 -------------------------------------------------------------------------------]] 18 -------------------------------------------------------------------------------]]
25 local function Button_OnClick(frame, ...) 19 local function Button_OnClick(frame, ...)
26 AceGUI:ClearFocus() 20 AceGUI:ClearFocus()
27 PlaySound("igMainMenuOption") 21 PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION
28 frame.obj:Fire("OnClick", ...) 22 frame.obj:Fire("OnClick", ...)
29 end 23 end
30 24
31 local function Control_OnEnter(frame) 25 local function Control_OnEnter(frame)
32 frame.obj:Fire("OnEnter") 26 frame.obj:Fire("OnEnter")
78 --[[----------------------------------------------------------------------------- 72 --[[-----------------------------------------------------------------------------
79 Constructor 73 Constructor
80 -------------------------------------------------------------------------------]] 74 -------------------------------------------------------------------------------]]
81 local function Constructor() 75 local function Constructor()
82 local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type) 76 local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
83 local frame = CreateFrame("Button", name, UIParent, wowMoP and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2") 77 local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate")
84 frame:Hide() 78 frame:Hide()
85 79
86 frame:EnableMouse(true) 80 frame:EnableMouse(true)
87 frame:SetScript("OnClick", Button_OnClick) 81 frame:SetScript("OnClick", Button_OnClick)
88 frame:SetScript("OnEnter", Control_OnEnter) 82 frame:SetScript("OnEnter", Control_OnEnter)