ESOUI SVN TaosGroupUltimate

[/] [trunk/] [TaosGroupUltimate/] [ui/] [SettingsWindow.lua] - Rev 27

Go to most recent revision | Compare with Previous | Blame | View Log

--[[
        Addon: Taos Group Ultimate
        Author: TProg Taonnor
        Created by @Taonnor
]]--

--[[
        Global variables
]]--
local LOG_ACTIVE = false

--[[
        Class SettingsWindow
]]--
SettingsWindow = {}
SettingsWindow.__index = SettingsWindow

--[[
        Class Members
]]--
SettingsWindow.MainMenuName = "TaosGroupUltimateSettingsMainMenu"


--[[
        Initialize creates settings window
]]--
function SettingsWindow.Initialize(major, minor, patch)
    if (LOG_ACTIVE) then 
        logTrace("SettingsWindow.Initialize")
        logDebug("major: " .. major, "minor: " .. minor, "patch: " .. patch)
    end

    local styleChoices = {
        [1] = GetString(TGU_OPTIONS_STYLE_SIMPLE),
        [2] = GetString(TGU_OPTIONS_STYLE_SWIM),
        [3] = GetString(TGU_OPTIONS_STYLE_SHORT_SWIM),
    }

        local panelData = {
                type = "panel",
                name = "Taos Group Ultimate",
                author = "TProg Taonnor",
                version = major .. "." .. minor .. "." .. patch,
                slashCommand = "/taosGroupUltimate",
                registerForDefaults = true
        }

        local optionsData = {
                [1] = {
                        type = "header",
                        name = GetString(TGU_OPTIONS_HEADER),
                },
                [2] = {
                        type = "checkbox",
                        name = GetString(TGU_OPTIONS_DRAG_LABEL),
                        tooltip = GetString(TGU_OPTIONS_DRAG_TOOLTIP),
                        getFunc = 
               function() 
                   return SettingsHandler.SavedVariables.Movable
               end,
                        setFunc = 
               function(value) 
                   SettingsHandler.SetMovableSettings(value)
                           end,
                        default = SettingsHandler.Default.Movable
                },
        [3] = {
                        type = "dropdown",
                        name = GetString(TGU_OPTIONS_STYLE_LABEL),
                        tooltip = GetString(TGU_OPTIONS_STYLE_TOOLTIP),
            choices = styleChoices,
                        getFunc = 
               function() 
                   return styleChoices[SettingsHandler.SavedVariables.Style]
               end,
                        setFunc = 
               function(value) 
                   for index, name in ipairs(styleChoices) do
                      if (name == value) then
                         SettingsHandler.SetStyleSettings(index)
                         break
                      end
                   end
                           end,
                        default = styleChoices[SettingsHandler.Default.Style]
                },
        }
        
        local LAM = LibStub("LibAddonMenu-2.0")
        LAM:RegisterAddonPanel(SettingsWindow.MainMenuName, panelData)
        LAM:RegisterOptionControls(SettingsWindow.MainMenuName, optionsData)
end

Go to most recent revision | Compare with Previous | Blame