WoWInterface SVN Broadcaster

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/Broadcaster/Libs
    from Rev 2 to Rev 16
    Reverse comparison

Rev 2 → Rev 16

AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua
29,7 → 29,7
 
local AceGUI = LibStub("AceGUI-3.0")
 
local Version = 4
local Version = 6
---------------------
-- Common Elements --
---------------------
102,14 → 102,15
ClearCursor()
end
self.button:Disable()
AceGUI:ClearFocus()
end
 
function MultiLineEditBox:Acquire()
function MultiLineEditBox:OnAcquire()
self:SetDisabled(false)
self:ShowButton(true)
end
 
function MultiLineEditBox:Release()
function MultiLineEditBox:OnRelease()
self.frame:ClearAllPoints()
self.frame:Hide()
self:SetDisabled(false)
216,7 → 217,7
button:SetWidth(80)
button:SetHeight(20)
button:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",0,2)
button:SetText("Apply")
button:SetText(ACCEPT)
button:SetScript("OnClick", Button_OnClick)
button:Disable()
button:Hide()
AceGUI-3.0/widgets/AceGUIWidget-Slider.lua
5,16 → 5,16
--------------------------
do
local Type = "Slider"
local Version = 3
local Version = 5
 
local function Acquire(self)
local function OnAcquire(self)
self:SetDisabled(false)
self:SetSliderValues(0,100,1)
self:SetIsPercent(nil)
self:SetValue(0)
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.slider:EnableMouseWheel(false)
143,6 → 143,7
 
local function FrameOnMouseDown(this)
this.obj.slider:EnableMouseWheel(true)
AceGUI:ClearFocus()
end
 
local SliderBackdrop = {
157,8 → 158,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.frame = frame
frame.obj = self
205,7 → 206,7
editbox:SetFontObject(GameFontHighlightSmall)
editbox:SetPoint("TOP",slider,"BOTTOM",0,0)
editbox:SetHeight(14)
editbox:SetWidth(100)
editbox:SetWidth(70)
editbox:SetJustifyH("CENTER")
editbox:EnableMouse(true)
editbox:SetScript("OnEscapePressed",EditBox_OnEscapePressed)
213,6 → 214,12
self.editbox = editbox
editbox.obj = self
 
local bg = editbox:CreateTexture(nil,"BACKGROUND")
editbox.bg = bg
bg:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
bg:SetVertexColor(0,0,0,0.25)
bg:SetAllPoints(editbox)
 
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal")
 
frame:SetWidth(200)
AceGUI-3.0/widgets/AceGUIWidget-TabGroup.lua
24,12 → 24,15
 
]]
 
local WotLK = select(4, GetBuildInfo()) >= 30000
 
--------------------------
-- Tab Group --
--------------------------
 
do
local Type = "TabGroup"
local Version = 4
local Version = 15
 
local PaneBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
38,48 → 41,38
insets = { left = 3, right = 3, top = 5, bottom = 3 }
}
 
local function Acquire(self)
local function OnAcquire(self)
 
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.status = nil
for k in pairs(self.localstatus) do
self.localstatus[k] = nil
end
self.tablist = nil
end
 
local function Tab_FixWidth(self)
self:SetScript("OnUpdate",nil)
self:SetWidth(self.text:GetWidth()+20)
end
 
local function Tab_SetText(self, text)
self.text:SetText(text)
self:SetScript("OnUpdate",Tab_FixWidth)
self:_SetText(text)
-- TODO: Remove when 3.0 hits live
if WotLK then
PanelTemplates_TabResize(self, 0)
else
PanelTemplates_TabResize(0, self)
end
end
 
local function UpdateTabLook(self)
if self.selected then
self.left:SetAlpha(1)
self.right:SetAlpha(1)
self.middle:SetAlpha(1)
self.text:SetTextColor(1,1,1)
self:GetHighlightTexture():Hide()
if self.disabled then
PanelTemplates_SetDisabledTabState(self)
elseif self.selected then
PanelTemplates_SelectTab(self)
else
self.left:SetAlpha(0.5)
self.right:SetAlpha(0.5)
self.middle:SetAlpha(0.5)
self.text:SetTextColor(1,0.82,0)
self:GetHighlightTexture():Show()
PanelTemplates_DeselectTab(self)
end
 
if self.disabled then
self.text:SetTextColor(0.5,0.5,0.5)
self:GetHighlightTexture():Hide()
end
end
 
local function Tab_SetSelected(self, selected)
98,58 → 91,31
UpdateTabLook(self)
end
 
local function Tab_OnEnter(this)
local self = this.obj
self:Fire("OnTabEnter", self.tabs[this.id].value, this)
end
 
local function Tab_OnLeave(this)
local self = this.obj
self:Fire("OnTabLeave", self.tabs[this.id].value, this)
end
 
local function CreateTab(self, id)
local tab = CreateFrame("Button",nil,self.border)
local tabname = "AceGUITabGroup"..self.num.."Tab"..id
local tab = CreateFrame("Button",tabname,self.border,"OptionsFrameTabButtonTemplate")
tab.obj = self
tab.id = id
tab:SetWidth(64)
tab:SetHeight(32)
 
tab:SetScript("OnClick",Tab_OnClick)
tab:SetScript("OnEnter",Tab_OnEnter)
tab:SetScript("OnLeave",Tab_OnLeave)
 
tab:SetHighlightTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight")
tab:GetHighlightTexture():SetBlendMode("ADD")
tab:GetHighlightTexture():SetPoint("TOPLEFT",tab,"TOPLEFT",2,-7)
tab:GetHighlightTexture():SetPoint("BOTTOMRIGHT",tab,"BOTTOMRIGHT",-2,-3)
local left = tab:CreateTexture(nil,"BACKGROUND")
local middle = tab:CreateTexture(nil,"BACKGROUND")
local right = tab:CreateTexture(nil,"BACKGROUND")
local text = tab:CreateFontString(nil,"BACKGROUND","GameFontNormalSmall")
 
tab.text = text
tab.left = left
tab.right = right
tab.middle = middle
tab._SetText = tab.SetText
tab.SetText = Tab_SetText
tab.SetSelected = Tab_SetSelected
tab.SetDisabled = Tab_SetDisabled
 
text:SetPoint("LEFT",tab,"LEFT",5,-4)
text:SetPoint("RIGHT",tab,"RIGHT",-5,-4)
text:SetHeight(18)
text:SetText("")
 
left:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
middle:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
right:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
 
left:SetWidth(16)
left:SetHeight(32)
middle:SetWidth(44)
middle:SetHeight(32)
right:SetWidth(16)
right:SetHeight(32)
 
left:SetTexCoord(0,0.25,0,1)
middle:SetTexCoord(0.25,0.75,0,1)
right:SetTexCoord(0.75,1,0,1)
 
left:SetPoint("TOPLEFT",tab,"TOPLEFT",0,0)
right:SetPoint("TOPRIGHT",tab,"TOPRIGHT",0,0)
 
middle:SetPoint("LEFT",left,"RIGHT",0,0)
middle:SetPoint("RIGHT",right,"LEFT",0,0)
 
return tab
end
 
186,36 → 152,118
self:BuildTabs()
end
 
 
local widths = {}
local rowwidths = {}
local rowends = {}
local function BuildTabs(self)
local status = self.status or self.localstatus
local tablist = self.tablist
 
 
local tabs = self.tabs
 
for i, v in ipairs(tabs) do
v:Hide()
end
if not tablist then return end
 
 
local width = self.frame.width or self.frame:GetWidth() or 0
 
for i = #widths, 1, -1 do
widths[i] = nil
end
for i = #rowwidths, 1, -1 do
rowwidths[i] = nil
end
for i = #rowends, 1, -1 do
rowends[i] = nil
end
 
--Place Text into tabs and get thier initial width
for i, v in ipairs(tablist) do
local tab = tabs[i]
if not tab then
tab = self:CreateTab(i)
tabs[i] = tab
if i == 1 then
tab:SetPoint("BOTTOMLEFT",self.border,"TOPLEFT",0,-3)
else
tab:SetPoint("LEFT",tabs[i-1],"RIGHT",-3,0)
end
end
 
tab:Show()
tab:SetText(v.text)
tab:SetDisabled(v.disabled)
tab.value = v.value
 
widths[i] = tab:GetWidth() - 10 --tabs are anchored 10 pixels from the right side of the previous one to reduce spacing
end
if #tablist > 1 then
self:SelectTab(status.selected or tablist[1].value)
 
--First pass, find the minimum number of rows needed to hold all tabs and the initial tab layout
local numtabs = #tablist
local numrows = 1
local usedwidth = 0
 
for i = 1, #tablist do
--If this is not the first tab of a row and there isn't room for it
if usedwidth ~= 0 and (width - usedwidth - widths[i]) < 0 then
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
rowends[numrows] = i - 1
numrows = numrows + 1
usedwidth = 0
end
usedwidth = usedwidth + widths[i]
end
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
rowends[numrows] = #tablist
 
--Fix for single tabs being left on the last row, move a tab from the row above if applicable
if numrows > 1 then
--if the last row has only one tab
if rowends[numrows-1] == numtabs-1 then
--if there are more than 2 tabs in the 2nd last row
if (numrows == 2 and rowends[numrows-1] > 2) or (rowends[numrows] - rowends[numrows-1] > 2) then
--move 1 tab from the second last row to the last
rowends[numrows-1] = rowends[numrows-1] - 1
rowwidths[numrows] = rowwidths[numrows] + widths[numtabs-1]
rowwidths[numrows-1] = rowwidths[numrows-1] - widths[numtabs-1]
end
end
end
 
--anchor the rows as defined and resize tabs to fill thier row
local starttab = 1
for row, endtab in ipairs(rowends) do
local first = true
for tabno = starttab, endtab do
local tab = tabs[tabno]
tab:ClearAllPoints()
if first then
tab:SetPoint("TOPLEFT",self.frame,"TOPLEFT",0,-7-(row-1)*20 )
first = false
else
tab:SetPoint("LEFT",tabs[tabno-1],"RIGHT",-10,0)
end
end
--equal padding for each tab to fill the available width
local padding = (width - rowwidths[row]) / (endtab - starttab+1)
for i = starttab, endtab do
-- TODO: Remove when 3.0 hits live
if WotLK then
PanelTemplates_TabResize(tabs[i], padding)
else
PanelTemplates_TabResize(padding, tabs[i])
end
end
starttab = endtab + 1
end
 
self.borderoffset = 10+((numrows)*20)
self.border:SetPoint("TOPLEFT",self.frame,"TOPLEFT",3,-self.borderoffset)
end
 
local function BuildTabsOnUpdate(this)
BuildTabs(this.obj)
this:SetScript("OnUpdate", nil)
end
 
local function OnWidthSet(self, width)
local content = self.content
local contentwidth = width - 60
224,29 → 272,32
end
content:SetWidth(contentwidth)
content.width = contentwidth
BuildTabs(self)
self.frame:SetScript("OnUpdate", BuildTabsOnUpdate)
end
 
 
local function OnHeightSet(self, height)
local content = self.content
local contentheight = height - 26
local contentheight = height - (self.borderoffset + 23)
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end
 
 
local function Constructor()
local frame = CreateFrame("Frame",nil,UIParent)
local self = {}
self.type = Type
 
self.num = AceGUI:GetNextWidgetNum(Type)
 
self.localstatus = {}
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetTitle = SetTitle
self.CreateTab = CreateTab
self.SelectTab = SelectTab
274,7 → 325,8
 
local border = CreateFrame("Frame",nil,frame)
self.border = border
border:SetPoint("TOPLEFT",frame,"TOPLEFT",3,-37)
self.borderoffset = 27
border:SetPoint("TOPLEFT",frame,"TOPLEFT",3,-27)
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-3,3)
 
border:SetBackdrop(PaneBackdrop)
AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua
5,7 → 5,7
--------------------------
do
local Type = "Keybinding"
local Version = 6
local Version = 8
 
local ControlBackdrop = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
42,6 → 42,7
self.waitingForKey = true
end
end
AceGUI:ClearFocus()
end
 
local ignoreKeys = nil
96,10 → 97,10
Keybinding_OnKeyDown(this, button)
end
 
