John@38: local AceGUI = LibStub("AceGUI-3.0") John@42: local bsk=bsk John@42: local _G=_G John@42: local table=table John@42: local pairs=pairs John@42: local ipairs=ipairs John@42: local string=string John@42: local tostring=tostring John@42: local type=type John@42: local getn=getn John@42: setfenv(1,bsk) John@1: John@1: local ChangeTab = function(container, event, group) John@1: container:ReleaseChildren() John@1: if group == "tab2" then John@1: local desc = AceGUI:Create("Label") John@1: desc:SetText("This is Tab 1") John@1: desc:SetFullWidth(true) John@1: container:AddChild(desc) John@1: John@1: local button = AceGUI:Create("Button") John@1: button:SetText("Tab 1 Button") John@1: button:SetWidth(200) John@1: container:AddChild(button) John@1: elseif group == "tab1" then John@38: --local leftGroup = AceGUI:Create("InlineGroup") John@38: --leftGroup:SetFullHeight() John@38: --leftGroup:SetWidth(200) John@38: John@38: local rightGroup = AceGUI:Create("InlineGroup") John@38: rightGroup:SetTitle("title") John@38: --rightGroup:SetWidth(600) John@38: --rightGroup:SetHeight(200) John@38: rightGroup.width = 'fill' John@38: --rightGroup:SetFullWidth() John@38: --rightGroup.alignoffset = 25 John@38: rightGroup:SetLayout("Flow") John@38: John@38: --local desc = AceGUI:Create("Label") John@38: --desc:SetText("This is Tab 1") John@38: --desc:SetFullWidth(true) John@38: --container:AddChild(desc) John@38: local icon = AceGUI:Create("Icon") John@38: icon:SetImage([[Interface\Icons\INV_Misc_PocketWatch_01]]) John@38: local sz = 64 * icon.frame:GetEffectiveScale() -- 64 matches the character frame icon size John@38: icon:SetWidth(sz,sz) John@38: icon:SetHeight(sz,sz) John@38: icon:SetImageSize(sz,sz) John@42: icon:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); _G.GameTooltip:Show() end ) John@42: icon:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end ) John@38: rightGroup:AddChild(icon) John@38: John@38: for i=1,12 do John@38: icon = AceGUI:Create("Icon") John@38: icon:SetImage([[Interface\Icons\INV_Misc_PocketWatch_01]]) John@38: local sz = 64 * icon.frame:GetEffectiveScale() -- 64 matches the character frame icon size John@38: icon:SetWidth(sz,sz) John@38: icon:SetHeight(sz,sz) John@38: icon:SetImageSize(sz,sz) John@42: icon:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); _G.GameTooltip:Show() end ) John@42: icon:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end ) John@38: rightGroup:AddChild(icon) John@38: end John@38: John@1: local item2 = {string="item2!", color = {r=1,g=0,b=0.5} } John@38: local itemList = {"Item1", "item2", "Item3", "Item4"} John@38: for i=5,29 do John@38: table.insert(itemList,"Item"..i) John@38: end John@1: John@38: local colorize = function(str,color) John@38: if str==nil or str=="" then return "" end John@38: if type(color) == "table" then John@38: color = string.format("%02x%02x%02x",255*color.r,255*color.g,255*color.b) John@38: end John@38: if color == nil then return str end John@38: return "|cff"..tostring(color or "ffffff")..str.."|r" John@38: end John@40: local pull = {} John@40: local ltemp = 0 John@42: for i,v in pairs(lists) do John@40: pull[i] = v.name John@40: --local entry = {value=i,text=v.name} John@40: if ltemp == 0 and getn(v) > 0 then John@40: ltemp = i John@38: end John@38: end John@38: John@42: PopulateRaidList() -- todo: this should be elsewhere John@38: John@38: John@42: scroller = AceGUI:Create("ScrollFrame") John@42: scroller:SetLayout("List") John@42: scroller:SetHeight(0) -- prevents a nasty graphical bug, dont ask me why John@42: scroller:SetFullHeight(true) John@42: scroller:SetFullWidth(true) John@38: John@38: local label = AceGUI:Create("InteractiveLabel") John@38: label:SetText("fucking hell\n") John@42: scroller:AddChild(label) John@42: scroller:AddChild(rightGroup) John@40: John@42: treecontrol = AceGUI:Create("TreeGroup") John@42: treecontrol:EnableButtonTooltips(false) John@42: treecontrol:SetFullWidth(true) John@42: treecontrol:SetFullHeight(true) John@42: treecontrol:SetAutoAdjustHeight(false) John@40: John@42: treecontrol:AddChild(scroller) John@40: John@40: local pulldown = AceGUI:Create("Dropdown") John@40: pulldown:SetWidth(175) John@40: pulldown:SetList(pull) John@42: for i,v in pairs(lists) do John@40: if getn(v) == 0 then John@40: pulldown:SetItemDisabled(i,true) John@40: end John@40: end John@40: local ovc = function(_,_,value) John@42: --treecontrol:ReleaseChildren() John@40: local tree = {} John@42: for x,y in ipairs(lists[value]) do John@42: local p = persons[y.id] John@40: local line = {value=y.id,text=p.main,icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]} John@42: line.iconCoords=_G.CLASS_ICON_TCOORDS[p.class] John@42: if not raidIdP[y.id] and not reserveIdP[y.id] then John@40: line.disabled = true John@40: else John@42: line.text=colorize(line.text,_G.RAID_CLASS_COLORS[p.class]) John@40: end John@40: table.insert(tree,line) John@40: end John@42: treecontrol:SetTree(tree) John@40: end John@40: pulldown:SetCallback("OnValueChanged", ovc) John@40: if ltemp > 0 then pulldown:SetValue(ltemp); ovc(nil,nil,ltemp) end -- sadly, SetValue doesn't fire a OnValueChanged John@40: John@40: container:AddChild(pulldown) John@42: container:AddChild(treecontrol) John@40: John@40: --pulldown:EnableButtonTooltips(false) John@40: --pulldown:SetFullWidth(true) John@40: --pulldown:SetFullHeight(true) John@40: --pulldown:SetAutoAdjustHeight(false) John@40: John@43: --pulldown:SetCallback("OnGroupSelected", function(widget,_,uniquevalue) print("OGS: uniquevalue: "..uniquevalue) John@40: --end) John@43: --pulldown:SetCallback("OnClick", function(widget,_,uniquevalue) print("Onclick: uniquevalue: " .. uniquevalue) end) John@43: --pulldown:SetCallback("OnButtonEnter", function(widget,_,value) print("OnButtonEnter: value: " .. value) end) John@40: John@40: John@1: end John@1: end John@1: John@38: --local myhook = function(tooltip, spellid) John@38: --tooltip:AddLine("MSS was here", 1, 1, 1) John@38: --tooltip:Show() John@38: --end John@38: --if GameTooltip:GetScript("OnTooltipSetSpell") then John@38: --GameTooltip:HookScript("OnTooltipSetSpell", myhook) John@38: --else John@38: --GameTooltip:SetScript("OnTooltipSetSpell", myhook) John@38: --end John@38: John@42: function CreateGUI() John@1: John@1: -- Create a container frame John@42: frame = AceGUI:Create("Frame") John@42: frame:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end) John@42: frame:SetTitle("BSK") John@42: frame:SetLayout("Flow") John@42: frame:SetHeight(700) John@42: frame:SetWidth(700) John@1: John@38: --local opts = John@38: --{ John@38: John@38: --} John@1: John@38: John@38: John@38: John@38: John@38: John@38: --local tab = AceGUI:Create("TabGroup") John@38: --tab:SetLayout("Flow") John@38: --tab:SetTabs( John@38: -- { John@38: -- { John@38: -- text="Tab 1", John@38: -- value="tab1" John@38: -- }, John@38: John@38: -- { John@38: -- text="Tab 2", John@38: -- value="tab2" John@38: -- }, John@38: -- { John@38: -- text="Tab 3", John@38: -- value="tab3" John@38: -- }, John@38: -- { John@38: -- text="Tab 4", John@38: -- value="tab4" John@38: -- } John@38: -- } John@38: --) John@38: --tab.width = "fill" John@38: --tab.height = "fill" John@38: John@38: --tab:SetCallback("OnGroupSelected",ChangeTab) John@38: --tab:SelectTab("tab1") John@42: --frame:AddChild(tab) John@42: ChangeTab(frame,0,"tab1") John@1: John@1: -- Create a button John@1: --local btn = AceGUI:Create("Button") John@1: --btn:SetWidth(170) John@1: --btn:SetText("Button !") John@43: --btn:SetCallback("OnClick", function() Print("Click!") end) John@1: -- Add the button to the container John@42: --frame:AddChild(btn) John@1: end John@1: John@1: