@@ -43,9 +43,16 @@ function UI:CreateMainWindow(classIsSupported, simLink)
43
43
44
44
local frame = AceGUI :Create (" Frame" )
45
45
frame :SetCallback (" OnClose" , OnClose )
46
- frame :SetTitle (" WowSimsExporter V " .. Env .VERSION .. " " )
46
+ frame :SetTitle (" WowSimsExporter " .. Env .VERSION .. " " )
47
47
frame :SetStatusText (" Click 'Generate Data' to generate exportable data" )
48
48
frame :SetLayout (" Flow" )
49
+
50
+ -- Add the frame as a global variable under the name `WowSimsExporter`
51
+ _G [" WowSimsExporter" ] = frame .frame
52
+ -- Register the global variable `WowSimsExporter` as a "special frame"
53
+ -- so that it is closed when the escape key is pressed.
54
+ tinsert (UISpecialFrames , " WowSimsExporter" )
55
+
49
56
_frame = frame
50
57
51
58
local icon = AceGUI :Create (" Icon" )
@@ -108,11 +115,28 @@ into the provided box and click "Import"
108
115
jsonbox :SetFullWidth (true )
109
116
jsonbox :SetFullHeight (true )
110
117
jsonbox :DisableButton (true )
118
+ jsonbox .editBox :SetScript (" OnEscapePressed" , function (self )
119
+ OnClose (frame )
120
+ end )
111
121
frame :AddChild (jsonbox )
112
122
113
123
_jsonbox = jsonbox
114
124
end
115
125
126
+ --- Create a button on the character panel that will call the provided function
127
+ --- @param onClick fun ()
128
+ function UI :CreateCharacterPanelButton (onClick )
129
+ local openButton = CreateFrame (" Button" , nil , CharacterFrame , " UIPanelButtonTemplate" )
130
+ openButton :SetPoint (" TOPRIGHT" , CharacterFrame , " BOTTOMRIGHT" , 0 , 0 )
131
+ openButton :Show ()
132
+ openButton :SetText (" WowSims" )
133
+ openButton :SetSize (openButton :GetTextWidth () + 15 , openButton :GetTextHeight () + 10 )
134
+ openButton :SetScript (" OnClick" , openButton :SetScript (" OnClick" , function (self )
135
+ onClick ()
136
+ end ))
137
+ openButton :RegisterForClicks (" AnyUp" )
138
+ end
139
+
116
140
--- Sets string in textbox.
117
141
--- @param outputString string
118
142
function UI :SetOutput (outputString )
0 commit comments