Skip to content

Commit e3d9148

Browse files
committed
Added method to get mail frame / TSM mail frame.
1 parent 1fd4bcc commit e3d9148

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

LibMagicUtil-1.0.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Interface: 120001, 50503, 38000, 20505, 11508
1+
Lib## Interface: 120001, 50503, 38000, 20505, 11508
22
## X-Curse-Project-ID: 18625
33
## LoadOnDemand: 1
44
## Title: Lib: MagicUtil-1.0

LibMagicUtil-1.0/LibMagicUtil-1.0.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ local embeddables = {
3636
"GetConfigTemplate", "_GetColorOpt", "_SetColorOpt", "_SetOption", "_GetOption",
3737
"_HideOption", "_DisableTiling", "FixBackdrop", "_SetBackgroundOption",
3838
"InterfaceOptions_AddCategory", "InterfaceOptionsFrame_OpenToCategory", "Dump",
39-
"GetSpellInfo", "UnitAura"
39+
"GetSpellInfo", "UnitAura", "GetMailFrame"
4040
}
4141

4242
lib.optionTemplates = lib.optionTemplates or {}
@@ -256,6 +256,21 @@ function lib:InterfaceOptionsFrame_OpenToCategory(categoryIDOrFrame)
256256
end
257257
end
258258

259+
-- Returns the currently visible mail frame. Checks for TSM's mail frame first
260+
-- (which replaces the default MailFrame), then falls back to the default MailFrame.
261+
function lib:GetMailFrame()
262+
for i = 1, #UISpecialFrames do
263+
local name = UISpecialFrames[i]
264+
if name:match("^TSM_FRAME:LargeApplicationFrame:") then
265+
local frame = _G[name]
266+
if frame and frame:IsShown() then
267+
return frame
268+
end
269+
end
270+
end
271+
return MailFrame
272+
end
273+
259274
-- Config template for a frame background
260275
optionTemplates.background = {
261276
type = "group",

0 commit comments

Comments
 (0)