adam@0: local addonName, AskMrRobot = ... adam@0: local L = AskMrRobot.L adam@0: adam@0: local wow_ver = select(4, GetBuildInfo()) adam@0: local wow_500 = wow_ver >= 50000 adam@0: local UIPanelButtonTemplate = wow_500 and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2" adam@0: adam@0: local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer) adam@0: frame.name = addonName adam@0: frame:Hide() adam@0: adam@0: -- Credits to Ace3, Tekkub, cladhaire and Tuller for some of the widget stuff. adam@0: adam@0: local function newCheckbox(label, tooltipTitle, description, onClick) adam@0: local check = CreateFrame("CheckButton", "AmrCheck" .. label, frame, "InterfaceOptionsCheckButtonTemplate") adam@0: check:SetScript("OnClick", function(self) adam@0: PlaySound(self:GetChecked() and "igMainMenuOptionCheckBoxOn" or "igMainMenuOptionCheckBoxOff") adam@0: onClick(self, self:GetChecked() and true or false) adam@0: end) adam@0: check.label = _G[check:GetName() .. "Text"] adam@0: check.label:SetText(label) adam@0: check.tooltipText = tooltipTitle adam@0: check.tooltipRequirement = description adam@0: return check adam@0: end adam@0: adam@0: frame:SetScript("OnShow", function(frame) adam@0: local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") adam@0: title:SetPoint("TOPLEFT", 16, -16) adam@0: title:SetText(addonName) adam@0: adam@0: local subTitleWrapper = CreateFrame("Frame", nil, frame) adam@0: subTitleWrapper:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8) adam@0: subTitleWrapper:SetPoint("RIGHT", -16, 0) adam@0: local subtitle = subTitleWrapper:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") adam@0: subtitle:SetPoint("TOPLEFT", subTitleWrapper) adam@0: subtitle:SetWidth(subTitleWrapper:GetRight() - subTitleWrapper:GetLeft()) adam@0: subtitle:SetJustifyH("LEFT") adam@0: subtitle:SetNonSpaceWrap(false) adam@0: subtitle:SetJustifyV("TOP") yellowfive@11: subtitle:SetText(L.AMR_CONFIG_EXIMPORT) adam@0: subTitleWrapper:SetHeight(subtitle:GetHeight()) adam@0: adam@17: -- hide minimap icon adam@0: local autoPopup = newCheckbox( yellowfive@11: L.AMR_CONFIG_CHECKBOX_MINIMAP_LABEL, yellowfive@11: L.AMR_CONFIG_CHECKBOX_MINIMAP_TOOLTIP_TITLE, yellowfive@11: L.AMR_CONFIG_CHECKBOX_MINIMAP_DESCRIPTION, adam@0: function(self, value) adam@17: if AmrDb.Options.hideMapIcon then adam@17: AmrDb.Options.hideMapIcon = false adam@0: else adam@17: AmrDb.Options.hideMapIcon = true adam@0: end adam@0: AskMrRobot.AmrUpdateMinimap(); adam@0: end adam@0: ) adam@17: autoPopup:SetChecked(not AmrDb.Options.hideMapIcon) adam@0: autoPopup:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -16) adam@0: adam@0: adam@17: -- auto-show at auction house adam@0: local autoAh = newCheckbox( yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOAH_LABEL, yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOAH_TOOLTIP_TITLE, yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOAH_DESCRIPTION, adam@0: function(self, value) adam@17: if AmrDb.Options.manualShowShop then adam@17: AmrDb.Options.manualShowShop = false adam@0: else adam@17: AmrDb.Options.manualShowShop = true adam@0: end adam@0: end adam@0: ) adam@17: autoAh:SetChecked(not AmrDb.Options.manualShowShop) adam@17: autoAh:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -58) adam@0: adam@0: frame:SetScript("OnShow", nil) adam@0: end) adam@0: InterfaceOptions_AddCategory(frame) adam@0: