/trunk/Plink!/Libs/AceGUI-3.0/widgets
--[[ $Id: AceGUIWidget-DropDown-Items.lua 76326 2008-06-09 09:29:17Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 656 2008-05-31 11:47:08Z nargiddley $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
do |
local Type = "TreeGroup" |
local Version = 13 |
local Version = 16 |
local DEFAULT_TREE_WIDTH = 175 |
local DEFAULT_TREE_SIZABLE = true |
local buttoncount = 1 |
local function CreateButton(self) |
local button = CreateFrame("Button",("AceGUI30TreeButton%d"):format(buttoncount),self.treeframe, "InterfaceOptionsButtonTemplate") |
local button = CreateFrame("Button",("AceGUI30TreeButton%d"):format(buttoncount),self.treeframe, "OptionsListButtonTemplate") |
buttoncount = buttoncount + 1 |
button.obj = self |
local line = button.line |
button.level = level |
if ( level == 1 ) then |
button:SetTextFontObject("GameFontNormal") |
button:SetNormalFontObject("GameFontNormal") |
button:SetHighlightFontObject("GameFontHighlight") |
button.text:SetPoint("LEFT", 8, 2) |
else |
button:SetTextFontObject("GameFontHighlightSmall") |
button:SetNormalFontObject("GameFontHighlightSmall") |
button:SetHighlightFontObject("GameFontHighlightSmall") |
button.text:SetPoint("LEFT", 8 * level, 2) |
end |
} |
]] |
local function SetTree(self, tree) |
assert(type(tree) == "table") |
if tree then |
assert(type(tree) == "table") |
end |
self.tree = tree |
self:RefreshTree() |
end |
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 ) / 18)) |
end |
local function OnWidthSet(self, width) |
local content = self.content |
local treeframe = self.treeframe |
local status = self.status or self.localstatus |
local contentwidth = width - status.treewidth - 20 |
if contentwidth < 0 then |
contentwidth = 0 |
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) |
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 |
status.treewidth = treewidth |
status.treesizable = resizable |
end |
local function draggerLeave(this) |
this:SetBackdropColor(1, 1, 1, 0) |
end |
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() |
treeframe.obj:Fire("OnTreeResize",treeframe:GetWidth()) |
local status = self.status or self.localstatus |
status.treewidth = treeframe:GetWidth() |
end |
local createdcount = 0 |
treeframe:SetBackdropColor(0.1,0.1,0.1,0.5) |
treeframe:SetBackdropBorderColor(0.4,0.4,0.4) |
treeframe:SetResizable(true) |
treeframe:SetResizable(true) |
treeframe:SetMinResize(100, 1) |
treeframe:SetMaxResize(400,1600) |
local dragger = CreateFrame("Frame", nil, treeframe) |
dragger:SetScript("OnEnter", draggerEnter) |
dragger:SetScript("OnLeave", draggerLeave) |
self.dragger = dragger |
self.dragger = dragger |
self.treeframe = treeframe |
self.OnRelease = OnRelease |
self.OnAcquire = OnAcquire |
self.SetTree = SetTree |
self.SetTreeWidth = SetTreeWidth |
self.SetTreeWidth = SetTreeWidth |
self.RefreshTree = RefreshTree |
self.SetStatusTable = SetStatusTable |
self.BuildLevel = BuildLevel |
local AceGUI = LibStub("AceGUI-3.0") |
local Version = 6 |
local Version = 7 |
--------------------- |
-- Common Elements -- |
--------------------- |
self.disabled = disabled |
if disabled then |
self.editbox:EnableMouse(false) |
self.scrollframe:EnableMouse(false) |
self.editbox:ClearFocus() |
self.editbox:SetTextColor(0.5, 0.5, 0.5) |
self.label:SetTextColor(0.5,0.5,0.5) |
else |
self.editbox:EnableMouse(true) |
self.scrollframe:EnableMouse(true) |
self.editbox:SetTextColor(1, 1, 1) |
self.label:SetTextColor(1,.82,0) |
end |
end |
scrollframe:SetPoint("TOPLEFT", 5, -6) |
scrollframe:SetPoint("BOTTOMRIGHT", -28, 6) |
scrollframe.obj = self |
self.scrollframe = scrollframe |
local scrollchild = CreateFrame("Frame", nil, scrollframe) |
scrollframe:SetScrollChild(scrollchild) |
scrollchild:SetHeight(2) |
scrollchild:SetWidth(2) |
local label = frame:CreateFontString(nil,"OVERLAY","GameFontHighlight") |
label:SetPoint("TOPLEFT",frame,"TOPLEFT",14,0) |
label:SetPoint("TOPRIGHT",frame,"TOPRIGHT",-14,0) |
local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall") |
label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,-2) |
label:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,-2) |
label:SetJustifyH("LEFT") |
label:SetHeight(18) |
self.label = label |
do |
local Type = "TabGroup" |
local Version = 14 |
local Version = 15 |
local PaneBackdrop = { |
bgFile = "Interface\\ChatFrame\\ChatFrameBackground", |
local function Tab_SetText(self, text) |
self:_SetText(text) |
PanelTemplates_TabResize(0, self) |
PanelTemplates_TabResize(self, 0) |
end |
local function UpdateTabLook(self) |
--equal padding for each tab to fill the available width |
local padding = (width - rowwidths[row]) / (endtab - starttab+1) |
for i = starttab, endtab do |
PanelTemplates_TabResize(padding, tabs[i]) |
end |
PanelTemplates_TabResize(tabs[i], padding) |
end |
starttab = endtab + 1 |
end |
-------------------------- |
-- Keybinding -- |
-------------------------- |
do |
local Type = "Keybinding" |
local Version = 8 |
local Version = 11 |
local ControlBackdrop = { |
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", |
end |
end |
this:EnableKeyboard(false) |
self.msgframe:Hide() |
this:UnlockHighlight() |
self.waitingForKey = nil |
if not self.disabled then |
self:SetKey(keyPressed) |
self:Fire("OnKeyChanged",keyPressed) |
end |
this:EnableKeyboard(false) |
self.msgframe:Hide() |
this:UnlockHighlight() |
self.waitingForKey = nil |
end |
end |
end |
local function OnAcquire(self) |
self:SetLabel("") |
self:SetKey("") |
end |
local function OnRelease(self) |
end |
local function SetKey(self, key) |
self.button:SetText(key or "") |
if (key or "") == "" then |
self.button:SetText(NOT_BOUND) |
self.button:SetNormalFontObject("GameFontNormal") |
else |
self.button:SetText(key) |
self.button:SetNormalFontObject("GameFontHighlight") |
end |
end |
local function SetLabel(self, label) |
self.label:SetText(label or "") |
if (label or "") == "" then |
self.alignoffset = nil |
self:SetHeight(24) |
else |
self.alignoffset = 30 |
self:SetHeight(44) |
end |
end |
local function Constructor() |
local num = AceGUI:GetNextWidgetNum(Type) |
local frame = CreateFrame("Frame",nil,UIParent) |
--[[ $Id: AceGUIWidget-DropDown.lua 76326 2008-06-09 09:29:17Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown.lua 679 2008-09-06 12:51:18Z nargiddley $ ]]-- |
local min, max, floor = math.min, math.max, math.floor |
local AceGUI = LibStub("AceGUI-3.0") |
do |
local widgetType = "Dropdown" |
local widgetVersion = 17 |
local widgetVersion = 18 |
--[[ Static data ]]-- |
end |
local function Dropdown_OnHide(this) |
this.obj.pullout:Close() |
local self = this.obj |
if self.open then |
self.pullout:Close() |
end |
end |
local function Dropdown_TogglePullout(this) |
self:Fire("OnValueChanged", this.userdata.value) |
else |
this:SetValue(true) |
end |
self.pullout:Close() |
end |
if self.open then |
self.pullout:Close() |
end |
end |
end |
-- exported, AceGUI callback |
local function OnRelease(self) |
self.pullout:Close() |
if self.open then |
self.pullout:Close() |
end |
AceGUI:Release(self.pullout) |
self:SetText("") |
-- exported |
local function ClearFocus(self) |
self.pullout:Close() |
if self.open then |
self.pullout:Close() |
end |
end |
-- exported |
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 |