<?php

/**
 * View representing window
 *
 * Window is rendered as a floating, absolute positioned layer
 * that can be moved around.
 *
 * @version DR1.7
 */
class Window extends View {



	public $closable = true;

	protected $package = 'core-containers';
	protected $acceptedEvents = array('onClose', 'onDropOnto');
	protected $idRequired = true;



	public function open() {
		$response = ResponseContext::getInstance();
		$response->Window->open($this);
	}



	public function close() {
		$response = ResponseContext::getInstance();
		$response->Window->close($this->getId());
	}



	public function getCloseBehaviour() {
		return new Behaviour("Window.close('{$this->id}')");
	}



	public function __toString() {
		if ($this->closable) {
			$this->addListener(new CloseListener($this->getCloseBehaviour()));
		}
		return parent::__toString();
	}



} // class Window

?>