TrackManiaControl/application/libs/FML/Controls/Frame3d.php

89 lines
2.1 KiB
PHP
Raw Normal View History

<?php
namespace FML\Controls;
2014-01-19 19:30:21 +01:00
use FML\Stylesheet\Style3d;
2014-05-14 23:24:00 +02:00
use FML\Types\Scriptable;
/**
2014-01-19 19:30:21 +01:00
* Frame3d Control
2014-01-12 00:51:46 +01:00
* (CMlFrame)
*
2014-05-20 15:44:45 +02:00
* @author steeffeen <mail@steeffeen.com>
2014-04-13 18:21:40 +02:00
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
2014-05-14 23:24:00 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Frame3d extends Frame implements Scriptable {
2014-05-14 23:24:00 +02:00
/*
* Constants
*/
const STYLE_BaseStation = 'BaseStation';
const STYLE_BaseBoxCase = 'BaseBoxCase';
const STYLE_Titlelogo = 'Titlelogo';
const STYLE_ButtonBack = 'ButtonBack';
const STYLE_ButtonNav = 'ButtonNav';
const STYLE_ButtonH = 'ButtonH';
const STYLE_Station3x3 = 'Station3x3';
const STYLE_Title = 'Title';
const STYLE_TitleEditor = 'TitleEditor';
const STYLE_Window = 'Window';
2014-01-21 20:30:40 +01:00
/*
2014-06-21 03:18:21 +02:00
* Protected properties
*/
2014-06-21 03:18:21 +02:00
protected $tagName = 'frame3d';
protected $style3dId = null;
2014-05-14 23:24:00 +02:00
/** @var Style3d $style3d */
2014-01-19 19:30:21 +01:00
protected $style3d = null;
2014-06-21 03:18:21 +02:00
protected $scriptEvents = null;
2014-01-19 19:30:21 +01:00
/**
2014-06-21 03:18:21 +02:00
* Set Style3d id
2014-01-19 19:30:21 +01:00
*
2014-06-21 03:18:21 +02:00
* @param string $style3dId Style3d id
2014-07-03 22:34:47 +02:00
* @return static
*/
2014-01-19 19:30:21 +01:00
public function setStyle3dId($style3dId) {
2014-05-14 23:24:00 +02:00
$this->style3dId = (string)$style3dId;
$this->style3d = null;
2014-01-19 19:30:21 +01:00
return $this;
}
/**
* Set Style3d
*
2014-06-21 03:18:21 +02:00
* @param Style3d $style3d Style3d object
2014-07-03 22:34:47 +02:00
* @return static
2014-01-19 19:30:21 +01:00
*/
public function setStyle3d(Style3d $style3d) {
2014-06-21 03:18:21 +02:00
$this->style3d = $style3d;
$this->style3dId = null;
return $this;
}
/**
* @see \FML\Types\Scriptable::setScriptEvents()
*/
public function setScriptEvents($scriptEvents) {
$this->scriptEvents = ($scriptEvents ? 1 : 0);
return $this;
}
/**
2014-07-03 22:34:47 +02:00
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
2014-01-12 00:51:46 +01:00
$xmlElement = parent::render($domDocument);
if ($this->style3d) {
2014-01-19 19:30:21 +01:00
$this->style3d->checkId();
$xmlElement->setAttribute('style3d', $this->style3d->getId());
2014-05-14 23:24:00 +02:00
} else if ($this->style3dId) {
2014-01-19 19:30:21 +01:00
$xmlElement->setAttribute('style3d', $this->style3dId);
}
if ($this->scriptEvents) {
2014-01-12 00:51:46 +01:00
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
2014-01-12 00:51:46 +01:00
return $xmlElement;
}
}