local function Acquire(self)
local function OnAcquire(self)
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.waitingForKey = nil
125,15 → 126,16
self.label:SetText(label or "")
end
 
local count = 0
 
local function Constructor()
count = count + 1
local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame",nil,UIParent)
 
local button = CreateFrame("Button","AceGUI-3.0 KeybindingButton"..count,frame,"UIPanelButtonTemplate2")
local button = CreateFrame("Button","AceGUI-3.0 KeybindingButton"..num,frame,"UIPanelButtonTemplate2")
 
local self = {}
self.type = Type
self.num = num
 
local text = button:GetFontString()
text:SetPoint("LEFT",button,"LEFT",7,0)
181,8 → 183,8
msgframe:SetPoint("BOTTOM",button,"TOP",0,0)
msgframe:Hide()
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetLabel = SetLabel
self.SetDisabled = SetDisabled
self.SetKey = SetKey
AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua
10,14 → 10,14
]]
do
local Type = "CheckBox"
local Version = 3
local Version = 4
 
local function Acquire(self)
local function OnAcquire(self)
self:SetValue(false)
self.tristate = nil
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.check:Hide()
60,6 → 60,7
self.text:SetPoint("LEFT",self.check,"RIGHT",1,-1)
self.down = true
end
AceGUI:ClearFocus()
end
 
local function SetDisabled(self,disabled)
159,8 → 160,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.SetValue = SetValue
self.GetValue = GetValue
AceGUI-3.0/widgets/AceGUIWidget-Icon.lua
5,14 → 5,14
--------------------------
do
local Type = "Icon"
local Version = 3
local Version = 4
 
local function Acquire(self)
local function OnAcquire(self)
self:SetText("")
self:SetImage(nil)
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end
38,6 → 38,7
 
local function OnClick(this)
this.obj:Fire("OnClick")
AceGUI:ClearFocus()
end
 
local function OnEnter(this)
53,8 → 54,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetText = SetText
self.frame = frame
self.SetImage = SetImage
AceGUI-3.0/widgets/AceGUIWidget-BlizOptionsGroup.lua
34,13 → 34,13
 
do
local Type = "BlizOptionsGroup"
local Version = 5
local Version = 6
 
local function Acquire(self)
local function OnAcquire(self)
 
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self:SetName()
110,8 → 110,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.frame = frame
self.SetName = SetName
 
AceGUI-3.0/widgets/AceGUIWidget-Frame.lua
10,7 → 10,7
]]
do
local Type = "Frame"
local Version = 3
local Version = 7
 
local FrameBackdrop = {
bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
30,21 → 30,17
this.obj:Fire("OnClose")
end
 
local function frameOnSizeChanged(this)
local self = this.obj
local status = self.status or self.localstatus
status.width = this:GetWidth()
status.height = this:GetHeight()
status.top = this:GetTop()
status.left = this:GetLeft()
end
 
local function closeOnClick(this)
this.obj:Hide()
end
 
local function frameOnMouseDown(this)
AceGUI:ClearFocus()
end
 
local function titleOnMouseDown(this)
this:GetParent():StartMoving()
AceGUI:ClearFocus()
end
 
local function frameOnMouseUp(this)
60,18 → 56,21
 
local function sizerseOnMouseDown(this)
this:GetParent():StartSizing("BOTTOMRIGHT")
AceGUI:ClearFocus()
end
 
local function sizersOnMouseDown(this)
this:GetParent():StartSizing("BOTTOM")
AceGUI:ClearFocus()
end
 
local function sizereOnMouseDown(this)
this:GetParent():StartSizing("RIGHT")
AceGUI:ClearFocus()
end
 
local function sizerOnMouseUp(this)
this:GetParent():StopMovingOrSizing()
this:GetParent():StopMovingOrSizing()
end
 
local function SetTitle(self,title)
90,13 → 89,13
self.frame:Show()
end
 
local function Acquire(self)
local function OnAcquire(self)
self.frame:SetParent(UIParent)
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
self:ApplyStatus()
end
 
local function Release(self)
local function OnRelease(self)
self.status = nil
for k in pairs(self.localstatus) do
self.localstatus[k] = nil
113,8 → 112,8
local function ApplyStatus(self)
local status = self.status or self.localstatus
local frame = self.frame
frame:SetWidth(status.width or 700)
frame:SetHeight(status.height or 500)
self:SetWidth(status.width or 700)
self:SetHeight(status.height or 500)
if status.top and status.left then
frame:SetPoint("TOP",UIParent,"BOTTOM",0,status.top)
frame:SetPoint("LEFT",UIParent,"LEFT",status.left,0)
125,7 → 124,7
 
local function OnWidthSet(self, width)
local content = self.content
local contentwidth = width - 44
local contentwidth = width - 34
if contentwidth < 0 then
contentwidth = 0
end
144,7 → 143,6
content.height = contentheight
end
 
 
local function Constructor()
local frame = CreateFrame("Frame",nil,UIParent)
local self = {}
153,8 → 151,8
self.Hide = Hide
self.Show = Show
self.SetTitle = SetTitle
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetStatusText = SetStatusText
self.SetStatusTable = SetStatusTable
self.ApplyStatus = ApplyStatus
172,12 → 170,12
frame:SetMovable(true)
frame:SetResizable(true)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetScript("OnMouseDown", frameOnMouseDown)
 
frame:SetBackdrop(FrameBackdrop)
frame:SetBackdropColor(0,0,0,1)
frame:SetScript("OnHide",frameOnClose)
frame:SetMinResize(400,200)
frame:SetScript("OnSizeChanged", frameOnSizeChanged)
frame:SetToplevel(true)
 
local closebutton = CreateFrame("Button",nil,frame,"UIPanelButtonTemplate")
210,7 → 208,7
local title = CreateFrame("Frame",nil,frame)
self.title = title
title:EnableMouse()
title:SetScript("OnMouseDown",frameOnMouseDown)
title:SetScript("OnMouseDown",titleOnMouseDown)
title:SetScript("OnMouseUp", frameOnMouseUp)
 
 
AceGUI-3.0/widgets/AceGUIWidget-InlineGroup.lua
35,14 → 35,14
 
do
local Type = "InlineGroup"
local Version = 3
local Version = 4
 
local function Acquire(self)
local function OnAcquire(self)
self:SetWidth(300)
self:SetHeight(100)
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end
89,8 → 89,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetTitle = SetTitle
self.frame = frame
self.LayoutFinished = LayoutFinished
AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua
1,17 → 1,37
--[[ $Id: AceGUIWidget-DropDown.lua 81438 2008-09-06 13:44:36Z nevcairiel $ ]]--
local min, max, floor = math.min, math.max, math.floor
 
local AceGUI = LibStub("AceGUI-3.0")
 
--------------------------
-- Dropdown --
--------------------------
--[[
Events :
OnValueChanged
local function fixlevels(parent,...)
local i = 1
local child = select(i, ...)
while child do
child:SetFrameLevel(parent:GetFrameLevel()+1)
fixlevels(child, child:GetChildren())
i = i + 1
child = select(i, ...)
end
end
 
]]
local function fixstrata(strata, parent, ...)
local i = 1
local child = select(i, ...)
parent:SetFrameStrata(strata)
while child do
fixstrata(strata, child, child:GetChildren())
i = i + 1
child = select(i, ...)
end
end
 
do
local Type = "Dropdown"
local Version = 10
local ControlBackdrop = {
local widgetType = "Dropdown-Pullout"
local widgetVersion = 2
 
--[[ Static data ]]--
 
local backdrop = {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
edgeSize = 32,
19,53 → 39,329
tile = true,
insets = { left = 11, right = 12, top = 12, bottom = 11 },
}
local sliderBackdrop = {
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
tile = true, tileSize = 8, edgeSize = 8,
insets = { left = 3, right = 3, top = 3, bottom = 3 }
}
 
local function Acquire(self)
self:SetLabel("")
local defaultWidth = 200
local defaultMaxHeight = 600
 
--[[ UI Event Handlers ]]--
 
-- HACK: This should be no part of the pullout, but there
-- is no other 'clean' way to response to any item-OnEnter
-- Used to close Submenus when an other item is entered
local function OnEnter(item)
local self = item.pullout
for k, v in ipairs(self.items) do
if v.CloseMenu and v ~= item then
v:CloseMenu()
end
end
end
 
local function Release(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self:SetLabel(nil)
self.list = nil
self:SetDisabled(false)
-- See the note in Constructor() for each scroll related function
local function OnMouseWheel(this, value)
this.obj:MoveScroll(value)
end
 
local function OnScrollValueChanged(this, value)
this.obj:SetScroll(value)
end
 
local function OnSizeChanged(this)
this.obj:FixScroll()
end
 
--[[ Exported methods ]]--
 
-- exported
local function SetScroll(self, value)
local status = self.scrollStatus
local frame, child = self.scrollFrame, self.itemFrame
local height, viewheight = frame:GetHeight(), child:GetHeight()
 
local function Control_OnEnter(this)
this.obj:Fire("OnEnter")
local offset
if height > viewheight then
offset = 0
else
offset = floor((viewheight - height) / 1000 * value)
end
child:ClearAllPoints()
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", self.slider:IsShown() and -12 or 0, offset)
status.offset = offset
status.scrollvalue = value
end
 
local function Control_OnLeave(this)
this.obj:Fire("OnLeave")
-- exported
local function MoveScroll(self, value)
local status = self.scrollStatus
local frame, child = self.scrollFrame, self.itemFrame
local height, viewheight = frame:GetHeight(), child:GetHeight()
 
if height > viewheight then
self.slider:Hide()
else
self.slider:Show()
local diff = height - viewheight
local delta = 1
if value < 0 then
delta = -1
end
self.slider:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
end
end
 
local function SetText(self, text)
self.text:SetText(text or "")
-- exported
local function FixScroll(self)
local status = self.scrollStatus
local frame, child = self.scrollFrame, self.itemFrame
local height, viewheight = frame:GetHeight(), child:GetHeight()
local offset = status.offset or 0
 
if viewheight < height then
self.slider:Hide()
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, offset)
self.slider:SetValue(0)
else
self.slider:Show()
local value = (offset / (viewheight - height) * 1000)
if value > 1000 then value = 1000 end
self.slider:SetValue(value)
self:SetScroll(value)
if value < 1000 then
child:ClearAllPoints()
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -12, offset)
status.offset = offset
end
end
end
 
local function SetValue(self, value)
if self.list then
self.text:SetText(self.list[value] or "")
-- exported, AceGUI callback
local function OnAcquire(self)
self.frame:SetParent(UIParent)
--self.itemFrame:SetToplevel(true)
end
 
-- exported, AceGUI callback
local function OnRelease(self)
self:Clear()
self.frame:ClearAllPoints()
self.frame:Hide()
end
 
-- exported
local function AddItem(self, item)
self.items[#self.items + 1] = item
 
local h = #self.items * 16
self.itemFrame:SetHeight(h)
self.frame:SetHeight(min(h + 34, self.maxHeight)) -- +34: 20 for scrollFrame placement (10 offset) and +14 for item placement
 
item.frame:SetPoint("LEFT", self.itemFrame, "LEFT")
item.frame:SetPoint("RIGHT", self.itemFrame, "RIGHT")
 
item:SetPullout(self)
item:SetOnEnter(OnEnter)
end
 
-- exported
local function Open(self, point, relFrame, relPoint, x, y)
local items = self.items
local frame = self.frame
local itemFrame = self.itemFrame
 
frame:SetPoint(point, relFrame, relPoint, x, y)
 
 
local height = 8
for i, item in pairs(items) do
if i == 1 then
item:SetPoint("TOP", itemFrame, "TOP", 0, -2)
else
item:SetPoint("TOP", items[i-1].frame, "BOTTOM", 0, 1)
end
 
item:Show()
 
height = height + 16
end
self.text.value = value
itemFrame:SetHeight(height)
fixstrata("TOOLTIP", frame, frame:GetChildren())
frame:Show()
self:Fire("OnOpen")
end
 
-- exported
local function Close(self)
self.frame:Hide()
self:Fire("OnClose")
end
 
-- exported
local function Clear(self)
local items = self.items
for i, item in pairs(items) do
AceGUI:Release(item)
items[i] = nil
end
end
 
-- exported
local function IterateItems(self)
return ipairs(self.items)
end
 
local function SetList(self, list)
self.list = list
-- exported
local function SetHideOnLeave(self, val)
self.hideOnLeave = val
end
 
local function AddItem(self, value, text)
if self.list then
self.list[value] = text
-- exported
local function SetMaxHeight(self, height)
self.maxHeight = height or defaultMaxHeight
if self.frame:GetHeight() > height then
self.frame:SetHeight(height)
elseif (self.itemFrame:GetHeight() + 34) < height then
self.frame:SetHeight(self.itemFrame:GetHeight() + 34) -- see :AddItem
end
end
 
-- exported
local function GetRightBorderWidth(self)
return 6 + (self.slider:IsShown() and 12 or 0)
end
 
local function Dropdown_OnEnterPressed(this)
-- exported
local function GetLeftBorderWidth(self)
return 6
end
 
--[[ Constructor ]]--
 
local function Constructor()
local count = AceGUI:GetNextWidgetNum(widgetType)
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent)
local self = {}
self.count = count
self.type = widgetType
self.frame = frame
frame.obj = self
 
self.OnAcquire = OnAcquire
self.OnRelease = OnRelease
 
self.AddItem = AddItem
self.Open = Open
self.Close = Close
self.Clear = Clear
self.IterateItems = IterateItems
self.SetHideOnLeave = SetHideOnLeave
 
self.SetScroll = SetScroll
self.MoveScroll = MoveScroll
self.FixScroll = FixScroll
 
self.SetMaxHeight = SetMaxHeight
self.GetRightBorderWidth = GetRightBorderWidth
self.GetLeftBorderWidth = GetLeftBorderWidth
 
self.items = {}
 
self.scrollStatus = {
scrollvalue = 0,
}
 
self.maxHeight = defaultMaxHeight
 
frame:SetBackdrop(backdrop)
frame:SetBackdropColor(0, 0, 0)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetClampedToScreen(true)
frame:SetWidth(defaultWidth)
frame:SetHeight(self.maxHeight)
--frame:SetToplevel(true)
 
-- NOTE: The whole scroll frame code is copied from the AceGUI-3.0 widget ScrollFrame
local scrollFrame = CreateFrame("ScrollFrame", nil, frame)
local itemFrame = CreateFrame("Frame", nil, scrollFrame)
 
self.scrollFrame = scrollFrame
self.itemFrame = itemFrame
 
scrollFrame.obj = self
itemFrame.obj = self
 
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame)
slider:SetOrientation("VERTICAL")
slider:SetHitRectInsets(0, 0, -10, 0)
slider:SetBackdrop(sliderBackdrop)
slider:SetWidth(8)
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Vertical")
slider:SetFrameStrata("FULLSCREEN_DIALOG")
self.slider = slider
slider.obj = self
 
