Quantcast

* Added cases for the On<X> handlers in UpdatePlugin, so we can set them whenever they are changed

James Whitehead II [12-15-08 - 23:28]
* Added cases for the On<X> handlers in UpdatePlugin, so we can set them whenever they are changed
Filename
NinjaPanel.lua
diff --git a/NinjaPanel.lua b/NinjaPanel.lua
index b9d7a85..2401d90 100644
--- a/NinjaPanel.lua
+++ b/NinjaPanel.lua
@@ -170,6 +170,21 @@ function NinjaPanel:UpdatePlugin(event, name, key, value, dataobj)
 		self:UpdateButtonWidth(button)
 	elseif key == "icon" then
 		button.icon:SetTexture(value)
+	-- TODO: Clean this up
+	elseif key == "OnTooltipShow" and type(value) == "function" then
+		button:SetScript("OnEnter", Button_OnEnter)
+		button:SetScript("OnLeave", Button_OnLeave)
+	elseif key == "OnEnter" and type(value) == "function" then
+		-- Set the OnEnter script
+		button:SetScript("OnEnter", value)
+	elseif key == "OnEnter" then
+		button:SetScript("OnEnter", Button_OnEnter)
+	elseif key == "OnLeave" and type(value) == "function" then
+		button:SetScript("OnLeave", value)
+	elseif key == "OnLeave" then
+		button:SetScript("OnEnter", Button_OnLeave)
+	elseif key == "OnClick" then
+		button:SetScript("OnClick", value)
 	end

 	-- Update the icon coordinates if either the icon or the icon coords were