Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Commit

Permalink
Add options to disable the tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim committed Dec 19, 2014
1 parent 61e38d9 commit 5d8e17d
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Broker_Equipment.lua
Expand Up @@ -64,8 +64,10 @@ local function OnLeave()
end

local function OnItemEnter(self)
GameTooltip:SetOwner(self, 'ANCHOR_RIGHT')
GameTooltip:SetEquipmentSet(self.name)
if(Broker_EquipmentDB.showTooltipMenu) then
GameTooltip:SetOwner(self, 'ANCHOR_RIGHT')
GameTooltip:SetEquipmentSet(self.name)
end

OnEnter()
end
Expand Down Expand Up @@ -142,7 +144,9 @@ local function UpdateMenu(parent)
end

function LDB:OnTooltipShow()
self:SetEquipmentSet(LDB.text)
if(Broker_EquipmentDB.showTooltipDisplay) then
self:SetEquipmentSet(LDB.text)
end
end

local hooked = {}
Expand Down
2 changes: 2 additions & 0 deletions Broker_Equipment.toc
Expand Up @@ -3,11 +3,13 @@
## Version: @project-version@
## Title: Broker Equipment
## Notes: LDB Equipment Manager plug-in
## SavedVariables: Broker_EquipmentDB

## OptionalDeps: LibStub, CallbackHandler-1.0, LibDataBroker-1.1

embeds\LibStub\LibStub.lua
embeds\CallbackHandler\CallbackHandler-1.0.lua
embeds\LibDataBroker\LibDataBroker-1.1.lua

Config.lua
Broker_Equipment.lua
96 changes: 96 additions & 0 deletions Config.lua
@@ -0,0 +1,96 @@
local addonName = ...

local objects = {}
local temporary = {}

local defaults = {
showTooltipDisplay = true,
showTooltipMenu = true,
}

local Panel = CreateFrame('Frame', nil, InterfaceOptionsFramePanelContainer)
Panel.name = addonName
Panel:Hide()

Panel:RegisterEvent('PLAYER_LOGIN')
Panel:SetScript('OnEvent', function()
Broker_EquipmentDB = Broker_EquipmentDB or defaults
end)

function Panel:okay()
for key, value in next, temporary do
Broker_EquipmentDB[key] = value
end

table.wipe(temporary)
end

function Panel:cancel()
table.wipe(temporary)
end

function Panel:default()
for key, value in next, defaults do
Broker_EquipmentDB[key] = value
end

table.wipe(temporary)
end

function Panel:refresh()
for key, object in next, objects do
if(object:IsObjectType('CheckButton')) then
object:SetChecked(Broker_EquipmentDB[key])
end
end
end

local CreateCheckButton
do
local function ClickCheckButton(self)
if(self:GetChecked()) then
temporary[self.key] = true
else
temporary[self.key] = false
end
end

function CreateCheckButton(parent, key, realParent)
local CheckButton = CreateFrame('CheckButton', nil, parent, 'InterfaceOptionsCheckButtonTemplate')
CheckButton:SetHitRectInsets(0, 0, 0, 0)
CheckButton:SetScript('OnClick', ClickCheckButton)
CheckButton.realParent = realParent
CheckButton.key = key

objects[key] = CheckButton

return CheckButton
end
end

Panel:SetScript('OnShow', function(self)
local Title = self:CreateFontString(nil, nil, 'GameFontNormalLarge')
Title:SetPoint('TOPLEFT', 16, -16)
Title:SetText(addonName)

local Description = self:CreateFontString(nil, nil, 'GameFontHighlightSmall')
Description:SetPoint('TOPLEFT', Title, 'BOTTOMLEFT', 0, -8)
Description:SetPoint('RIGHT', -32, 0)
Description:SetJustifyH('LEFT')
Description:SetText('Equipment sets!')
self.Description = Description

local DisplayTooltip = CreateCheckButton(self, 'showTooltipDisplay')
DisplayTooltip:SetPoint('TOPLEFT', Description, 'BOTTOMLEFT', -2, -10)
DisplayTooltip.Text:SetText('Enable tooltips in display')

local MenuTooltip = CreateCheckButton(self, 'showTooltipMenu')
MenuTooltip:SetPoint('TOPLEFT', DisplayTooltip, 'BOTTOMLEFT', 0, -8)
MenuTooltip.Text:SetText('Enable tooltips in menu')

Panel:refresh()

self:SetScript('OnShow', nil)
end)

InterfaceOptions_AddCategory(Panel)

0 comments on commit 5d8e17d

Please sign in to comment.