<?xml version="1.0" encoding="win1251"?>
<rmml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="L:\collaborative-nir\program\Cscl3DWS\rmml\RMML.xsd">
	<include src="buttons.xml"/>
	<styles _name="SRadioBtn" fontFamily="Arial" fontSize="14" color="#492D0B"/>

	<composition name="CRadioButton" class="CTextButton">
		<script>
			this.captionAlignH = this.CA_RIGHT_HAND;
		</script>
		<script event="onRelease">
			Event.sender = this;
			this.parent.fireEvent( "onChecked");
			Event.sender = null;
		</script>
	</composition>

	<composition name="CRadioGroup" class="COrderedCompositionBase" userEvents="onChecked">
		<script>
			this.orderType = this.OT_VERTICAL;
			this.radioButtonList = new Array();
			this.checked = 0;
			this.styles = ['SRadioBtn', 'SRadioBtn', 'SRadioBtn', 'SRadioBtn'];
			this.radioSkin = getFullPath( "rmgr:tools/btnRadio.png");
			this.checkedSkin = getFullPath( "rmgr:tools/btnRadioChecked.png");
			this.skinVertical = true;
			this.captionSpacingH = 3;
			this.captionAlignH = 2;
			this.captionAlignV = 0;
			this.captionShift = 0;
		</script>
		<script><![CDATA[
			function init( aCaptions, aStyles, aRadioSkin, aCheckedSkin)
			{
				if (aStyles != null)
					this.styles = aStyles;
				if (aRadioSkin != null)
					this.radioSkin = aRadioSkin;
				if (aCheckedSkin != null)
					this.checkedSkin = aCheckedSkin;
				for( var i = 0; i < aCaptions.length; i++)
					this.addRadio( aCaptions[ i]);
				this.update();
			}

			function addRadio( aCaptionText)
			{
				var radioBtn = new Composition();
				radioBtn._class = "CRadioButton";
				radioBtn.imSkin.src = this.radioSkin;
				radioBtn.txCaption.value = aCaptionText;
				radioBtn.parent = this;
				radioBtn.captionAlignH = this.captionAlignH;
				radioBtn.captionAlignV = this.captionAlignV;
				radioBtn.captionSpacingH = this.captionSpacingH;
				radioBtn.init( this.styles.length, this.styles, false, this.skinVertical);
				this.addOrdered( radioBtn);
			}

			function getItems()
			{
				return getOrderedItems( true);
			}

			function update()
			{
				var items = getOrderedItems( true);
				var chk = this.checked + 1;
				for (var i = 0;  i < items.length;  i++)
				{
					if (items[ i].order == chk)
					{
						if (items[ i].imSkin.src != this.checkedSkin)
						{
							items[ i].imSkin.src = this.checkedSkin;
							items[ i].update();
						}
					}
					else
					{
						if (items[ i].imSkin.src != this.radioSkin)
						{
							items[ i].imSkin.src = this.radioSkin;
							items[ i].update();
						}
					}
				}
				COrderedCompositionBase_update();
			}
		]]></script>
		<script event="onChecked">
			if (Event.sender.order - 1 != this.checked)
			{
				this.checked = Event.sender.order - 1;
				this.update();
			}
		</script>
	</composition>
</rmml>