<Ui xmlns="http://www.blizzard.com/wow/ui/">
	
	<Script file="ui.lua"/>
	
	<!-- a button added to each frame, shows the character selection list when clicked -->
	<Button name="BagnonDBUIDropDownButton" topLevel="true" virtual="true">
		<Size x="24" y="24"/>
		
		<Anchors>
			<Anchor point="TOPLEFT">
				<Offset x="6" y="-6"/>
			</Anchor>
		</Anchors>
		
		<Scripts>
			<OnClick>
				if not BagnonDBUICharacterList:IsShown() then
					BagnonDBUI_ShowCharacterList(self:GetParent())	
				else
					BagnonDBUICharacterList:Hide()
				end
			</OnClick>
		</Scripts>
		<NormalTexture file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Up" setAllPoints="true"/>
		<PushedTexture file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Down" setAllPoints="true"/>
		<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD" setAllPoints="true"/>
	</Button>
	
	<!-- a player name checkbox -->
	<CheckButton name="BagnonDBUINameBox" virtual="true">
		<Size x="140" y="20"/>
		
		<ButtonText>
			<Anchors>
				<Anchor point="LEFT">
					<Offset x="16" y="0"/>
				</Anchor>
			</Anchors>
		</ButtonText>

		<NormalFont font = "GameFontNormal"/>
		<HighlightFont font="GameFontHighlight"/>
		
		<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check">
			<Anchors>
				<Anchor point="TOPLEFT"/>
				<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMLEFT">
					<Offset x="16" y="0"/>
				</Anchor>
			</Anchors>
		</CheckedTexture>

		<Scripts>
			<OnClick>
				local parent = self:GetParent()
				local clickedPlayer = self:GetText()
				
				if(arg1 == "RightButton" and IsShiftKeyDown()) then
					local player = parent.frame:GetPlayer()

					if(clickedPlayer ~= UnitName("player")) then
						parent.frame:SetPlayer(nil)
						BagnonDB:RemovePlayer(clickedPlayer)
					end
				else
					parent.frame:SetPlayer(clickedPlayer)
				end
				parent:Hide();
			</OnClick>
		</Scripts>
	</CheckButton>
	
	<!-- the dropdown list of character names that we have data about -->
	<Frame name="BagnonDBUICharacterList" inherits="GooeyPopup">
		<Scripts>
			<OnLoad>
				self:RegisterEvent("BANKFRAME_OPENED");
			</OnLoad>
			<OnEvent>
				if Banknon then
					Banknon:SetPlayer(UnitName("player"));
				end
			</OnEvent>
			<OnHide>
				self:SetParent(UIParent);
			</OnHide>
		</Scripts>
	</Frame>
</Ui>