First decision. Do you want to make seperate xml frames for classic and non-classic
If yes then:
Classic: (same as always)
Lua Code:
<Frame name="TestFrame" parent="UIParent">
<Size x="300" y="300"/>
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<BackgroundInsets>
<AbsInset left="5" right="5" top="5" bottom="5"/>
</BackgroundInsets>
<TileSize>
<AbsValue val="16"/>
</TileSize>
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
</Backdrop>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Scripts>
<OnLoad inherit="prepend">
self:SetBackdropColor(0.5, 0.3, 0.3)
self:SetBackdropBorderColor(0.5, 0.3, 0.3, 0.25)
print("Loaded!");
</OnLoad>
</Scripts>
</Frame>
Others, Mostly the same xml frame but inherits the BackdropTemplate and all backdrop information is set in lua (OnLoad)
Lua Code:
<Frame name="TestFrame" parent="UIParent" inherits="BackdropTemplate">
<Size x="300" y="300"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Scripts>
<OnLoad inherit="prepend">
self:SetBackdrop( {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileEdge = true,
tileSize = 16,
edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }
})
self:SetBackdropColor(0.5, 0.3, 0.3)
self:SetBackdropBorderColor(0.5, 0.3, 0.3, 0.25)
print("Loaded!");
</OnLoad>
</Scripts>
</Frame>
Or, do you want one frame for both Classic and the rest: Mostly the same xml frame but detecting if backdrop mixin (template) is needed and all backdrop information is set in lua (OnLoad)
Lua Code:
<Frame name="TestFrame" parent="UIParent">
<Size x="300" y="300"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Scripts>
<OnLoad inherit="prepend">
if BackdropTemplateMixin then -- if this is NOT a Classic type frame, add the backdrop mixin
Mixin(self, BackdropTemplateMixin)
end
self:SetBackdrop( {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileEdge = true,
tileSize = 16,
edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }
})
self:SetBackdropColor(0.5, 0.3, 0.3)
self:SetBackdropBorderColor(0.5, 0.3, 0.3, 0.25)
print("Loaded!");
</OnLoad>
</Scripts>
</Frame>
Done this way to show separation of xml and lua. With the Classic and non-Classic you could use <KeyValues></KeyValues> for both but not with the one frame for multiple versions layout.
Definitions like BACKDROP_TOOLTIP_16_16_5555 and LEGENDARY_ORANGE_COLOR don't exist in Classic and may not BCC either so probably easiest not to use them and just define backdrop, colours, alpha manually in both.