scrollFrame:SetScrollChild(itemFrame)
scrollFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 6, -12)
scrollFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -6, 12)
scrollFrame:EnableMouseWheel(true)
scrollFrame:SetScript("OnMouseWheel", OnMouseWheel)
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
scrollFrame:SetToplevel(true)
scrollFrame:SetFrameStrata("FULLSCREEN_DIALOG")
 
itemFrame:SetPoint("TOPLEFT", scrollFrame, "TOPLEFT", 0, 0)
itemFrame:SetPoint("TOPRIGHT", scrollFrame, "TOPRIGHT", -12, 0)
itemFrame:SetHeight(400)
itemFrame:SetToplevel(true)
itemFrame:SetFrameStrata("FULLSCREEN_DIALOG")
 
slider:SetPoint("TOPLEFT", scrollFrame, "TOPRIGHT", -16, 0)
slider:SetPoint("BOTTOMLEFT", scrollFrame, "BOTTOMRIGHT", -16, 0)
slider:SetScript("OnValueChanged", OnScrollValueChanged)
slider:SetMinMaxValues(0, 1000)
slider:SetValueStep(1)
slider:SetValue(0)
 
scrollFrame:Show()
itemFrame:Show()
slider:Hide()
 
self:FixScroll()
 
AceGUI:RegisterAsWidget(self)
return self
end
 
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion)
end
 
do
local widgetType = "Dropdown"
local widgetVersion = 18
 
--[[ Static data ]]--
 
--[[ UI event handler ]]--
 
local function Control_OnEnter(this)
this.obj:Fire("OnEnter")
end
 
local function Control_OnLeave(this)
this.obj:Fire("OnLeave")
end
 
local function Dropdown_OnHide(this)
local self = this.obj
if not self.disabled then
local ret = this.value or this:GetText()
self:Fire("OnValueChanged",ret)
if self.open then
self.pullout:Close()
end
end
 
73,37 → 369,105
local self = this.obj
if self.open then
self.open = nil
self.pullout:Hide()
self.pullout:Close()
AceGUI:ClearFocus()
else
self.open = true
self:BuildPullout()
if self.lines[1] and self.lines[1]:IsShown() then
self.pullout:Show()
self.pullout:SetWidth(self.frame:GetWidth())
self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0)
AceGUI:SetFocus(self)
end
end
 
local function OnPulloutOpen(this)
local self = this.userdata.obj
local value = self.value
 
if not self.multiselect then
for i, item in this:IterateItems() do
item:SetValue(item.userdata.value == value)
end
end
 
self.open = true
end
 
local function OnPulloutClose(this)
local self = this.userdata.obj
self.open = nil
self:Fire("OnClosed")
end
 
local function Dropdown_OnHide(this)
this.obj.pullout:Hide()
local function ShowMultiText(self)
local text
for i, widget in self.pullout:IterateItems() do
if widget.type == "Dropdown-Item-Toggle" then
if widget:GetValue() then
if text then
text = text..", "..widget:GetText()
else
text = widget:GetText()
end
end
end
end
self:SetText(text)
end
 
local function Dropdown_LineClicked(this)
local self = this.obj
self.open = false
self.pullout:Hide()
self.text:SetText(this.text:GetText())
self.text.value = this.value
Dropdown_OnEnterPressed(self.text)
local function OnItemValueChanged(this, event, checked)
local self = this.userdata.obj
 
if self.multiselect then
self:Fire("OnValueChanged", this.userdata.value, checked)
ShowMultiText(self)
else
if checked then
self:SetValue(this.userdata.value)
self:Fire("OnValueChanged", this.userdata.value)
else
this:SetValue(true)
end
if self.open then
self.pullout:Close()
end
end
end
 
local function Dropdown_LineEnter(this)
this.highlight:Show()
--[[ Exported methods ]]--
 
-- exported, AceGUI callback
local function OnAcquire(self)
local pullout = AceGUI:Create("Dropdown-Pullout")
self.pullout = pullout
pullout.userdata.obj = self
pullout:SetCallback("OnClose", OnPulloutClose)
pullout:SetCallback("OnOpen", OnPulloutOpen)
self.pullout.frame:SetFrameLevel(self.frame:GetFrameLevel() + 1)
fixlevels(self.pullout.frame, self.pullout.frame:GetChildren())
end
 
local function Dropdown_LineLeave(this)
this.highlight:Hide()
end
-- exported, AceGUI callback
local function OnRelease(self)
if self.open then
self.pullout:Close()
end
AceGUI:Release(self.pullout)
 
self:SetText("")
self:SetLabel("")
self:SetDisabled(false)
self:SetMultiselect(false)
 
self.value = nil
self.list = nil
self.open = nil
self.hasClose = nil
 
self.frame:ClearAllPoints()
self.frame:Hide()
end
 
-- exported
local function SetDisabled(self, disabled)
self.disabled = disabled
if disabled then
117,70 → 481,19
end
end
 
local function fixlevels(parent,...)
local i = 1
local child = select(i, ...)
while child do
child:SetFrameLevel(parent:GetFrameLevel()+1)
fixlevels(child, child:GetChildren())
i = i + 1
child = select(i, ...)
-- exported
local function ClearFocus(self)
if self.open then
self.pullout:Close()
end
end
 
local ddsort = {}
local function BuildPullout(self)
local list = self.list
local lines = self.lines
local totalheight = 22
self:ClearPullout()
self.pullout:SetFrameLevel(self.frame:GetFrameLevel()+1000)
if type(list) == "table" then
for k, v in pairs(list) do
tinsert(ddsort,k)
end
table.sort(ddsort)
for i, value in pairs(ddsort) do
local text = list[value]
if not lines[i] then
lines[i] = self:CreateLine()
if i == 1 then
lines[i]:SetPoint("TOP",self.pullout,"TOP",0,-10)
else
lines[i]:SetPoint("TOP",lines[i-1],"BOTTOM",0,1)
end
end
lines[i].text:SetText(text)
lines[i]:SetFrameLevel(self.frame:GetFrameLevel()+1001)
lines[i].value = value
if lines[i].value == self.text.value then
lines[i].check:Show()
else
lines[i].check:Hide()
end
lines[i]:Show()
totalheight = totalheight + 16
i = i + 1
end
for k in pairs(ddsort) do
ddsort[k] = nil
end
end
self.pullout:SetHeight(totalheight)
fixlevels(self.pullout,self.pullout:GetChildren())
-- exported
local function SetText(self, text)
self.text:SetText(text or "")
end
 
local function ClearPullout(self)
if self.lines then
for i, line in ipairs(self.lines) do
line.text:SetText("")
line:Hide()
end
end
self.pullout:SetHeight(10)
self.pullout:SetWidth(200)
end
 
-- exported
local function SetLabel(self, text)
if text and text ~= "" then
self.label:SetText(text)
194,80 → 507,142
self.frame:SetHeight(26)
end
end
 
local function CreateLine(self, row, column)
local frame = CreateFrame("Button",nil,self.pullout)
frame.text = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
frame.text:SetTextColor(1,1,1)
frame.text:SetJustifyH("LEFT")
frame:SetHeight(17)
frame:SetPoint("LEFT",self.pullout,"LEFT",6,0)
frame:SetPoint("RIGHT",self.pullout,"RIGHT",-6,0)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame.obj = self
 
local highlight = frame:CreateTexture(nil, "OVERLAY")
highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
highlight:SetBlendMode("ADD")
highlight:SetHeight(14)
highlight:ClearAllPoints()
highlight:SetPoint("RIGHT",frame,"RIGHT",-3,0)
highlight:SetPoint("LEFT",frame,"LEFT",5,0)
highlight:Hide()
frame.highlight = highlight
-- exported
local function SetValue(self, value)
if self.list then
self:SetText(self.list[value] or "")
end
self.value = value
end
 
local check = frame:CreateTexture("OVERLAY")
frame.check = check
check:SetWidth(16)
check:SetHeight(16)
check:SetPoint("LEFT",frame,"LEFT",3,-1)
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
frame.text:SetPoint("TOPLEFT",frame,"TOPLEFT",18,0)
frame.text:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-8,0)
-- exported
local function SetItemValue(self, item, value)
if not self.multiselect then return end
for i, widget in self.pullout:IterateItems() do
if widget.userdata.value == item then
if widget.SetValue then
widget:SetValue(value)
end
end
end
ShowMultiText(self)
end
 
frame:SetScript("OnClick",Dropdown_LineClicked)
frame:SetScript("OnEnter",Dropdown_LineEnter)
frame:SetScript("OnLeave",Dropdown_LineLeave)
return frame
-- exported
local function SetItemDisabled(self, item, disabled)
for i, widget in self.pullout:IterateItems() do
if widget.userdata.value == item then
widget:SetDisabled(disabled)
end
end
end
 
local count = 0
local function AddListItem(self, value, text)
local item = AceGUI:Create("Dropdown-Item-Toggle")
item:SetText(text)
item.userdata.obj = self
item.userdata.value = value
item:SetCallback("OnValueChanged", OnItemValueChanged)
self.pullout:AddItem(item)
end
 
local function AddCloseButton(self)
if not self.hasClose then
local close = AceGUI:Create("Dropdown-Item-Execute")
close:SetText(CLOSE)
self.pullout:AddItem(close)
self.hasClose = true
end
end
 
-- exported
local sortlist = {}
local function SetList(self, list)
self.list = list
self.pullout:Clear()
self.hasClose = nil
if not list then return end
 
