<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/ .. \FrameXML\UI.xsd">

	<!-- TEMPLATES -->

	<Frame parentKey="border" name="TellMeWhen_GenericBorder" virtual="true" setAllPoints="true">
		<Size x="1" y="1"/>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture parentKey="borderTop">
					<Size x="1" y="1"/>
				</Texture>
				<Texture parentKey="borderBottom">
					<Size x="1" y="1"/>
				</Texture>
				<Texture parentKey="borderLeft">
					<Size x="1" y="1"/>

					<Anchors>
						<Anchor point="TOPLEFT" relativeKey="$parent.borderTop" relativePoint="BOTTOMLEFT"/>
						<Anchor point="BOTTOMLEFT" relativeKey="$parent.borderBottom" relativePoint="TOPLEFT"/>
					</Anchors>
				</Texture>
				<Texture parentKey="borderRight">
					<Size x="1" y="1"/>
					<Anchors>
						<Anchor point="TOPRIGHT" relativeKey="$parent.borderTop" relativePoint="BOTTOMRIGHT"/>
						<Anchor point="BOTTOMRIGHT" relativeKey="$parent.borderBottom" relativePoint="TOPRIGHT"/>
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad>
				function self:SetBorderSize(pixels)
					self.size = pixels
					self.borderTop:ClearAllPoints()
					self.borderBottom:ClearAllPoints()

					for i, tex in TMW:Vararg(self:GetRegions()) do
						tex:SetShown(pixels ~= 0)
						tex:SetSize(math.abs(pixels), math.abs(pixels))
					end

					-- Negative sizes should make inset borders.
					-- Positive sizes will make outset borders
					if 0 > pixels then
						pixels = 0
					end

					self.borderTop:SetPoint("TOPLEFT", -pixels, pixels)
					self.borderTop:SetPoint("TOPRIGHT", pixels, pixels)
					
					self.borderBottom:SetPoint("BOTTOMLEFT", -pixels, -pixels)
					self.borderBottom:SetPoint("BOTTOMRIGHT", pixels, -pixels)

				end

				function self:SetColor(r, g, b, a)
					a = a or 1

					for i, tex in TMW:Vararg(self:GetRegions()) do
						tex:SetColorTexture(r, g, b, a)
					end
				end

				self:SetBorderSize(1)
				self:SetColor(0, 0, 0, 1)
			</OnLoad>
		</Scripts>
	</Frame>
	
	<Frame name="TellMeWhen_GroupTemplate" enableMouse="false" toplevel="true" movable="true" parent="TMW" virtual="true">
		<Size x="1" y="1"/>
	</Frame>

	<Frame name="TellMeWhen_GlobalGroupTemplate" inherits="TellMeWhen_GroupTemplate" virtual="true">
		<Frames>
			<Frame inherits="TellMeWhen_GenericBorder">
				<Scripts>
					<OnSizeChanged>
						self:SetScale(1/self:GetParent():GetEffectiveScale())
					</OnSizeChanged>
				</Scripts>
			</Frame>
		</Frames>
		<Scripts>
			<OnLoad>
				self.border:SetBorderSize(1)
				self.border:SetColor(0, 0.7647, 0, 0.75)
			</OnLoad>
		</Scripts>
	</Frame>

	<Button name="TellMeWhen_IconTemplate" virtual="true" enableMouse="true" hidden="true">
		<Size x="30" y="30"/>
	</Button>

	<!-- END TEMPLATES -->

	<Cooldown hidden="true">
		<!-- cooldown bug fixer.
		Seems to fix the long-standing bug once and for all where cooldown models would
		not show up until one was initiated somewhere outside a TMW icon.
		Don't ask why this works, because I don't have a clue. But, it does. So leave it alone.-->
		<Scripts>
			<OnLoad>
				self:SetCooldown(GetTime(), 1)
			</OnLoad>
		</Scripts>
	</Cooldown>
	
	<Frame name="TellMeWhen_InterfaceOptionsPanel">
		<Layers>
			<Layer level="ARTWORK">
				<FontString parentKey="title" inherits="GameFontNormalHuge" justifyH="CENTER" text="TellMeWhen">
					<Size y="150"/>
					<Anchors>
						<Anchor point="TOP" y="-50"/>
						<Anchor point="LEFT" x="20"/>
						<Anchor point="RIGHT" x="-20"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		<Frames>
			<!-- Much of this is copied from TellMeWhen_ButtonTemplate because that template is defined in the options. -->
			<Button parentKey="Button">
				<Size x="144" y="15"/>
	
				<Anchors>
					<Anchor point="TOP" relativeKey="$parent.title" relativePoint="BOTTOM" y="-10"/>
				</Anchors>

				<NormalFont style="GameFontNormal"/>
				<HighlightFont style="GameFontHighlight"/>

				<Frames>
					<Frame inherits="TellMeWhen_GenericBorder" >
						<Scripts>
							<OnLoad inherit="prepend">
								self:SetBorderSize(-1)
								self:SetColor(.4, .4, .4, 1)
							</OnLoad>
						</Scripts>
					</Frame>
				</Frames>

				<Layers>
					<Layer level="BACKGROUND">
						<Texture parentKey="Background" setAllPoints="true">
							<Color r="0.15" g="0.15" b="0.15" a="0.5"/>
						</Texture>
					</Layer>
				</Layers>
				<Scripts>
					<OnLoad>
						TMW:TT(self, "MAINOPTIONS_SHOW")
						self:SetText(TMW.L["MAINOPTIONS_SHOW"])
						self:SetWidth(self:GetTextWidth() + 10)
						self:SetFrameLevel(self:GetFrameLevel() + 2)
						self:SetScale(2)
					</OnLoad>
					<OnClick>
						TMW:ClickSound()

						TMW:SlashCommand("options")
					</OnClick>
				</Scripts>
			</Button>
		</Frames>

		<Scripts>
			<OnLoad>
				self.name = "TellMeWhen"
				self.title:SetText("TellMeWhen v" .. TELLMEWHEN_VERSION_FULL)
				self.title:SetFont("Fonts\\FRIZQT__.TTF", 40, "THINOUTLINE")
				InterfaceOptions_AddCategory(self);
			</OnLoad>
		</Scripts>
	</Frame>
</Ui>




