2024-08-19 13:08:40 +02:00
|
|
|
local function CreateCheckbox(parent, frame, text, optionKey)
|
|
|
|
local checkbox = CreateFrame("CheckButton", nil, frame, "InterfaceOptionsCheckButtonTemplate")
|
2024-07-07 19:26:28 +02:00
|
|
|
checkbox.Text:SetText(text)
|
2024-08-19 13:08:40 +02:00
|
|
|
checkbox:SetScript("OnClick", function(self)
|
|
|
|
CzechQuestsAddon.options[optionKey] = self:GetChecked()
|
2024-07-07 19:26:28 +02:00
|
|
|
end)
|
|
|
|
checkbox:SetPoint("TOPLEFT", parent, "BOTTOMLEFT", 0, -8)
|
2024-08-19 13:08:40 +02:00
|
|
|
checkbox:SetChecked(CzechQuestsAddon.options[optionKey])
|
2024-07-07 19:26:28 +02:00
|
|
|
return checkbox
|
|
|
|
end
|
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
function CzechQuestsAddon:InitializeOptions()
|
|
|
|
CzechQuestsAddon.optionsFrame = {};
|
2024-07-07 19:26:28 +02:00
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
|
|
|
|
local frame
|
|
|
|
-- Create Frame
|
|
|
|
CzechQuestsAddon.optionsFrame = CreateFrame("Frame", "CzechQuestsOptionsPanel", UIParent)
|
|
|
|
CzechQuestsAddon.optionsFrame.name = "CzechQuests"
|
2024-07-07 19:26:28 +02:00
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
-- Create frame title
|
|
|
|
local title = CzechQuestsAddon.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
|
|
title:SetPoint("TOPLEFT", 16, -16)
|
|
|
|
title:SetText("CzechQuests")
|
2024-07-07 19:26:28 +02:00
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
-- Add DEBUG checkbox
|
|
|
|
local debugModeCheckbox = CreateCheckbox(title, CzechQuestsAddon.optionsFrame, "Enable DEBUG mode", "DEBUG_MODE")
|
|
|
|
debugModeCheckbox:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 16, -16)
|
2024-08-13 22:24:45 +02:00
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
-- Add Dark Mode checkbox
|
|
|
|
local darkModeCheckbox = CreateCheckbox(debugModeCheckbox, CzechQuestsAddon.optionsFrame, "Dark mode (require reload)", "DARK_MODE")
|
|
|
|
darkModeCheckbox:SetPoint("TOPLEFT", debugModeCheckbox, "BOTTOMLEFT", 0, -4)
|
|
|
|
|
|
|
|
-- Store it into Addon options
|
|
|
|
InterfaceOptions_AddCategory(CzechQuestsAddon.optionsFrame)
|
|
|
|
|
|
|
|
else
|
|
|
|
CzechQuestsAddon.optionsFrame = Settings.RegisterVerticalLayoutCategory("CzechQuests")
|
|
|
|
|
|
|
|
-- Add DEBUG checkbox
|
|
|
|
local debugCheckbox = Settings.RegisterAddOnSetting(
|
|
|
|
CzechQuestsAddon.optionsFrame,
|
|
|
|
"CzechQuestsAddon__DEBUG_MODE",
|
|
|
|
"DEBUG_MODE",
|
|
|
|
CzechQuestsAddon.options,
|
|
|
|
type(CzechQuestsAddon.options.DEBUG_MODE),
|
|
|
|
"Enable DEBUG mode",
|
|
|
|
CzechQuestsAddon.options.DEBUG_MODE
|
|
|
|
)
|
|
|
|
Settings.CreateCheckbox(CzechQuestsAddon.optionsFrame, debugCheckbox)
|
|
|
|
|
|
|
|
-- Add DARK mode checkbox
|
|
|
|
local darkModeCheckbox = Settings.RegisterAddOnSetting(
|
|
|
|
CzechQuestsAddon.optionsFrame,
|
|
|
|
"CzechQuestsAddon__DARK_MODE",
|
|
|
|
"DARK_MODE",
|
|
|
|
CzechQuestsAddon.options,
|
|
|
|
type(CzechQuestsAddon.options.DARK_MODE),
|
|
|
|
"Use dark mode",
|
|
|
|
CzechQuestsAddon.options.DARK_MODE
|
|
|
|
)
|
|
|
|
Settings.CreateCheckbox(CzechQuestsAddon.optionsFrame, darkModeCheckbox)
|
2024-07-07 19:26:28 +02:00
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
-- Store it into Addon options
|
|
|
|
Settings.RegisterAddOnCategory(CzechQuestsAddon.optionsFrame)
|
2024-07-07 19:26:28 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
-- initialize options frame
|
|
|
|
CzechQuestsAddon:InitializeOptions()
|