<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">
	
	<Script file="Menu.lua"/>
	
	<!-- General Slider -->
	<Slider name="BagnonSlider" inherits="OptionsSliderTemplate" virtual="true">
		<Size>
			<AbsDimension x="212" y="18"/>
		</Size>
		<Layers>
			<Layer level="ARTWORK">
				<FontString name="$parentValText" inherits="GameFontNormalSmall">
					<Anchors>
						<Anchor point="BOTTOM">
							<Offset>
								<AbsDimension x="0" y="-6"/>
							</Offset>
						</Anchor>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
	</Slider>
	
	<!-- 
		The right click menu
	-->
	
	<Button name="BagnonMenu" enableMouse="true" toplevel="true" hidden="true" parent="UIParent">
	
		<Size>
			<AbsDimension x="254" y="290"/>
		</Size>
		
		<Backdrop bgFile="Interface\CharacterFrame\UI-Party-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
			<BackgroundInsets>
				<AbsInset left="11" right="12" top="12" bottom="11"/>
			</BackgroundInsets>
			<TileSize>
				<AbsValue val="32"/>
			</TileSize>
			<EdgeSize>
				<AbsValue val="32"/>
			</EdgeSize>
		</Backdrop>

		<Layers>
			<Layer level="ARTWORK">
				<FontString name="$parentText" inherits="GameFontHighlightLarge">
					<Anchors>
						<Anchor point="TOP">
							<Offset>
								<AbsDimension x="0" y="-16"/>
							</Offset>
						</Anchor>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		
		<Frames>
			<!-- checkbox -->
			<CheckButton name="$parentLocked" text="Lock Position">
				<Size>
					<AbsDimension x="32" y="32"/>
				</Size>
				
				<Anchors>
					<Anchor point="TOPLEFT" relativePoint="TOPLEFT">
						<Offset>
							<AbsDimension x="18" y="-36"/>
						</Offset>
					</Anchor>
				</Anchors>
				
				<NormalText name="$parentText" inherits="GameFontNormalSmall">
					<Anchors>
						<Anchor point="LEFT" relativePoint="RIGHT">
							<Offset>
								<AbsDimension x="-2" y="0"/>
							</Offset>
						</Anchor>
					</Anchors>
				</NormalText>
				<NormalTexture file="Interface\Buttons\UI-CheckBox-Up"/>
				<PushedTexture file="Interface\Buttons\UI-CheckBox-Down"/>
				<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD"/>
				<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check"/>
				<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled"/>
				
				<Scripts>
					<OnClick>
						BagnonMenu_ToggleLock(this:GetParent().frame, this:GetChecked());
					</OnClick>
				</Scripts>
			</CheckButton>
			
			<!-- texture -->
			<CheckButton name="$parentOpaque" text="Opaque Background">
				<Size>
					<AbsDimension x="32" y="32"/>
				</Size>

				<Anchors>
					<Anchor point="TOP" relativeTo="$parentLocked" relativePoint="BOTTOM">
						<Offset>
							<AbsDimension x="0" y="-2"/>
						</Offset>
					</Anchor>
				</Anchors>

				<NormalText name="$parentText" inherits="GameFontNormalSmall">
					<Anchors>
						<Anchor point="LEFT" relativePoint="RIGHT">
							<Offset>
								<AbsDimension x="-2" y="0"/>
							</Offset>
						</Anchor>
					</Anchors>
				</NormalText>
				<NormalTexture file="Interface\Buttons\UI-CheckBox-Up"/>
				<PushedTexture file="Interface\Buttons\UI-CheckBox-Down"/>
				<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD"/>
				<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check"/>
				<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled"/>

				<Scripts>
					<OnClick>
						BagnonMenu_ToggleBG(this:GetParent().frame, this:GetChecked());
					</OnClick>
				</Scripts>
			</CheckButton>
			
			<!-- Columns -->
			<Slider name="$parentColumns" inherits="BagnonSlider" minValue="1" maxValue="144" valuestep="1">
			
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentOpaque" relativePoint="BOTTOMLEFT">
						<Offset>
							<AbsDimension x="2" y="-12"/>
						</Offset>
					</Anchor>
				</Anchors>
				
				<Scripts>
					<OnLoad>
						getglobal(this:GetName() .. "Text"):SetText("Columns");
						getglobal(this:GetName() .. "Low"):SetText("1");
						getglobal(this:GetName() .. "High"):SetText("144");
					</OnLoad>
					<!-- 
						parent.onShow is set to 1 when a frame is loading values (usually on an onShow)
						used to prevent doing something when just loading values 
					-->
					<OnValueChanged>
						if(not this:GetParent().onShow) then
							BagnonCore_LayoutFrame(this:GetParent().frame, this:GetValue(), this:GetParent().frame.space);
						end
						getglobal(this:GetName() .. "ValText"):SetText( this:GetValue() );
					</OnValueChanged>
				</Scripts>
			</Slider>
			
			<!-- Spacing -->
			<Slider name="$parentSpacing" inherits="BagnonSlider" minValue="0" maxValue="32" valuestep="1">
			
				<Anchors>
					<Anchor point="TOP" relativeTo="$parentColumns" relativePoint="BOTTOM">
						<Offset>
							<AbsDimension x="0" y="-24"/>
						</Offset>
					</Anchor>
				</Anchors>
				
				<Scripts>
					<OnLoad>
						getglobal(this:GetName() .. "Text"):SetText("Spacing");
						getglobal(this:GetName() .. "Low"):SetText("0");
						getglobal(this:GetName() .. "High"):SetText("32");
					</OnLoad>
					<OnValueChanged>
						if(not this:GetParent().onShow) then
							BagnonCore_LayoutFrame(this:GetParent().frame, this:GetParent().frame.cols, this:GetValue() );
						end
						getglobal(this:GetName() .. "ValText"):SetText( this:GetValue() );
					</OnValueChanged>
				</Scripts>
			</Slider>
			
			<!-- Scaler -->
			<Slider name="$parentScale" inherits="BagnonSlider" minValue="50" maxValue="150" valuestep="1">
				
				<Anchors>
					<Anchor point="TOP" relativeTo="$parentSpacing" relativePoint="BOTTOM">
						<Offset>
							<AbsDimension x="0" y="-24"/>
						</Offset>
					</Anchor>
				</Anchors>
				
				<Scripts>
					<OnLoad>
						getglobal(this:GetName() .. "Text"):SetText("Scale");
						getglobal(this:GetName() .. "Low"):SetText("50%");
						getglobal(this:GetName() .. "High"):SetText("150%");
					</OnLoad>
					<OnValueChanged>
						if(not this:GetParent().onShow) then
							BagnonMenu_SetScale(this:GetParent().frame, this:GetValue() / 100 );
						end
						getglobal(this:GetName() .. "ValText"):SetText( this:GetValue() );
					</OnValueChanged>
				</Scripts>
			</Slider>
			
			<!-- Opacity -->
			<Slider name="$parentOpacity" inherits="BagnonSlider" minValue="0" maxValue="100" valuestep="1">
			
				<Anchors>
					<Anchor point="TOP" relativeTo="$parentScale" relativePoint="BOTTOM">
						<Offset>
							<AbsDimension x="0" y="-24"/>
						</Offset>
					</Anchor>
				</Anchors>
				
				<Scripts>
					<OnLoad>
						getglobal(this:GetName() .. "Text"):SetText("Opacity");
						getglobal(this:GetName() .. "Low"):SetText("0%");
						getglobal(this:GetName() .. "High"):SetText("100%");
					</OnLoad>
					<OnValueChanged>
						if(not this:GetParent().onShow) then
							BagnonMenu_SetAlpha(this:GetParent().frame, this:GetValue() / 100 );
						end
						getglobal(this:GetName() .. "ValText"):SetText( this:GetValue() );
					</OnValueChanged>
				</Scripts>
			</Slider>
		</Frames>

		<!-- Setup all buttons to whatever the bar had the settings to -->
		<Scripts>
			<OnLoad>
				this:RegisterForClicks("LeftButtonDown", "LeftButtonUp", "RightButtonUp");
			</OnLoad>
			<OnClick>
				this:Hide();
			</OnClick>
			<OnHide>
				this:SetParent(UIParent);
			</OnHide>
		</Scripts>
	</Button>
</Ui>