for v in pairs(list) do
sortlist[#sortlist + 1] = v
end
table.sort(sortlist)
 
for i, value in pairs(sortlist) do
AddListItem(self, value, list[value])
sortlist[i] = nil
end
if self.multiselect then
ShowMultiText(self)
AddCloseButton(self)
end
end
 
-- exported
local function AddItem(self, value, text)
if self.list then
self.list[value] = text
AddListItem(self, value, text)
end
end
 
-- exported
local function SetMultiselect(self, multi)
self.multiselect = multi
if multi then
ShowMultiText(self)
AddCloseButton(self)
end
end
 
-- exported
local function GetMultiselect(self)
return self.multiselect
end
 
--[[ Constructor ]]--
 
local function Constructor()
count = count + 1
local count = AceGUI:GetNextWidgetNum(widgetType)
local frame = CreateFrame("Frame", nil, UIParent)
local dropdown = CreateFrame("Frame", "AceGUI30DropDown"..count, frame, "UIDropDownMenuTemplate")
 
local self = {}
local frame = CreateFrame("Frame",nil,UIParent)
local dropdown = CreateFrame("Frame","AceGUI30DropDown" .. count,frame, "UIDropDownMenuTemplate")
self.type = widgetType
self.frame = frame
self.dropdown = dropdown
self.type = Type
self.count = count
frame.obj = self
dropdown.obj = self
 
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.ClearFocus = ClearFocus
 
self.Release = Release
self.Acquire = Acquire
 
self.CreateLine = CreateLine
self.ClearPullout = ClearPullout
self.BuildPullout = BuildPullout
self.SetText = SetText
self.SetValue = SetValue
self.SetList = SetList
self.AddItem = AddItem
self.SetLabel = SetLabel
self.SetText = SetText
self.SetValue = SetValue
self.SetList = SetList
self.SetLabel = SetLabel
self.SetDisabled = SetDisabled
self.AddItem = AddItem
self.SetMultiselect = SetMultiselect
self.GetMultiselect = GetMultiselect
self.SetItemValue = SetItemValue
self.SetItemDisabled = SetItemDisabled
 
self.frame = frame
frame.obj = self
self.alignoffset = 31
 
self.alignoffset = 30
 
frame:SetHeight(44)
frame:SetWidth(200)
frame:SetScript("OnHide",Dropdown_OnHide)
 
 
dropdown:ClearAllPoints()
dropdown:SetPoint("TOPLEFT",frame,"TOPLEFT",-15,0)
dropdown:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",17,0)
dropdown:SetScript("OnHide", nil)
 
-- fix anchoring of the dropdown
 
local left = _G[dropdown:GetName() .. "Left"]
local middle = _G[dropdown:GetName() .. "Middle"]
local right = _G[dropdown:GetName() .. "Right"]
293,17 → 668,6
text:SetPoint("RIGHT", right, "RIGHT" ,-43, 2)
text:SetPoint("LEFT", left, "LEFT", 25, 2)
 
local pullout = CreateFrame("Frame",nil,UIParent)
self.pullout = pullout
frame:EnableMouse()
pullout:SetBackdrop(ControlBackdrop)
pullout:SetBackdropColor(0,0,0)
pullout:SetFrameStrata("FULLSCREEN_DIALOG")
pullout:SetPoint("TOPLEFT",frame,"BOTTOMLEFT",0,0)
pullout:SetPoint("TOPRIGHT",frame,"BOTTOMRIGHT",0,0)
pullout:SetClampedToScreen(true)
pullout:Hide()
 
local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
label:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,0)
311,12 → 675,10
label:SetHeight(18)
label:Hide()
self.label = label
 
self.lines = {}
 
AceGUI:RegisterAsWidget(self)
return self
end
 
AceGUI:RegisterWidgetType(Type,Constructor,Version)
end
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion)
end
AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua
11,14 → 11,14
]]
do
local Type = "EditBox"
local Version = 5
 
local function Acquire(self)
local Version = 8
 
local function OnAcquire(self)
self:SetDisabled(false)
self.showbutton = true
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self:SetDisabled(false)
80,6 → 80,7
ClearCursor()
end
HideButton(self)
AceGUI:ClearFocus()
end
 
local function EditBox_OnTextChanged(this)
131,17 → 132,18
end
end
 
local count = 0
 
local function Constructor()
count = count + 1
local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame",nil,UIParent)
local editbox = CreateFrame("EditBox","AceGUI-3.0EditBox"..count,frame,"InputBoxTemplate")
local editbox = CreateFrame("EditBox","AceGUI-3.0EditBox"..num,frame,"InputBoxTemplate")
 
local self = {}
self.type = Type
self.num = num
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.SetDisabled = SetDisabled
self.SetText = SetText
168,6 → 170,7
editbox:SetScript("OnTextChanged",EditBox_OnTextChanged)
editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag)
editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag)
 
editbox:SetTextInsets(0,0,3,3)
editbox:SetMaxLetters(256)
 
183,10 → 186,10
self.label = label
 
local button = CreateFrame("Button",nil,editbox,"UIPanelButtonTemplate")
button:SetWidth(20)
button:SetWidth(40)
button:SetHeight(20)
button:SetPoint("RIGHT",editbox,"RIGHT",-2,0)
button:SetText("OK")
button:SetText(OKAY)
button:SetScript("OnClick", Button_OnClick)
button:Hide()
 
AceGUI-3.0/widgets/AceGUIWidget-Heading.lua
5,13 → 5,13
--------------------------
do
local Type = "Heading"
local Version = 2
local Version = 3
 
local function Acquire(self)
local function OnAcquire(self)
self:SetText("")
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end
32,8 → 32,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetText = SetText
self.frame = frame
frame.obj = self
AceGUI-3.0/widgets/AceGUIWidget-SimpleGroup.lua
35,14 → 35,14
 
do
local Type = "SimpleGroup"
local Version = 3
local Version = 4
 
local function Acquire(self)
local function OnAcquire(self)
self:SetWidth(300)
self:SetHeight(100)
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end
68,8 → 68,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.frame = frame
self.LayoutFinished = LayoutFinished
self.OnWidthSet = OnWidthSet
AceGUI-3.0/widgets/AceGUIWidget-DropDownGroup.lua
1,30 → 1,6
local AceGUI = LibStub("AceGUI-3.0")
 
-------------
-- Widgets --
-------------
--[[
Widgets must provide the following functions
Acquire() - Called when the object is aquired, should set everything to a default hidden state
Release() - Called when the object is Released, should remove any anchors and hide the Widget
 
And the following members
frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes
type - the type of the object, same as the name given to :RegisterWidget()
 
Widgets contain a table called userdata, this is a safe place to store data associated with the wigdet
It will be cleared automatically when a widget is released
Placing values directly into a widget object should be avoided
 
If the Widget can act as a container for other Widgets the following
content - frame or derivitive that children will be anchored to
 
The Widget can supply the following Optional Members
 
 
]]
 
--[[
Selection Group controls all have an interface to select a group for thier contents
None of them will auto size to thier contents, and should usually be used with a scrollframe
unless you know that the controls will fit inside
40,13 → 16,13
]]
do
local Type = "DropdownGroup"
local Version = 5
local Version = 9
 
local function Acquire(self)
local function OnAcquire(self)
self.dropdown:SetText("")
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.dropdown.list = nil
71,12 → 47,12
local function SelectedGroup(self,event,value)
local group = self.parentgroup
local status = group.status or group.localstatus
status.selectedgroup = value
status.selected = value
self.parentgroup:Fire("OnGroupSelected", value)
end
 
local function SetGroupList(self,list)
self.dropdown.list = list
self.dropdown:SetList(list)
end
 
-- called to set an external table to store status in
88,13 → 64,13
local function SetGroup(self,group)
self.dropdown:SetValue(group)
local status = self.status or self.localstatus
status.selectedgroup = group
status.selected = group
self:Fire("OnGroupSelected", group)
end
 
local function OnWidthSet(self, width)
local content = self.content
local contentwidth = width - 63
local contentwidth = width - 26
if contentwidth < 0 then
contentwidth = 0
end
105,7 → 81,7
 
local function OnHeightSet(self, height)
local content = self.content
local contentheight = height - 26
local contentheight = height - 63
if contentheight < 0 then
contentheight = 0
end
118,10 → 94,10
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.SetTitle = SetTitle
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.SetTitle = SetTitle
self.SetGroupList = SetGroupList
self.SetGroup = SetGroup
self.SetStatusTable = SetStatusTable
AceGUI-3.0/widgets/AceGUIWidget-ScrollFrame.lua
29,13 → 29,13
--------------------------
do
local Type = "ScrollFrame"
local Version = 2
local Version = 3
 
local function Acquire(self)
local function OnAcquire(self)
 
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.status = nil
161,8 → 161,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.MoveScroll = MoveScroll
self.FixScroll = FixScroll
AceGUI-3.0/widgets/AceGUIWidget-Button.lua
5,12 → 5,12
--------------------------
do
local Type = "Button"
local Version = 5
local Version = 7
 
local function Acquire(self)
local function OnAcquire(self)
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self:SetDisabled(false)
18,6 → 18,7
 
local function Button_OnClick(this)
this.obj:Fire("OnClick")
AceGUI:ClearFocus()
end
 
local function Button_OnEnter(this)
41,11 → 42,11
end
end
 
local count = 0
local function Constructor()
count = count + 1
local frame = CreateFrame("Button","AceGUI30Button"..count,UIParent,"UIPanelButtonTemplate2")
local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Button","AceGUI30Button"..num,UIParent,"UIPanelButtonTemplate2")
local self = {}
self.num = num
self.type = Type
self.frame = frame
 
66,8 → 67,8
frame:SetHeight(24)
frame:SetWidth(200)
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.frame = frame
frame.obj = self
AceGUI-3.0/widgets/AceGUIWidget-TreeGroup.lua
21,37 → 21,18
end
end
 
-------------
-- Widgets --
-------------
--[[
Widgets must provide the following functions
Acquire() - Called when the object is aquired, should set everything to a default hidden state
Release() - Called when the object is Released, should remove any anchors and hide the Widget
 
And the following members
frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes
type - the type of the object, same as the name given to :RegisterWidget()
 
Widgets contain a table called userdata, this is a safe place to store data associated with the wigdet
It will be cleared automatically when a widget is released
Placing values directly into a widget object should be avoided
 
If the Widget can act as a container for other Widgets the following
content - frame or derivitive that children will be anchored to
 
The Widget can supply the following Optional Members
local WotLK = select(4, GetBuildInfo()) >= 30000
 
 
]]
 
--------------
-- TreeView --
--------------
 
do
local Type = "TreeGroup"
local Version = 6
local Version = 15
 
local DEFAULT_TREE_WIDTH = 175
local DEFAULT_TREE_SIZABLE = true
 
local PaneBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
60,11 → 41,20
insets = { left = 3, right = 3, top = 5, bottom = 3 }
}
 
local function Acquire(self)
 
local DraggerBackdrop = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = nil,
tile = true, tileSize = 16, edgeSize = 0,
insets = { left = 3, right = 3, top = 7, bottom = 7 }
}
 
local function OnAcquire(self)
self:SetTreeWidth(DEFAULT_TREE_WIDTH,DEFAULT_TREE_SIZABLE)
self:EnableButtonTooltips(true)
end
 
local function Release(self)
local function OnRelease(self)
 
self.frame:ClearAllPoints()
self.frame:Hide()
self.status = nil
78,6 → 68,8
end
end
self.localstatus.scrollvalue = 0
self.localstatus.treewidth = DEFAULT_TREE_WIDTH
self.localstatus.treesizable = DEFAULT_TREE_SIZABLE
end
 
local function GetButtonParents(line)
105,6 → 97,7
this:LockHighlight()
self:RefreshTree()
end
AceGUI:ClearFocus()
end
 
local function ExpandOnClick(this)
122,7 → 115,34
status[button.uniquevalue] = not status[button.uniquevalue]
self:RefreshTree()
end
 
 
local function EnableButtonTooltips(self, enable)
self.enabletooltips = enable
end
 
local function Button_OnEnter(this)
local self = this.obj
self:Fire("OnButtonEnter", this.uniquevalue, this)
 
