<?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">
	<!-- Композиция одного элемента: C, N, O -->
	<composition name="CTableElement" depth="0" class="CKMButton">
		<include src="styles.xml"/>
		<image _name="img" src="rmgr:molconst2d/btnCNO.png"/>
		<text name="oText" style="parent.stlElement" class="CHintText" x="11" y="9">
			<script event="onPress">
				this.parent.handleOnPress();
			</script>
			<script event="onRelease">
				this.parent.handleOnRelease();
			</script>
			<script event="onReleaseOutside">
				this.parent.handleOnRelease();
			</script>
			<script></script>
		</text>
		<script>
			this.oText.hint = "Перетащите элемент на рабочее поле для создания новой молекулы";
			//this.x = (parent.img.getMediaSize().width/2 - this.getMediaSize().width)/2;
			//this.y = (parent.img.getMediaSize().height - this.getMediaSize().height)/2;
		</script>
		<!-- Композиция таскаемого элемента: C, N, O -->
		<composition name="dragElement" _class="CDraggableComposition" visible="false" enabled="false">
			<text name="oText" style="parent.parent.stlElement">
			</text>
		</composition>
		<script><![CDATA[
			this.type="C";
			this.workspace=null;
			function setType(atype)
			{
				this.type = atype;
				this.oText.value = atype;
			}
			function handleOnPress()
			{
				this.dragElement.x = this.xMouse  + 20;
				this.dragElement.y = this.yMouse  + 5;
				this.dragElement.oText.value = this.oText.value;
				//this.dragElement.visible = true;
				seqShowDragElement.rewindAndPlay();
				this.dragElement.stick( true);
				if( this.workspace != null)
				{
					this.workspace.handleDragElementPress( this);
				}
				CKMButton_handleOnPress();
				CKMButton_handleOnRelease();
			}
			function handleOnRelease()
			{
				seqShowDragElement.stop();
				var isVisible = this.dragElement.visible;
				this.dragElement.visible = false;
				this.dragElement.stick( false);
				if( isVisible && this.workspace != null)
				{
					this.workspace.handleDragElementRelease( this);
				}
			}

			function handleOnReleaseOutside()
			{
				this.handleOnRelease();
			}
		]]></script>
		<script event="onMouseUp">
			if( this.dragElement.visible || this.seqShowDragElement.playing)
			{
				this.handleOnRelease();
			}
		</script>
		<sequencer name="seqShowDragElement">
			<script>
				100;
			</script>
			<script>
				this.dragElement.visible = true;
			</script>
		</sequencer>
	</composition>
</rmml>