Intrinsic frame

Intrinsic frame templates are similar to virtual XML templates. Intrinsics also support defining script handlers to be called before/after the normal handler.
==Blue post==
==Summary==
* The name attribute becomes the new tag name in XML or the frame type in .
* Specifying the intrinsicOrder="precall" attribute means the handler is called before the normal script handler.
* Specifying the intrinsicOrder="postcall" attribute means the handler is called after the normal script handler.
* Intrinsic scripts cannot be removed after being defined.
* They can be returned from GetScript and hooked with HookScript with LE_SCRIPT_BINDING_TYPE_INTRINSIC_PRECALL/POSTCALL.
==Details==
* GetObjectType returns the intrinsic's type, not the intrinsic's name e.g. CreateFrame("MyFrame"):GetObjectType() == "Frame", not "MyFrame".
* It is not possible to declare an intrinsic based on another intrinsic.
* For intrinsic frame templates when the intrinsicOrder attribute is not specified it will default to "precall".
==FrameXML Intrinsics==
Frame
* EventFrame
* ScrollingMessageFrame
Button
* ContainedAlertFrame
* DropDownToggleButton
* EventButton
* ItemButton
EditBox
* EventEditBox
==Example==
===Minimal example===
Creates a frame in XML that inherits from an intrinsic template.
* Prints ExampleIntrinsic_OnShow, ExampleIntrinsic_OnPostShow in order.
TestXml.toc
 ## Interface: 
 ## Title: TestXml intrinsic
 
 ExampleIntrinsic.xml
 ExampleFrame.xml
ExampleIntrinsic.xml
<Ui>
	<Frame name="ExampleIntrinsic" intrinsic="true">
		<Scripts>
			<OnShow intrinsicOrder="postcall">
				print("ExampleIntrinsic_OnPostShow")
			</OnShow>
		</Scripts>
	</Frame>
</Ui>
ExampleFrame.xml
<Ui>
	<ExampleIntrinsic name="ExampleFrame">
		<Scripts>
			<OnShow>
				print("ExampleIntrinsic_OnShow")
			</OnShow>
		</Scripts>
	</ExampleIntrinsic>
</Ui>
===Lua example===
Creates a frame with CreateFrame which inherits from both an intrinsic template and virtual template; also uses mixins to keep things tidy.
TestLua.toc
 ## Interface: 
 ## Title: TestLua intrinsic
 
 TestIntrinsic.xml
 TestTemplate.xml
 Core.lua
TestIntrinsic.lua
TestIntrinsicMixin = {}
function TestIntrinsicMixin:OnPreShow()
	print("TestIntrinsic OnPreShow")
end
function TestIntrinsicMixin:OnPostShow()
	print("TestIntrinsic OnPostShow")
end
TestIntrinsic.xml
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
https://raw.githubusercontent.com/Gethe/wow-ui-source/live/Interface/FrameXML/UI_shared.xsd">
	<Script file="TestIntrinsic.lua"/>
	<Frame name="TestIntrinsic" mixin="TestIntrinsicMixin" intrinsic="true">
		<Scripts>
			<OnShow method="OnPreShow" intrinsicOrder="precall"/>
			<OnShow method="OnPostShow" intrinsicOrder="postcall"/>
		</Scripts>
	</Frame>
</Ui>
TestTemplate.lua
TestTemplateMixin = {}
function TestTemplateMixin:OnShow()
	print("TestTemplate OnShow")
end
TestTemplate.xml
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
https://raw.githubusercontent.com/Gethe/wow-ui-source/live/Interface/FrameXML/UI_shared.xsd">
	<Script file="TestTemplate.lua"/>
	<Frame name="TestTemplate" mixin="TestTemplateMixin" virtual="true">
		<Scripts>
			<OnShow method="OnShow"/>
		</Scripts>
	</Frame>
</Ui>
Core.lua
local f = CreateFrame("TestIntrinsic", nil, nil, "TestTemplate")
-- prints "TestIntrinsic OnPreShow"
-- prints "TestTemplate OnShow"
-- prints "TestIntrinsic OnPostShow"
-- inspects script handlers
print(f:GetScript("OnShow", LE_SCRIPT_BINDING_TYPE_INTRINSIC_PRECALL)) -- function: 0000024A781FFC98
print(f:GetScript("OnShow", LE_SCRIPT_BINDING_TYPE_EXTRINSIC)) -- function: 0000024A781FFDB0
print(f:GetScript("OnShow", LE_SCRIPT_BINDING_TYPE_INTRINSIC_POSTCALL)) -- function: 0000024A781FFD08