if self.enabletooltips then
GameTooltip:SetOwner(this, "ANCHOR_NONE")
GameTooltip:SetPoint("LEFT",this,"RIGHT")
GameTooltip:SetText(this.text:GetText(), 1, .82, 0, 1)
 
GameTooltip:Show()
end
end
 
local function Button_OnLeave(this)
local self = this.obj
self:Fire("OnButtonLeave", this.uniquevalue, this)
 
if self.enabletooltips then
GameTooltip:Hide()
end
end
 
 
local buttoncount = 1
local function CreateButton(self)
local button = CreateFrame("Button",("AceGUI30TreeButton%d"):format(buttoncount),self.treeframe, "InterfaceOptionsButtonTemplate")
131,6 → 151,8
 
button:SetScript("OnClick",ButtonOnClick)
button:SetScript("OnDoubleClick", ButtonOnDoubleClick)
button:SetScript("OnEnter",Button_OnEnter)
button:SetScript("OnLeave",Button_OnLeave)
 
button.toggle.button = button
button.toggle:SetScript("OnClick",ExpandOnClick)
163,11 → 185,19
local line = button.line
button.level = level
if ( level == 1 ) then
button:SetTextFontObject("GameFontNormal")
if WotLK then
button:SetNormalFontObject("GameFontNormal")
else
button:SetTextFontObject("GameFontNormal")
end
button:SetHighlightFontObject("GameFontHighlight")
button.text:SetPoint("LEFT", 8, 2)
else
button:SetTextFontObject("GameFontHighlightSmall")
if WotLK then
button:SetNormalFontObject("GameFontHighlightSmall")
else
button:SetTextFontObject("GameFontHighlightSmall")
end
button:SetHighlightFontObject("GameFontHighlightSmall")
button.text:SetPoint("LEFT", 8 * level, 2)
end
201,6 → 231,7
local status = self.status or self.localstatus
status.scrollvalue = value
self:RefreshTree()
AceGUI:ClearFocus()
end
 
-- called to set an external table to store status in
213,6 → 244,13
if not status.scrollvalue then
status.scrollvalue = 0
end
if not status.treewidth then
status.treewidth = DEFAULT_TREE_WIDTH
end
if not status.treesizable then
status.treesizable = DEFAULT_TREE_SIZABLE
end
self:SetTreeWidth(status.treewidth,status.treesizable)
self:RefreshTree()
end
 
259,7 → 297,9
}
]]
local function SetTree(self, tree)
assert(type(tree) == "table")
if tree then
assert(type(tree) == "table")
end
self.tree = tree
self:RefreshTree()
end
307,34 → 347,33
end
 
local function RefreshTree(self)
if not self.tree then return end
--Build the list of visible entries from the tree and status tables
local status = self.status or self.localstatus
local groupstatus = status.groups
local tree = self.tree
local buttons = self.buttons
local lines = self.lines
local buttons = self.buttons
 
local treeframe = self.treeframe
 
 
for i, v in ipairs(buttons) do
v:Hide()
end
while lines[1] do
local t = tremove(lines)
for k in pairs(t) do
t[k] = nil
end
del(t)
end
end
 
if not self.tree then return end
--Build the list of visible entries from the tree and status tables
local status = self.status or self.localstatus
local groupstatus = status.groups
local tree = self.tree
 
local treeframe = self.treeframe
 
self:BuildLevel(tree, 1)
 
for i, v in ipairs(buttons) do
v:Hide()
end
 
local numlines = #lines
 
local maxlines = (math.floor(((self.treeframe:GetHeight()or 0) - 20 ) / 20))
local maxlines = (math.floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
 
local first, last
 
444,12 → 483,22
 
local function OnWidthSet(self, width)
local content = self.content
local contentwidth = width - 199
local treeframe = self.treeframe
local status = self.status or self.localstatus
 
local contentwidth = width - status.treewidth - 20
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
 
local maxtreewidth = math.min(400, width - 50)
 
if maxtreewidth > 100 and status.treewidth > maxtreewidth then
self:SetTreeWidth(maxtreewidth, status.treesizable)
end
treeframe:SetMaxResize(maxtreewidth,1600)
end
 
 
477,6 → 526,56
end
end
 
local function SetTreeWidth(self, treewidth, resizable)
if not resizable then
if type(treewidth) == 'number' then
resizable = false
elseif type(treewidth) == 'boolean' then
resizable = treewidth
treewidth = DEFAULT_TREE_WIDTH
else
resizable = false
treewidth = DEFAULT_TREE_WIDTH
end
end
self.treeframe:SetWidth(treewidth)
self.dragger:EnableMouse(resizable)
 
local status = self.status or self.localstatus
status.treewidth = treewidth
status.treesizable = resizable
end
 
local function draggerLeave(this)
this:SetBackdropColor(1, 1, 1, 0)
end
 
local function draggerEnter(this)
this:SetBackdropColor(1, 1, 1, 0.8)
end
 
local function draggerDown(this)
local treeframe = this:GetParent()
treeframe:StartSizing("RIGHT")
end
 
local function draggerUp(this)
local treeframe = this:GetParent()
local self = treeframe.obj
local frame = treeframe:GetParent()
treeframe:StopMovingOrSizing()
--treeframe:SetScript("OnUpdate", nil)
treeframe:SetUserPlaced(false)
--Without this :GetHeight will get stuck on the current height, causing the tree contents to not resize
treeframe:SetHeight(0)
treeframe:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
treeframe:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",0,0)
treeframe.obj:Fire("OnTreeResize",treeframe:GetWidth())
 
local status = self.status or self.localstatus
status.treewidth = treeframe:GetWidth()
end
 
local createdcount = 0
local function Constructor()
local frame = CreateFrame("Frame",nil,UIParent)
493,7 → 592,7
treeframe.obj = self
treeframe:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
treeframe:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",0,0)
treeframe:SetWidth(183)
treeframe:SetWidth(DEFAULT_TREE_WIDTH)
treeframe:SetScript("OnUpdate",FirstFrameUpdate)
treeframe:SetScript("OnSizeChanged",ResizeUpdate)
 
503,11 → 602,27
treeframe:SetBackdropColor(0.1,0.1,0.1,0.5)
treeframe:SetBackdropBorderColor(0.4,0.4,0.4)
 
treeframe:SetResizable(true)
treeframe:SetMinResize(100, 1)
treeframe:SetMaxResize(400,1600)
local dragger = CreateFrame("Frame", nil, treeframe)
dragger:SetWidth(8)
dragger:SetPoint("TOP", treeframe, "TOPRIGHT")
dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT")
dragger:SetBackdrop(DraggerBackdrop)
dragger:SetBackdropColor(1, 1, 1, 0)
dragger:SetScript("OnMouseDown", draggerDown)
dragger:SetScript("OnMouseUp", draggerUp)
dragger:SetScript("OnEnter", draggerEnter)
dragger:SetScript("OnLeave", draggerLeave)
 
self.dragger = dragger
self.treeframe = treeframe
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.SetTree = SetTree
self.SetTreeWidth = SetTreeWidth
self.RefreshTree = RefreshTree
self.SetStatusTable = SetStatusTable
self.BuildLevel = BuildLevel
520,9 → 635,11
self.SelectByPath = SelectByPath
self.OnWidthSet = OnWidthSet
self.OnHeightSet = OnHeightSet
self.EnableButtonTooltips = EnableButtonTooltips
 
self.frame = frame
frame.obj = self
 
createdcount = createdcount + 1
local scrollbar = CreateFrame("Slider",("AceConfigDialogTreeGroup%dScrollBar"):format(createdcount),treeframe,"UIPanelScrollBarTemplate")
self.scrollbar = scrollbar
543,7 → 660,7
 
local border = CreateFrame("Frame",nil,frame)
self.border = border
border:SetPoint("TOPLEFT",frame,"TOPLEFT",179,0)
border:SetPoint("TOPLEFT",treeframe,"TOPRIGHT", 0,0)
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,0)
 
border:SetBackdrop(PaneBackdrop)
AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua
5,9 → 5,9
--------------------------
do
local Type = "ColorPicker"
local Version = 8
local Version = 9
 
local function Acquire(self)
local function OnAcquire(self)
self.HasAlpha = false
self:SetColor(0,0,0,1)
end
83,9 → 83,10
end
ShowUIPanel(ColorPickerFrame)
end
AceGUI:ClearFocus()
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end
104,8 → 105,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.SetLabel = SetLabel
self.SetColor = SetColor
AceGUI-3.0/widgets/AceGUIWidget-Label.lua
5,15 → 5,15
--------------------------
do
local Type = "Label"
local Version = 6
local Version = 8
 
local function Acquire(self)
local function OnAcquire(self)
self:SetText("")
self:SetImage(nil)
self:SetColor()
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end
51,10 → 51,10
height = self.label:GetHeight()
end
 
frame.resizing = true
self.resizing = true
self.frame:SetHeight(height)
self.frame.height = height
frame.resizing = nil
self.resizing = nil
end
 
local function SetText(self, text)
70,15 → 70,10
end
 
local function OnWidthSet(self, width)
if self.resizing then return end
UpdateImageAnchor(self)
end
 
local function OnFrameResize(this)
if this.resizing then return end
local self = this.obj
OnWidthSet(self, this:GetWidth())
end
 
local function SetImage(self, path, ...)
local image = self.image
image:SetTexture(path)
106,8 → 101,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetText = SetText
self.SetColor = SetColor
self.frame = frame
118,7 → 113,6
 
frame:SetHeight(18)
frame:SetWidth(200)
frame:SetScript("OnSizeChanged", OnFrameResize)
local label = frame:CreateFontString(nil,"BACKGROUND","GameFontHighlightSmall")
label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
label:SetWidth(200)
AceGUI-3.0/AceGUI-3.0.xml
6,6 → 6,7
<Script file="widgets\AceGUIWidget-ColorPicker.lua"/>
<Script file="widgets\AceGUIWidget-DropDownGroup.lua"/>
<Script file="widgets\AceGUIWidget-DropDown.lua"/>
<Script file="widgets\AceGUIWidget-DropDown-Items.lua"/>
<Script file="widgets\AceGUIWidget-EditBox.lua"/>
<Script file="widgets\AceGUIWidget-Frame.lua"/>
<Script file="widgets\AceGUIWidget-Heading.lua"/>
AceGUI-3.0/AceGUI-3.0.lua
1,10 → 1,10
--[[ $Id: AceGUI-3.0.lua 65669 2008-03-25 08:59:22Z nevcairiel $ ]]
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 7
--[[ $Id: AceGUI-3.0.lua 81438 2008-09-06 13:44:36Z nevcairiel $ ]]
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 16
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR)
 
if not AceGUI then return end -- No upgrade needed
 
local con = LibStub("AceConsole-3.0",true)
--local con = LibStub("AceConsole-3.0",true)
 
AceGUI.WidgetRegistry = AceGUI.WidgetRegistry or {}
AceGUI.LayoutRegistry = AceGUI.LayoutRegistry or {}
99,6 → 99,12
if not objPools[type] then
objPools[type] = {}
end
for i,v in ipairs(objPools[type]) do
if v == obj then
error("Attempt to Release Widget that is already released")
return
end
end
tinsert(objPools[type],obj)
end
end
110,22 → 116,28
 
-- Gets a widget Object
 
local warned = {}
function AceGUI:Create(type)
local reg = WidgetRegistry
if reg[type] then
local widget = new(type,reg[type])
if widget.Acquire then
widget:Acquire()
elseif widget.Aquire then
if not warned[type] then
DEFAULT_CHAT_FRAME:AddMessage(("AceGUI: Warning, Widget type %s uses the deprecated Aquire, this should be updated to Acquire"):format(type))
warned[type] = true
end
widget.Acquire = widget.Aquire
widget:Acquire()
 
if rawget(widget,'Acquire') then
widget.OnAcquire = widget.Acquire
widget.Acquire = nil
elseif rawget(widget,'Aquire') then
widget.OnAcquire = widget.Aquire
widget.Aquire = nil
end
 
if rawget(widget,'Release') then
widget.OnRelease = rawget(widget,'Release')
widget.Release = nil
end
 
