Mercurial > wow > askmrrobot
view Options.lua @ 60:017c05f42fd4
Added tag v22 for changeset ee701ce45354
author | yellowfive |
---|---|
date | Sun, 07 Jun 2015 15:20:25 -0700 |
parents | 01b63b8ed811 |
children | cf2b6b9a8337 |
line wrap: on
line source
local Amr = LibStub("AceAddon-3.0"):GetAddon("AskMrRobot") local L = LibStub("AceLocale-3.0"):GetLocale("AskMrRobot", true) local AceGUI = LibStub("AceGUI-3.0") local _chkMinimap local _chkAutoGear local _chkAh local function onCheckClick(widget) local setting = widget:GetUserData("setting") local val = widget:GetChecked() if setting == "minimap" then Amr.db.profile.minimap.hide = val else Amr.db.profile.options[setting] = val end Amr:RefreshConfig() end local function onChkMinimapClick() Amr.db.profile.minimap.hide = _chkMinimap:GetChecked() Amr:RefreshConfig() end local function createCheck(container, setting, text, description) local chk = AceGUI:Create("AmrUiCheckBox") chk:SetUserData("setting", setting) chk:SetText(text) chk:SetCallback("OnClick", onCheckClick) container:AddChild(chk) local desc = AceGUI:Create("AmrUiLabel") desc:SetWidth(800) desc:SetText(description) desc:SetFont(Amr.CreateFont("Italic", 12, Amr.Colors.TextTan)) desc:SetPoint("TOPLEFT", chk.frame, "BOTTOMLEFT", 24, -3) container:AddChild(desc) return chk, desc end -- renders the main UI for the Combat Log tab function Amr:RenderTabOptions(container) local header = AceGUI:Create("AmrUiLabel") header:SetWidth(600) header:SetText(L.OptionsHeaderGeneral) header:SetFont(Amr.CreateFont("Bold", 24, Amr.Colors.TextHeaderActive)) header:SetPoint("TOPLEFT", container.content, "TOPLEFT", 12, -40) container:AddChild(header) local desc, desc2 _chkMinimap, desc = createCheck(container, "minimap", L.OptionsHideMinimapName, L.OptionsHideMinimapDesc) _chkMinimap:SetPoint("TOPLEFT", header.frame, "BOTTOMLEFT", 0, -20) _chkAutoGear, desc2 = createCheck(container, "autoGear", L.OptionsAutoGearName, L.OptionsAutoGearDesc) _chkAutoGear:SetPoint("TOPLEFT", desc.frame, "BOTTOMLEFT", -24, -20) _chkAh, desc = createCheck(container, "shopAh", L.OptionsShopAhName, L.OptionsShopAhDesc) _chkAh:SetPoint("TOPLEFT", desc2.frame, "BOTTOMLEFT", -24, -20) -- initialize state of controls Amr:RefreshOptionsUi() end function Amr:ReleaseTabOptions() _chkMinimap = nil end function Amr:RefreshOptionsUi() if _chkMinimap then _chkMinimap:SetChecked(self.db.profile.minimap.hide) end if _chkAutoGear then _chkAutoGear:SetChecked(self.db.profile.options.autoGear) end if _chkAh then _chkAh:SetChecked(self.db.profile.options.shopAh) end end