/trunk/Stuf_Options/libs/AceGUI-3.0/widgets
--[[ $Id: AceGUIWidget-DropDown.lua 1161 2017-08-12 14:30:16Z funkydude $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown.lua 1167 2017-08-29 22:08:48Z funkydude $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local function Dropdown_TogglePullout(this) |
local self = this.obj |
PlaySound(PlaySoundKitID and "igMainMenuOptionCheckBoxOn" or 856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
if self.open then |
self.open = nil |
self.pullout:Close() |
--[[----------------------------------------------------------------------------- |
EditBox Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "EditBox", 27 |
local Type, Version = "EditBox", 28 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local value = frame:GetText() |
local cancel = self:Fire("OnEnterPressed", value) |
if not cancel then |
PlaySound(PlaySoundKitID and "igMainMenuOptionCheckBoxOn" or 856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
HideButton(self) |
end |
end |
local function EditBox_OnReceiveDrag(frame) |
local self = frame.obj |
local type, id, info = GetCursorInfo() |
local name |
if type == "item" then |
self:SetText(info) |
self:Fire("OnEnterPressed", info) |
ClearCursor() |
name = info |
elseif type == "spell" then |
local name = GetSpellInfo(id, info) |
self:SetText(name) |
self:Fire("OnEnterPressed", name) |
ClearCursor() |
name = GetSpellInfo(id, info) |
elseif type == "macro" then |
local name = GetMacroInfo(id) |
name = GetMacroInfo(id) |
end |
if name then |
self:SetText(name) |
self:Fire("OnEnterPressed", name) |
ClearCursor() |
HideButton(self) |
AceGUI:ClearFocus() |
end |
HideButton(self) |
AceGUI:ClearFocus() |
end |
local function EditBox_OnTextChanged(frame) |
end |
local function closeOnClick(this) |
PlaySound(PlaySoundKitID and "gsTitleOptionExit" or 799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT |
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT |
this.obj:Hide() |
end |
TreeGroup Container |
Container that uses a tree control to switch between groups. |
-------------------------------------------------------------------------------]] |
local Type, Version = "TreeGroup", 40 |
local Type, Version = "TreeGroup", 41 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local WoW80 = select(4, GetBuildInfo()) >= 80000 |
-- Lua APIs |
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type |
local math_min, math_max, floor = math.min, math.max, floor |
local function FirstFrameUpdate(frame) |
local self = frame.obj |
frame:SetScript("OnUpdate", nil) |
self:RefreshTree() |
self:RefreshTree(nil, true) |
end |
local function BuildUniqueValue(...) |
["OnRelease"] = function(self) |
self.status = nil |
self.tree = nil |
self.frame:SetScript("OnUpdate", nil) |
for k, v in pairs(self.localstatus) do |
if k == "groups" then |
for k2 in pairs(v) do |
end |
end, |
["RefreshTree"] = function(self,scrollToSelection) |
local buttons = self.buttons |
["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate) |
local buttons = self.buttons |
local lines = self.lines |
for i, v in ipairs(buttons) do |
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18)) |
if maxlines <= 0 then return end |
-- workaround for lag spikes on WoW 8.0 |
if WoW80 and self.frame:GetParent() == UIParent and not fromOnUpdate then |
self.frame:SetScript("OnUpdate", FirstFrameUpdate) |
return |
end |
local first, last |
scrollToSelection = status.scrollToSelection |
-------------------------------------------------------------------------------]] |
local function Button_OnClick(frame, ...) |
AceGUI:ClearFocus() |
PlaySound(PlaySoundKitID and "igMainMenuOption" or 852) -- SOUNDKIT.IG_MAINMENU_OPTION |
PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION |
frame.obj:Fire("OnClick", ...) |
end |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 1161 2017-08-12 14:30:16Z funkydude $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 1167 2017-08-29 22:08:48Z funkydude $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
if self.disabled then return end |
self.value = not self.value |
if self.value then |
PlaySound(PlaySoundKitID and "igMainMenuOptionCheckBoxOn" or 856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
else |
PlaySound(PlaySoundKitID and "igMainMenuOptionCheckBoxOff" or 857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF |
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF |
end |
UpdateToggle(self) |
self:Fire("OnValueChanged", self.value) |
end |
if value then |
PlaySound(PlaySoundKitID and "igMainMenuOptionCheckBoxOn" or 856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
self.slider:SetValue(value) |
self:Fire("OnMouseUp", value) |
end |
-------------------------------------------------------------------------------]] |
local function Tab_OnClick(frame) |
if not (frame.selected or frame.disabled) then |
PlaySound(PlaySoundKitID and "igCharacterInfoTab" or 841) -- SOUNDKIT.IG_CHARACTER_INFO_TAB |
PlaySound(841) -- SOUNDKIT.IG_CHARACTER_INFO_TAB |
frame.obj:SelectTab(frame.value) |
end |
end |
--[[----------------------------------------------------------------------------- |
Checkbox Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "CheckBox", 23 |
local Type, Version = "CheckBox", 24 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
self.text:SetPoint("LEFT", self.checkbg, "RIGHT") |
self.text:SetPoint("RIGHT") |
else |
self.text:SetPoint("LEFT", self.image,"RIGHT", 1, 0) |
self.text:SetPoint("LEFT", self.checkbg, "RIGHT", self.image:GetWidth() + 2, 0) |
self.text:SetPoint("RIGHT") |
end |
end |
self:ToggleChecked() |
if self.checked then |
PlaySound(PlaySoundKitID and "igMainMenuOptionCheckBoxOn" or 856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON |
else -- for both nil and false (tristate) |
PlaySound(PlaySoundKitID and "igMainMenuOptionCheckBoxOff" or 857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF |
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF |
end |
self:Fire("OnValueChanged", self.checked) |
desc:ClearAllPoints() |
desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21) |
desc:SetWidth(self.frame.width - 30) |
desc:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0) |
desc:SetJustifyH("LEFT") |
desc:SetJustifyV("TOP") |
self.desc = desc |
Scripts |
-------------------------------------------------------------------------------]] |
local function Button_OnClick(frame) |
PlaySound(PlaySoundKitID and "gsTitleOptionExit" or 799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT |
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT |
frame.obj:Hide() |
end |