<?xml version="1.0" encoding="UTF-8"?>
<rmml>
<!--
$RCSfile: rnmc_stdRectangle.xml,v $
$Revision: 875 $

last change: $Date: 2009-01-19 17:19:59 +0300 (Пн, 19 янв 2009) $
             $Author: Pavel $

	Lacerta Project
	version 1.0.0.1
	Copyright (C) 2008 RNMC
-->
<composition name="rnmc_stdRectangle" class="rnmc_stdMediaObject">
<!--flash name="objectContent" playing="false"/-->
<script><![CDATA[
	this.type = "rnmc_stdRectangle"
	this.id = "";
	
	this.borderColor = "";
	this.borderSize  = 0;

	function initFromNode(srcNode){
		var xmlNode = null;
		var xmlAttributeMap = null;
		var xmlAttribute = null;

		xmlAttributeMap = srcNode.attributes;
		if (xmlAttributeMap){
			xmlAttribute = xmlAttributeMap.getNamedItem("id");
			if (xmlAttribute != null && xmlAttribute.specified)
				this.id = xmlAttribute.value;
			xmlAttribute = xmlAttributeMap.getNamedItem("visible");
			if (xmlAttribute != null && xmlAttribute.specified){
				if((xmlAttribute.value).toLowerCase() == "true")
					this.visibility = OBJECT_VISIBILITY_TRUE;
				else if((xmlAttribute.value).toLowerCase() == "false")
					this.visibility = OBJECT_VISIBILITY_FALSE;
			}
		}

		xmlNode = srcNode.firstChild;
		while(xmlNode){
//trace("xmlNode.nodeName == "+xmlNode.nodeName);
			if(xmlNode.nodeName == "rollovermenu"){
				this.parseRolloverMenuNode(xmlNode);
			} else if(xmlNode.nodeName == "param"){
				this.parseParamNode(xmlNode);
			} else if(xmlNode.nodeName == "actions"){
			//	стандартые события
				rnmc_stdMediaObject_parseActionsNode(xmlNode);
			} else if(xmlNode.nodeName == "title"){
				this.parseTitleNode(xmlNode);
			} else if(xmlNode.nodeName == "zoom"){
			} else if(xmlNode.nodeName == "hint"){
				this.parseHintNode(xmlNode);
			} else if(xmlNode.nodeName == "effect"){
				this.parseEffectNode(xmlNode);
			} else if(xmlNode.nodeName == "drag"){ //	таскание медиа-объекта
				this.parseDraggingNode(xmlNode);
			} else if(xmlNode.nodeName == "scrollmenu"){ //	
				this.parseScrollMenuNode(xmlNode);
			} else if (xmlNode.nodeName == "border"){
				xmlAttributeMap = xmlNode.attributes;
				xmlAttribute =  xmlAttributeMap.getNamedItem("color");
				if (xmlAttribute != null && xmlAttribute.specified){
					this.borderColor = xmlAttribute.value;
				}
				xmlAttribute =  xmlAttributeMap.getNamedItem("size");
				if (xmlAttribute != null && xmlAttribute.specified){
					this.borderSize = parseInt(xmlAttribute.value);
				}
//				xmlAttribute =  xmlAttributeMap.getNamedItem("bgcolor");
//				if (xmlAttribute != null && xmlAttribute.specified){
//					this.activeBgColor = xmlAttribute.value;
//				}
			}
			

			xmlNode = xmlNode.nextSibling;
		}
		return true;
	};

	function loadObject(){
		if(!this.objectContent){
			this.objectContent = new Composition();
			this.objectContent.parent = this;
		}
		
		if (this.borderColor != "" && this.borderSize != 0) {
			if (this.borderSize > 0) {
				this.objectContent.top          = new Text(); 
				this.objectContent.top.bkgColor = this.borderColor;
				this.objectContent.top.x        = 0;
				this.objectContent.top.y        = 0;
				this.objectContent.top.width    = this.objectWidth - (Math.abs(this.borderSize) == 1 ? 1 : 0);
				this.objectContent.top.height   = Math.abs(this.borderSize);
				this.objectContent.top.parent   = this.objectContent;

				this.objectContent.left          = new Text();
				this.objectContent.left.bkgColor = this.borderColor;
				this.objectContent.left.x        = 0;
				this.objectContent.left.y        = this.borderSize;
				this.objectContent.left.width    = this.borderSize;
				this.objectContent.left.height   = this.objectHeight - 2*this.borderSize;
				this.objectContent.left.parent   = this.objectContent;

				this.objectContent.bottom          = new Text();
				this.objectContent.bottom.bkgColor = this.borderColor;
				this.objectContent.bottom.x        = 0;
				this.objectContent.bottom.y        = this.objectHeight - this.borderSize;
				this.objectContent.bottom.width    = this.objectWidth - (Math.abs(this.borderSize) == 1 ? 1 : 0);
				this.objectContent.bottom.height   = this.borderSize;
				this.objectContent.bottom.parent   = this.objectContent;

				this.objectContent.right          = new Text();
				this.objectContent.right.bkgColor = this.borderColor;
				this.objectContent.right.x        = this.objectWidth - this.borderSize;
				this.objectContent.right.y        = this.borderSize;
				this.objectContent.right.width    = this.borderSize;
				this.objectContent.right.height   = this.objectHeight - 2 * this.borderSize;
				this.objectContent.right.parent   = this.objectContent;
			} else {
				this.objectContent.top          = new Text(); 
				this.objectContent.top.bkgColor = this.borderColor;
				this.objectContent.top.x        = this.borderSize;
				this.objectContent.top.y        = this.borderSize;
				this.objectContent.top.width    = this.objectWidth - 2 * this.borderSize
													- (Math.abs(this.borderSize) == 1 ? 1 : 0);

				this.objectContent.top.height   = Math.abs(this.borderSize);
				this.objectContent.top.parent   = this.objectContent;

				this.objectContent.left          = new Text();
				this.objectContent.left.bkgColor = this.borderColor;
				this.objectContent.left.x        = this.borderSize;
				this.objectContent.left.y        = 0;
				this.objectContent.left.width    = Math.abs(this.borderSize);
				this.objectContent.left.height   = this.objectHeight;
				this.objectContent.left.parent   = this.objectContent;

				this.objectContent.bottom          = new Text();
				this.objectContent.bottom.bkgColor = this.borderColor;
				this.objectContent.bottom.x        = this.borderSize;
				this.objectContent.bottom.y        = this.objectHeight;
				this.objectContent.bottom.width    = this.objectWidth - 2 * this.borderSize
														- (Math.abs(this.borderSize) == 1 ? 1 : 0);
				this.objectContent.bottom.height   = Math.abs(this.borderSize);
				this.objectContent.bottom.parent   = this.objectContent;

				this.objectContent.right          = new Text();
				this.objectContent.right.bkgColor = this.borderColor;
				this.objectContent.right.x        = this.objectWidth;
				this.objectContent.right.y        = 0;
				this.objectContent.right.width    = Math.abs(this.borderSize);
				this.objectContent.right.height   = this.objectHeight;
				this.objectContent.right.parent   = this.objectContent;
			}
		}
	}

	function unloadObject(){
		if(this.objectContent){
			this.objectContent.parent = null;
			this.objectContent = null;
		}
	}

	function showObject(){
//trace("rnmc_stdRectangle.showObject()");
		this.loadObject();
		if(this.objectContent){
			var objectPosition = this.getPosition();
			this.setPosition(objectPosition[0], objectPosition[1], objectPosition[2], objectPosition[3], this.objectDepth);
			this.objectContent.opacity = this.objectOpacity;
			this.objectContent.visible = false;
		};

		//	перебор присоединённых эффектов для показа
		this.effectsTarget = this.objectContent;
		var showEffectsCount = this.startEffects(EVENT_ON_SHOW);
		if(showEffectsCount == 0){
			this.objectContent.visible = true;
		}
		//	если определена панель управления
		if(this.controlDefined && !this.attachedControl){
			this.attachedControl = scene.ControlManager.getControl(this.controlStyle, this);
			if(this.attachedControl){
				this.attachedControl.visible = false;
				this.attachedControl.x = this.controlX;
				this.attachedControl.y = this.controlY;
				this.attachedControl.depth = this.controlDepth;
				this.attachedControl.setDispatcher(this, this.buttonDispatcher);
				if(this.zoomObject){
					this.attachedControl.hideChildControl("zoomout");
					this.attachedControl.showChildControl("zoomin");
				}
			//	кнопки, относящиеся к подписи
				if(this.titleObject){
					if(this.titleVisible){
						this.attachedControl.hideChildControl("showtitle");
						this.attachedControl.showChildControl("hidetitle");
					} else {
						this.attachedControl.hideChildControl("hidetitle");
						this.attachedControl.showChildControl("showtitle");
					}
				} else {
					this.attachedControl.hideChildControl("hidetitle");
					this.attachedControl.hideChildControl("showtitle");
				}
				this.attachedControl.showChildControl("save");
				this.attachedControl.showChildControl("copy");
				this.attachedControl.showObject();
			}
		}

		rnmc_stdMediaObject_showObject();
	};

	function hideObject(){
//trace("rnmc_stdRectangle.hideObject()");
		rnmc_stdMediaObject_hideObject();
	};
]]></script>
</composition>
</rmml>