John@38: local AceGUI = LibStub("AceGUI-3.0") 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@38: icon:SetCallback("OnEnter", function(widget) GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); GameTooltip:Show() end ) John@38: icon:SetCallback("OnLeave", function(widget) 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@38: icon:SetCallback("OnEnter", function(widget) GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); GameTooltip:Show() end ) John@38: icon:SetCallback("OnLeave", function(widget) 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@38: local tree = {} John@38: for i,v in pairs(bsk.lists) do John@38: local entry = {value=i,text=v.name} John@38: if getn(v) > 0 then John@38: entry.children = {} John@38: for x,y in ipairs(v) do John@38: local p = bsk.persons[y.id] John@38: local line = {value=y.id,text=p.main,icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]} John@38: line.iconCoords=CLASS_ICON_TCOORDS[p.class] John@38: bsk:PopulateRaidList() -- todo: this should be elsewhere John@38: if not bsk.raidIdP[y.id] and not bsk.reserveIdP[y.id] then John@38: line.disabled = true John@38: else John@38: line.text=colorize(line.text,RAID_CLASS_COLORS[p.class]) John@38: end John@38: table.insert(entry.children,line) John@38: end John@38: else John@38: entry.disabled=true John@38: end John@38: table.insert(tree,entry) John@38: end John@38: local treegroup = AceGUI:Create("TreeGroup") John@38: treegroup:SetTree(tree) John@38: treegroup:EnableButtonTooltips(false) John@38: treegroup:SetFullWidth(true) John@38: treegroup:SetFullHeight(true) John@38: treegroup:SetAutoAdjustHeight(false) John@38: John@38: treegroup:SetCallback("OnGroupSelected", function(widget,_,uniquevalue) bsk:Print("OGS: uniquevalue: "..uniquevalue) John@38: end) John@38: treegroup:SetCallback("OnClick", function(widget,_,uniquevalue) bsk:Print("Onclick: uniquevalue: " .. uniquevalue) end) John@38: treegroup:SetCallback("OnButtonEnter", function(widget,_,value) bsk:Print("OnButtonEnter: value: " .. value) end) John@38: John@38: container:AddChild(treegroup) John@38: John@38: local scroller = AceGUI:Create("ScrollFrame") John@38: scroller:SetLayout("List") John@38: scroller:SetHeight(0) -- prevents a nasty graphical bug, dont ask me why John@38: scroller:SetFullHeight(true) John@38: scroller:SetFullWidth(true) John@38: John@38: local label = AceGUI:Create("InteractiveLabel") John@38: label:SetText("fucking hell\n") John@38: scroller:AddChild(label) John@38: scroller:AddChild(rightGroup) John@38: --widget:ReleaseChildren() John@38: --widget:SetLayout("List") John@38: --widget:AddChild(scroller) John@38: treegroup:AddChild(scroller) 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@1: function bsk:CreateGUI() John@1: John@1: -- Create a container frame John@1: self.frame = AceGUI:Create("Frame") John@1: self.frame:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end) John@1: self.frame:SetTitle("BSK") John@1: self.frame:SetLayout("Flow") John@1: self.frame:SetHeight(700) John@38: self.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@38: --self.frame:AddChild(tab) John@38: ChangeTab(self.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@1: --btn:SetCallback("OnClick", function() print("Click!") end) John@1: -- Add the button to the container John@1: --self.frame:AddChild(btn) John@1: end John@1: John@1: