<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="FloLib_localization.lua"/>
	<Script file="FloLib.lua"/>
	<CheckButton name="FloButtonTemplate" inherits="SecureActionButtonTemplate" virtual="true">
		<Size>
			<AbsDimension x="30" y="30"/>
		</Size>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture name="$parentIcon"/>
			</Layer>
		</Layers>
		<Frames>
			<Cooldown name="$parentCooldown" inherits="CooldownFrameTemplate">
				<Size x="36" y="36"/>
				<Anchors>
					<Anchor point="CENTER">
						<Offset>
							<AbsDimension x="0" y="-1"/>
						</Offset>
					</Anchor>
				</Anchors> 
			</Cooldown>
		</Frames>
		<NormalTexture name="$parentNormalTexture" file="Interface\Buttons\UI-Quickslot2">
			<Size>
				<AbsDimension x="54" y="54"/>
			</Size>
			<Anchors>
				<Anchor point="CENTER">
					<Offset>
						<AbsDimension x="0" y="-1"/>
					</Offset>
				</Anchor>
			</Anchors>
		</NormalTexture>
		<PushedTexture file="Interface\Buttons\UI-Quickslot-Depress"/>
		<HighlightTexture alphaMode="ADD" file="Interface\Buttons\ButtonHilight-Square"/>
		<CheckedTexture alphaMode="ADD" file="Interface\Buttons\CheckButtonHilight"/>
		<Scripts>
			<OnLoad>
				local cooldown = getglobal(self:GetName().."Cooldown");
				cooldown:SetFrameLevel(cooldown:GetFrameLevel() + 2);
				cooldown:SetScale(.83);	
				self:RegisterForDrag("LeftButton", "RightButton");
--				self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
			</OnLoad>
			<OnDragStart>
				if not InCombatLockdown() and (LOCK_ACTIONBAR ~= "1" or IsShiftKeyDown()) then
					local spell = self:GetParent().spells[self:GetID()];
					if spell then
						PickupSpell(spell.id, BOOKTYPE_SPELL);
					end
				end
			</OnDragStart>
			<PreClick>
				self:SetChecked(not self:GetChecked());
			</PreClick>
			<OnMouseUp>
				FloLib_BarDropDown_Show(self:GetParent(), button);
				FloLib_ReceiveDrag(self);
			</OnMouseUp>
			<OnReceiveDrag>
				FloLib_ReceiveDrag(self, true);
			</OnReceiveDrag>
			<OnEnter>
				if GetCVar("UberTooltips") == "1" then
					if self:GetParent().settings.position ~= "auto" then
						GameTooltip_SetDefaultAnchor(GameTooltip, self);
					else
						GameTooltip:SetOwner(self, "ANCHOR_NONE");
						GameTooltip:SetPoint("BOTTOMRIGHT", "UIParent", "BOTTOMRIGHT", -CONTAINER_OFFSET_X - 13, CONTAINER_OFFSET_Y + self:GetHeight());
						GameTooltip.default = 1;
					end
				else
					GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
				end
				local spell = self:GetParent().spells[self:GetID()];
				if spell then
					--Display the tooltip
					local _, spellRank = GetSpellName(spell.id, BOOKTYPE_SPELL)
					GameTooltip:SetSpell(spell.id, BOOKTYPE_SPELL);
					GameTooltipTextRight1:SetText(spellRank);
					GameTooltipTextRight1:SetTextColor(0.5, 0.5, 0.5);
					GameTooltipTextRight1:Show();
					GameTooltip:Show();
				end
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
		</Scripts>
	</CheckButton>
	<Frame name="FloBarTemplate" parent="UIParent" enableMouse="true" movable="true" hidden="true" virtual="true">
		<Size>
			<AbsDimension x="44" y="44"/>
		</Size>
		<Frames>
			<CheckButton name="$parentButton1" inherits="FloButtonTemplate" id="1">
				<Anchors>
					<Anchor point="LEFT">
						<Offset>
							<AbsDimension x="8" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton2" inherits="FloButtonTemplate" id="2">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton1" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton3" inherits="FloButtonTemplate" id="3">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton2" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton4" inherits="FloButtonTemplate" id="4">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton3" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton5" inherits="FloButtonTemplate" id="5">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton4" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton6" inherits="FloButtonTemplate" id="6">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton5" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton7" inherits="FloButtonTemplate" id="7">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton6" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton8" inherits="FloButtonTemplate" id="8">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton7" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton9" inherits="FloButtonTemplate" id="9">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton8" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton10" inherits="FloButtonTemplate" id="10">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton9" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<Frame name="$parentDropDown" inherits="UIDropDownMenuTemplate" id="1" hidden="true">
				<Anchors>
					<Anchor point="TOP">
						<Offset>
							<AbsDimension x="-80" y="-35"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnLoad>
						FloLib_BarDropDown_OnLoad(self);
					</OnLoad>
					<OnShow>
						FloLib_BarDropDown_OnLoad(self);
					</OnShow>
				</Scripts>
			</Frame>
		</Frames>
		<Scripts>
			<OnMouseUp>
				FloLib_BarDropDown_Show(self, button);
			</OnMouseUp>
			<OnDragStart>
				if self.settings.position == "unlock" then
					self:StartMoving();
				end
			</OnDragStart>
			<OnDragStop>
				if self.settings.position == "unlock" then
					self:StopMovingOrSizing();
					--ValidateFramePosition(self);
				end
			</OnDragStop>
		</Scripts>
	</Frame>
</Ui>
