/trunk/sStats/libs/AceGUI-3.0/widgets
Slider Widget |
Graphical Slider, like, for Range values. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Slider", 20 |
local Type, Version = "Slider", 21 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local self = frame.obj |
if not frame.setup then |
local newvalue = frame:GetValue() |
if self.step and self.step > 0 then |
local min_value = self.min or 0 |
newvalue = floor((newvalue - min_value) / self.step + 0.5) * self.step + min_value |
end |
if newvalue ~= self.value and not self.disabled then |
self.value = newvalue |
self:Fire("OnValueChanged", newvalue) |
BlizOptionsGroup Container |
Simple container widget for the integration of AceGUI into the Blizzard Interface Options |
-------------------------------------------------------------------------------]] |
local Type, Version = "BlizOptionsGroup", 20 |
local Type, Version = "BlizOptionsGroup", 21 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
frame.obj:Fire("cancel") |
end |
local function defaults(frame) |
frame.obj:Fire("defaults") |
local function default(frame) |
frame.obj:Fire("default") |
end |
local function refresh(frame) |
frame.obj:Fire("refresh") |
end |
--[[----------------------------------------------------------------------------- |
Methods |
-------------------------------------------------------------------------------]] |
-- support functions for the Blizzard Interface Options |
frame.okay = okay |
frame.cancel = cancel |
frame.defaults = defaults |
frame.default = default |
frame.refresh = refresh |
frame:SetScript("OnHide", OnHide) |
frame:SetScript("OnShow", OnShow) |
InlineGroup Container |
Simple container widget that creates a visible "box" with an optional title. |
-------------------------------------------------------------------------------]] |
local Type, Version = "InlineGroup", 20 |
local Type, Version = "InlineGroup", 21 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
["OnAcquire"] = function(self) |
self:SetWidth(300) |
self:SetHeight(100) |
self:SetTitle("") |
end, |
-- ["OnRelease"] = nil, |
--[[ $Id: AceGUIWidget-DropDown.lua 1029 2011-06-10 23:10:58Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown.lua 1116 2014-10-12 08:15:46Z nevcairiel $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
do |
local widgetType = "Dropdown" |
local widgetVersion = 25 |
local widgetVersion = 30 |
--[[ Static data ]]-- |
--[[ UI event handler ]]-- |
local function Control_OnEnter(this) |
this.obj.button:LockHighlight() |
this.obj:Fire("OnEnter") |
end |
local function Control_OnLeave(this) |
this.obj.button:UnlockHighlight() |
this.obj:Fire("OnLeave") |
end |
AceGUI:ClearFocus() |
else |
self.open = true |
self.pullout:SetWidth(self.frame:GetWidth()) |
self.pullout:SetWidth(self.pulloutWidth or self.frame:GetWidth()) |
self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0) |
AceGUI:SetFocus(self) |
end |
end |
self.open = true |
self:Fire("OnOpened") |
end |
local function OnPulloutClose(this) |
self:SetHeight(44) |
self:SetWidth(200) |
self:SetLabel() |
self:SetPulloutWidth(nil) |
end |
-- exported, AceGUI callback |
if disabled then |
self.text:SetTextColor(0.5,0.5,0.5) |
self.button:Disable() |
self.button_cover:Disable() |
self.label:SetTextColor(0.5,0.5,0.5) |
else |
self.button:Enable() |
self.button_cover:Enable() |
self.label:SetTextColor(1,.82,0) |
self.text:SetTextColor(1,1,1) |
end |
if text and text ~= "" then |
self.label:SetText(text) |
self.label:Show() |
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-18) |
self:SetHeight(44) |
self.alignoffset = 30 |
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-14) |
self:SetHeight(40) |
self.alignoffset = 26 |
else |
self.label:SetText("") |
self.label:Hide() |
return self.multiselect |
end |
local function SetPulloutWidth(self, width) |
self.pulloutWidth = width |
end |
--[[ Constructor ]]-- |
local function Constructor() |
self.GetMultiselect = GetMultiselect |
self.SetItemValue = SetItemValue |
self.SetItemDisabled = SetItemDisabled |
self.SetPulloutWidth = SetPulloutWidth |
self.alignoffset = 30 |
self.alignoffset = 26 |
frame:SetScript("OnHide",Dropdown_OnHide) |
button:SetScript("OnLeave",Control_OnLeave) |
button:SetScript("OnClick",Dropdown_TogglePullout) |
local button_cover = CreateFrame("BUTTON",nil,self.frame) |
self.button_cover = button_cover |
button_cover.obj = self |
button_cover:SetPoint("TOPLEFT",self.frame,"BOTTOMLEFT",0,25) |
button_cover:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT") |
button_cover:SetScript("OnEnter",Control_OnEnter) |
button_cover:SetScript("OnLeave",Control_OnLeave) |
button_cover:SetScript("OnClick",Dropdown_TogglePullout) |
local text = _G[dropdown:GetName() .. "Text"] |
self.text = text |
text.obj = self |
--[[----------------------------------------------------------------------------- |
EditBox Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "EditBox", 24 |
local Type, Version = "EditBox", 25 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
self:SetText(name) |
self:Fire("OnEnterPressed", name) |
ClearCursor() |
elseif type == "macro" then |
local name = GetMacroInfo(id) |
self:SetText(name) |
self:Fire("OnEnterPressed", name) |
ClearCursor() |
end |
HideButton(self) |
AceGUI:ClearFocus() |
TreeGroup Container |
Container that uses a tree control to switch between groups. |
-------------------------------------------------------------------------------]] |
local Type, Version = "TreeGroup", 34 |
local Type, Version = "TreeGroup", 36 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
if frame.obj.noupdate then return end |
local self = frame.obj |
local status = self.status or self.localstatus |
status.scrollvalue = value |
status.scrollvalue = floor(value + 0.5) |
self:RefreshTree() |
AceGUI:ClearFocus() |
end |
Button Widget |
Graphical Button. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Button", 22 |
local Type, Version = "Button", 23 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
self:SetHeight(24) |
self:SetWidth(200) |
self:SetDisabled(false) |
self:SetAutoWidth(false) |
self:SetText() |
end, |
["SetText"] = function(self, text) |
self.text:SetText(text) |
if self.autoWidth then |
self:SetWidth(self.text:GetStringWidth() + 30) |
end |
end, |
["SetAutoWidth"] = function(self, autoWidth) |
self.autoWidth = autoWidth |
if self.autoWidth then |
self:SetWidth(self.text:GetStringWidth() + 30) |
end |
end, |
["SetDisabled"] = function(self, disabled) |
self.disabled = disabled |
--[[----------------------------------------------------------------------------- |
ColorPicker Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "ColorPicker", 20 |
local Type, Version = "ColorPicker", 22 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local self = frame.obj |
if not self.disabled then |
ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG") |
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10) |
ColorPickerFrame:SetClampedToScreen(true) |
ColorPickerFrame.func = function() |
local r, g, b = ColorPickerFrame:GetColorRGB() |