<!-- vertical_scroll.xml -->
<!-- image name="vertical_scroll" -->
	<!-- These tags should be changed by the parent menu: -->
	<id> &generic; </id>		<!-- Needs a unique ID so it can receive events -->
	<filename> Menus\Shared\all_general_scrollbar.dds </filename>
	<cropx> 32 </cropx>
	<width> 20 </width>
	<height> 300 </height>	<!-- marks the distance between the two arrows, not including them -->	
	<locus> &true; </locus>
	<depth> 1 </depth>
	
	<x> 0 </x>				<!-- marks the position of the right edge of the left arrow -->	
	<y> 0 </y>				<!-- vertical position (where the arrow begins) -->
	<user1> 1 </user1>		<!-- Minimum value that can be scrolled to (should usually be zero) -->
	<user2> 100 </user2>	<!-- Maximum value that can be scrolled to (should be the number of
								 items minus the number of items visible.  i.e. if your list has
								 8 items and you can see 2 at any one time, this should be 6 -->
	<user3> 1 </user3>		<!-- When the scroll arrow is clicked on, this is how many items it will advance -->
	<user4> 10 </user4>		<!-- When the scroll bar is clicked on, this is how many items it will advance -->
	<user5> 0 </user5>		<!-- The starting position of the scroll bar (set this only once) -->
	<user6> -1 </user6>		<!-- A unique ID so that the scroll marker can be dragged around -->
	<user7>					<!-- DO NOT SET - The current value of the scrollbar -->
		<copy src="child(vertical_scroll_marker)" trait="_value_scrolled_to"/>
	</user7>
	<user8> 5 </user8>		<!-- How many items are visible at once -->
	<user9> 0 </user9>		<!-- Manual step value (multiplied by step distance and added to scroll value -->
	<user10></user10>		<!-- reserved -->

	<!-- The scrollbar should only be visible if scrolling can be done -->
	<visible>
		<copy src="me()" trait="user2" />
		<add>
			<copy src="me()" trait="user8" />
		</add>
		<gt>
			<copy src="me()" trait="user8" />
		</gt>
	</visible>
	
	<_scrollable_range>
		<copy src="me()" trait="user2"/>
		<sub src="me()" trait="user1"/>
		<max> 0 </max>
	</_scrollable_range>


	<rect name="vertical_scroll_topside">
		<id> &generic; </id>
		<target> &true; </target>
		<depth> 3 </depth>
		<height> <!-- make it long enough to stretch from the top arrow to the marker -->
			<copy src="sibling(vertical_scroll_marker)" trait="y"/>
		</height>
		<width> 20 </width>
		<x> 0 </x>
		<y> 0 </y>
		<clicksound>3</clicksound>
	</rect>
	
	<rect name="vertical_scroll_bottomside">
		<id> &generic; </id>
		<target> &true; </target>
		<depth> 2 </depth>
		<height>
			<copy src="parent()" trait="height"/>
			<sub src="sibling(vertical_scroll_topside)" trait="height"/>
			<sub src="sibling(vertical_scroll_marker)" trait="height"/>
		</height>
		<width> 20 </width>
		<x> 0 </x>
		<y>
			<copy src="sibling(vertical_scroll_topside)" trait="height"/>
			<add src="sibling(vertical_scroll_marker)" trait="height"/>
		</y>
		<clicksound>3</clicksound>
	</rect>
	
	<image name="vertical_scroll_top">
		<id> &generic; </id>
		<target> &true; </target>
		<filename> Menus\Shared\all_general_scrollbar.dds </filename>
		<depth> 4 </depth>
		<width> 20 </width>
		<height> 32 </height>
		<x> 0 </x>
		<y> <!-- move off the top edge of parent -->
			<copy> 0 </copy>
			<sub src="me()" trait="height"/>
		</y>
		<clicksound>3</clicksound>
	</image>
	
	<image name="vertical_scroll_bottom">
		<id> &generic; </id>
		<target> &true; </target>
		<filename> Menus\Shared\all_general_scrollbar.dds </filename>
		<cropy> 98 </cropy>
		<depth> 4 </depth>
		<width> 20 </width>
		<height> 32 </height>
		<x> 0 </x>
		<y>
			<copy src="parent()" trait="height"/>
		</y>
		<clicksound>3</clicksound>
	</image>
	
	<image name="vertical_scroll_marker">
		<id> <copy src="parent()" trait="user6"/> </id>
		<target> &true; </target>
		<filename> Menus\Shared\all_general_scrollbar.dds </filename>
		<cropy> 32 </cropy>
		<depth> 6 </depth>
		<width> 20 </width>
		<height> 42 </height>
		<x> 0 </x>
		<y> <!-- set my position relative to the current scroll -->
			<copy src="parent()" trait="height"/>
			<sub src="me()" trait="height"/>
			<mul>
				<copy src="me()" trait="_value_scrolled_to"/>
				<sub src="parent()" trait="user1"/>
				<div src="parent()" trait="_scrollable_range"/>
			</mul>
		</y>
		<_value_scrolled_to>
			<!-- copy old value -->
			<add>
				<copy src="sibling(vertical_scroll_bottom)" trait="clicked"/>
				<sub src="sibling(vertical_scroll_top)" trait="clicked"/>
				<mul src="parent()" trait="user3"/> <!-- step distance -->
			</add>
			<add>
				<copy src="sibling(vertical_scroll_bottomside)" trait="clicked"/>
				<sub src="sibling(vertical_scroll_topside)" trait="clicked"/>
				<mul src="parent()" trait="user4"/>	<!-- jump distance -->
			</add>
			<add>
				<copy src="me()" trait="user9"/>
				<add src="me()" trait="user10"/>
				<mul src="parent()" trait="user3"/> <!-- step distance -->
			</add>
			<add src="parent()" trait="user5"/>
			<add src="parent()" trait="user10"/>
			<min>
				<copy src="parent()" trait="user2"/>
				<sub src="parent()" trait="user1"/>
			</min>
			<max> 0 </max>
		</_value_scrolled_to>
		<user8>	<!-- for dragging - drag interval -->
			<copy src="parent()" trait="height"/>
			<sub src="me()" trait="height"/>
			<div src="parent()" trait="_scrollable_range"/>
		</user8>
		<user9> 0 </user9>
		<user10> <copy src="parent()" trait="user9"/> </user10>
		<clicksound>3</clicksound>
	</image>
<!-- /rect -->