SecureHandlers

:::These templates are defined in FrameXML/SecureHandlerTemplates.xml and FrameXML/SecureHandlers.lua
SecureHandlers (created by inheriting SecureHandlerBaseTemplate) use code snippets inside the RestrictedEnvironment. Each snippet is a that behaves like the body of a Lua function, but it can only contain a subset of the World of Warcraft API.
== Defined methods ==
* - Executes a code snippet in the restricted environment.
* - Wraps a widget script with code snippets executed in the restricted environment.
* - Strips (and returns) the outermost-wrapped handler.
* - Creates a frame reference accessible in the restricted environment.
== Details ==
* The base template has an OnLoad widget script which adds the four defined methods.
* Other templates (listed below) use () to run widget script handlers in the RestrictedEnvironment.
Template 	Description 	Attribute (arguments)
SecureHandlerBaseTemplate 	Enables common methods on the frame	none
SecureHandlerStateTemplate 	Only "state-xxx" attribute changes 	_onstate-xxx(self, stateid, newstate)
SecureHandlerAttributeTemplate 	Any attribute change 	_onattributechanged(self, name, value)
SecureHandlerClickTemplate 	Clicks 	_onclick(self, button, down)
SecureHandlerDoubleClickTemplate	Double clicks 	_ondoubleclick(self, button, down)
SecureHandlerDragTemplate 	Dragging 	_ondragstart(self, button), _onreceivedrag(self, button, kind, value, ...)
SecureHandlerMouseUpDownTemplate	Mouse up/down 	_onmouseup(self, button), _onmousedown(self, button)
SecureHandlerMouseWheelTemplate 	Mouse wheel 	_onmousewheel(self, delta)
SecureHandlerEnterLeaveTemplate 	Mouse entering/leaving 	_onenter(self), _onleave(self)
SecureHandlerShowHideTemplate 	Frame shown/hidden 	_onshow(self), _onhide(self)
== Example ==
local frame = CreateFrame("Frame", nil, "SecureHandlerClickTemplate")
frame:SetAttribute("_onclick", [=[
	-- self, button, down
	if button == "RightButton" then
		self:Hide();
	end
]=])
== External links ==
*