adam@0
|
1 local _, AskMrRobot = ...
|
yellowfive@11
|
2 local L = AskMrRobot.L;
|
adam@0
|
3
|
adam@0
|
4 -- initialize the ImportTab class
|
adam@0
|
5 AskMrRobot.ImportTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame)
|
adam@0
|
6
|
adam@0
|
7 function AskMrRobot.ImportTab:new(parent)
|
adam@0
|
8
|
adam@0
|
9 local tab = AskMrRobot.Frame:new(nil, parent)
|
adam@0
|
10 setmetatable(tab, { __index = AskMrRobot.ImportTab })
|
adam@0
|
11 tab:SetPoint("TOPLEFT")
|
adam@0
|
12 tab:SetPoint("BOTTOMRIGHT")
|
adam@0
|
13 tab:Hide()
|
adam@0
|
14
|
adam@0
|
15 -- import button
|
adam@0
|
16 tab.button = CreateFrame("Button", "AmrImportButton", tab, "UIPanelButtonTemplate")
|
adam@0
|
17 tab.button:SetPoint("BOTTOM")
|
yellowfive@11
|
18 tab.button:SetText(L.AMR_IMPORTTAB_BUTTON)
|
adam@0
|
19 tab.button:SetWidth(100)
|
adam@0
|
20 tab.button:SetHeight(20)
|
adam@0
|
21 tab.button:SetPoint("BOTTOM", 0, 15)
|
adam@0
|
22
|
adam@0
|
23 local text = tab:CreateFontString("AmrImportText1", "ARTWORK", "GameFontNormalLarge")
|
adam@0
|
24 text:SetPoint("TOPLEFT", 0, -5)
|
yellowfive@11
|
25 text:SetFormattedText(L.AMR_IMPORTTAB_TITLE)
|
adam@0
|
26
|
adam@0
|
27 text = tab:CreateFontString("AmrImportText2", "ARTWORK", "GameFontWhite")
|
adam@0
|
28 text:SetPoint("TOPLEFT", "AmrImportText1", "BOTTOMLEFT", 0, -20)
|
adam@0
|
29 text:SetPoint("RIGHT", 0, -20)
|
adam@0
|
30 text:SetWidth(text:GetWidth())
|
adam@0
|
31 text:SetJustifyH("LEFT")
|
yellowfive@11
|
32 text:SetText(L.AMR_IMPORTTAB_INSTRUCTIONS_1)
|
adam@0
|
33
|
adam@0
|
34 local image = tab:CreateTexture(nil, "BACKGROUND")
|
adam@0
|
35 image:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 16, -10)
|
adam@0
|
36 image:SetTexture("Interface\\AddOns\\AskMrRobot\\Media\\AddonExport")
|
adam@0
|
37 image:SetSize(256, 256)
|
adam@0
|
38
|
adam@0
|
39 text = tab:CreateFontString("AmrImportText3", "ARTWORK", "GameFontWhite")
|
adam@0
|
40 text:SetPoint("TOPLEFT", image, "BOTTOMLEFT", -16, 24)
|
adam@0
|
41 text:SetPoint("RIGHT", -15, 40)
|
adam@0
|
42 text:SetWidth(text:GetWidth())
|
adam@0
|
43 text:SetJustifyH("LEFT")
|
yellowfive@11
|
44 text:SetText(L.AMR_IMPORTTAB_INSTRUCTIONS_2)
|
adam@0
|
45
|
adam@0
|
46 local scrollFrame = CreateFrame("ScrollFrame", "AmrImportScrollFrame", tab, "InputScrollFrameTemplate")
|
adam@0
|
47 scrollFrame:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 5, -10)
|
adam@0
|
48 scrollFrame:SetPoint("BOTTOM", "AmrImportButton", "TOP", 0, 10)
|
adam@0
|
49 scrollFrame:SetPoint("RIGHT", -30, 0)
|
adam@0
|
50 scrollFrame:SetWidth(430)
|
adam@0
|
51 scrollFrame.EditBox:SetWidth(scrollFrame:GetWidth())
|
adam@0
|
52 scrollFrame.EditBox:SetMaxLetters(1100)
|
adam@0
|
53 scrollFrame.CharCount:Hide()
|
yellowfive@11
|
54 scrollFrame.EditBox.PromptText:SetText(L.AMR_IMPORTTAB_INSTRUCTIONS_3)
|
adam@0
|
55 scrollFrame.EditBox:SetFocus()
|
adam@0
|
56 scrollFrame.EditBox:HighlightText()
|
adam@0
|
57 tab.scrollFrame = scrollFrame
|
adam@0
|
58
|
adam@0
|
59 tab:SetScript("OnShow", function()
|
adam@0
|
60 tab.scrollFrame.EditBox:HighlightText()
|
adam@0
|
61 tab.scrollFrame.EditBox:SetFocus()
|
adam@0
|
62 end)
|
adam@0
|
63
|
adam@0
|
64 return tab
|
adam@0
|
65 end
|