Details | Compare with Previous | View Log
Line No. | Rev | Author | Line |
---|---|---|---|
1 | 2 | Seerah-7 | local MAJOR, MINOR = "LibAddonMenu-1.0", 4 |
2 | Seerah-7 | local lam, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
|
3 | Seerah-7 | if not lam then return end --the same or newer version of this lib is already loaded into memory |
|
4 | Seerah-7 | ||
5 | Seerah-7 | --UPVALUES-- |
|
6 | Seerah-7 | lam.lastAddedControl = {} |
|
7 | Seerah-7 | local lastAddedControl = lam.lastAddedControl |
|
8 | Seerah-7 | local wm = GetWindowManager() |
|
9 | Seerah-7 | local strformat = string.format |
|
10 | Seerah-7 | local tostring = tostring |
|
11 | Seerah-7 | local round = zo_round |
|
12 | Seerah-7 | local optionsWindow = ZO_OptionsWindowSettingsScrollChild |
|
13 | Seerah-7 | ||
14 | Seerah-7 | --maybe return the controls from the creation functions? |
|
15 | Seerah-7 | ||
16 | Seerah-7 | function lam:CreateControlPanel(controlPanelID, controlPanelName) |
|
17 | Seerah-7 | local panelID |
|
18 | Seerah-7 | ||
19 | Seerah-7 | if _G[controlPanelID] then |
|
20 | Seerah-7 | panelID = _G[controlPanelID] |
|
21 | Seerah-7 | return panelID |
|
22 | Seerah-7 | end |
|
23 | Seerah-7 | ||
24 | Seerah-7 | ZO_OptionsWindow_AddUserPanel(controlPanelID, controlPanelName) |
|
25 | Seerah-7 | ||
26 | Seerah-7 | --disables Defaults button because we don't need it, but keybind still works :/ ... |
|
27 | Seerah-7 | panelID = _G[controlPanelID] |
|
28 | Seerah-7 | ZO_PreHook("ZO_OptionsWindow_ChangePanels", function(panel) |
|
29 | Seerah-7 | local enable = (panel ~= panelID) |
|
30 | Seerah-7 | ZO_OptionsWindowResetToDefaultButton:SetEnabled(enable) |
|
31 | Seerah-7 | ZO_OptionsWindowResetToDefaultButton:SetKeybindEnabled(enable) |
|
32 | Seerah-7 | end) |
|
33 | Seerah-7 | ||
34 | Seerah-7 | return panelID |
|
35 | Seerah-7 | end |
|
36 | Seerah-7 | ||
37 | Seerah-7 | function lam:AddHeader(panelID, controlName, text) |
|
38 | Seerah-7 | local header = wm:CreateControlFromVirtual(controlName, optionsWindow, lastAddedControl[panelID] and "ZO_Options_SectionTitle_WithDivider" or "ZO_Options_SectionTitle") |
|
39 | Seerah-7 | if lastAddedControl[panelID] then |
|
40 | Seerah-7 | header:SetAnchor(TOPLEFT, lastAddedControl[panelID], BOTTOMLEFT, 0, 15) |
|
41 | Seerah-7 | else |
|
42 | Seerah-7 | header:SetAnchor(TOPLEFT) |
|
43 | Seerah-7 | end |
|
44 | Seerah-7 | header.controlType = OPTIONS_SECTION_TITLE |
|
45 | Seerah-7 | header.panel = panelID |
|
46 | Seerah-7 | header.text = text |
|
47 | Seerah-7 | ||
48 | Seerah-7 | ZO_OptionsWindow_InitializeControl(header) |
|
49 | Seerah-7 | ||
50 | Seerah-7 | lastAddedControl[panelID] = header |
|
51 | Seerah-7 | end |
|
52 | Seerah-7 | ||
53 | Seerah-7 | ||
54 | Seerah-7 | --To-Do list: |
|
55 | Seerah-7 | --extra sub-options window out to the right?? (or maybe addon list?) |
|
56 | Seerah-7 | --find alternatives to handler hooks |
|
57 | Seerah-7 | ||
58 | Seerah-7 | function lam:AddSlider(panelID, controlName, text, tooltip, minValue, maxValue, step, getFunc, setFunc, warning, warningText) |
|
59 | Seerah-7 | local slider = wm:CreateControlFromVirtual(controlName, optionsWindow, "ZO_Options_Slider") |
|
60 | Seerah-7 | slider:SetAnchor(TOPLEFT, lastAddedControl[panelID], BOTTOMLEFT, 0, 6) |
|
61 | Seerah-7 | slider.controlType = OPTIONS_SLIDER |
|
62 | Seerah-7 | slider.system = SETTING_TYPE_UI |
|
63 | Seerah-7 | slider.panel = panelID |
|
64 | Seerah-7 | slider.text = text |
|
65 | Seerah-7 | slider.tooltipText = tooltip |
|
66 | Seerah-7 | slider.showValue = true |
|
67 | Seerah-7 | slider.showValueMin = minValue |
|
68 | Seerah-7 | slider.showValueMax = maxValue |
|
69 | Seerah-7 | local range = maxValue - minValue |
|
70 | Seerah-7 | local slidercontrol = slider:GetNamedChild("Slider") |
|
71 | Seerah-7 | local slidervalue = slider:GetNamedChild("ValueLabel") |
|
72 | Seerah-7 | slidercontrol:SetValueStep(1/range * step) |
|
73 | Seerah-7 | slider:SetHandler("OnShow", function() |
|
74 | Seerah-7 | local curValue = getFunc() |
|
75 | Seerah-7 | slidercontrol:SetValue((curValue - minValue)/range) |
|
76 | Seerah-7 | slidervalue:SetText(tostring(curValue)) |
|
77 | Seerah-7 | end) |
|
78 | Seerah-7 | slidercontrol:SetHandler("OnValueChanged", function (self, value) |
|
79 | Seerah-7 | self:SetValue(value) |
|
80 | Seerah-7 | value = round(value*range + minValue) |
|
81 | Seerah-7 | slidervalue:SetText(strformat("%d", value)) |
|
82 | Seerah-7 | end) |
|
83 | Seerah-7 | slidercontrol:SetHandler("OnSliderReleased", function(self, value) |
|
84 | Seerah-7 | value = round(value*range + minValue) |
|
85 | Seerah-7 | setFunc(value) |
|
86 | Seerah-7 | end) |
|
87 | Seerah-7 | ||
88 | Seerah-7 | if warning then |
|
89 | Seerah-7 | slider.warning = wm:CreateControlFromVirtual(controlName.."WarningIcon", slider, "ZO_Options_WarningIcon") |
|
90 | Seerah-7 | slider.warning:SetAnchor(RIGHT, slidercontrol, LEFT, -5, 0) |
|
91 | Seerah-7 | slider.warning.tooltipText = warningText |
|
92 | Seerah-7 | end |
|
93 | Seerah-7 | ||
94 | Seerah-7 | ZO_OptionsWindow_InitializeControl(slider) |
|
95 | Seerah-7 | ||
96 | Seerah-7 | lastAddedControl[panelID] = slider |
|
97 | Seerah-7 | end |
|
98 | Seerah-7 | ||
99 | Seerah-7 | function lam:AddDropdown(panelID, controlName, text, tooltip, validChoices, getFunc, setFunc, warning, warningText) |
|
100 | Seerah-7 | local dropdown = wm:CreateControlFromVirtual(controlName, optionsWindow, "ZO_Options_Dropdown") |
|
101 | Seerah-7 | dropdown:SetAnchor(TOPLEFT, lastAddedControl[panelID], BOTTOMLEFT, 0, 6) |
|
102 | Seerah-7 | dropdown.controlType = OPTIONS_DROPDOWN |
|
103 | Seerah-7 | dropdown.system = SETTING_TYPE_UI |
|
104 | Seerah-7 | dropdown.panel = panelID |
|
105 | Seerah-7 | dropdown.text = text |
|
106 | Seerah-7 | dropdown.tooltipText = tooltip |
|
107 | Seerah-7 | dropdown.valid = validChoices |
|
108 | Seerah-7 | local dropmenu = ZO_ComboBox_ObjectFromContainer(GetControl(dropdown, "Dropdown")) |
|
109 | Seerah-7 | local setText = dropmenu.m_selectedItemText.SetText |
|
110 | Seerah-7 | local selectedName |
|
111 | Seerah-7 | ZO_PreHookHandler(dropmenu.m_selectedItemText, "OnTextChanged", function(self) |
|
112 | Seerah-7 | if dropmenu.m_selectedItemData then |
|
113 | Seerah-7 | selectedName = dropmenu.m_selectedItemData.name |
|
114 | Seerah-7 | setText(self, selectedName) |
|
115 | Seerah-7 | setFunc(selectedName) |
|
116 | Seerah-7 | end |
|
117 | Seerah-7 | end) |
|
118 | Seerah-7 | dropdown:SetHandler("OnShow", function() |
|
119 | Seerah-7 | dropmenu:SetSelectedItem(getFunc()) |
|
120 | Seerah-7 | end) |
|
121 | Seerah-7 | ||
122 | Seerah-7 | if warning then |
|
123 | Seerah-7 | dropdown.warning = wm:CreateControlFromVirtual(controlName.."WarningIcon", dropdown, "ZO_Options_WarningIcon") |
|
124 | Seerah-7 | dropdown.warning:SetAnchor(RIGHT, dropdown:GetNamedChild("Dropdown"), LEFT, -5, 0) |
|
125 | Seerah-7 | dropdown.warning.tooltipText = warningText |
|
126 | Seerah-7 | end |
|
127 | Seerah-7 | ||
128 | Seerah-7 | ZO_OptionsWindow_InitializeControl(dropdown) |
|
129 | Seerah-7 | ||
130 | Seerah-7 | lastAddedControl[panelID] = dropdown |
|
131 | Seerah-7 | end |
|
132 | Seerah-7 | ||
133 | Seerah-7 | function lam:AddCheckbox(panelID, controlName, text, tooltip, getFunc, setFunc, warning, warningText) |
|
134 | Seerah-7 | local checkbox = wm:CreateControlFromVirtual(controlName, optionsWindow, "ZO_Options_Checkbox") |
|
135 | Seerah-7 | checkbox:SetAnchor(TOPLEFT, lastAddedControl[panelID], BOTTOMLEFT, 0, 6) |
|
136 | Seerah-7 | checkbox.controlType = OPTIONS_CHECKBOX |
|
137 | Seerah-7 | checkbox.system = SETTING_TYPE_UI |
|
138 | Seerah-7 | checkbox.settingId = _G[strformat("SETTING_%s", controlName)] |
|
139 | Seerah-7 | checkbox.panel = panelID |
|
140 | Seerah-7 | checkbox.text = text |
|
141 | Seerah-7 | checkbox.tooltipText = tooltip |
|
142 | Seerah-7 | ||
143 | Seerah-7 | local checkboxButton = checkbox:GetNamedChild("Checkbox") |
|
144 | Seerah-7 | ||
145 | Seerah-7 | ZO_PreHookHandler(checkbox, "OnShow", function() |
|
146 | Seerah-7 | checkboxButton:SetState(getFunc() and 1 or 0) |
|
147 | Seerah-7 | checkboxButton:toggleFunction(getFunc()) |
|
148 | Seerah-7 | end) |
|
149 | Seerah-7 | ZO_PreHookHandler(checkboxButton, "OnClicked", function() setFunc(not getFunc()) end) |
|
150 | Seerah-7 | ||
151 | Seerah-7 | if warning then |
|
152 | Seerah-7 | checkbox.warning = wm:CreateControlFromVirtual(controlName.."WarningIcon", checkbox, "ZO_Options_WarningIcon") |
|
153 | Seerah-7 | checkbox.warning:SetAnchor(RIGHT, checkboxButton, LEFT, -5, 0) |
|
154 | Seerah-7 | checkbox.warning.tooltipText = warningText |
|
155 | Seerah-7 | end |
|
156 | Seerah-7 | ||
157 | Seerah-7 | ZO_OptionsWindow_InitializeControl(checkbox) |
|
158 | Seerah-7 | ||
159 | Seerah-7 | lastAddedControl[panelID] = checkbox |
|
160 | Seerah-7 | end |
|
161 | Seerah-7 | ||
162 | Seerah-7 | function lam:AddColorPicker(panelID, controlName, text, tooltip, getFunc, setFunc, warning, warningText) |
|
163 | Seerah-7 | local colorpicker = wm:CreateTopLevelWindow(controlName) |
|
164 | Seerah-7 | colorpicker:SetParent(optionsWindow) |
|
165 | Seerah-7 | colorpicker:SetAnchor(TOPLEFT, lastAddedControl[panelID], BOTTOMLEFT, 0, 10) |
|
166 | Seerah-7 | colorpicker:SetResizeToFitDescendents(true) |
|
167 | Seerah-7 | colorpicker:SetWidth(510) |
|
168 | Seerah-7 | colorpicker:SetMouseEnabled(true) |
|
169 | Seerah-7 | ||
170 | Seerah-7 | colorpicker.label = wm:CreateControl(controlName.."Label", colorpicker, CT_LABEL) |
|
171 | Seerah-7 | local label = colorpicker.label |
|
172 | Seerah-7 | label:SetDimensions(300, 26) |
|
173 | Seerah-7 | label:SetAnchor(TOPLEFT) |
|
174 | Seerah-7 | label:SetFont("ZoFontWinH4") |
|
175 | Seerah-7 | label:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS) |
|
176 | Seerah-7 | label:SetText(text) |
|
177 | Seerah-7 | ||
178 | Seerah-7 | colorpicker.color = wm:CreateControl(controlName.."Color", colorpicker, CT_CONTROL) |
|
179 | Seerah-7 | local color = colorpicker.color |
|
180 | Seerah-7 | color:SetDimensions(200,26) |
|
181 | Seerah-7 | color:SetAnchor(RIGHT) |
|
182 | Seerah-7 | ||
183 | Seerah-7 | color.thumb = wm:CreateControl(controlName.."ColorThumb", color, CT_TEXTURE) |
|
184 | Seerah-7 | local thumb = color.thumb |
|
185 | Seerah-7 | thumb:SetDimensions(36, 18) |
|
186 | Seerah-7 | thumb:SetAnchor(LEFT, color, LEFT, 4, 0) |
|
187 | Seerah-7 | local r, g, b, a = getFunc() |
|
188 | Seerah-7 | thumb:SetColor(r, g, b, a or 1) |
|
189 | Seerah-7 | ||
190 | Seerah-7 | color.border = wm:CreateControl(controlName.."ColorBorder", color, CT_TEXTURE) |
|
191 | Seerah-7 | local border = color.border |
|
192 | Seerah-7 | border:SetTexture("EsoUI\\Art\\ChatWindow\\chatOptions_bgColSwatch_frame.dds") |
|
193 | Seerah-7 | border:SetTextureCoords(0, .625, 0, .8125) |
|
194 | Seerah-7 | border:SetDimensions(40, 22) |
|
195 | Seerah-7 | border:SetAnchor(CENTER, thumb, CENTER, 0, 0) |
|
196 | Seerah-7 | ||
197 | Seerah-7 | local ColorPickerCallback |
|
198 | Seerah-7 | if not ColorPickerCallback then |
|
199 | Seerah-7 | ColorPickerCallback = function(r, g, b, a) |
|
200 | Seerah-7 | thumb:SetColor(r, g, b, a or 1) |
|
201 | Seerah-7 | setFunc(r, g, b, a) |
|
202 | Seerah-7 | end |
|
203 | Seerah-7 | end |
|
204 | Seerah-7 | ||
205 | Seerah-7 | colorpicker.controlType = OPTIONS_CUSTOM |
|
206 | Seerah-7 | colorpicker.customSetupFunction = function(colorpicker) |
|
207 | Seerah-7 | colorpicker:SetHandler("OnMouseUp", function(self, btn, upInside) |
|
208 | Seerah-7 | if upInside then |
|
209 | Seerah-7 | local r, g, b, a = getFunc() |
|
210 | Seerah-7 | COLOR_PICKER:Show(ColorPickerCallback, r, g, b, a, text) |
|
211 | Seerah-7 | end |
|
212 | Seerah-7 | end) |
|
213 | Seerah-7 | end |
|
214 | Seerah-7 | colorpicker.panel = panelID |
|
215 | Seerah-7 | colorpicker.tooltipText = tooltip |
|
216 | Seerah-7 | colorpicker:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter) |
|
217 | Seerah-7 | colorpicker:SetHandler("OnMouseExit", ZO_Options_OnMouseExit) |
|
218 | Seerah-7 | ||
219 | Seerah-7 | if warning then |
|
220 | Seerah-7 | colorpicker.warning = wm:CreateControlFromVirtual(controlName.."WarningIcon", colorpicker, "ZO_Options_WarningIcon") |
|
221 | Seerah-7 | colorpicker.warning:SetAnchor(RIGHT, colorpicker:GetNamedChild("Color"), LEFT, -5, 0) |
|
222 | Seerah-7 | colorpicker.warning.tooltipText = warningText |
|
223 | Seerah-7 | end |
|
224 | Seerah-7 | ||
225 | Seerah-7 | ZO_OptionsWindow_InitializeControl(colorpicker) |
|
226 | Seerah-7 | ||
227 | Seerah-7 | lastAddedControl[panelID] = colorpicker |
|
228 | Seerah-7 | end |
|
229 | Seerah-7 | ||
230 | Seerah-7 | function lam:AddEditBox(panelID, controlName, text, tooltip, isMultiLine, getFunc, setFunc, warning, warningText) |
|
231 | Seerah-7 | local editbox = wm:CreateTopLevelWindow(controlName) |
|
232 | Seerah-7 | editbox:SetParent(optionsWindow) |
|
233 | Seerah-7 | editbox:SetAnchor(TOPLEFT, lastAddedControl[panelID], BOTTOMLEFT, 0, 10) |
|
234 | Seerah-7 | editbox:SetResizeToFitDescendents(true) |
|
235 | Seerah-7 | editbox:SetWidth(510) |
|
236 | Seerah-7 | editbox:SetMouseEnabled(true) |
|
237 | Seerah-7 | ||
238 | Seerah-7 | editbox.label = wm:CreateControl(controlName.."Label", editbox, CT_LABEL) |
|
239 | Seerah-7 | local label = editbox.label |
|
240 | Seerah-7 | label:SetDimensions(300, 26) |
|
241 | Seerah-7 | label:SetAnchor(TOPLEFT) |
|
242 | Seerah-7 | label:SetFont("ZoFontWinH4") |
|
243 | Seerah-7 | label:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS) |
|
244 | Seerah-7 | label:SetText(text) |
|
245 | Seerah-7 | ||
246 | Seerah-7 | editbox.bg = wm:CreateControlFromVirtual(controlName.."BG", editbox, "ZO_EditBackdrop") |
|
247 | Seerah-7 | local bg = editbox.bg |
|
248 | Seerah-7 | bg:SetDimensions(200,isMultiLine and 100 or 24) |
|
249 | Seerah-7 | bg:SetAnchor(RIGHT) |
|
250 | Seerah-7 | editbox.edit = wm:CreateControlFromVirtual(controlName.."Edit", bg, isMultiLine and "ZO_DefaultEditMultiLineForBackdrop" or "ZO_DefaultEditForBackdrop") |
|
251 | Seerah-7 | editbox.edit:SetText(getFunc()) |
|
252 | Seerah-7 | editbox.edit:SetHandler("OnFocusLost", function(self) setFunc(self:GetText()) end) |
|
253 | Seerah-7 | ||
254 | Seerah-7 | ||
255 | Seerah-7 | editbox.panel = panelID |
|
256 | Seerah-7 | editbox.tooltipText = tooltip |
|
257 | Seerah-7 | editbox:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter) |
|
258 | Seerah-7 | editbox:SetHandler("OnMouseExit", ZO_Options_OnMouseExit) |
|
259 | Seerah-7 | ||
260 | Seerah-7 | if warning then |
|
261 | Seerah-7 | editbox.warning = wm:CreateControlFromVirtual(controlName.."WarningIcon", editbox, "ZO_Options_WarningIcon") |
|
262 | Seerah-7 | editbox.warning:SetAnchor(TOPRIGHT, editbox:GetNamedChild("BG"), TOPLEFT, -5, 0) |
|
263 | Seerah-7 | editbox.warning.tooltipText = warningText |
|
264 | Seerah-7 | end |
|
265 | Seerah-7 | ||
266 | Seerah-7 | ZO_OptionsWindow_InitializeControl(editbox) |
|
267 | Seerah-7 | ||
268 | Seerah-7 | lastAddedControl[panelID] = editbox |
|
269 | Seerah-7 | end |
|
270 | Seerah-7 | ||
271 | Seerah-7 | function lam:AddButton(panelID, controlName, text, tooltip, onClick, warning, warningText) |
|
272 | Seerah-7 | local button = wm:CreateTopLevelWindow(controlName) |
|
273 | Seerah-7 | button:SetParent(optionsWindow) |
|
274 | Seerah-7 | button:SetAnchor(TOPLEFT, lastAddedControl[panelID], BOTTOMLEFT, 0, 6) |
|
275 | Seerah-7 | button:SetDimensions(510, 28) |
|
276 | Seerah-7 | button:SetMouseEnabled(true) |
|
277 | Seerah-7 | ||
278 | Seerah-7 | button.btn = wm:CreateControlFromVirtual(controlName.."Button", button, "ZO_DefaultButton") |
|
279 | Seerah-7 | local btn = button.btn |
|
280 | Seerah-7 | btn:SetAnchor(TOPRIGHT) |
|
281 | Seerah-7 | btn:SetWidth(200) |
|
282 | Seerah-7 | btn:SetText(text) |
|
283 | Seerah-7 | btn:SetHandler("OnClicked", onClick) |
|
284 | Seerah-7 | ||
285 | Seerah-7 | button.controlType = OPTIONS_CUSTOM |
|
286 | Seerah-7 | button.customSetupFunction = function() end --move handlers into this function? (since I created a function...) |
|
287 | Seerah-7 | button.panel = panelID |
|
288 | Seerah-7 | btn.tooltipText = tooltip |
|
289 | Seerah-7 | btn:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter) |
|
290 | Seerah-7 | btn:SetHandler("OnMouseExit", ZO_Options_OnMouseExit) |
|
291 | Seerah-7 | ||
292 | Seerah-7 | if warning then |
|
293 | Seerah-7 | button.warning = wm:CreateControlFromVirtual(controlName.."WarningIcon", button, "ZO_Options_WarningIcon") |
|
294 | Seerah-7 | button.warning:SetAnchor(RIGHT, btn, LEFT, -5, 0) |
|
295 | Seerah-7 | button.warning.tooltipText = warningText |
|
296 | Seerah-7 | end |
|
297 | Seerah-7 | ||
298 | Seerah-7 | ZO_OptionsWindow_InitializeControl(button) |
|
299 | Seerah-7 | ||
300 | Seerah-7 | lastAddedControl[panelID] = button |
|
301 | Seerah-7 | end |
|
302 | Seerah-7 | ||
303 | Seerah-7 | function lam:AddDescription(panelID, controlName, text, titleText) |
|
304 | Seerah-7 | local textBox = wm:CreateTopLevelWindow(controlName) |
|
305 | Seerah-7 | textBox:SetParent(optionsWindow) |
|
306 | Seerah-7 | textBox:SetAnchor(TOPLEFT, lastAddedControl[panelID], BOTTOMLEFT, 0, 10) |
|
307 | Seerah-7 | textBox:SetResizeToFitDescendents(true) |
|
308 | Seerah-7 | textBox:SetWidth(510) |
|
309 | Seerah-7 | ||
310 | Seerah-7 | if titleText then |
|
311 | Seerah-7 | textBox.title = wm:CreateControl(controlName.."Title", textBox, CT_LABEL) |
|
312 | Seerah-7 | local title = textBox.title |
|
313 | Seerah-7 | title:SetWidth(510) |
|
314 | Seerah-7 | title:SetAnchor(TOPLEFT, textBox, TOPLEFT) |
|
315 | Seerah-7 | title:SetFont("ZoFontWinH4") |
|
316 | Seerah-7 | title:SetText(headerText) |
|
317 | Seerah-7 | end |
|
318 | Seerah-7 | ||
319 | Seerah-7 | textBox.desc = wm:CreateControl(controlName.."Text", textBox, CT_LABEL) |
|
320 | Seerah-7 | local desc = textBox.desc |
|
321 | Seerah-7 | desc:SetWidth(510) |
|
322 | Seerah-7 | if titleText then |
|
323 | Seerah-7 | desc:SetAnchor(TOPLEFT, textBox.title, BOTTOMLEFT) |
|
324 | Seerah-7 | else |
|
325 | Seerah-7 | desc:SetAnchor(TOPLEFT) |
|
326 | Seerah-7 | end |
|
327 | Seerah-7 | desc:SetVerticalAlignment(TEXT_ALIGN_TOP) |
|
328 | Seerah-7 | desc:SetFont("ZoFontGame") |
|
329 | Seerah-7 | desc:SetText(text) |
|
330 | Seerah-7 | ||
331 | Seerah-7 | textBox.controlType = OPTIONS_CUSTOM |
|
332 | Seerah-7 | textBox.panel = panelID |
|
333 | Seerah-7 | ||
334 | Seerah-7 | ZO_OptionsWindow_InitializeControl(textBox) |
|
335 | Seerah-7 | ||
336 | Seerah-7 | lastAddedControl[panelID] = textBox |
|
337 | Seerah-7 | end |
|
338 | Seerah-7 | ||
339 | Seerah-7 | ||
340 | Seerah-7 | --test controls-- |
|
341 | Seerah-7 | --[[local controlPanelID = lam:CreateControlPanel("ZAM_ADDON_OPTIONS", "ZAM Addons") |
|
342 | Seerah-7 | lam:AddHeader(controlPanelID, "ZAM_Addons_TESTADDON", "TEST ADDON") |
|
343 | Seerah-7 | lam:AddDescription(controlPanelID, "ZAM_Addons_TESTDESC", "This is a test description.", "Header") |
|
344 | Seerah-7 | lam:AddSlider(controlPanelID, "ZAM_TESTSLIDER", "Test slider", "Adjust the slider.", 1, 10, 1, function() return 7 end, function(value) end, true, "needs UI reload") |
|
345 | Seerah-7 | lam:AddDropdown(controlPanelID, "ZAM_TESTDROPDOWN", "Test Dropdown", "Pick something!", {"thing 1", "thing 2", "thing 3"}, function() return "thing 2" end, function(self,valueString) print(valueString) end) |
|
346 | Seerah-7 | local checkbox1 = true |
|
347 | Seerah-7 | lam:AddCheckbox(controlPanelID, "ZAM_TESTCHECKBOX", "Test Checkbox", "On or off?", function() return checkbox1 end, function(value) checkbox1 = not checkbox1 print(value, checkbox1) end) |
|
348 | Seerah-7 | lam:AddColorPicker(controlPanelID, "ZAM_TESTCOLORPICKER", "Test color picker", "What's your favorite color?", function() return 1, 1, 0 end, function(r,g,b) print(r,g,b) end) |
|
349 | Seerah-7 | lam:AddEditBox(controlPanelID, "ZAM_TESTEDITBOX", "Test Edit Box", "This is a tooltip!", false, function() return "hi" end, function(text) print(text) end) |
|
350 | Seerah-7 | lam:AddHeader(controlPanelID, "ZAM_Addons_TESTADDON2", "TEST ADDON 2") |
|
351 | Seerah-7 | local checkbox2 = false |
|
352 | Seerah-7 | lam:AddCheckbox(controlPanelID, "ZAM_TESTCHECKBOX2", "Test Checkbox 2", "On or off?", function() return checkbox2 end, function(value) checkbox2 = not checkbox2 print(value, checkbox2) end) |
|
353 | Seerah-7 | lam:AddButton(controlPanelID, "ZAM_TESTBUTTON", "Test Button", "Click me", function() print("hi") end, true, "oh noez!") |
|
354 | Seerah-7 | lam:AddEditBox(controlPanelID, "ZAM_TESTEDITBOX2", "Test Edit Box 2", "This is a tooltip!", true, function() return "hi" end, function(text) print(text) end, true, "warning text") |
|
355 | Seerah-7 | lam:AddSlider(controlPanelID, "ZAM_TESTSLIDER2", "Test slider 2", "Adjust the slider.", 50, 100, 10, function() return 80 end, function(value) end) |
|
356 | Seerah-7 | lam:AddDropdown(controlPanelID, "ZAM_TESTDROPDOWN2", "Test Dropdown 2", "Pick something!", {"thing 4", "thing 5", "thing 6"}, function() return "thing 6" end, function(self,valueString) print(valueString) end) |
|
357 | Seerah-7 | ]]-- |