if widget.OnAcquire then
widget:OnAcquire()
else
error(("Widget type %s doesn't supply an Acquire Function"):format(type))
error(("Widget type %s doesn't supply an OnAcquire Function"):format(type))
end
safecall(widget.ResumeLayout, widget)
return widget
137,14 → 149,19
safecall( widget.PauseLayout, widget )
widget:Fire("OnRelease")
safecall( widget.ReleaseChildren, widget )
 
if widget.OnRelease then
widget:OnRelease()
else
error(("Widget type %s doesn't supply an OnRelease Function"):format(type))
end
for k in pairs(widget.userdata) do
widget.userdata[k] = nil
end
for k in pairs(widget.events) do
widget.events[k] = nil
end
widget.width = nil
widget:Release()
widget.width = nil
--widget.frame:SetParent(nil)
widget.frame:ClearAllPoints()
widget.frame:Hide()
156,14 → 173,39
del(widget,widget.type)
end
 
-----------
-- Focus --
-----------
 
-----
-- Called when a widget has taken focus
-- e.g. Dropdowns opening, Editboxes gaining kb focus
-----
function AceGUI:SetFocus(widget)
if self.FocusedWidget and self.FocusedWidget ~= widget then
safecall(self.FocusedWidget.ClearFocus, self.FocusedWidget)
end
self.FocusedWidget = widget
end
 
-----
-- Called when something has happened that could cause widgets with focus to drop it
-- e.g. titlebar of a frame being clicked
-----
function AceGUI:ClearFocus()
if self.FocusedWidget then
safecall(self.FocusedWidget.ClearFocus, self.FocusedWidget)
self.FocusedWidget = nil
end
end
 
-------------
-- Widgets --
-------------
--[[
Widgets must provide the following functions
Acquire() - Called when the object is acquired, should set everything to a default hidden state
Release() - Called when the object is Released, should remove any anchors and hide the Widget
OnAcquire() - Called when the object is acquired, should set everything to a default hidden state
OnRelease() - Called when the object is Released, should remove any anchors and hide the Widget
 
And the following members
frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes
177,8 → 219,13
content - frame or derivitive that children will be anchored to
 
The Widget can supply the following Optional Members
:OnWidthSet(width) - Called when the width of the widget is changed
:OnHeightSet(height) - Called when the height of the widget is changed
Widgets should not use the OnSizeChanged events of thier frame or content members, use these methods instead
AceGUI already sets a handler to the event
:OnLayoutFinished(width, height) - called after a layout has finished, the width and height will be the width and height of the
area used for controls. These can be nil if the layout used the existing size to layout the controls.
 
 
]]
 
--------------------------
236,7 → 283,71
self:OnHeightSet(height)
end
end
 
WidgetBase.IsVisible = function(self)
return self.frame:IsVisible()
end
 
WidgetBase.IsShown= function(self)
return self.frame:IsShown()
end
 
WidgetBase.Release = function(self)
AceGUI:Release(self)
end
 
WidgetBase.SetPoint = function(self, ...)
return self.frame:SetPoint(...)
end
 
WidgetBase.ClearAllPoints = function(self)
return self.frame:ClearAllPoints()
end
 
WidgetBase.GetNumPoints = function(self)
return self.frame:GetNumPoints()
end
 
WidgetBase.GetPoint = function(self, ...)
return self.frame:GetPoint(...)
end
 
WidgetBase.GetUserDataTable = function(self)
return self.userdata
end
 
WidgetBase.SetUserData = function(self, key, value)
self.userdata[key] = value
end
 
WidgetBase.GetUserData = function(self, key)
return self.userdata[key]
end
 
WidgetBase.IsFullHeight = function(self)
return self.height == "fill"
end
 
WidgetBase.SetFullHeight = function(self, isFull)
if isFull then
self.height = "fill"
else
self.height = nil
end
end
 
WidgetBase.IsFullWidth = function(self)
return self.width == "fill"
end
 
WidgetBase.SetFullWidth = function(self, isFull)
if isFull then
self.width = "fill"
else
self.width = nil
end
end
 
-- local function LayoutOnUpdate(this)
-- this:SetScript("OnUpdate",nil)
-- this.obj:PerformLayout()
286,16 → 397,26
self.LayoutFunc = AceGUI:GetLayout(Layout)
end
 
local function FrameResize(this)
local self = this.obj
if this:GetWidth() and this:GetHeight() then
if self.OnWidthSet then
self:OnWidthSet(this:GetWidth())
end
if self.OnHeightSet then
self:OnHeightSet(this:GetHeight())
end
end
end
 
local function ContentResize(this)
if this.lastwidth ~= this:GetWidth() then
if this:GetWidth() and this:GetHeight() then
this.width = this:GetWidth()
this.height = this:GetHeight()
this.obj:DoLayout()
end
end
 
 
setmetatable(WidgetContainerBase,{__index=WidgetBase})
 
--One of these function should be called on each Widget Instance as part of its creation process
304,7 → 425,10
widget.userdata = {}
widget.events = {}
widget.base = WidgetContainerBase
widget.content.obj = widget
widget.frame.obj = widget
widget.content:SetScript("OnSizeChanged",ContentResize)
widget.frame:SetScript("OnSizeChanged",FrameResize)
setmetatable(widget,{__index=WidgetContainerBase})
widget:SetLayout("List")
end
313,6 → 437,8
widget.userdata = {}
widget.events = {}
widget.base = WidgetBase
widget.frame.obj = widget
widget.frame:SetScript("OnSizeChanged",FrameResize)
setmetatable(widget,{__index=WidgetBase})
end
end
351,6 → 477,16
return LayoutRegistry[Name]
end
 
AceGUI.counts = AceGUI.counts or {}
 
function AceGUI:GetNextWidgetNum(type)
if not self.counts[type] then
self.counts[type] = 0
end
self.counts[type] = self.counts[type] + 1
return self.counts[type]
end
 
--[[ Widget Template
 
--------------------------
359,11 → 495,11
do
local Type = "Type"
 
local function Acquire(self)
local function OnAcquire(self)
 
end
 
local function Release(self)
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end
374,8 → 510,8
local self = {}
self.type = Type
 
self.Release = Release
self.Acquire = Acquire
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.frame = frame
frame.obj = self
411,6 → 547,7
function(content, children)
 
local height = 0
local width = content.width or content:GetWidth() or 0
for i, child in ipairs(children) do
 
 
424,6 → 561,7
end
 
if child.width == "fill" then
child:SetWidth(width)
frame:SetPoint("RIGHT",content,"RIGHT")
if child.OnWidthSet then
child:OnWidthSet(content.width or content:GetWidth())
443,7 → 581,9
AceGUI:RegisterLayout("Fill",
function(content, children)
if children[1] then
children[1].frame:SetAllPoints(content)
children[1]:SetWidth(content:GetWidth() or 0)
children[1]:SetHeight(content:GetHeight() or 0)
children[1].frame:SetAllPoints(content)
children[1].frame:Show()
safecall( content.obj.LayoutFinished, content.obj, nil, children[1].frame:GetHeight() )
end
471,8 → 611,9
 
local frameoffset
local lastframeoffset
local oversize
for i, child in ipairs(children) do
 
oversize = nil
local frame = child.frame
local frameheight = frame.height or frame:GetHeight() or 0
local framewidth = frame.width or frame:GetWidth() or 0
489,6 → 630,9
rowstart = frame
rowstartoffset = frameoffset
usedwidth = framewidth
if usedwidth > width then
oversize = true
end
else
-- if there isn't available width for the control start a new row
-- if a control is "fill" it will be on a row of its own full width
502,6 → 646,9
rowheight = frameheight
rowoffset = frameoffset
usedwidth = frame.width or frame:GetWidth()
if usedwidth > width then
oversize = true
end
-- put the control on the current row, adding it to the width and checking if the height needs to be increased
else
--handles cases where the new height is higher than either control because of the offsets
530,6 → 677,10
rowheight = frame.height or frame:GetHeight() or 0
rowoffset = child.alignoffset or (rowheight / 2)
rowstartoffset = rowoffset
elseif oversize then
if width > 1 then
frame:SetPoint("RIGHT",content,"RIGHT",0,0)
end
end
 
if child.height == "fill" then
AceAddon-3.0/AceAddon-3.0.lua
1,5 → 1,5
--[[ $Id: AceAddon-3.0.lua 66331 2008-03-27 09:41:53Z nevcairiel $ ]]
local MAJOR, MINOR = "AceAddon-3.0", 4
--[[ $Id: AceAddon-3.0.lua 76326 2008-06-09 09:29:17Z nevcairiel $ ]]
local MAJOR, MINOR = "AceAddon-3.0", 5
local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 
if not AceAddon then return end -- No Upgrade needed.
70,28 → 70,52
-- used in the addon metatable
local function addontostring( self ) return self.name end
 
-- AceAddon:NewAddon( name, [lib, lib, lib, ...] )
-- AceAddon:NewAddon( [object, ]name, [lib, lib, lib, ...] )
-- [object] (table) - table to use as the base for the addon
-- name (string) - unique addon object name
-- [lib] (string) - optional libs to embed in the addon object
--
-- returns the addon object when succesful
function AceAddon:NewAddon(name, ...)
if type(name) ~= "string" then error(("Usage: NewAddon(name, [lib, lib, lib, ...]): 'name' - string expected got '%s'."):format(type(name)), 2) end
function AceAddon:NewAddon(objectorname, ...)
local object,name
local i=1
if type(objectorname)=="table" then
object=objectorname
name=...
i=2
else
name=objectorname
end
if type(name)~="string" then
error(("Usage: NewAddon([object,] name, [lib, lib, lib, ...]): 'name' - string expected got '%s'."):format(type(name)), 2)
end
if self.addons[name] then
error(("Usage: NewAddon([object,] name, [lib, lib, lib, ...]): 'name' - Addon '%s' already exists."):format(name), 2)
end
 
if self.addons[name] then error(("Usage: NewAddon(name, [lib, lib, lib, ...]): 'name' - Addon '%s' already exists."):format(name), 2) end
object = object or {}
object.name = name
 
local addonmeta = {}
local oldmeta = getmetatable(object)
if oldmeta then
for k, v in pairs(oldmeta) do addonmeta[k] = v end
end
addonmeta.__tostring = addontostring
 
local addon = setmetatable( {name = name}, { __tostring = addontostring } )
self.addons[name] = addon
addon.modules = {}
addon.defaultModuleLibraries = {}
Embed( addon ) -- embed NewModule, GetModule methods
self:EmbedLibraries(addon, ...)
setmetatable( object, addonmeta )
self.addons[name] = object
object.modules = {}
object.defaultModuleLibraries = {}
Embed( object ) -- embed NewModule, GetModule methods
self:EmbedLibraries(object, select(i,...))
 
-- add to queue of addons to be initialized upon ADDON_LOADED
tinsert(self.initializequeue, addon)
return addon
tinsert(self.initializequeue, object)
return object
end
 
 
-- AceAddon:GetAddon( name, [silent])
-- name (string) - unique addon object name
-- silent (boolean) - if true, addon is optional, silently return nil if its not found
AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua
3,7 → 3,7
 
]]
local LibStub = LibStub
local MAJOR, MINOR = "AceConfigDialog-3.0", 17
local MAJOR, MINOR = "AceConfigDialog-3.0", 25
local lib = LibStub:NewLibrary(MAJOR, MINOR)
 
if not lib then return end
12,6 → 12,9
lib.Status = lib.Status or {}
lib.frame = lib.frame or CreateFrame("Frame")
 
lib.frame.apps = lib.frame.apps or {}
lib.frame.closing = lib.frame.closing or {}
 
local gui = LibStub("AceGUI-3.0")
local reg = LibStub("AceConfigRegistry-3.0")
 
226,6 → 229,7
end
 
info.options = options
info.appName = appName
info[0] = appName
info.arg = option.arg
info.handler = handler
383,33 → 387,36
end
 
local function CleanUserData(widget, event)
local user = widget.userdata
 
local user = widget:GetUserDataTable()
 
if user.path then
del(user.path)
end
 
if widget.type == "TreeGroup" then
local tree = widget.tree
local tree = user.tree
widget:SetTree(nil)
if tree then
for i = 1, #tree do
DelTree(tree[i])
del(tree[i])
end
del(tree)
widget.tree = nil
end
end
 
if widget.type == "TabGroup" then
del(widget.tablist)
widget.tablist = nil
widget:SetTabs(nil)
if user.tablist then
del(user.tablist)
end
end
 
if widget.type == "DropdownGroup" then
if widget.dropdown.list then
del(widget.dropdown.list)
widget.dropdown.list = nil
widget:SetGroupList(nil)
if user.grouplist then
del(user.grouplist)
end
end
end
443,9 → 450,76
return status.status
end
 
--[[
Sets the given path to be selected
]]
function lib:SelectGroup(appName, ...)
local path = new()
 
 
local app = reg:GetOptionsTable(appName)
if not app then
error(("%s isn't registed with AceConfigRegistry, unable to open config"):format(appName), 2)
end
local options = app("dialog", MAJOR)
local group = options
local status = self:GetStatusTable(appName, path)
if not status.groups then
status.groups = {}
end
status = status.groups
local treevalue
local treestatus
 
for n = 1, select('#',...) do
local key = select(n, ...)
 
if group.childGroups == "tab" or group.childGroups == "select" then
--if this is a tab or select group, select the group
status.selected = key
--children of this group are no longer extra levels of a tree
treevalue = nil
else
--tree group by default
if treevalue then
--this is an extra level of a tree group, build a uniquevalue for it
treevalue = treevalue.."\001"..key
else
--this is the top level of a tree group, the uniquevalue is the same as the key
treevalue = key
if not status.groups then
status.groups = {}
end
--save this trees status table for any extra levels or groups
treestatus = status
end
--make sure that the tree entry is open, and select it.
--the selected group will be overwritten if a child is the final target but still needs to be open
treestatus.selected = treevalue
treestatus.groups[treevalue] = true
 
end
 
--move to the next group in the path
group = GetSubOption(group, key)
if not group then
break
end
tinsert(path, key)
status = self:GetStatusTable(appName, path)
if not status.groups then
status.groups = {}
end
status = status.groups
end
 
del(path)
reg:NotifyChange(appName)
end
 
local function OptionOnMouseOver(widget, event)
--show a tooltip/set the status bar to the desc text
local user = widget.userdata
local user = widget:GetUserDataTable()
local opt = user.option
local options = user.options
local path = user.path
483,7 → 557,7
return 'set'
end
end
local function confirmPopup(appName, rootframe, info, message, func, ...)
local function confirmPopup(appName, rootframe, basepath, info, message, func, ...)
if not StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] then
StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] = {}
end
500,7 → 574,7
if dialog and oldstrata then
dialog:SetFrameStrata(oldstrata)
end
lib:Open(appName, rootframe)
lib:Open(appName, rootframe, basepath and unpack(basepath))
del(info)
end
t.OnCancel = function()
525,8 → 599,8
 
