comparison ui/ImportTab.lua @ 17:e77e01abce98

Warlords of Draenor pre-patch
author Adam tegen <adam.tegen@gmail.com>
date Mon, 13 Oct 2014 21:28:32 -0500
parents ece9167c0d1c
children
comparison
equal deleted inserted replaced
16:9793e8b683d2 17:e77e01abce98
10 setmetatable(tab, { __index = AskMrRobot.ImportTab }) 10 setmetatable(tab, { __index = AskMrRobot.ImportTab })
11 tab:SetPoint("TOPLEFT") 11 tab:SetPoint("TOPLEFT")
12 tab:SetPoint("BOTTOMRIGHT") 12 tab:SetPoint("BOTTOMRIGHT")
13 tab:Hide() 13 tab:Hide()
14 14
15 -- import button
16 tab.button = CreateFrame("Button", "AmrImportButton", tab, "UIPanelButtonTemplate")
17 tab.button:SetPoint("BOTTOM")
18 tab.button:SetText(L.AMR_IMPORTTAB_BUTTON)
19 tab.button:SetWidth(100)
20 tab.button:SetHeight(20)
21 tab.button:SetPoint("BOTTOM", 0, 15)
22
23 local text = tab:CreateFontString("AmrImportText1", "ARTWORK", "GameFontNormalLarge") 15 local text = tab:CreateFontString("AmrImportText1", "ARTWORK", "GameFontNormalLarge")
24 text:SetPoint("TOPLEFT", 0, -5) 16 text:SetPoint("TOPLEFT", 0, -5)
25 text:SetFormattedText(L.AMR_IMPORTTAB_TITLE) 17 text:SetFormattedText(L.AMR_IMPORTTAB_TITLE)
26 18
27 text = tab:CreateFontString("AmrImportText2", "ARTWORK", "GameFontWhite") 19 text = tab:CreateFontString("AmrImportText2", "ARTWORK", "GameFontWhite")
28 text:SetPoint("TOPLEFT", "AmrImportText1", "BOTTOMLEFT", 0, -20) 20 text:SetPoint("TOPLEFT", "AmrImportText1", "BOTTOMLEFT", 0, -20)
29 text:SetPoint("RIGHT", 0, -20) 21 text:SetPoint("RIGHT", -15, 0)
30 text:SetWidth(text:GetWidth()) 22 text:SetWidth(text:GetWidth())
31 text:SetJustifyH("LEFT") 23 text:SetJustifyH("LEFT")
32 text:SetText(L.AMR_IMPORTTAB_INSTRUCTIONS_1) 24 text:SetText(L.AMR_IMPORTTAB_INSTRUCTIONS_1)
33 25
34 local image = tab:CreateTexture(nil, "BACKGROUND")
35 image:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 16, -10)
36 image:SetTexture("Interface\\AddOns\\AskMrRobot\\Media\\AddonExport")
37 image:SetSize(256, 256)
38
39 text = tab:CreateFontString("AmrImportText3", "ARTWORK", "GameFontWhite") 26 text = tab:CreateFontString("AmrImportText3", "ARTWORK", "GameFontWhite")
40 text:SetPoint("TOPLEFT", image, "BOTTOMLEFT", -16, 24) 27 text:SetPoint("TOPLEFT", "AmrImportText2", "BOTTOMLEFT", 0, -10)
41 text:SetPoint("RIGHT", -15, 40) 28 text:SetPoint("RIGHT", -15, 0)
42 text:SetWidth(text:GetWidth()) 29 text:SetWidth(text:GetWidth())
43 text:SetJustifyH("LEFT") 30 text:SetJustifyH("LEFT")
44 text:SetText(L.AMR_IMPORTTAB_INSTRUCTIONS_2) 31 text:SetText(L.AMR_IMPORTTAB_INSTRUCTIONS_2)
45 32
46 local scrollFrame = CreateFrame("ScrollFrame", "AmrImportScrollFrame", tab, "InputScrollFrameTemplate") 33 local scrollFrame = CreateFrame("ScrollFrame", "AmrImportScrollFrame", tab, "InputScrollFrameTemplate")
47 scrollFrame:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 5, -10) 34 scrollFrame:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 5, -10)
48 scrollFrame:SetPoint("BOTTOM", "AmrImportButton", "TOP", 0, 10)
49 scrollFrame:SetPoint("RIGHT", -30, 0) 35 scrollFrame:SetPoint("RIGHT", -30, 0)
50 scrollFrame:SetWidth(430) 36 scrollFrame:SetWidth(430)
37 scrollFrame:SetHeight(60);
51 scrollFrame.EditBox:SetWidth(scrollFrame:GetWidth()) 38 scrollFrame.EditBox:SetWidth(scrollFrame:GetWidth())
52 scrollFrame.EditBox:SetMaxLetters(1100) 39 scrollFrame.EditBox:SetMaxLetters(2400)
53 scrollFrame.CharCount:Hide() 40 scrollFrame.CharCount:Hide()
54 scrollFrame.EditBox.PromptText:SetText(L.AMR_IMPORTTAB_INSTRUCTIONS_3)
55 scrollFrame.EditBox:SetFocus() 41 scrollFrame.EditBox:SetFocus()
56 scrollFrame.EditBox:HighlightText() 42 scrollFrame.EditBox:HighlightText()
57 tab.scrollFrame = scrollFrame 43 tab.scrollFrame = scrollFrame
58 44
45 tab.button = CreateFrame("Button", "AmrImportButton", tab, "UIPanelButtonTemplate")
46 tab.button:SetText(L.AMR_IMPORTTAB_BUTTON)
47 tab.button:SetWidth(100)
48 tab.button:SetHeight(20)
49 tab.button:SetPoint("BOTTOM", tab, "BOTTOM", 0, 20)
50 scrollFrame:SetPoint("BOTTOM", tab.button, "TOP", 0, 15)
51
59 tab:SetScript("OnShow", function() 52 tab:SetScript("OnShow", function()
60 tab.scrollFrame.EditBox:HighlightText() 53 tab.scrollFrame.EditBox:HighlightText()
61 tab.scrollFrame.EditBox:SetFocus() 54 tab.scrollFrame.EditBox:SetFocus()
55 tab:Update()
62 end) 56 end)
63 57
64 return tab 58 return tab
65 end 59 end
60
61 function AskMrRobot.ImportTab:GetImportText()
62 return self.scrollFrame.EditBox:GetText()
63 end
64
65 function AskMrRobot.ImportTab:SetImportText(text)
66 self.scrollFrame.EditBox:SetText(text)
67 self.scrollFrame.EditBox:HighlightText()
68 end
69
70 -- update the panel and state
71 function AskMrRobot.ImportTab:Update()
72 end