|
762 | 762 | end
|
763 | 763 | end
|
764 | 764 |
|
| 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 | + |
765 | 823 | function S:HandleButton(button, strip, isDecline, noStyle, createBackdrop, template, noGlossTex, overrideTex, frameLevel, regionsKill, regionsZero, isFilterButton, filterDirection)
|
766 | 824 | assert(button, 'doesn\'t exist!')
|
767 | 825 |
|
|
0 commit comments