local function ActivateControl(widget, event, ...)
--This function will call the set / execute handler for the widget
--widget.userdata contains the needed info
local user = widget.userdata
--widget:GetUserDataTable() contains the needed info
local user = widget:GetUserDataTable()
local option = user.option
local options = user.options
local path = user.path
563,7 → 637,7
end
 
info.options = options
info[0] = user.appName
info.appName = user.appName
info.arg = option.arg
info.handler = handler
info.option = option
638,7 → 712,7
--call confirm func/method
if type(confirm) == "string" then
if handler and handler[confirm] then
success, confirm = safecall(handler[confirm],handler, info)
success, confirm = safecall(handler[confirm], handler, info, ...)
if success and type(confirm) == "string" then
confirmText = confirm
confirm = true
649,7 → 723,7
error(string.format("Method %s doesn't exist in handler for type confirm", confirm))
end
elseif type(confirm) == "function" then
success, confirm = safecall(confirm,info)
success, confirm = safecall(confirm, info, ...)
if success and type(confirm) == "string" then
confirmText = confirm
confirm = true
675,19 → 749,21
end
end
 
local iscustom = user.rootframe.userdata.iscustom
local iscustom = user.rootframe:GetUserData('iscustom')
local rootframe
 
if iscustom then
rootframe = user.rootframe
end
local basepath = user.rootframe:GetUserData('basepath')
if type(func) == "string" then
if handler and handler[func] then
confirmPopup(user.appName, rootframe, info, confirmText, handler[func], handler, info, ...)
confirmPopup(user.appName, rootframe, basepath, info, confirmText, handler[func], handler, info, ...)
else
error(string.format("Method %s doesn't exist in handler for type func", func))
end
elseif type(func) == "function" then
confirmPopup(user.appName, rootframe, info, confirmText, func, info, ...)
confirmPopup(user.appName, rootframe, basepath, info, confirmText, func, info, ...)
end
--func will be called and info deleted when the confirm dialog is responded to
return
707,29 → 783,34
 
 
 
local iscustom = user.rootframe.userdata.iscustom
local iscustom = user.rootframe:GetUserData('iscustom')
local basepath = user.rootframe:GetUserData('basepath')
--full refresh of the frame, some controls dont cause this on all events
if option.type == "color" then
if event == "OnValueConfirmed" then
 
if iscustom then
lib:Open(user.appName, user.rootframe)
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
else
lib:Open(user.appName)
lib:Open(user.appName, basepath and unpack(basepath))
end
end
elseif option.type == "range" then
if event == "OnMouseUp" then
if iscustom then
lib:Open(user.appName, user.rootframe)
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
else
lib:Open(user.appName)
lib:Open(user.appName, basepath and unpack(basepath))
end
end
--multiselects don't cause a refresh on 'OnValueChanged' only 'OnClosed'
elseif option.type == "multiselect" then
user.valuechanged = true
else
if iscustom then
lib:Open(user.appName, user.rootframe)
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
else
lib:Open(user.appName)
lib:Open(user.appName, basepath and unpack(basepath))
end
end
 
738,7 → 819,7
end
 
local function ActivateSlider(widget, event, value)
local option = widget.userdata.option
local option = widget:GetUserData('option')
local min, max, step = option.min or 0, option.max or 100, option.step
if step then
value = math.floor((value - min) / step + 0.5) * step + min
748,12 → 829,35
ActivateControl(widget,event,value)
end
 
--called from a checkbox that is part of an internally created multiselect group
--this type is safe to refresh on activation of one control
local function ActivateMultiControl(widget, event, ...)
ActivateControl(widget, event, widget.userdata.value, ...)
ActivateControl(widget, event, widget:GetUserData('value'), ...)
local user = widget:GetUserDataTable()
local iscustom = user.rootframe:GetUserData('iscustom')
local basepath = user.rootframe:GetUserData('basepath')
if iscustom then
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
else
lib:Open(user.appName, basepath and unpack(basepath))
end
end
 
local function MultiControlOnClosed(widget, event, ...)
local user = widget:GetUserDataTable()
if user.valuechanged then
local iscustom = user.rootframe:GetUserData('iscustom')
local basepath = user.rootframe:GetUserData('basepath')
if iscustom then
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
else
lib:Open(user.appName, basepath and unpack(basepath))
end
end
end
 
local function FrameOnClose(widget, event)
local appName = widget.userdata.appName
local appName = widget:GetUserData('appName')
lib.OpenFrames[appName] = nil
gui:Release(widget)
end
899,7 → 1003,7
end
 
local function InjectInfo(control, options, option, path, rootframe, appName)
local user = control.userdata
local user = control:GetUserDataTable()
for i = 1, #path do
user[i] = path[i]
end
1022,22 → 1126,51
 
elseif v.type == "multiselect" then
local values = GetOptionsMemberValue("values", v, options, path, appName)
local disabled = CheckOptionDisabled(v, options, path, appName)
 
control = gui:Create("InlineGroup")
control:SetLayout("Flow")
control:SetTitle(name)
control.width = "fill"
 
local controlType = v.dialogControl or v.control
 
local valuesort = new()
 
local disabled = CheckOptionDisabled(v, options, path, appName)
 
if values then
for value, text in pairs(values) do
tinsert(valuesort, value)
end
end
table.sort(valuesort)
 
if controlType then
control = gui:Create(controlType)
if not control then
error(("Invalid Custom Control Type - %s"):format(tostring(controlType)))
end
control:SetMultiselect(true)
control:SetLabel(name)
control:SetList(values)
control:SetDisabled(disabled)
control:SetCallback("OnValueChanged",ActivateControl)
control:SetCallback("OnClosed", MultiControlOnClosed)
local width = GetOptionsMemberValue("width",v,options,path,appName)
if width == "double" then
control:SetWidth(width_multiplier * 2)
elseif width == "half" then
control:SetWidth(width_multiplier / 2)
elseif width == "full" then
control.width = "fill"
else
control:SetWidth(width_multiplier)
end
--check:SetTriState(v.tristate)
for i = 1, #valuesort do
local key = valuesort[i]
local value = GetOptionsMemberValue("get",v, options, path, appName, key)
control:SetItemValue(key,value)
end
else
control = gui:Create("InlineGroup")
control:SetLayout("Flow")
control:SetTitle(name)
control.width = "fill"
 
table.sort(valuesort)
control:PauseLayout()
local width = GetOptionsMemberValue("width",v,options,path,appName)
for i = 1, #valuesort do
1045,8 → 1178,8
local text = values[value]
local check = gui:Create("CheckBox")
check:SetLabel(text)
check.userdata.value = value
check.userdata.text = text
check:SetUserData('value', value)
check:SetUserData('text', text)
check:SetDisabled(disabled)
check:SetTriState(v.tristate)
check:SetValue(GetOptionsMemberValue("get",v, options, path, appName, value))
1065,7 → 1198,10
end
control:ResumeLayout()
control:DoLayout()
 
 
end
 
del(valuesort)
 
elseif v.type == "color" then
1156,6 → 1292,51
end
end
 
 
local function TreeOnButtonEnter(widget, event, uniquevalue, button)
local user = widget:GetUserDataTable()
if not user then return end
local options = user.options
local option = user.option
local path = user.path
local appName = user.appName
 
local feedpath = new()
for i = 1, #path do
feedpath[i] = path[i]
end
 
BuildPath(feedpath, string.split("\001", uniquevalue))
local group = options
for i = 1, #feedpath do
if not group then return end
group = GetSubOption(group, feedpath[i])
end
 
local name = GetOptionsMemberValue("name", group, options, feedpath, appName)
local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName)
 
GameTooltip:SetOwner(button, "ANCHOR_NONE")
if widget.type == "TabGroup" then
GameTooltip:SetPoint("BOTTOM",button,"TOP")
else
GameTooltip:SetPoint("LEFT",button,"RIGHT")
end
 
GameTooltip:SetText(name, 1, .82, 0, 1)
 
if type(desc) == "string" then
GameTooltip:AddLine(desc, 1, 1, 1, 1)
end
 
GameTooltip:Show()
end
 
local function TreeOnButtonLeave(widget, event, value, button)
GameTooltip:Hide()
end
 
 
local function GroupExists(appName, options, path, uniquevalue)
if not uniquevalue then return false end
 
1186,7 → 1367,7
 
local function GroupSelected(widget, event, uniquevalue)
 
local user = widget.userdata
local user = widget:GetUserDataTable()
 
local options = user.options
local option = user.option
1203,16 → 1384,14
for i = 1, #feedpath do
group = GetSubOption(group, feedpath[i])
end
 
widget:ReleaseChildren()
lib:FeedGroup(user.appName,options,widget,rootframe,feedpath,group)
lib:FeedGroup(user.appName,options,widget,rootframe,feedpath)
 
del(feedpath)
end
 
 
 
 
--[[
This function will feed one group, and any inline child groups into the given container
Select Groups will only have the selection control (tree, tabs, dropdown) fed in
1228,7 → 1407,7
if its parent is a tree group, its already a node on a tree
--]]
 
function lib:FeedGroup(appName,options,container,rootframe,path)
function lib:FeedGroup(appName,options,container,rootframe,path, isRoot)
local group = options
--follow the path to get to the curent group
local inline
1272,7 → 1451,7
local scroll
 
