1
0
Bifurcation 0
Ce dépôt a été archivé le 2024-10-10. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
ButtonForge-classic/UILibCreateButton.lua

50 lignes
1,3 Kio
Lua

--[[
Author: Alternator (Massiner of Nathrezim)
Copyright 2010
Notes:
]]
BFUILib = BFUILib or {}; local UILib = BFUILib;
function UILib.CreateButton(Parent, Width, Height, Point, NormalTexture, PushedTexture, CheckedTexture, HighlightTexture, Tooltip, OnClickScript, OMDScript, OMUScript, AnchorPoint)
local Widget = CreateFrame("CHECKBUTTON", nil, Parent);
Widget:SetSize(Width, Height);
Widget:SetPoint(unpack(Point));
Widget:SetNormalTexture(NormalTexture);
Widget:SetPushedTexture(PushedTexture);
Widget:SetCheckedTexture(CheckedTexture);
Widget:SetHighlightTexture(HighlightTexture);
Widget.Tooltip = Tooltip;
Widget:SetScript("OnClick", OnClickScript);
Widget:SetScript("OnMouseDown", OMDScript);
Widget:SetScript("OnMouseUp", OMUScript);
Widget:SetScript("OnEnter", UILib.OnEnter);
Widget:SetScript("OnLeave", UILib.OnLeave);
Widget.AnchorPoint = AnchorPoint;
return Widget;
end
function UILib.OnEnter(Widget)
if (Widget.AnchorPoint) then
GameTooltip:SetOwner(Widget, Widget.AnchorPoint);
else
GameTooltip:SetOwner(Widget, "ANCHOR_TOPRIGHT");
end
GameTooltip:SetText(Widget.Tooltip, nil, nil, nil, nil, 1);
end
function UILib.OnLeave(Widget)
GameTooltip_Hide();
end
function UILib.RefreshTooltip(Widget)
if (GameTooltip:GetOwner() == Widget) then
GameTooltip:SetText(Widget.Tooltip, nil, nil, nil, nil, 1);
end
end