TrackManiaControl/application/core/FML/Controls/Frame.php
Steffen Schröder 666785de90 FML Update
2013-12-09 13:05:05 +01:00

71 lines
1.2 KiB
PHP

<?php
namespace FML\Controls;
use FML\Types\Container;
use FML\Types\Renderable;
/**
* Class representing CMlFrame
*
* @author steeffeen
*/
class Frame extends Control implements Container {
/**
* Protected properties
*/
protected $children = array();
/**
* Construct a new frame control
*
* @param string $id
*/
public function __construct($id = null) {
parent::__construct($id);
$this->tagName = 'frame';
}
/**
*
* @see \FML\Types\Container::add()
* @return \FML\Controls\Frame
*/
public function add(Renderable $child) {
array_push($this->children, $child);
return $this;
}
/**
*
* @see \FML\Types\Container::removeChildren()
* @return \FML\Controls\Frame
*/
public function removeChildren() {
$this->children = array();
return $this;
}
/**
*
* @see \FML\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
foreach ($this->children as $child) {
$childXml = $child->render($domDocument);
$xml->appendChild($childXml);
}
return $xml;
}
/**
* Return class name
*
* @return string
*/
public static function getClass() {
return __CLASS__;
}
}