--Add a scrollframe if we are not going to add a group control, this is the inverse of the conditions for that later on
if (not (hasChildGroups and not inline)) or (grouptype ~= "tab" and grouptype ~= "select" and parenttype == "tree") then
if (not (hasChildGroups and not inline)) or (grouptype ~= "tab" and grouptype ~= "select" and (parenttype == "tree" and not isRoot)) then
if container.type ~= "InlineGroup" then
scroll = gui:Create("ScrollFrame")
scroll:SetLayout("flow")
1302,6 → 1481,9
local tab = gui:Create("TabGroup")
InjectInfo(tab, options, group, path, rootframe, appName)
tab:SetCallback("OnGroupSelected", GroupSelected)
tab:SetCallback("OnTabEnter", TreeOnButtonEnter)
tab:SetCallback("OnTabLeave", TreeOnButtonLeave)
 
local status = lib:GetStatusTable(appName, path)
if not status.groups then
status.groups = {}
1312,6 → 1494,7
 
local tabs = BuildGroups(group, options, path, appName)
tab:SetTabs(tabs)
tab:SetUserData("tablist", tabs)
 
for i = 1, #tabs do
local entry = tabs[i]
1335,6 → 1518,7
select:SetStatusTable(status.groups)
local grouplist = BuildSelect(group, options, path, appName)
select:SetGroupList(grouplist)
select:SetUserData("grouplist", grouplist)
local firstgroup
for k, v in pairs(grouplist) do
if not firstgroup or k < firstgroup then
1343,7 → 1527,7
end
 
if firstgroup then
select:SetGroup( (GroupExists(appName, options, path,status.groups.selectedgroup) and status.groups.selectedgroup) or firstgroup)
select:SetGroup( (GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup)
end
 
select.width = "fill"
1353,16 → 1537,18
 
--assume tree group by default
--if parenttype is tree then this group is already a node on that tree
elseif parenttype ~= "tree" then
 
elseif (parenttype ~= "tree") or isRoot then
local tree = gui:Create("TreeGroup")
InjectInfo(tree, options, group, path, rootframe, appName)
 
tree:EnableButtonTooltips(false)
 
tree.width = "fill"
tree.height = "fill"
 
tree:SetCallback("OnGroupSelected", GroupSelected)
 
tree:SetCallback("OnButtonEnter", TreeOnButtonEnter)
tree:SetCallback("OnButtonLeave", TreeOnButtonLeave)
 
local status = lib:GetStatusTable(appName, path)
if not status.groups then
status.groups = {}
1371,6 → 1557,7
tree:SetStatusTable(status.groups)
 
tree:SetTree(treedefinition)
tree:SetUserData("tree",treedefinition)
 
for i = 1, #treedefinition do
local entry = treedefinition[i]
1387,31 → 1574,32
 
local old_CloseSpecialWindows
 
function lib:CloseAll()
local closed
for k, v in pairs(self.OpenFrames) do
v:Hide()
closed = true
end
return closed
end
 
function lib:Close(appName)
if self.OpenFrames[appName] then
self.OpenFrames[appName]:Hide()
return true
local function RefreshOnUpdate(this)
for appName in pairs(this.closing) do
if lib.OpenFrames[appName] then
lib.OpenFrames[appName]:Hide()
end
this.closing[appName] = nil
end
end
 
local function RefreshOnUpdate(this)
 
if this.closeAll then
for k, v in pairs(lib.OpenFrames) do
v:Hide()
end
this.closeAll = nil
end
 
for appName in pairs(this.apps) do
if lib.OpenFrames[appName] then
lib:Open(appName)
local user = lib.OpenFrames[appName]:GetUserDataTable()
lib:Open(appName, user.basepath and unpack(user.basepath))
end
if lib.BlizOptions and lib.BlizOptions[appName] then
local widget = lib.BlizOptions[appName]
if widget.frame:IsVisible() then
lib:Open(widget.userdata.appName, widget)
local user = widget:GetUserDataTable()
if widget:IsVisible() then
lib:Open(widget:GetUserData('appName'), widget, user.basepath and unpack(user.basepath))
end
end
this.apps[appName] = nil
1419,10 → 1607,23
this:SetScript("OnUpdate", nil)
end
 
function lib:CloseAll()
lib.frame.closeAll = true
lib.frame:SetScript("OnUpdate", RefreshOnUpdate)
if next(self.OpenFrames) then
return true
end
end
 
function lib:Close(appName)
if self.OpenFrames[appName] then
lib.frame.closing[appName] = true
lib.frame:SetScript("OnUpdate", RefreshOnUpdate)
return true
end
end
 
function lib:ConfigTableChanged(event, appName)
if not lib.frame.apps then
lib.frame.apps = {}
end
lib.frame.apps[appName] = true
lib.frame:SetScript("OnUpdate", RefreshOnUpdate)
end
1437,7 → 1638,8
end
end
 
function lib:Open(appName, container)
-- :Open(appName, [container], [path ...])
function lib:Open(appName, container, ...)
if not old_CloseSpecialWindows then
old_CloseSpecialWindows = CloseSpecialWindows
CloseSpecialWindows = function()
1456,14 → 1658,24
local path = new()
local name = GetOptionsMemberValue("name", options, options, path, appName)
 
--If an optional path is specified add it to the path table before feeding the options
--as container is optional as well it may contain the first element of the path
if type(container) == "string" then
tinsert(path, container)
container = nil
end
for n = 1, select('#',...) do
tinsert(path, (select(n, ...)))
end
 
--if a container is given feed into that
if container then
f = container
f:ReleaseChildren()
f.userdata.appName = appName
f.userdata.iscustom = true
if f.SetTitle then
f:SetTitle(name or "")
f:SetUserData('appName', appName)
f:SetUserData('iscustom', true)
if #path > 0 then
f:SetUserData('basepath', copy(path))
end
local status = lib:GetStatusTable(appName)
if not status.width then
1484,13 → 1696,16
end
f:ReleaseChildren()
f:SetCallback("OnClose", FrameOnClose)
f.userdata.appName = appName
f:SetUserData('appName', appName)
if #path > 0 then
f:SetUserData('basepath', copy(path))
end
f:SetTitle(name or "")
local status = lib:GetStatusTable(appName)
f:SetStatusTable(status)
end
 
self:FeedGroup(appName,options,f,f,path)
self:FeedGroup(appName,options,f,f,path,true)
if f.Show then
f:Show()
end
1500,26 → 1715,41
lib.BlizOptions = lib.BlizOptions or {}
 
local function FeedToBlizPanel(widget, event)
lib:Open(widget.userdata.appName, widget)
local path = widget:GetUserData('path')
lib:Open(widget:GetUserData('appName'), widget, path and unpack(path))
end
 
local function ClearBlizPanel(widget, event)
widget:ReleaseChildren()
end
 
function lib:AddToBlizOptions(appName, name, parent)
function lib:AddToBlizOptions(appName, name, parent, ...)
local BlizOptions = lib.BlizOptions
if not BlizOptions[appName] then
 
local key = appName
for n = 1, select('#', ...) do
key = key..'\001'..select(n, ...)
end
 
if not BlizOptions[key] then
local group = gui:Create("BlizOptionsGroup")
BlizOptions[appName] = group
BlizOptions[key] = group
group:SetName(name or appName, parent)
 
group:SetTitle(name or appName)
group.userdata.appName = appName
group:SetUserData('appName', appName)
if select('#', ...) > 0 then
local path = {}
for n = 1, select('#',...) do
tinsert(path, (select(n, ...)))
end
group:SetUserData('path', path)
end
group:SetCallback("OnShow", FeedToBlizPanel)
group:SetCallback("OnHide", ClearBlizPanel)
InterfaceOptions_AddCategory(group.frame)
return group.frame
else
error(("%s has already been added to the Blizzard Options Window"):format(appName), 2)
error(("%s has already been added to the Blizzard Options Window with the given path"):format(appName), 2)
end
end
AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua
13,7 → 13,7
-- TODO: plugin args
 
 
local MAJOR, MINOR = "AceConfigCmd-3.0", 4
local MAJOR, MINOR = "AceConfigCmd-3.0", 6
local lib = LibStub:NewLibrary(MAJOR, MINOR)
 
if not lib then return end
310,7 → 310,7
local oldget,oldget_at = getparam(info,inputpos,tab,depth,"get",functypes,funcmsg)
local oldfunc,oldfunc_at = getparam(info,inputpos,tab,depth,"func",functypes,funcmsg)
local oldvalidate,oldvalidate_at = getparam(info,inputpos,tab,depth,"validate",functypes,funcmsg)
local oldconfirm,oldconfirm_at = getparam(info,inputpos,tab,depth,"confirm",functypes,funcmsg)
--local oldconfirm,oldconfirm_at = getparam(info,inputpos,tab,depth,"confirm",functypes,funcmsg)
 
-------------------------------------------------------------------
-- Act according to .type of this table
357,7 → 357,7
info.get,info.get_at = oldget,oldget_at
info.func,info.func_at = oldfunc,oldfunc_at
info.validate,info.validate_at = oldvalidate,oldvalidate_at
info.confirm,info.confirm_at = oldconfirm,oldconfirm_at
--info.confirm,info.confirm_at = oldconfirm,oldconfirm_at
return false
end
 
656,6 → 656,9
 
do_final(info, inputpos, tab, "set", value)
 
elseif tab.type=="description" then
------------ description --------------------
-- ignore description, GUI config only
else
err(info, inputpos, "unknown options table item type '"..tostring(tab.type).."'")
end
AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua
11,7 → 11,7
:IterateOptionsTables() and :GetOptionsTable() always return a function reference that the requesting config handling addon must call with the above arguments.
]]
 
local MAJOR, MINOR = "AceConfigRegistry-3.0", 5
local MAJOR, MINOR = "AceConfigRegistry-3.0", 6
local lib = LibStub:NewLibrary(MAJOR, MINOR)
 
if not lib then return end
147,6 → 147,9
values=ismethodtable,
style=optstring,
tristate=optbool,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
color={
hasAlpha=optbool,
AceDB-3.0/AceDB-3.0.lua
1,5 → 1,5
--[[ $Id: AceDB-3.0.lua 69511 2008-04-13 10:10:53Z nevcairiel $ ]]
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 7
--[[ $Id: AceDB-3.0.lua 81438 2008-09-06 13:44:36Z nevcairiel $ ]]
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 8
local AceDB, oldminor = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
 
if not AceDB then return end -- No upgrade needed
95,7 → 95,7
for key, value in pairs(db) do
if type(value) == "table" then
-- if the key was not explicitly specified in the defaults table, just strip everything from * and ** tables
if defaults[key] == nil then
if defaults[key] == nil and (not blocker or blocker[key] == nil) then
removeDefaults(value, v)
-- if the table is empty afterwards, remove it
if not next(value) then
AceConsole-3.0/AceConsole-3.0.lua
1,5 → 1,5
--[[ $Id: AceConsole-3.0.lua 63886 2008-03-08 12:43:31Z nevcairiel $ ]]
local MAJOR,MINOR = "AceConsole-3.0", 4
--[[ $Id: AceConsole-3.0.lua 74633 2008-05-21 08:20:50Z nevcairiel $ ]]
local MAJOR,MINOR = "AceConsole-3.0", 6
 
local AceConsole, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 
45,21 → 45,15
-- command (string) - chat command to be registered WITHOUT leading "/"
-- func (function|membername) - function to call, or self[membername](self, ...) call
-- persist (boolean) - false: the command will be soft disabled/enabled when aceconsole is used as a mixin (default: true)
-- silent (boolean) - don't whine if command already exists, silently fail
--
-- Register a simple chat command
function AceConsole:RegisterChatCommand( command, func, persist, silent )
if type(command)~="string" then error([[Usage: AceConsole:RegisterChatCommand( "command", func[, persist[, silent] ]): 'command' - expected a string]], 2) end
function AceConsole:RegisterChatCommand( command, func, persist )
if type(command)~="string" then error([[Usage: AceConsole:RegisterChatCommand( "command", func[, persist ]): 'command' - expected a string]], 2) end
 
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
 
local name = "ACECONSOLE_"..command:upper()
if SlashCmdList[name] then
if not silent then
geterrorhandler()(tostring(self)..": Chat Command '"..command.."' already exists, will not overwrite.")
end
return
end
 
if type( func ) == "string" then
SlashCmdList[name] = function(input)
self[func](self, input)