WoWInterface SVN NeedyGreedy

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/libs/AceGUI-3.0/widgets
    from Rev 126 to Rev 128
    Reverse comparison

Rev 126 → Rev 128

AceGUIWidget-MultiLineEditBox.lua
1,4 → 1,4
local Type, Version = "MultiLineEditBox", 22
local Type, Version = "MultiLineEditBox", 23
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
 
15,6 → 15,27
-- GLOBALS: ACCEPT, ChatFontNormal
 
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function Layout(self)
self:SetHeight(self.numlines * 14 + (self.disablebutton and 19 or 41) + self.labelHeight)
 
if self.labelHeight == 0 then
self.scrollBar:SetPoint("TOP", self.frame, "TOP", 0, -23)
else
self.scrollBar:SetPoint("TOP", self.label, "BOTTOM", 0, -19)
end
 
if self.disablebutton then
self.scrollBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 21)
self.scrollBG:SetPoint("BOTTOMLEFT", 0, 4)
else
self.scrollBar:SetPoint("BOTTOM", self.button, "TOP", 0, 18)
self.scrollBG:SetPoint("BOTTOMLEFT", self.button, "TOPLEFT")
end
end
 
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function OnClick(self) -- Button
113,23 → 134,17
Methods
-------------------------------------------------------------------------------]]
local methods = {
["GetText"] = function(self)
return self.editBox:GetText()
end,
 
["OnAcquire"] = function(self)
self.editBox:SetText("")
self:SetDisabled(false)
self:SetWidth(200)
self:DisableButton(false)
self:SetNumLines()
self.entered = nil
self:SetMaxLetters(0)
end,
 
["OnRelease"] = function(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end,
-- ["OnRelease"] = nil,
 
["SetDisabled"] = function(self, disabled)
local editBox = self.editBox
153,31 → 168,43
self.label:SetText(text)
if self.labelHeight ~= 10 then
self.labelHeight = 10
self.scrollBar:SetPoint("TOP", self.label, "BOTTOM", 0, -19)
self:SetHeight(self.frame.height + 10)
self.label:Show()
end
elseif self.labelHeight ~= 0 then
self.labelHeight = 0
self.label:Hide()
self.scrollBar:SetPoint("TOP", self.frame, "TOP", 0, -23)
self:SetHeight(self.frame.height - 10)
end
Layout(self)
end,
 
["SetNumLines"] = function(self, value)
if not value or value < 4 then
value = 4
end
self:SetHeight(value * 14 + 41 + self.labelHeight)
self.numlines = value
Layout(self)
end,
 
["SetText"] = function(self, text)
self.editBox:SetText(text)
end,
 
["GetText"] = function(self)
return self.editBox:GetText()
end,
 
["SetMaxLetters"] = function (self, num)
self.editBox:SetMaxLetters(num or 0)
end,
 
["DisableButton"] = function(self, disabled)
self.disablebutton = disabled
if disabled then
self.button:Hide()
else
self.button:Show()
end
Layout(self)
end
}
 
204,7 → 231,7
label:SetHeight(10)
 
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate2")
button:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 0, 4)
button:SetPoint("BOTTOMLEFT", 0, 4)
button:SetHeight(22)
button:SetWidth(label:GetStringWidth() + 24)
button:SetText(ACCEPT)
267,7 → 294,9
frame = frame,
label = label,
labelHeight = 10,
numlines = 4,
scrollBar = scrollBar,
scrollBG = scrollBG,
scrollFrame = scrollFrame,
type = Type
}
276,8 → 305,7
end
button.obj, editBox.obj, scrollFrame.obj = widget, widget, widget
 
AceGUI:RegisterAsWidget(widget)
return widget
return AceGUI:RegisterAsWidget(widget)
end
 
AceGUI:RegisterWidgetType(Type, Constructor, Version)
AceGUIWidget-EditBox.lua
1,7 → 1,7
--[[-----------------------------------------------------------------------------
EditBox Widget
-------------------------------------------------------------------------------]]
local Type, Version = "EditBox", 21
local Type, Version = "EditBox", 22
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
 
146,6 → 146,10
HideButton(self)
end,
 
["GetText"] = function(self, text)
return self.editbox:GetText()
end,
 
["SetLabel"] = function(self, text)
if text and text ~= "" then
self.label:SetText(text)
164,6 → 168,9
 
["DisableButton"] = function(self, disabled)
self.disablebutton = disabled
if disabled then
HideButton(self)
end
end,
 
["SetMaxLetters"] = function (self, num)
AceGUIContainer-ScrollFrame.lua
2,13 → 2,13
ScrollFrame Container
Plain container that scrolls its content and doesn't grow in height.
-------------------------------------------------------------------------------]]
local Type, Version = "ScrollFrame", 20
local Type, Version = "ScrollFrame", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
 
-- Lua APIs
local pairs, assert, type = pairs, assert, type
local min, max, floor = math.min, math.max, math.floor
local min, max, floor, abs = math.min, math.max, math.floor, math.abs
 
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
77,10 → 77,7
local status = self.status or self.localstatus
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
 
if height > viewheight then
self.scrollbar:Hide()
else
self.scrollbar:Show()
if self.scrollBarShown then
local diff = height - viewheight
local delta = 1
if value < 0 then
97,7 → 94,9
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
local offset = status.offset or 0
local curvalue = self.scrollbar:GetValue()
if viewheight < height then
-- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys
-- No-one is going to miss 2 pixels at the bottom of the frame, anyhow!
if viewheight < height + 2 then
if self.scrollBarShown then
self.scrollBarShown = nil
self.scrollbar:Hide()