comparison ui/ImportTab.lua @ 0:ec731d2fe6ba

Version 1.2.12.0
author Adam tegen <adam.tegen@gmail.com>
date Tue, 20 May 2014 21:43:23 -0500
parents
children ece9167c0d1c
comparison
equal deleted inserted replaced
-1:000000000000 0:ec731d2fe6ba
1 local _, AskMrRobot = ...
2
3 -- initialize the ImportTab class
4 AskMrRobot.ImportTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame)
5
6 function AskMrRobot.ImportTab:new(parent)
7
8 local tab = AskMrRobot.Frame:new(nil, parent)
9 setmetatable(tab, { __index = AskMrRobot.ImportTab })
10 tab:SetPoint("TOPLEFT")
11 tab:SetPoint("BOTTOMRIGHT")
12 tab:Hide()
13
14 -- import button
15 tab.button = CreateFrame("Button", "AmrImportButton", tab, "UIPanelButtonTemplate")
16 tab.button:SetPoint("BOTTOM")
17 tab.button:SetText("Import!")
18 tab.button:SetWidth(100)
19 tab.button:SetHeight(20)
20 tab.button:SetPoint("BOTTOM", 0, 15)
21
22 local text = tab:CreateFontString("AmrImportText1", "ARTWORK", "GameFontNormalLarge")
23 text:SetPoint("TOPLEFT", 0, -5)
24 text:SetFormattedText("Import Mr. Robot's optimizations")
25
26 text = tab:CreateFontString("AmrImportText2", "ARTWORK", "GameFontWhite")
27 text:SetPoint("TOPLEFT", "AmrImportText1", "BOTTOMLEFT", 0, -20)
28 text:SetPoint("RIGHT", 0, -20)
29 text:SetWidth(text:GetWidth())
30 text:SetJustifyH("LEFT")
31 text:SetText("1. Go to our website, optimize, then click the 'export to addon' button found just above the stats section.")
32
33 local image = tab:CreateTexture(nil, "BACKGROUND")
34 image:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 16, -10)
35 image:SetTexture("Interface\\AddOns\\AskMrRobot\\Media\\AddonExport")
36 image:SetSize(256, 256)
37
38 text = tab:CreateFontString("AmrImportText3", "ARTWORK", "GameFontWhite")
39 text:SetPoint("TOPLEFT", image, "BOTTOMLEFT", -16, 24)
40 text:SetPoint("RIGHT", -15, 40)
41 text:SetWidth(text:GetWidth())
42 text:SetJustifyH("LEFT")
43 text:SetText("2. A window will popup, copy the text from that window.\r\r3. Return here and paste the text into the window below. To paste it, hold ctrl + v, or on a mac apple + v.\r\r4. Click the 'Import' button below")
44
45 local scrollFrame = CreateFrame("ScrollFrame", "AmrImportScrollFrame", tab, "InputScrollFrameTemplate")
46 scrollFrame:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 5, -10)
47 scrollFrame:SetPoint("BOTTOM", "AmrImportButton", "TOP", 0, 10)
48 scrollFrame:SetPoint("RIGHT", -30, 0)
49 scrollFrame:SetWidth(430)
50 scrollFrame.EditBox:SetWidth(scrollFrame:GetWidth())
51 scrollFrame.EditBox:SetMaxLetters(1100)
52 scrollFrame.CharCount:Hide()
53 scrollFrame.EditBox.PromptText:SetText("Paste text from AskMrRobot.com here.")
54 scrollFrame.EditBox:SetFocus()
55 scrollFrame.EditBox:HighlightText()
56 tab.scrollFrame = scrollFrame
57
58 tab:SetScript("OnShow", function()
59 tab.scrollFrame.EditBox:HighlightText()
60 tab.scrollFrame.EditBox:SetFocus()
61 end)
62
63 return tab
64 end