-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathOptionsFrame.lua
79 lines (60 loc) · 2.22 KB
/
OptionsFrame.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
-- DevTool is a World of Warcraft® addon development tool.
-- Copyright (c) 2021-2025 Britt W. Yazel
-- Copyright (c) 2016-2021 Peter aka "Varren"
-- This code is licensed under the MIT license (see LICENSE for details)
local _, addonTable = ... --make use of the default addon namespace
local DevTool = addonTable.DevTool
local AceGUI = LibStub("AceGUI-3.0")
function DevTool:LoadInterfaceOptions()
if not self.MainWindow.optionsFrame then
local frame = CreateFrame("Frame", "DevToolOptionsMainFrame", self.MainWindow, "DevToolOptionsFrameRowTemplate")
frame:SetPoint("BOTTOM", self.MainWindow, "TOP")
frame:SetPoint("LEFT")
frame:SetPoint("RIGHT")
frame:Hide()
self:CreateColorPickerFrame(frame)
self.MainWindow.optionsFrame = frame
end
end
function DevTool:CreateColorPickerFrame(parent)
local point = "TOPLEFT"
local relativeTo = parent
local relativePoint = "TOPLEFT"
local xOffset = 5
local yOffset = -5
-- Color Pickers
for _, menuItem in pairs({ "table", "function", "string", "number", "default" }) do
local ColorPicker = AceGUI:Create("ColorPicker")
ColorPicker:SetLabel(menuItem)
ColorPicker:SetHasAlpha(true)
ColorPicker:SetColor(unpack(self.db.profile.colorVals[menuItem]))
ColorPicker.frame:SetParent(parent)
ColorPicker.frame:SetPoint(point, relativeTo, relativePoint, xOffset, yOffset)
ColorPicker.frame:SetWidth(100)
ColorPicker.frame:SetHeight(25)
ColorPicker:SetCallback("OnValueChanged", function(widget, event, r, g, b, a)
self.db.profile.colorVals[menuItem] = { r, g, b, a }
self.colors[menuItem]:SetRGBA(r, g, b, a)
self:UpdateMainTableUI()
end)
ColorPicker.frame:Show()
point = "LEFT"
relativeTo = ColorPicker.frame
relativePoint = "RIGHT"
yOffset = 0
xOffset = 5
end
-- Text Size Slider
local TextSizeSlider = AceGUI:Create("Slider")
TextSizeSlider:SetSliderValues(8, 24, 1)
TextSizeSlider:SetValue(self.db.profile.fontSize)
TextSizeSlider.frame:SetParent(parent)
TextSizeSlider.frame:SetPoint(point, relativeTo, relativePoint, 0, 5)
TextSizeSlider.frame:SetWidth(200)
TextSizeSlider:SetCallback("OnValueChanged", function(widget, event, size)
print(size)
self.db.profile.fontSize = size
DevTool:UpdateMainTableUI()
end)
TextSizeSlider.frame:Show()
end