<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="CT_RAMenu_Groups.lua"/>

<Button name="CT_RAMenu_GroupsCellTemplate" parent="CT_RAMenu_GroupsFrame" movable="true" clampedToScreen="true" virtual="true">
	<Size>
		<AbsDimension x="32" y="32"/>
	</Size>
	<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
		<EdgeSize>
			<AbsValue val="16"/>
		</EdgeSize>
		<TileSize>
			<AbsValue val="16"/>
		</TileSize>
		<BackgroundInsets>
			<AbsInset left="5" right="5" top="5" bottom="5"/>
		</BackgroundInsets>
	</Backdrop>
	<Layers>
		<Layer level="ARTWORK">
			<FontString name="$parentLabel" inherits="GameFontHighlightLarge">
				<Anchors>
					<Anchor point="CENTER"/>
				</Anchors>
			</FontString>
		</Layer>
	</Layers>
	<Scripts>
		<OnLoad>
			this.bg = {r = 0, g = 0, b = 0};
			this.hover = {r = 1, g = 0.5, b = 0};

			this:SetMovable(1);
			this:SetFrameLevel(this:GetFrameLevel() + 2);
			this:RegisterForDrag("LeftButton");
	
			this.slot = nil;
	
			getglobal(this:GetName().."Label"):SetText(this:GetID());

			this:SetBackdropColor(0.0, 0.0, 0.0);
		</OnLoad>
		<OnDragStart>
			CT_RAMenu_Groups.onDragStartCell();
		</OnDragStart>
		<OnDragStop>
			CT_RAMenu_Groups.onDragStopCell();
		</OnDragStop>
		<OnEnter>
			this:SetBackdropColor(this.hover.r, this.hover.g, this.hover.b);
		</OnEnter>
		<OnLeave>
			this:SetBackdropColor(this.bg.r, this.bg.g, this.hover.b);
		</OnLeave>
	</Scripts>
</Button>
<Button name="CT_RAMenu_GroupsCellSlotTemplate" parent="CT_RAMenu_GroupsFrame" virtual="true" hidden="false">
	<Size>
		<AbsDimension x="32" y="32"/>
	</Size>
	<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
		<EdgeSize>
			<AbsValue val="16"/>
		</EdgeSize>
		<TileSize>
			<AbsValue val="16"/>
		</TileSize>
		<BackgroundInsets>
			<AbsInset left="5" right="5" top="5" bottom="5"/>
		</BackgroundInsets>
	</Backdrop>
		
	<Layers>
		<Layer level="BACKGROUND">
			<FontString name="$parentLabel" inherits="GameFontDarkGraySmall" text="">
				<Anchors>
					<Anchor point="CENTER"/>
				</Anchors>
			</FontString>
		</Layer>
	</Layers>
	<Scripts>
		<OnLoad>
			this.bg = {r = 0, g = 0, b = 0};
			this.hover = {r = 0, g = 0.5, b = 0};
	
			this.button = nil;
			this:SetBackdropColor(this.bg.r, this.bg.g, this.bg.b);
			this:ClearAllPoints();

			if this:GetID() == 1 then
				this:SetPoint("TOPLEFT", this:GetParent(), "TOPLEFT", 15, -28);
			elseif math.mod((this:GetID() - 1), 8) == 0 then
				this:SetPoint("TOPLEFT", this:GetParent():GetName().."CellSlot"..(this:GetID() - 8), "BOTTOMLEFT", 0, 0);
			else
				this:SetPoint("TOPLEFT", this:GetParent():GetName().."CellSlot"..(this:GetID() - 1), "TOPRIGHT", 0, 0);
			end
		</OnLoad>
	</Scripts>
</Button>

