<?xml version="1.0" encoding="UTF-8"?>
<rmml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="L:\collaborative-nir\program\Cscl3DWS\rmml\RMML.xsd">
	<include src="scroller.xml"/>

	<composition name="CScrolledList" class="ui_CList">
		<image name="maskIm" enabled="false"/>
		<script>
			function createScroller(maskIm, type)
			{<![CDATA[
				if (type == undefined || type == 0 || type == 2)
				{
					var scrollerV = new Composition();
					scrollerV._class = "CScrollerVertical";
					scrollerV.parent = this;
					scrollerV.name = "scrollerV";
					scrollerV.slider = 2;
					scrollerV.initialize(root, maskIm.height, root.height);
					scrollerV.resizeScroller(maskIm.height, 0);
					scrollerV.moveScroller(maskIm.width);
					scrollerV.reconstructScroller();
				}
				if (type == 1 || type == 2)
				{
					var scrollerH = new Composition();
					scrollerH._class = "CScrollerHorizontal";
					scrollerH.parent = this;
					scrollerH.name = "scrollerH";
					scrollerH.slider = 2;
					scrollerH.initialize(root, maskIm.width, root.width);
					scrollerH.resizeScroller(maskIm.width, 0);
					scrollerH.moveScroller(0, maskIm.height);
					scrollerH.reconstructScroller();
				}
				this.maskIm.src = maskIm.src;
				this.root.setMask(maskIm);
			}]]>

			this.root.scrollTo = function(pos, horizontal)
			{<![CDATA[
				if (horizontal == undefined || horizontal == false)
					this.y = -pos;
				else
					this.x = -pos;
			}]]>
			
			function resetScrollers()
			{<![CDATA[
				if (this.scrollerV != undefined && this.scrollerV != null)
					this.scrollerV.setScrollHeight(getItemHeight(root));
				if (this.scrollerH != undefined && this.scrollerH != null)
					this.scrollerH.setScrollHeight(this.root.width);
			}]]>

			function enableList(flag)
			{
				if (flag != undefined)
					this.root.enabled = flag;
			}
			this.root.isMouseOn = function()
			{<![CDATA[
				if(xMouse < 0 || yMouse < 0)
					return false;
				if (this.parent.scrollerV != undefined && yMouse > this.parent.scrollerV.height)
					return false;
				var par = Mouse.target;
				while(par != null){
					if(par == this.parent){
						return true;
					}
					par = par.parent;
				}
				return false;
			}]]>
		</script>
		<script event="evItemMaximize">
			resetScrollers();
		</script>
		<script event="evItemMinimize">
			resetScrollers();
		</script>
		<script event="evItemAdd">
			resetScrollers();
		</script>
		<script event="evItemDelete">
			resetScrollers();
		</script>
	</composition>

	<composition name="CScrolledList2" class="ui_CList">
		<script><![CDATA[
			function createScroller(aWidth, aHeight, type)
			{
				if (type == undefined || type == 0 || type == 2)
				{
					var scrollerV = new Composition();
					scrollerV._class = "CScrollerVertical";
					scrollerV.parent = this;
					scrollerV.name = "scrollerV";
					scrollerV.slider = 2;
					scrollerV.initialize(root, getVisibilityCount(root), root.height);
					scrollerV.resizeScroller(aHeight, 0);
					scrollerV.moveScroller(aWidth);
					scrollerV.reconstructScroller();
				}
				if (type == 1 || type == 2)
				{
					var scrollerH = new Composition();
					scrollerH._class = "CScrollerHorizontal";
					scrollerH.parent = this;
					scrollerH.name = "scrollerH";
					scrollerH.slider = 2;
					scrollerH.initialize(root, aWidth, root.width);
					scrollerH.resizeScroller(aWidth, 0);
					scrollerH.moveScroller(0, aHeight);
					scrollerH.reconstructScroller();
				}
			}

			this.root.scrollTo = function(pos, horizontal)
			{
				if (horizontal == undefined || horizontal == false)
				{
					this.y = -pos;
				}
				else
					this.x = -pos;
			}

			function scrollChildren( anItem, aPos, aProcessHeight)
			{
				for (var i = 0;  i < anItem.children.length;  i++)
				{
					
				}
			}
			
			function resetScrollers()
			{
				if (typeof( this.scrollerV) != 'undefined')
				{
					this.scrollerV.setScrollHeight( this.root.height);
				}
				this.scrollerH.setScrollHeight( this.root.width);
			}
		]]></script>
		<script event="evItemMaximize">
			resetScrollers();
		</script>
		<script event="evItemMinimize">
			resetScrollers();
		</script>
	</composition>
</rmml>