diff ui/Ui.lua @ 124:e31b02b24488

Updated for 8.0 pre-patch and BfA.
author yellowfive
date Tue, 17 Jul 2018 09:57:39 -0700
parents f1da233629be
children a0894ffebd15
line wrap: on
line diff
--- a/ui/Ui.lua	Mon Feb 12 19:34:09 2018 -0800
+++ b/ui/Ui.lua	Tue Jul 17 09:57:39 2018 -0700
@@ -168,24 +168,25 @@
 		
 	-- some status text
 	local lblStatus = AceGUI:Create("AmrUiLabel")
+	f:AddChild(lblStatus)
 	lblStatus:SetWidth(900)
 	lblStatus:SetFont(Amr.CreateFont("Italic", 12, Amr.Colors.TextTan))
 	lblStatus:SetText("Ask Mr. Robot " .. L.MainStatusText("v" .. GetAddOnMetadata(Amr.ADDON_NAME, "Version"), "https://www.askmrrobot.com/wow/addon"))
 	lblStatus:SetJustifyH("CENTER")
 	lblStatus:SetWordWrap(false)
 	lblStatus:SetPoint("TOP", f.content, "BOTTOM")
-	f:AddChild(lblStatus)
 		
 	-- create the main UI container
 	local c = AceGUI:Create("AmrUiPanel")
 	c:SetLayout("Fill")
 	c:SetBackgroundColor(Amr.Colors.Black, 0)
+	f:AddChild(c)
 	c:SetPoint("TOPLEFT", f.content, "TOPLEFT")
 	c:SetPoint("BOTTOMRIGHT", f.content, "BOTTOMRIGHT")
-	f:AddChild(c)
 	
 	-- create the main tab strip
 	local t =  AceGUI:Create("AmrUiTabGroup")
+	c:AddChild(t)
 	t:SetLayout("None")
 	t:SetTabs({
 		{text=L.TabExportText, value="Export"}, 
@@ -195,16 +196,15 @@
 		{text=L.TabOptionsText, value="Options"}
 	})
 	t:SetCallback("OnGroupSelected", onMainTabSelected)
-	c:AddChild(t)
 	
 	-- create the cover/overlay container
 	c = AceGUI:Create("AmrUiPanel")
 	c:SetLayout("None")
 	c:EnableMouse(true)
 	c:SetBackgroundColor(Amr.Colors.Black, 0.75)
+	f:AddChild(c)
 	c:SetPoint("TOPLEFT", f.frame, "TOPLEFT")
 	c:SetPoint("BOTTOMRIGHT", f.frame, "BOTTOMRIGHT")
-	f:AddChild(c)
 
 	-- after adding, set cover to sit on top of everything, then hide it
 	c:SetStrata("FULLSCREEN_DIALOG")
@@ -213,13 +213,13 @@
 
 	-- put standard cover ui elements (label, cancel button)
 	local coverMsg = AceGUI:Create("AmrUiLabel")
+	c:AddChild(coverMsg)
 	coverMsg:SetWidth(600)
 	coverMsg:SetFont(Amr.CreateFont("Regular", 16, Amr.Colors.TextTan))
 	coverMsg:SetJustifyH("MIDDLE")
 	coverMsg:SetJustifyV("MIDDLE")
 	coverMsg:SetText("")
 	coverMsg:SetPoint("CENTER", c.frame, "CENTER", 0, 20)
-	c:AddChild(coverMsg)
 	
 	local coverCancel = AceGUI:Create("AmrUiTextButton")
 	coverCancel:SetWidth(200)
@@ -227,8 +227,8 @@
 	coverCancel:SetText(L.CoverCancel)
 	coverCancel:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.TextHeaderDisabled))
 	coverCancel:SetHoverFont(Amr.CreateFont("Italic", 14, Amr.Colors.TextHeaderActive))
+	c:AddChild(coverCancel)
 	coverCancel:SetPoint("CENTER", c.frame, "CENTER", 0, -20)
-	c:AddChild(coverCancel)
 	
 	coverCancel:SetCallback("OnClick", function(widget)
 		Amr:HideCover()
@@ -238,9 +238,9 @@
 	local coverContent = AceGUI:Create("AmrUiPanel")
 	coverContent:SetLayout("None")
 	coverContent:SetBackgroundColor(Amr.Colors.Black, 0)
+	c:AddChild(coverContent)
 	coverContent:SetPoint("TOPLEFT", c.frame, "TOPLEFT")
 	coverContent:SetPoint("BOTTOMRIGHT", c.frame, "BOTTOMRIGHT")
-	c:AddChild(coverContent)
 
 	_mainFrame = f
 	_mainTabs = t
@@ -288,23 +288,23 @@
 		border:SetBackgroundColor(Amr.Colors.BorderBlue)
 		border:SetWidth(400)
 		border:SetHeight(150)
+		container:AddChild(border)
 		border:SetPoint("CENTER", container.frame, "CENTER")
-		container:AddChild(border)
 
 		local bg = AceGUI:Create("AmrUiPanel")
 		bg:SetLayout("None")
 		bg:SetBackgroundColor(Amr.Colors.Bg)
+		border:AddChild(bg)
 		bg:SetPoint("TOPLEFT", border.frame, "TOPLEFT", 1, -1)
 		bg:SetPoint("BOTTOMRIGHT", border.frame, "BOTTOMRIGHT", -1, 1)
-		border:AddChild(bg)
 		
 		local lbl = AceGUI:Create("AmrUiLabel")
+		bg:AddChild(lbl)
 		lbl:SetWidth(360)
 		lbl:SetFont(Amr.CreateFont("Regular", 16, Amr.Colors.Text))
 		lbl:SetJustifyH("CENTER")
 		lbl:SetText(message)
 		lbl:SetPoint("TOP", bg.content, "TOP", 0, -20)
-		bg:AddChild(lbl)
 
 		local btn = AceGUI:Create("AmrUiButton")
 		btn:SetBackgroundColor(Amr.Colors.Orange)
@@ -312,8 +312,8 @@
 		btn:SetWidth(120)
 		btn:SetHeight(26)
 		btn:SetText(btnText)
+		bg:AddChild(btn)
 		btn:SetPoint("BOTTOM", bg.content, "BOTTOM", 0, 20)
-		bg:AddChild(btn)
 		
 		btn:SetCallback("OnClick", function(widget)
 			Amr:HideCover()
@@ -410,15 +410,15 @@
 	border:SetBackgroundColor(Amr.Colors.BorderBlue)
 	border:SetWidth(width + 2)
 	border:SetHeight(height + 2)
+	container:AddChild(border)
 	border:SetPoint("CENTER", container.frame, "CENTER")
-	container:AddChild(border)
 
 	local bg = AceGUI:Create("AmrUiPanel")
 	bg:SetLayout("None")
 	bg:SetBackgroundColor(Amr.Colors.Bg)
+	border:AddChild(bg)
 	bg:SetPoint("TOPLEFT", border.frame, "TOPLEFT", 1, -1)
 	bg:SetPoint("BOTTOMRIGHT", border.frame, "BOTTOMRIGHT", -1, 1)
-	border:AddChild(bg)
 	
 	return bg, border
 end