<Frame name="CT_RAMenu_GroupsFrame" toplevel="true" hidden="true" movable="false" parent="UIParent" frameStrata="DIALOG">
	<Size>
		<AbsDimension x="285" y="430"/>
	</Size>
	<Anchors>
		<Anchor point="CENTER"/>
	</Anchors>
	<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
		<BackgroundInsets>
			<AbsInset left="11" right="12" top="12" bottom="11" />	
			<Size>
				<AbsDimension x="128" y="17" />
			</Size>
		</BackgroundInsets>
		<TileSize>
			<AbsValue val="32" />
		</TileSize>
		<EdgeSize>
			<AbsValue val="32" />
		</EdgeSize>
	</Backdrop>
	<Layers>
		<Layer level="ARTWORK">
			<Texture file="Interface\DialogFrame\UI-DialogBox-Header">
				<Size>
					<AbsDimension x="290" y="64" />
				</Size>
				<Anchors>
					<Anchor point="TOP">
						<Offset>
							<AbsDimension x="0" y="12" />
						</Offset>
					</Anchor>
				</Anchors>
			</Texture>
			<FontString inherits="GameFontNormal" text="CT_RA_ARRGROUPS_HEADER">
				<Anchors>
					<Anchor point="TOP">
						<Offset>
							<AbsDimension x="0" y="-3" />
						</Offset>
					</Anchor>
				</Anchors>
			</FontString>
		</Layer>
	</Layers>
	<Frames>
		<Button name="$parentReset" inherits="OptionsButtonTemplate" text="CT_RA_ARRGROUPS_BUTTON_RESET">
			<Size>
				<AbsDimension x="100" y="25"/>
			</Size>
			<Anchors>
				<Anchor point="CENTER" relativeTo="$parent" relativePoint="BOTTOM">
					<Offset>
						<AbsDimension x="-60" y="30"/>
					</Offset>
				</Anchor>
			</Anchors>
			<Scripts>
				<OnClick>
					CT_RAMenu_Groups.changePosition("reset");
				</OnClick>
			</Scripts>
		</Button>
		<Button name="$parentClose" inherits="OptionsButtonTemplate" text="CT_RA_ARRGROUPS_BUTTON_CLOSE">
			<Size>
				<AbsDimension x="100" y="25"/>
			</Size>
			<Anchors>
				<Anchor point="CENTER" relativeTo="$parent" relativePoint="BOTTOM">
					<Offset>
						<AbsDimension x="60" y="30"/>
					</Offset>
				</Anchor>
			</Anchors>
			<Scripts>
				<OnClick>
					this:GetParent():Hide();
				</OnClick>
			</Scripts>
		</Button>
		<Slider name="$parentSpacingX" inherits="OptionsSliderTemplate">
			<Size>
			  <AbsDimension x="220" y="16"/>
			</Size>
			<Anchors>
			  <Anchor point="CENTER" relativeTo="$parent" relativePoint="BOTTOM">
				<Offset>
				  <AbsDimension x="-60" y="100"/>
				</Offset>
			  </Anchor>
			</Anchors>
			<Scripts>
				<OnLoad>
					getglobal(this:GetName().."Text"):SetText("(" .. this:GetValue() .. ")\n" .. CT_RA_ARRGROUPS_SLIDER_DX);
					getglobal(this:GetName().."High"):SetText("");
					getglobal(this:GetName().."Low"):SetText("");
					this:SetMinMaxValues(-ceil(GetScreenWidth() / 8), 50);
					this:SetValueStep(1);
					this:SetWidth(100);
				</OnLoad>
				<OnValueChanged>
					CT_RAMenu_Groups.onClick();
					getglobal(this:GetName().."Text"):SetText("(" .. this:GetValue() .. ")\n" .. CT_RA_ARRGROUPS_SLIDER_DX);
				</OnValueChanged>
			</Scripts>
		</Slider>
		<Slider name="$parentSpacingY" inherits="OptionsSliderTemplate">
			<Size>
			  <AbsDimension x="220" y="16"/>
			</Size>
			<Anchors>
			  <Anchor point="CENTER" relativeTo="$parent" relativePoint="BOTTOM">
				<Offset>
				  <AbsDimension x="60" y="100"/>
				</Offset>
			  </Anchor>
			</Anchors>
			<Scripts>
				<OnLoad>
					getglobal(this:GetName().."Text"):SetText("(" .. this:GetValue() .. ")\n" .. CT_RA_ARRGROUPS_SLIDER_DY);
					getglobal(this:GetName().."High"):SetText("");
					getglobal(this:GetName().."Low"):SetText("");
					this:SetMinMaxValues(0, 100);
					this:SetValueStep(1);
					this:SetWidth(100);
				</OnLoad>
				<OnValueChanged>
					CT_RAMenu_Groups.onClick();
					getglobal(this:GetName().."Text"):SetText("(" .. this:GetValue() .. ")\n" .. CT_RA_ARRGROUPS_SLIDER_DY);
				</OnValueChanged>
			</Scripts>
		</Slider>
		<Slider name="$parentOffsetX" inherits="OptionsSliderTemplate">
			<Size>
			  <AbsDimension x="220" y="16"/>
			</Size>
			<Anchors>
			  <Anchor point="CENTER" relativeTo="$parent" relativePoint="BOTTOM">
				<Offset>
				  <AbsDimension x="-60" y="60"/>
				</Offset>
			  </Anchor>
			</Anchors>
			<Scripts>
				<OnLoad>
					getglobal(this:GetName().."Text"):SetText("(" .. this:GetValue() .. ")\n" .. CT_RA_ARRGROUPS_SLIDER_OX);
					getglobal(this:GetName().."High"):SetText("");
					getglobal(this:GetName().."Low"):SetText("");
					this:SetMinMaxValues(0, 500);
					this:SetValueStep(1);
					this:SetWidth(100);
				</OnLoad>
				<OnValueChanged>
					CT_RAMenu_Groups.onClick();
					getglobal(this:GetName().."Text"):SetText("(" .. this:GetValue() .. ")\n" .. CT_RA_ARRGROUPS_SLIDER_OX);
				</OnValueChanged>
			</Scripts>
		</Slider>
		<Slider name="$parentOffsetY" inherits="OptionsSliderTemplate">
			<Size>
			  <AbsDimension x="220" y="16"/>
			</Size>
			<Anchors>
			  <Anchor point="CENTER" relativeTo="$parent" relativePoint="BOTTOM">
				<Offset>
				  <AbsDimension x="60" y="60"/>
				</Offset>
			  </Anchor>
			</Anchors>
			<Scripts>
				<OnLoad>
					getglobal(this:GetName().."Text"):SetText("(" .. this:GetValue() .. ")\n" .. CT_RA_ARRGROUPS_SLIDER_OY);
					getglobal(this:GetName().."High"):SetText("");
					getglobal(this:GetName().."Low"):SetText("");
					this:SetMinMaxValues(0, 500);
					this:SetValueStep(1);
					this:SetWidth(100);
				</OnLoad>
				<OnValueChanged>
					CT_RAMenu_Groups.onClick();
					getglobal(this:GetName().."Text"):SetText("(" .. this:GetValue() .. ")\n" .. CT_RA_ARRGROUPS_SLIDER_OY);
				</OnValueChanged>
			</Scripts>
		</Slider>

		<!-- 64 group cell slots -->
		<Button name="$parentCellSlot1" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="1"/>
		<Button name="$parentCellSlot2" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="2"/>
		<Button name="$parentCellSlot3" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="3"/>
		<Button name="$parentCellSlot4" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="4"/>
		<Button name="$parentCellSlot5" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="5"/>
		<Button name="$parentCellSlot6" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="6"/>
		<Button name="$parentCellSlot7" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="7"/>
		<Button name="$parentCellSlot8" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="8"/>

		<Button name="$parentCellSlot9" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="9"/>
		<Button name="$parentCellSlot10" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="10"/>
		<Button name="$parentCellSlot11" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="11"/>
		<Button name="$parentCellSlot12" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="12"/>
		<Button name="$parentCellSlot13" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="13"/>
		<Button name="$parentCellSlot14" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="14"/>
		<Button name="$parentCellSlot15" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="15"/>
		<Button name="$parentCellSlot16" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="16"/>

		<Button name="$parentCellSlot17" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="17"/>
		<Button name="$parentCellSlot18" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="18"/>
		<Button name="$parentCellSlot19" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="19"/>
		<Button name="$parentCellSlot20" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="20"/>
		<Button name="$parentCellSlot21" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="21"/>
		<Button name="$parentCellSlot22" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="22"/>
		<Button name="$parentCellSlot23" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="23"/>
		<Button name="$parentCellSlot24" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="24"/>

		<Button name="$parentCellSlot25" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="25"/>
		<Button name="$parentCellSlot26" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="26"/>
		<Button name="$parentCellSlot27" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="27"/>
		<Button name="$parentCellSlot28" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="28"/>
		<Button name="$parentCellSlot29" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="29"/>
		<Button name="$parentCellSlot30" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="30"/>
		<Button name="$parentCellSlot31" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="31"/>
		<Button name="$parentCellSlot32" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="32"/>

		<Button name="$parentCellSlot33" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="33"/>
		<Button name="$parentCellSlot34" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="34"/>
		<Button name="$parentCellSlot35" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="35"/>
		<Button name="$parentCellSlot36" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="36"/>
		<Button name="$parentCellSlot37" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="37"/>
		<Button name="$parentCellSlot38" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="38"/>
		<Button name="$parentCellSlot39" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="39"/>
		<Button name="$parentCellSlot40" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="40"/>

		<Button name="$parentCellSlot41" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="41"/>
		<Button name="$parentCellSlot42" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="42"/>
		<Button name="$parentCellSlot43" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="43"/>
		<Button name="$parentCellSlot44" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="44"/>
		<Button name="$parentCellSlot45" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="45"/>
		<Button name="$parentCellSlot46" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="46"/>
		<Button name="$parentCellSlot47" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="47"/>
		<Button name="$parentCellSlot48" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="48"/>

		<Button name="$parentCellSlot49" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="49"/>
		<Button name="$parentCellSlot50" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="50"/>
		<Button name="$parentCellSlot51" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="51"/>
		<Button name="$parentCellSlot52" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="52"/>
		<Button name="$parentCellSlot53" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="53"/>
		<Button name="$parentCellSlot54" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="54"/>
		<Button name="$parentCellSlot55" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="55"/>
		<Button name="$parentCellSlot56" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="56"/>

		<Button name="$parentCellSlot57" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="57"/>
		<Button name="$parentCellSlot58" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="58"/>
		<Button name="$parentCellSlot59" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="59"/>
		<Button name="$parentCellSlot60" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="60"/>
		<Button name="$parentCellSlot61" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="61"/>
		<Button name="$parentCellSlot62" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="62"/>
		<Button name="$parentCellSlot63" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="63"/>
		<Button name="$parentCellSlot64" inherits="CT_RAMenu_GroupsCellSlotTemplate" id="64"/>

		<!-- the 8 group cells -->
		<Button name="$parentCell1" inherits="CT_RAMenu_GroupsCellTemplate" id="1"/>
		<Button name="$parentCell2" inherits="CT_RAMenu_GroupsCellTemplate" id="2"/>
		<Button name="$parentCell3" inherits="CT_RAMenu_GroupsCellTemplate" id="3"/>
		<Button name="$parentCell4" inherits="CT_RAMenu_GroupsCellTemplate" id="4"/>
		<Button name="$parentCell5" inherits="CT_RAMenu_GroupsCellTemplate" id="5"/>
		<Button name="$parentCell6" inherits="CT_RAMenu_GroupsCellTemplate" id="6"/>
		<Button name="$parentCell7" inherits="CT_RAMenu_GroupsCellTemplate" id="7"/>
		<Button name="$parentCell8" inherits="CT_RAMenu_GroupsCellTemplate" id="8"/>
	</Frames>
		
	<Scripts>
   	    <OnLoad>
       		CT_RAMenu_Groups.onLoad();
        </OnLoad>
		<OnEvent>
       		CT_RAMenu_Groups.onEvent();
        </OnEvent>
		<OnUpdate>
			CT_RAMenu_Groups.onUpdate();
		</OnUpdate>
		<OnShow>
			CT_RAMenu_Groups.onShow();
   		</OnShow>
		<OnHide>
			CT_RAMenu_Groups.onHide();
		</OnHide>
	</Scripts>
</Frame>

</Ui>
