Skip to content

Commit be97f41

Browse files
committed
start group overlay button to look like a real button
1 parent 94a340a commit be97f41

File tree

2 files changed

+59
-21
lines changed

2 files changed

+59
-21
lines changed

ElvUI/Core/Modules/Skins/Skins.lua

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,64 @@ do
762762
end
763763
end
764764

765+
do
766+
local overlays = {}
767+
768+
local function OverlayHide(button)
769+
local overlay = overlays[button]
770+
if not overlay then return end
771+
772+
overlay:Hide()
773+
end
774+
775+
local function OverlayShow(button)
776+
local overlay = overlays[button]
777+
if not overlay then return end
778+
779+
overlay:ClearAllPoints()
780+
overlay:SetPoint(button:GetPoint())
781+
overlay:Show()
782+
end
783+
784+
local function OverlayOnEnter(overlay)
785+
overlay.text:SetTextColor(1, 1, 1)
786+
S:SetBackdropBorderColor(overlay, 'OnEnter')
787+
end
788+
789+
local function OverlayOnLeave(overlay)
790+
overlay.text:SetTextColor(1, 0.81, 0)
791+
S:SetBackdropBorderColor(overlay, 'OnLeave')
792+
end
793+
794+
function S:OverlayButton(button, name, text, textLayer, level, strata)
795+
if overlays[button] then return end -- already exists
796+
797+
local width, height = button:GetSize()
798+
local overlay = CreateFrame('Frame', 'ElvUI_OverlayButton_'..name, E.UIParent)
799+
overlay:Size(width, height)
800+
overlay:SetTemplate(nil, true)
801+
overlay:SetPoint(button:GetPoint())
802+
overlay:SetFrameLevel(level or 10)
803+
overlay:SetFrameStrata(strata or 'MEDIUM')
804+
overlay:Hide()
805+
806+
local txt = overlay:CreateFontString(nil, textLayer or 'OVERLAY')
807+
txt:SetPoint('CENTER')
808+
txt:FontTemplate()
809+
txt:SetText(text)
810+
txt:SetTextColor(1, 0.81, 0)
811+
overlay.text = txt
812+
813+
overlay:SetScript('OnEnter', OverlayOnEnter)
814+
overlay:SetScript('OnLeave', OverlayOnLeave)
815+
816+
button:HookScript('OnHide', OverlayHide)
817+
button:HookScript('OnShow', OverlayShow)
818+
819+
overlays[button] = overlay
820+
end
821+
end
822+
765823
function S:HandleButton(button, strip, isDecline, noStyle, createBackdrop, template, noGlossTex, overrideTex, frameLevel, regionsKill, regionsZero, isFilterButton, filterDirection)
766824
assert(button, 'doesn\'t exist!')
767825

ElvUI/Mainline/Modules/Skins/LFG.lua

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -434,27 +434,7 @@ function S:LookingForGroupFrames()
434434
S:HandleButton(LFGListFrame.SearchPanel.SignUpButton)
435435

436436
-- Monitor this button, this seems NOT to taint. But who knows
437-
local StartGroupButton = LFGListFrame.SearchPanel.ScrollBox.StartGroupButton
438-
local bu = CreateFrame("Frame", "StartGroupButton", E.UIParent)
439-
bu:SetFrameLevel(10)
440-
bu:SetFrameStrata("HIGH")
441-
bu:Size(135,22)
442-
bu:SetTemplate()
443-
bu:SetPoint(StartGroupButton:GetPoint())
444-
bu.text = bu:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
445-
bu.text:SetPoint("CENTER")
446-
bu.text:FontTemplate()
447-
bu.text:SetText(_G.START_A_GROUP)
448-
bu:Hide()
449-
450-
StartGroupButton:HookScript("OnHide", function()
451-
bu:Hide()
452-
end)
453-
StartGroupButton:HookScript("OnShow", function()
454-
bu:ClearAllPoints()
455-
bu:SetPoint(StartGroupButton:GetPoint())
456-
bu:Show()
457-
end)
437+
S:OverlayButton(LFGListFrame.SearchPanel.ScrollBox.StartGroupButton, 'StartGroupButton', _G.START_A_GROUP, nil, nil, 'HIGH')
458438

459439
LFGListFrame.SearchPanel.BackButton:ClearAllPoints()
460440
LFGListFrame.SearchPanel.BackButton:Point('BOTTOMLEFT', -1, 3)

0 commit comments

Comments
 (0)