/branches/preview/Aloft/Libs/AceGUI-3.0
--[[ $Id: AceGUIWidget-DropDown.lua 991 2010-11-12 16:51:38Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown.lua 997 2010-12-01 18:36:28Z nevcairiel $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
do |
local widgetType = "Dropdown" |
local widgetVersion = 23 |
local widgetVersion = 24 |
--[[ Static data ]]-- |
end |
end |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("Dropdown-Item-Toggle") |
local function AddListItem(self, value, text, itemType) |
if not itemType then itemType = "Dropdown-Item-Toggle" end |
local exists = AceGUI:GetWidgetVersion(itemType) |
if not exists then error(("The given item type, %q, does not exist within AceGUI-3.0"):format(tostring(itemType)), 2) end |
local item = AceGUI:Create(itemType) |
item:SetText(text) |
item.userdata.obj = self |
item.userdata.value = value |
-- exported |
local sortlist = {} |
local function SetList(self, list,order) |
local function SetList(self, list, order, itemType) |
self.list = list |
self.pullout:Clear() |
self.hasClose = nil |
tsort(sortlist) |
for i, key in ipairs(sortlist) do |
AddListItem(self, key, list[key]) |
AddListItem(self, key, list[key], itemType) |
sortlist[i] = nil |
end |
else |
for i, key in ipairs(order) do |
AddListItem(self, key, list[key]) |
AddListItem(self, key, list[key], itemType) |
end |
end |
if self.multiselect then |
end |
-- exported |
local function AddItem(self, value, text) |
local function AddItem(self, value, text, itemType) |
if self.list then |
self.list[value] = text |
AddListItem(self, value, text) |
AddListItem(self, value, text, itemType) |
end |
end |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 916 2010-03-15 12:24:36Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 996 2010-12-01 18:34:17Z nevcairiel $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
return self |
end |
-- Register a dummy LibStub library to retrieve the ItemBase, so other addons can use it. |
local IBLib = LibStub:NewLibrary("AceGUI-3.0-DropDown-ItemBase", ItemBase.version) |
if IBLib then |
IBLib.GetItemBase = function() return ItemBase end |
end |
--[[ |
Template for items: |
TreeGroup Container |
Container that uses a tree control to switch between groups. |
-------------------------------------------------------------------------------]] |
local Type, Version = "TreeGroup", 31 |
local Type, Version = "TreeGroup", 32 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local numlines = #lines |
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18)) |
if maxlines <= 0 then return end |
local first, last |
--check if we are scrolled down too far |
if numlines - status.scrollvalue < maxlines then |
status.scrollvalue = numlines - maxlines |
end |
if self.scrollbar:GetValue() ~= status.scrollvalue then |
self.scrollbar:SetValue(status.scrollvalue) |
end |
self.noupdate = nil |
button:SetParent(treeframe) |
button:SetFrameLevel(treeframe:GetFrameLevel()+1) |
button:ClearAllPoints() |
if i == 1 then |
if buttonnum == 1 then |
if self.showscroll then |
button:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",-22,-10) |
button:SetPoint("TOPLEFT", self.treeframe, "TOPLEFT", 0, -10) |
button:SetPoint("TOPRIGHT", -22, -10) |
button:SetPoint("TOPLEFT", 0, -10) |
else |
button:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",0,-10) |
button:SetPoint("TOPLEFT", self.treeframe, "TOPLEFT", 0, -10) |
button:SetPoint("TOPRIGHT", 0, -10) |
button:SetPoint("TOPLEFT", 0, -10) |
end |
else |
button:SetPoint("TOPRIGHT", buttons[buttonnum-1], "BOTTOMRIGHT",0,0) |
TabGroup Container |
Container that uses tabs on top to switch between groups. |
-------------------------------------------------------------------------------]] |
local Type, Version = "TabGroup", 30 |
local Type, Version = "TabGroup", 31 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
-- equal padding for each tab to fill the available width, |
-- if the used space is above 75% already |
-- the 18 pixel is the typical width of a scrollbar, so we can have a tab group inside a scrolling frame, |
-- and not have the tabs jump around funny when switching between tabs that need scrolling and those that don't |
local padding = 0 |
if not (numrows == 1 and rowwidths[1] < width*0.75) then |
if not (numrows == 1 and rowwidths[1] < width*0.75 - 18) then |
padding = (width - rowwidths[row]) / (endtab - starttab+1) |
end |