Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed Keyring Support Changes #590

Draft
wants to merge 1 commit into
base: bcc
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ local NUM_BANKBAGSLOTS = _G.NUM_BANKBAGSLOTS
local pairs = _G.pairs
--GLOBALS>

-- Keyring, backpack, and bags
local BAGS = { [KEYRING_CONTAINER] = KEYRING_CONTAINER, [BACKPACK_CONTAINER] = BACKPACK_CONTAINER }
-- Backpack and bags
local BAGS = { [BACKPACK_CONTAINER] = BACKPACK_CONTAINER }
for i = 1, NUM_BAG_SLOTS do BAGS[i] = i end

-- Bank and bank bags
Expand Down
28 changes: 28 additions & 0 deletions widgets/ContainerFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ local NUM_BAG_SLOTS = _G.NUM_BAG_SLOTS
local pairs = _G.pairs
local PlaySound = _G.PlaySound
local select = _G.select
local SOUNDKIT = _G.SOUNDKIT
local strjoin = _G.strjoin
local strsplit = _G.strsplit
local tinsert = _G.tinsert
Expand Down Expand Up @@ -79,6 +80,17 @@ local LSM = LibStub('LibSharedMedia-3.0')
-- Widget scripts
--------------------------------------------------------------------------------

local function KeyringButton_OnClick(button)
PlaySound(button:GetChecked() and SOUNDKIT.KEY_RING_OPEN or SOUNDKIT.KEY_RING_CLOSE)
if button:GetChecked() then
BAG_IDS.BAGS[KEYRING_CONTAINER] = KEYRING_CONTAINER
-- TODO: Initialize/setup hooks, callbacks, and etc. for the keyring "bag."
else
BAG_IDS.BAGS[KEYRING_CONTAINER] = nil
-- TODO: Undo the above.
end
end

local function BagSlotButton_OnClick(button)
button.panel:SetShown(button:GetChecked())
end
Expand Down Expand Up @@ -174,6 +186,22 @@ function containerProto:OnCreate(name, isBank, bagObject)
addon.SetupTooltip(closeButton, L["Close"])
closeButton:SetFrameLevel(frameLevel)

if not self.isBank then
local keyringButton = CreateFrame("CheckButton", nil, self)
keyringButton:SetNormalTexture([[Interface\Buttons\UI-Button-KeyRing]])
keyringButton:SetCheckedTexture([[Interface\Buttons\UI-Button-KeyRing-Highlight]])
keyringButton:GetCheckedTexture():SetBlendMode("ADD")
keyringButton:SetScript('OnClick', KeyringButton_OnClick)
keyringButton:SetWidth(15)
keyringButton:SetHeight(30)
self.keyringButton = keyringButton
addon.SetupTooltip(keyringButton, {
L["Keyring"],
L["Click to toggle the keyring."]
}, "ANCHOR_BOTTOMLEFT", -8, 0)
headerLeftRegion:AddWidget(keyringButton, 60, 8)
end

local bagSlotButton = CreateFrame("CheckButton", nil, self)
bagSlotButton:SetNormalTexture([[Interface\Buttons\Button-Backpack-Up]])
bagSlotButton:SetCheckedTexture([[Interface\Buttons\CheckButtonHilight]])
Expand Down