<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">

	<Script file="EDB_Frame.lua"/>

	<!-- Tab button template -->
	<Button name="EDB_Frame_Tab_Template" inherits="CharacterFrameTabButtonTemplate" virtual="true">
		<Scripts>
			<OnLoad>
				this:SetFrameLevel(this:GetFrameLevel() + 4);
			</OnLoad>
			<OnShow>
				PanelTemplates_TabResize(10);
				getglobal(this:GetName().."HighlightTexture"):SetWidth(this:GetTextWidth() + 30);
			</OnShow>
		</Scripts>
	</Button>

	
	<!-- Main UI frame -->
	<Frame name="EDB_Frame" toplevel="true" movable="true" enableMouse="true" parent="UIParent" hidden="true">

		<Size>
			<AbsDimension x="384" y="512"/>
		</Size>

		<Anchors>
			<Anchor point="TOPLEFT">
				<Offset>
					<AbsDimension x="0" y="-104"/>
				</Offset>
			</Anchor>
		</Anchors>
		
		<Layers>

			<Layer level="BACKGROUND">
				<Texture file="Interface\QuestFrame\UI-QuestLog-BookIcon">
					<Size>
						<AbsDimension x="64" y="64"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="6" y="-4"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>
			</Layer>

			<Layer level="BORDER">

				<Texture name="$parent_SkillBorderLeft" file="Interface\TradeSkillFrame\UI-TradeSkill-SkillBorder">
					<Size>
						<AbsDimension x="256" y="8"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="63" y="-50"/>
							</Offset>
						</Anchor>
					</Anchors>
					<TexCoords left="0" right="1.0" top="0" bottom="0.25"/>
				</Texture>

				<Texture file="Interface\TradeSkillFrame\UI-TradeSkill-SkillBorder">
					<Size>
						<AbsDimension x="28" y="8"/>
					</Size>
					<Anchors>
						<Anchor point="LEFT" relativeTo="$parent_SkillBorderLeft" relativePoint="RIGHT"/>
					</Anchors>
					<TexCoords left="0" right="0.109375" top="0.25" bottom="0.5"/>
				</Texture>

			</Layer>

			<Layer level="ARTWORK">

				<Texture file="Interface\ClassTrainerFrame\UI-ClassTrainer-TopLeft">
					<Size>
						<AbsDimension x="256" y="256"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="2" y="-1"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>

				<Texture file="Interface\ClassTrainerFrame\UI-ClassTrainer-TopRight">
					<Size>
						<AbsDimension x="128" y="256"/>
					</Size>
					<Anchors>
						<Anchor point="TOPRIGHT">
							<Offset>
								<AbsDimension x="2" y="-1"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>

				<Texture file="Interface\PaperDollInfoFrame\UI-Character-General-BottomLeft">
					<Size>
						<AbsDimension x="256" y="256"/>
					</Size>
					<Anchors>
						<Anchor point="BOTTOMLEFT">
							<Offset>
								<AbsDimension x="2" y="-1"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>

				<Texture file="Interface\PaperDollInfoFrame\UI-Character-General-BottomRight">
					<Size>
						<AbsDimension x="128" y="256"/>
					</Size>
					<Anchors>
						<Anchor point="BOTTOMRIGHT">
							<Offset>
								<AbsDimension x="2" y="-1"/>
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>

				<FontString name="EDB_Frame_TitleText" inherits="GameFontNormal" text="EnchantingDB">
					<Size>
					    <AbsDimension x="300" y="14"/>
					</Size>
					<Anchors>
						<Anchor point="TOP" relativeTo="EDB_Frame" relativePoint="TOP">
							<Offset>
								<AbsDimension x="0" y="-17"/>
							</Offset>
						</Anchor>
					</Anchors>
				</FontString>

			</Layer>

		</Layers>

		<Frames>

			<Button name="EDB_Frame_CloseButton" inherits="UIPanelCloseButton">
				<Anchors>
					<Anchor point="TOPRIGHT" relativeTo="EDB_Frame" relativePoint="TOPRIGHT">
						<Offset>
							<AbsDimension x="-28" y="-9"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnLoad>
						this:SetFrameLevel(this:GetFrameLevel() + 4);
					</OnLoad>
				</Scripts>
			</Button>

			<Button name="EDB_Frame_LockButton">
				<Size>
					<AbsDimension x="32" y="32"/>
				</Size>
				<Anchors>
					<Anchor point="RIGHT" relativeTo="EDB_Frame_CloseButton" relativePoint="LEFT">
						<Offset>
							<AbsDimension x="11" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnLoad>
						EDB_Frame.isLocked = false;
						EDB_Frame_LockButtonNorm:SetTexture("Interface\\AddOns\\EnchantingDB\\LockButton-Unlocked-Up");
						EDB_Frame_LockButtonPush:SetTexture("Interface\\AddOns\\EnchantingDB\\LockButton-Unlocked-Down");
					</OnLoad>
					<OnClick>
						if ( EDB_Frame.isLocked ) then
							EDB_Frame.isLocked = false;
							EDB_Frame_LockButtonNorm:SetTexture("Interface\\AddOns\\EnchantingDB\\LockButton-Unlocked-Up");
							EDB_Frame_LockButtonPush:SetTexture("Interface\\AddOns\\EnchantingDB\\LockButton-Unlocked-Down");
						else
							EDB_Frame.isLocked = true;
							EDB_Frame_LockButtonNorm:SetTexture("Interface\\AddOns\\EnchantingDB\\LockButton-Locked-Up");
							EDB_Frame_LockButtonPush:SetTexture("Interface\\AddOns\\EnchantingDB\\LockButton-Locked-Down");
						end
					</OnClick>
				</Scripts>
				<NormalTexture name="EDB_Frame_LockButtonNorm"/>
				<PushedTexture name="EDB_Frame_LockButtonPush"/>
				<HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" AlphaMode="ADD"/>
			</Button>

			<!-- Enchanting skill progress bar -->
			<StatusBar name="$parent_SkillRankFrame" drawLayer="BACKGROUND" minValue="0" maxValue="1" defaultValue="0">
				<Size>
					<AbsDimension x="268" y="15"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT">
						<Offset>
							<AbsDimension x="73" y="-37"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Layers>
					<Layer level="ARTWORK">
						<FontString name="$parentSkillName" inherits="GameFontNormalSmall">
							<Anchors>
								<Anchor point="LEFT">
									<Offset>
										<AbsDimension x="6" y="1"/>
									</Offset>
								</Anchor>
							</Anchors>
						</FontString>
						<FontString name="$parentSkillRank" inherits="GameFontHighlightSmall" justifyH="LEFT">
							<Size>
								<AbsDimension x="128" y="0"/>
							</Size>
							<Anchors>
								<Anchor point="LEFT" relativeTo="$parentSkillName" relativePoint="RIGHT">
									<Offset>
										<AbsDimension x="13" y="0"/>
									</Offset>
								</Anchor>
							</Anchors>
						</FontString>
					</Layer>
					<Layer level="BACKGROUND">
							<Texture name="$parentBackground">
								<Color r="1.0" g="1.0" b="1.0" a="0.2"/>
							</Texture>
					</Layer>
				</Layers>
				<Frames>
					<Button name="$parentBorder">
						<Size>
							<AbsDimension x="281" y="32"/>
						</Size>
						<Anchors>
							<Anchor point="LEFT">
								<Offset>
									<AbsDimension x="-5" y="0"/>
								</Offset>
							</Anchor>
						</Anchors>
						<NormalTexture name="$parentNormal" file="Interface\PaperDollInfoFrame\UI-Character-Skills-BarBorder" />
					</Button>
				</Frames>
				<Scripts>
					<OnLoad>
						this:RegisterEvent("SKILL_LINES_CHANGED");
					</OnLoad>
					<OnEvent>
						if ( event == "SKILL_LINES_CHANGED" ) then
							EDB_Frame_SkillRankFrame_Update();
						end
					</OnEvent>
				</Scripts>
				<BarTexture name="$parentBar" file="Interface\PaperDollInfoFrame\UI-Character-Skills-Bar" />
				<BarColor r="0.25" g="0.25" b="0.75" />
			</StatusBar>

			<Button name="EDB_FrameTab1" inherits="EDB_Frame_Tab_Template" id="1" text="Enchants">
				<Anchors>
					<Anchor point="CENTER" relativePoint="BOTTOMLEFT">
						<Offset>
							<AbsDimension x="85" y="61"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnClick>
						EDB_Frame_Tab_OnClick("EDB_Frame_Enchant");
					</OnClick>
				</Scripts>
			</Button>

			<Button name="EDB_FrameTab2" inherits="EDB_Frame_Tab_Template" id="2" text="Reagents">
				<Anchors>
				   <Anchor point="LEFT" relativeTo="EDB_FrameTab1" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="-10" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnClick>
						EDB_Frame_Tab_OnClick("EDB_Frame_Reagent");
					</OnClick>
				</Scripts>
			</Button>

			<Button name="EDB_FrameTab3" inherits="EDB_Frame_Tab_Template" id="3" text="Options">
				<Anchors>
				   <Anchor point="LEFT" relativeTo="EDB_FrameTab2" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="-10" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnClick>
						EDB_Frame_Tab_OnClick("EDB_Frame_Options");
					</OnClick>
				</Scripts>
			</Button>
			
			<Frame name="$parent_DragBar" frameStrata="high" toplevel="true" movable="true" enableMouse="true" parent="EDB_Frame" hidden="false">
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="EDB_Frame" relativePoint="TOPLEFT">
						<Offset>
							<AbsDimension x="65" y="-12"/>
						</Offset>
					</Anchor>
				</Anchors>

				<Size>
					<AbsDimension x="245" y="26"/>
				</Size>

<!--				<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
					<BackgroundInsets>
						<AbsInset left="5" right="4" top="5" bottom="5"/>
					</BackgroundInsets>
					<TileSize>
						<AbsValue val="16"/>
					</TileSize>
					<EdgeSize>
						<AbsValue val="16"/>
					</EdgeSize>
				</Backdrop>
-->
				<Scripts>
					<OnMouseDown>
						if ( ( not EDB_Frame.isLocked ) and ( arg1 == "LeftButton" ) ) then
							EDB_Frame:StartMoving();
							EDB_Frame.isMoving = true;
						end
					</OnMouseDown>
					<OnMouseUp>
						if ( EDB_Frame.isMoving ) then
							EDB_Frame:StopMovingOrSizing();
							EDB_Frame.isMoving = false;
						end
					</OnMouseUp>
				</Scripts>

			</Frame>

		</Frames>

		<Scripts>
			<OnLoad>
				EDB_Frame_OnLoad();
			</OnLoad>
			<OnShow>
				EDB_Frame_OnShow();
			</OnShow>
			<OnHide>
				EDB_Frame_OnHide();
			</OnHide>
		</Scripts>

	</Frame>

</Ui>
