<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<Script file="MainMenuBarBagButtons.lua"/>
	<Model name="ItemAnimTemplate" file="Interface\ItemAnimations\ForcedBackpackItem.mdx" hidden="true" virtual="true">
		<Scripts>
			<OnLoad>
				ItemAnim_OnLoad(self);
			</OnLoad>
			<OnEvent>
				ItemAnim_OnEvent(self, event, ...);
			</OnEvent>
			<OnAnimFinished>
				ItemAnim_OnAnimFinished(self);
			</OnAnimFinished>
		</Scripts>
	</Model>
	<CheckButton name="BagSlotButtonTemplate" inherits="ItemButtonTemplate" virtual="true">
		<Size x="30" y="30"/>
		<Frames>
			<Model name="$parentItemAnim" inherits="ItemAnimTemplate">
				<Anchors>
					<Anchor point="BOTTOMRIGHT">
						<Offset>
							<AbsDimension x="-10" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Model>
		</Frames>
		<Scripts>
			<OnLoad>
				PaperDollItemSlotButton_OnLoad(self);
				self:RegisterEvent("BAG_UPDATE");
				self.isBag = 1;
				self.UpdateTooltip = BagSlotButton_OnEnter;
				getglobal(self:GetName().."NormalTexture"):SetWidth(50);
				getglobal(self:GetName().."NormalTexture"):SetHeight(50);
			</OnLoad>
			<OnEvent>
				if event == "BAG_UPDATE" then
					PaperDollItemSlotButton_Update(self);
				else
					PaperDollItemSlotButton_OnEvent(self, event, ...);
				end
			</OnEvent>
			<OnShow>
				PaperDollItemSlotButton_OnShow(self);
			</OnShow>
			<OnHide>
				PaperDollItemSlotButton_OnHide(self);
			</OnHide>
			<OnClick>
				if IsModifiedClick() then
					BagSlotButton_OnModifiedClick(self, button);
				else
					BagSlotButton_OnClick(self, button);
				end
			</OnClick>
			<OnDragStart>
				BagSlotButton_OnDrag(self);
			</OnDragStart>
			<OnReceiveDrag>
				BagSlotButton_OnClick(self, button);
			</OnReceiveDrag>
			<OnEnter>
				BagSlotButton_OnEnter(self);
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
				ResetCursor();
			</OnLeave>
		</Scripts>
		<CheckedTexture alphaMode="ADD" file="Interface\Buttons\CheckButtonHilight"/>
	</CheckButton>
	<CheckButton name="MainMenuBarBackpackButton" inherits="ItemButtonTemplate" parent="MainMenuBarArtFrame" id="0">
		<Size>
			<AbsDimension x="37" y="37"/>
		</Size>
		<Anchors>
			<Anchor point="BOTTOMRIGHT">
				<Offset>
					<AbsDimension x="-6" y="2"/>
				</Offset>
			</Anchor>
		</Anchors>
		<Frames>
			<Model name="$parentItemAnim" inherits="ItemAnimTemplate">
				<Anchors>
					<Anchor point="BOTTOMRIGHT">
						<Offset>
							<AbsDimension x="-10" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Model>
		</Frames>
		<Scripts>
			<OnLoad>
				self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
				MainMenuBarBackpackButtonIconTexture:SetTexture("Interface\\Buttons\\Button-Backpack-Up");
				self:RegisterEvent("PLAYER_ENTERING_WORLD");
				self:RegisterEvent("CVAR_UPDATE");
				self:RegisterEvent("BAG_UPDATE");
			</OnLoad>
			<OnClick>
				if IsModifiedClick() then
					BackpackButton_OnModifiedClick(self, button);
				else
					BackpackButton_OnClick(self, button);
				end
			</OnClick>
			<OnReceiveDrag>
				BackpackButton_OnClick(self, button);
			</OnReceiveDrag>
			<OnEnter>
				GameTooltip:SetOwner(self, "ANCHOR_LEFT");
				GameTooltip:SetText(BACKPACK_TOOLTIP, 1.0, 1.0, 1.0);
				local keyBinding = GetBindingKey("TOGGLEBACKPACK");
				if keyBinding then
					GameTooltip:AppendText(" "..NORMAL_FONT_COLOR_CODE.."("..keyBinding..")"..FONT_COLOR_CODE_CLOSE);
				end
				GameTooltip:AddLine(string.format(NUM_FREE_SLOTS, (self.freeSlots or 0)));
				GameTooltip:Show();
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
			<OnEvent>
				MainMenuBarBackpackButton_OnEvent(self, event, ...);
			</OnEvent>
		</Scripts>
		<CheckedTexture alphaMode="ADD" file="Interface\Buttons\CheckButtonHilight"/>
	</CheckButton>
	<CheckButton name="CharacterBag0Slot" inherits="BagSlotButtonTemplate" parent="MainMenuBarArtFrame">
		<Anchors>
			<Anchor point="RIGHT" relativeTo="MainMenuBarBackpackButton" relativePoint="LEFT">
				<Offset>
					<AbsDimension x="-5" y="0"/>
				</Offset>
			</Anchor>
		</Anchors>
	</CheckButton>
	<CheckButton name="CharacterBag1Slot" inherits="BagSlotButtonTemplate" parent="MainMenuBarArtFrame">
		<Anchors>
			<Anchor point="RIGHT" relativeTo="CharacterBag0Slot" relativePoint="LEFT">
				<Offset>
					<AbsDimension x="-4" y="0"/>
				</Offset>
			</Anchor>
		</Anchors>
	</CheckButton>
	<CheckButton name="CharacterBag2Slot" inherits="BagSlotButtonTemplate" parent="MainMenuBarArtFrame">
		<Anchors>
			<Anchor point="RIGHT" relativeTo="CharacterBag1Slot" relativePoint="LEFT">
				<Offset>
					<AbsDimension x="-4" y="0"/>
				</Offset>
			</Anchor>
		</Anchors>
	</CheckButton>
	<CheckButton name="CharacterBag3Slot" inherits="BagSlotButtonTemplate" parent="MainMenuBarArtFrame">
		<Anchors>
			<Anchor point="RIGHT" relativeTo="CharacterBag2Slot" relativePoint="LEFT">
				<Offset>
					<AbsDimension x="-4" y="0"/>
				</Offset>
			</Anchor>
		</Anchors>
	</CheckButton>
	<CheckButton name="KeyRingButton" parent="MainMenuBarArtFrame" hidden="true">
		<Size x="18" y="39"/>
		<Anchors>
			<Anchor point="RIGHT" relativeTo="CharacterBag3Slot" relativePoint="LEFT">
				<Offset>
					<AbsDimension x="-6" y="0"/>
				</Offset>
			</Anchor>
		</Anchors>
		<Frames>
			<Model name="$parentItemAnim" inherits="ItemAnimTemplate">
				<Anchors>
					<Anchor point="BOTTOMRIGHT">
						<Offset>
							<AbsDimension x="0" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</Model>
		</Frames>
		<Scripts>
			<OnLoad>
				self:SetID(KEYRING_CONTAINER);
				self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
			</OnLoad>
			<OnClick>
				if CursorHasItem() then
					PutKeyInKeyRing();
				else
					ToggleKeyRing();
				end
			</OnClick>
			<OnReceiveDrag>
				if CursorHasItem() then
					PutKeyInKeyRing();
				end
			</OnReceiveDrag>
			<OnEnter>
				GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
				GameTooltip:SetText(KEYRING, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
				GameTooltip:AddLine();
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
		</Scripts>
		<NormalTexture file="Interface\Buttons\UI-Button-KeyRing">
			<TexCoords left="0" right="0.5625" top="0" bottom="0.609375"/>
		</NormalTexture>
		<HighlightTexture file="Interface\Buttons\UI-Button-KeyRing-Highlight" alphaMode="ADD">
			<TexCoords left="0" right="0.5625" top="0" bottom="0.609375"/>
		</HighlightTexture>
		<PushedTexture file="Interface\Buttons\UI-Button-KeyRing-Down">
			<TexCoords left="0" right="0.5625" top="0" bottom="0.609375"/>
		</PushedTexture>
	</CheckButton>
</Ui>
