Huge FML Update

This commit is contained in:
Steffen Schröder
2014-01-12 00:51:46 +01:00
parent 6a6fa56596
commit 345368df39
69 changed files with 2068 additions and 429 deletions

View File

@ -2,30 +2,120 @@
namespace FML\Controls;
use FML\Types\Playable;
use FML\Types\Scriptable;
/**
* Class representing Audio (CMlMediaPlayer)
* Audio Element
* (CMlMediaPlayer)
*
* @author steeffeen
*/
class Audio extends Control implements Playable, Scriptable {
/**
* Protected Properties
*/
protected $data = '';
protected $play = 0;
protected $looping = 0;
protected $music = 0;
protected $volume = 1.;
protected $scriptEvents = 0;
/**
* Construct a new Audio Control
*
* @param string $id
* Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
$this->tagName = 'audio';
}
/**
*
* @see \FML\Types\Playable::setData()
* @return \FML\Controls\Audio
*/
public function setData($data) {
$this->data = (string) $data;
return $this;
}
/**
*
* @see \FML\Types\Playable::setPlay()
* @return \FML\Controls\Audio
*/
public function setPlay($play) {
$this->play = ($play ? 1 : 0);
return $this;
}
/**
*
* @see \FML\Types\Playable::setLooping()
* @return \FML\Controls\Audio
*/
public function setLooping($looping) {
$this->looping = ($looping ? 1 : 0);
return $this;
}
/**
*
* @see \FML\Types\Playable::setMusic()
* @return \FML\Controls\Audio
*/
public function setMusic($music) {
$this->music = ($music ? 1 : 0);
return $this;
}
/**
*
* @see \FML\Types\Playable::setVolume()
* @return \FML\Controls\Audio
*/
public function setVolume($volume) {
$this->volume = (float) $volume;
return $this;
}
/**
*
* @see \FML\Types\Scriptable::setScriptEvents()
* @return \FML\Controls\Audio
*/
public function setScriptEvents($scriptEvents) {
$this->scriptEvents = ($scriptEvents ? 1 : 0);
return $this;
}
/**
*
* @see \FML\Control::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
return $xml;
$xmlElement = parent::render($domDocument);
if ($this->data) {
$xmlElement->setAttribute('data', $this->data);
}
if ($this->play) {
$xmlElement->setAttribute('play', $this->play);
}
if ($this->looping) {
$xmlElement->setAttribute('looping', $this->looping);
}
if ($this->music) {
$xmlElement->setAttribute('music', $this->music);
}
if ($this->volume != 1.) {
$xmlElement->setAttribute('volume', $this->volume);
}
if ($this->scriptEvents) {
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
return $xmlElement;
}
}

View File

@ -5,7 +5,8 @@ namespace FML\Controls;
use FML\Types\Renderable;
/**
* Class representing CMlControl
* Base Control Element
* (CMlControl)
*
* @author steeffeen
*/
@ -39,12 +40,10 @@ abstract class Control implements Renderable {
/**
* Construct a new Control
*
* @param string $id Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
if ($id !== null) {
$this->setId($id);
}
$this->setId($id);
}
/**
@ -63,7 +62,7 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function setId($id) {
$this->id = $id;
$this->id = (string) $id;
return $this;
}
@ -100,7 +99,7 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function setX($x) {
$this->x = $x;
$this->x = (float) $x;
return $this;
}
@ -111,7 +110,7 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function setY($y) {
$this->y = $y;
$this->y = (float) $y;
return $this;
}
@ -122,7 +121,7 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function setZ($z) {
$this->z = $z;
$this->z = (float) $z;
return $this;
}
@ -131,7 +130,7 @@ abstract class Control implements Renderable {
*
* @param float $x Horizontal Position
* @param float $y Vertical Position
* @param float $z Depth
* @param float $z (optional) Depth
* @return \FML\Controls\Control
*/
public function setPosition($x, $y, $z = null) {
@ -150,7 +149,7 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function setWidth($width) {
$this->width = $width;
$this->width = (float) $width;
return $this;
}
@ -161,7 +160,7 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function setHeight($height) {
$this->height = $height;
$this->height = (float) $height;
return $this;
}
@ -185,7 +184,7 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function setHAlign($hAlign) {
$this->hAlign = $hAlign;
$this->hAlign = (string) $hAlign;
return $this;
}
@ -196,7 +195,7 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function setVAlign($vAlign) {
$this->vAlign = $vAlign;
$this->vAlign = (string) $vAlign;
return $this;
}
@ -220,14 +219,14 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function setScale($scale) {
$this->scale = $scale;
$this->scale = (float) $scale;
return $this;
}
/**
* Set Visibility
*
* @param bool $visible If Control should be visible
* @param bool $visible Whether Control should be visible
* @return \FML\Controls\Control
*/
public function setVisible($visible) {
@ -242,6 +241,7 @@ abstract class Control implements Renderable {
* @return \FML\Controls\Control
*/
public function addClass($class) {
$class = (string) $class;
if (!in_array($class, $this->classes)) {
array_push($this->classes, $class);
}
@ -253,35 +253,35 @@ abstract class Control implements Renderable {
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = $domDocument->createElement($this->tagName);
$xmlElement = $domDocument->createElement($this->tagName);
if ($this->id) {
$xml->setAttribute('id', $this->id);
$xmlElement->setAttribute('id', $this->id);
}
if ($this->x !== 0. || $this->y !== 0. || $this->z !== 0.) {
$xml->setAttribute('posn', "{$this->x} {$this->y} {$this->z}");
if ($this->x != 0. || $this->y != 0. || $this->z != 0.) {
$xmlElement->setAttribute('posn', "{$this->x} {$this->y} {$this->z}");
}
if ($this->width >= 0. || $this->height >= 0.) {
$xml->setAttribute('sizen', "{$this->width} {$this->height}");
$xmlElement->setAttribute('sizen', "{$this->width} {$this->height}");
}
if ($this->hAlign) {
$xml->setAttribute('halign', $this->hAlign);
$xmlElement->setAttribute('halign', $this->hAlign);
}
if ($this->vAlign) {
$xml->setAttribute('valign', $this->vAlign);
$xmlElement->setAttribute('valign', $this->vAlign);
}
if ($this->scale !== 1.) {
$xml->setAttribute('scale', $this->scale);
if ($this->scale != 1.) {
$xmlElement->setAttribute('scale', $this->scale);
}
if ($this->hidden) {
$xml->setAttribute('hidden', $this->hidden);
$xmlElement->setAttribute('hidden', $this->hidden);
}
$classes = '';
foreach ($this->classes as $class) {
$classes .= $class . ' ';
if (!empty($this->classes)) {
$classes = '';
foreach ($this->classes as $class) {
$classes .= $class . ' ';
}
$xmlElement->setAttribute('class', $classes);
}
if ($classes) {
$xml->setAttribute('class', $classes);
}
return $xml;
return $xmlElement;
}
}

View File

@ -8,7 +8,8 @@ use FML\Types\Styleable;
use FML\Types\TextFormatable;
/**
* Class representing CMlEntry
* Entry Element
* (CMlEntry)
*
* @author steeffeen
*/
@ -29,7 +30,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
/**
* Construct a new Entry Control
*
* @param string $id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
@ -39,20 +40,18 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
/**
* Set Entry Name
*
* @param string $name
* Entry Name
* @param string $name Entry Name
* @return \FML\Controls\Entry
*/
public function setName($name) {
$this->name = $name;
$this->name = (string) $name;
return $this;
}
/**
* Set Default Value
*
* @param string $default
* Default Value
* @param string $default Default Value
* @return \FML\Controls\Entry
*/
public function setDefault($default) {
@ -86,7 +85,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
* @return \FML\Controls\Entry
*/
public function setStyle($style) {
$this->style = $style;
$this->style = (string) $style;
return $this;
}
@ -96,7 +95,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
* @return \FML\Controls\Entry
*/
public function setTextColor($textColor) {
$this->textColor = $textColor;
$this->textColor = (string) $textColor;
return $this;
}
@ -106,7 +105,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
* @return \FML\Controls\Entry
*/
public function setTextSize($textSize) {
$this->textSize = $textSize;
$this->textSize = (int) $textSize;
return $this;
}
@ -116,7 +115,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
* @return \FML\Controls\Entry
*/
public function setAreaColor($areaColor) {
$this->areaColor = $areaColor;
$this->areaColor = (string) $areaColor;
return $this;
}
@ -126,7 +125,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
* @return \FML\Controls\Entry
*/
public function setAreaFocusColor($areaFocusColor) {
$this->areaFocusColor = $areaFocusColor;
$this->areaFocusColor = (string) $areaFocusColor;
return $this;
}
@ -135,34 +134,34 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
* @see \FML\Control::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
$xmlElement = parent::render($domDocument);
if ($this->name) {
$xml->setAttribute('name', $this->name);
$xmlElement->setAttribute('name', $this->name);
}
if ($this->default !== null) {
$xml->setAttribute('default', $this->default);
$xmlElement->setAttribute('default', $this->default);
}
if ($this->autoNewLine) {
$xml->setAttribute('autonewline', $this->autoNewLine);
$xmlElement->setAttribute('autonewline', $this->autoNewLine);
}
if ($this->scriptEvents) {
$xml->setAttribute('scriptevents', $this->scriptEvents);
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
if ($this->style) {
$xml->setAttribute('style', $this->style);
$xmlElement->setAttribute('style', $this->style);
}
if ($this->textColor) {
$xml->setAttribute('textcolor', $this->textColor);
$xmlElement->setAttribute('textcolor', $this->textColor);
}
if ($this->textSize >= 0.) {
$xml->setAttribute('textsize', $this->textSize);
$xmlElement->setAttribute('textsize', $this->textSize);
}
if ($this->areaColor) {
$xml->setAttribute('areacolor', $this->areaColor);
$xmlElement->setAttribute('areacolor', $this->areaColor);
}
if ($this->areaFocusColor) {
$xml->setAttribute('areafocuscolor', $this->areaFocusColor);
$xmlElement->setAttribute('areafocuscolor', $this->areaFocusColor);
}
return $xml;
return $xmlElement;
}
}

View File

@ -16,8 +16,7 @@ class FileEntry extends Entry {
/**
* Construct a new FileEntry Control
*
* @param string $id
* Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
@ -27,12 +26,11 @@ class FileEntry extends Entry {
/**
* Set Folder
*
* @param string $folder
* Base Folder
* @param string $folder Base Folder
* @return \FML\Controls\FileEntry
*/
public function setFolder($folder) {
$this->folder = $folder;
$this->folder = (string) $folder;
return $this;
}
@ -41,8 +39,10 @@ class FileEntry extends Entry {
* @see \FML\Entry::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
$xml->setAttribute('folder', $this->folder);
return $xml;
$xmlElement = parent::render($domDocument);
if ($this->folder) {
$xmlElement->setAttribute('folder', $this->folder);
}
return $xmlElement;
}
}

View File

@ -6,7 +6,8 @@ use FML\Types\Container;
use FML\Types\Renderable;
/**
* Class representing CMlFrame
* Frame Element
* (CMlFrame)
*
* @author steeffeen
*/
@ -19,8 +20,7 @@ class Frame extends Control implements Container {
/**
* Construct a new Frame Control
*
* @param string $id
* Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
@ -33,7 +33,9 @@ class Frame extends Control implements Container {
* @return \FML\Controls\Frame
*/
public function add(Renderable $child) {
array_push($this->children, $child);
if (!in_array($child, $this->children)) {
array_push($this->children, $child);
}
return $this;
}
@ -52,11 +54,11 @@ class Frame extends Control implements Container {
* @see \FML\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
$xmlElement = parent::render($domDocument);
foreach ($this->children as $child) {
$childXml = $child->render($domDocument);
$xml->appendChild($childXml);
$childXmlElement = $child->render($domDocument);
$xmlElement->appendChild($childXmlElement);
}
return $xml;
return $xmlElement;
}
}

View File

@ -5,7 +5,8 @@ namespace FML\Controls;
use FML\Types\Scriptable;
/**
* Class representing Frame3d Elements (CMlFrame)
* Frame3d Element
* (CMlFrame)
*
* @author steeffeen
*/
@ -19,8 +20,7 @@ class Frame3d extends Frame implements Scriptable {
/**
* Construct a new Frame3d Control
*
* @param string $id
* Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
@ -30,12 +30,11 @@ class Frame3d extends Frame implements Scriptable {
/**
* Set style3d
*
* @param string $style3d
* 3D Style
* @param string $style3d 3D Style
* @return \FML\Controls\Frame3d
*/
public function setStyle3d($style3d) {
$this->style3d = $style3d;
$this->style3d = (string) $style3d;
return $this;
}
@ -54,13 +53,13 @@ class Frame3d extends Frame implements Scriptable {
* @see \FML\Controls\Frame::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
$xmlElement = parent::render($domDocument);
if ($this->style3d) {
$xml->setAttribute('style3d', $this->style3d);
$xmlElement->setAttribute('style3d', $this->style3d);
}
if ($this->scriptEvents) {
$xml->setAttribute('scriptevents', $this->scriptEvents);
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
return $xml;
return $xmlElement;
}
}

View File

@ -5,7 +5,8 @@ namespace FML\Controls;
use FML\Types\Styleable;
/**
* Class representing CMlGauge
* Gauge Element
* (CMlGauge)
*
* @author steeffeen
*/
@ -14,6 +15,7 @@ class Gauge extends Control implements Styleable {
* Protected Properties
*/
protected $ratio = 1.;
// TODO: validate grading
protected $grading = 1.;
protected $color = '';
protected $rotation = 0.;
@ -26,8 +28,7 @@ class Gauge extends Control implements Styleable {
/**
* Construct a new Gauge Control
*
* @param string $id
* Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
@ -37,56 +38,51 @@ class Gauge extends Control implements Styleable {
/**
* Set Ratio
*
* @param float $ratio
* Ratio Value
* @param float $ratio Ratio Value
* @return \FML\Controls\Gauge
*/
public function setRatio($ratio) {
$this->ratio = $ratio;
$this->ratio = (float) $ratio;
return $this;
}
/**
* Set Grading
*
* @param float $grading
* Grading Value
* @param float $grading Grading Value
* @return \FML\Controls\Gauge
*/
public function setGrading($grading) {
$this->grading = $grading;
$this->grading = (float) $grading;
return $this;
}
/**
* Set Color
*
* @param string $color
* Gauge Color
* @param string $color Gauge Color
* @return \FML\Controls\Gauge
*/
public function setColor($color) {
$this->color = $color;
$this->color = (string) $color;
return $this;
}
/**
* Set Rotation
*
* @param float $rotation
* Gauge Rotation
* @param float $rotation Gauge Rotation
* @return \FML\Controls\Gauge
*/
public function setRotation($rotation) {
$this->rotation = $rotation;
$this->rotation = (float) $rotation;
return $this;
}
/**
* Set Centered
*
* @param bool $centered
* If Gauge is centered
* @param bool $centered Whether Gauge is centered
* @return \FML\Controls\Gauge
*/
public function setCentered($centered) {
@ -97,20 +93,18 @@ class Gauge extends Control implements Styleable {
/**
* Set Clan
*
* @param int $clan
* Clan number
* @param int $clan Clan number
* @return \FML\Controls\Gauge
*/
public function setClan($clan) {
$this->clan = $clan;
$this->clan = (int) $clan;
return $this;
}
/**
* Set Draw Background
*
* @param bool $drawBg
* If Gauge Background should be drawn
* @param bool $drawBg Whether Gauge Background should be drawn
* @return \FML\Controls\Gauge
*/
public function setDrawBg($drawBg) {
@ -121,8 +115,7 @@ class Gauge extends Control implements Styleable {
/**
* Set Draw Block Background
*
* @param bool $drawBlockBg
* If Gauge Block Background should be drawn
* @param bool $drawBlockBg Whether Gauge Block Background should be drawn
* @return \FML\Controls\Gauge
*/
public function setDrawBlockBg($drawBlockBg) {
@ -136,7 +129,7 @@ class Gauge extends Control implements Styleable {
* @return \FML\Controls\Gauge
*/
public function setStyle($style) {
$this->style = $style;
$this->style = (string) $style;
return $this;
}
@ -145,26 +138,27 @@ class Gauge extends Control implements Styleable {
* @see \FML\Control::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
$xml->setAttribute('ratio', $this->ratio);
$xml->setAttribute('grading', $this->grading);
$xmlElement = parent::render($domDocument);
// TODO: validate default values
$xmlElement->setAttribute('ratio', $this->ratio);
$xmlElement->setAttribute('grading', $this->grading);
if ($this->color) {
$xml->setAttribute('color', $this->color);
$xmlElement->setAttribute('color', $this->color);
}
if ($this->rotation) {
$xml->setAttribute('rotation', $this->rotation);
$xmlElement->setAttribute('rotation', $this->rotation);
}
if ($this->centered) {
$xml->setAttribute('centered', $this->centered);
$xmlElement->setAttribute('centered', $this->centered);
}
if ($this->clan) {
$xml->setAttribute('clan', $this->clan);
$xmlElement->setAttribute('clan', $this->clan);
}
$xml->setAttribute('drawbg', $this->drawBg);
$xml->setAttribute('drawblockbg', $this->drawBlockBg);
$xmlElement->setAttribute('drawbg', $this->drawBg);
$xmlElement->setAttribute('drawblockbg', $this->drawBlockBg);
if ($this->style) {
$xml->setAttribute('style', $this->style);
$xmlElement->setAttribute('style', $this->style);
}
return $xml;
return $xmlElement;
}
}

View File

@ -10,7 +10,8 @@ use FML\Types\Styleable;
use FML\Types\TextFormatable;
/**
* Class representing CMlLabel
* Label Element
* (CMlLabel)
*
* @author steeffeen
*/
@ -22,8 +23,9 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
protected $textPrefix = '';
protected $textEmboss = 0;
protected $translate = 0;
protected $maxLines = 0;
protected $maxLines = -1;
protected $action = '';
protected $actionKey = -1;
protected $url = '';
protected $manialink = '';
protected $autoNewLine = 0;
@ -37,8 +39,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
/**
* Construct a new Label Control
*
* @param string $id
* Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
@ -49,32 +50,29 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
/**
* Set Text
*
* @param string $text
* Text Value
* @param string $text Text Value
* @return \FML\Controls\Label
*/
public function setText($text) {
$this->text = $text;
$this->text = (string) $text;
return $this;
}
/**
* Set Text Prefix
*
* @param string $textPrefix
* Text Prefix
* @param string $textPrefix Text Prefix
* @return \FML\Controls\Label
*/
public function setTextPrefix($textPrefix) {
$this->textPrefix = $textPrefix;
$this->textPrefix = (string) $textPrefix;
return $this;
}
/**
* Set Text Emboss
*
* @param bool $textEmboss
* If Text should be embossed
* @param bool $textEmboss Whether Text should be embossed
* @return \FML\Controls\Label
*/
public function setTextEmboss($textEmboss) {
@ -85,8 +83,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
/**
* Set Translate
*
* @param bool $translate
* If Text should be translated
* @param bool $translate Whether Text should be translated
* @return \FML\Controls\Label
*/
public function setTranslate($translate) {
@ -97,12 +94,11 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
/**
* Set Max Lines Count
*
* @param int $maxLines
* Max Lines Count
* @param int $maxLines Max Lines Count
* @return \FML\Controls\Label
*/
public function setMaxLines($maxLines) {
$this->maxLines = $maxLines;
$this->maxLines = (int) $maxLines;
return $this;
}
@ -112,7 +108,17 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
* @return \FML\Controls\Label
*/
public function setAction($action) {
$this->action = $action;
$this->action = (string) $action;
return $this;
}
/**
*
* @see \FML\Types\Actionable::setActionKey()
* @return \FML\Controls\Label
*/
public function setActionKey($actionKey) {
$this->actionKey = (int) $actionKey;
return $this;
}
@ -122,7 +128,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
* @return \FML\Controls\Label
*/
public function setUrl($url) {
$this->url = $url;
$this->url = (string) $url;
return $this;
}
@ -132,7 +138,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
* @return \FML\Controls\Label
*/
public function setManialink($manialink) {
$this->manialink = $manialink;
$this->manialink = (string) $manialink;
return $this;
}
@ -162,7 +168,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
* @return \FML\Controls\Label
*/
public function setStyle($style) {
$this->style = $style;
$this->style = (string) $style;
return $this;
}
@ -172,7 +178,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
* @return \FML\Controls\Label
*/
public function setTextSize($textSize) {
$this->textSize = $textSize;
$this->textSize = (int) $textSize;
return $this;
}
@ -182,7 +188,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
* @return \FML\Controls\Label
*/
public function setTextColor($textColor) {
$this->textColor = $textColor;
$this->textColor = (string) $textColor;
return $this;
}
@ -192,7 +198,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
* @return \FML\Controls\Label
*/
public function setAreaColor($areaColor) {
$this->areaColor = $areaColor;
$this->areaColor = (string) $areaColor;
return $this;
}
@ -202,7 +208,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
* @return \FML\Controls\Label
*/
public function setAreaFocusColor($areaFocusColor) {
$this->areaFocusColor = $areaFocusColor;
$this->areaFocusColor = (string) $areaFocusColor;
return $this;
}
@ -211,52 +217,55 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
* @see \FML\Control::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
$xmlElement = parent::render($domDocument);
if ($this->text) {
$xml->setAttribute('text', $this->text);
$xmlElement->setAttribute('text', $this->text);
}
if ($this->textPrefix) {
$xml->setAttribute('textprefix', $this->textPrefix);
$xmlElement->setAttribute('textprefix', $this->textPrefix);
}
if ($this->textEmboss) {
$xml->setAttribute('textemboss', $this->textEmboss);
$xmlElement->setAttribute('textemboss', $this->textEmboss);
}
if ($this->translate) {
$xml->setAttribute('translate', $this->translate);
$xmlElement->setAttribute('translate', $this->translate);
}
if ($this->maxLines) {
$xml->setAttribute('maxlines', $this->maxLines);
if ($this->maxLines >= 0) {
$xmlElement->setAttribute('maxlines', $this->maxLines);
}
if ($this->action) {
$xml->setAttribute('action', $this->action);
$xmlElement->setAttribute('action', $this->action);
}
if ($this->actionKey >= 0) {
$xmlElement->setAttribute('actionkey', $this->actionKey);
}
if ($this->url) {
$xml->setAttribute('url', $this->url);
$xmlElement->setAttribute('url', $this->url);
}
if ($this->manialink) {
$xml->setAttribute('manialink', $this->manialink);
$xmlElement->setAttribute('manialink', $this->manialink);
}
if ($this->autoNewLine) {
$xml->setAttribute('autonewline', $this->autoNewLine);
$xmlElement->setAttribute('autonewline', $this->autoNewLine);
}
if ($this->scriptEvents) {
$xml->setAttribute('scriptevents', $this->scriptEvents);
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
if ($this->style) {
$xml->setAttribute('style', $this->style);
$xmlElement->setAttribute('style', $this->style);
}
if ($this->textSize >= 0) {
$xml->setAttribute('textsize', $this->textSize);
$xmlElement->setAttribute('textsize', $this->textSize);
}
if ($this->textColor) {
$xml->setAttribute('textcolor', $this->textColor);
$xmlElement->setAttribute('textcolor', $this->textColor);
}
if ($this->areaColor) {
$xml->setAttribute('areacolor', $this->areaColor);
$xmlElement->setAttribute('areacolor', $this->areaColor);
}
if ($this->areaFocusColor) {
$xml->setAttribute('areafocuscolor', $this->areaFocusColor);
$xmlElement->setAttribute('areafocuscolor', $this->areaFocusColor);
}
return $xml;
return $xmlElement;
}
}

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Labels;
use FML\Controls\Label;
/**
* Label class for button styles
* Label Class for Button Styles
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Labels;
use FML\Controls\Label;
/**
* Label class for text styles
* Label Class for Text Styles
*
* @author steeffeen
*/

View File

@ -10,7 +10,8 @@ use FML\Types\Styleable;
use FML\Types\SubStyleable;
/**
* Class representing CMlQuad
* Quad Element
* (CMlQuad)
*
* @author steeffeen
*/
@ -22,7 +23,9 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
protected $imageFocus = '';
protected $colorize = '';
protected $modulizeColor = '';
protected $autoScale = 1;
protected $action = '';
protected $actionKey = -1;
protected $bgColor = '';
protected $url = '';
protected $manialink = '';
@ -33,8 +36,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
/**
* Construct a new Quad Control
*
* @param string $id
* Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
@ -45,48 +47,55 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
/**
* Set Image Url
*
* @param string $image
* Image Url
* @param string $image Image Url
* @return \FML\Controls\Quad
*/
public function setImage($image) {
$this->image = $image;
$this->image = (string) $image;
return $this;
}
/**
* Set Focus Image Url
*
* @param string $imageFocus
* Focus Image Url
* @param string $imageFocus Focus Image Url
* @return \FML\Controls\Quad
*/
public function setImageFocus($imageFocus) {
$this->imageFocus = $imageFocus;
$this->imageFocus = (string) $imageFocus;
return $this;
}
/**
* Set Colorization
*
* @param string $colorize
* Colorize Value
* @param string $colorize Colorize Value
* @return \FML\Controls\Quad
*/
public function setColorize($colorize) {
$this->colorize = $colorize;
$this->colorize = (string) $colorize;
return $this;
}
/**
* Set Modulization
*
* @param string $modulizeColor
* Modulize Value
* @param string $modulizeColor Modulize Value
* @return \FML\Controls\Quad
*/
public function setModulizeColor($modulizeColor) {
$this->modulizeColor = $modulizeColor;
$this->modulizeColor = (string) $modulizeColor;
return $this;
}
/**
* Disable the automatic Image Scaling
*
* @param bool $autoScale Whether the Image should scale automatically
* @return \FML\Controls\Quad
*/
public function setAutoScale($autoScale) {
$this->autoScale = ($autoScale ? 1 : 0);
return $this;
}
@ -96,7 +105,17 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setAction($action) {
$this->action = $action;
$this->action = (string) $action;
return $this;
}
/**
*
* @see \FML\Types\Actionable::setActionKey()
* @return \FML\Controls\Quad
*/
public function setActionKey($actionKey) {
$this->actionKey = (int) $actionKey;
return $this;
}
@ -106,7 +125,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setBgColor($bgColor) {
$this->bgColor = $bgColor;
$this->bgColor = (string) $bgColor;
return $this;
}
@ -116,7 +135,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setUrl($url) {
$this->url = $url;
$this->url = (string) $url;
return $this;
}
@ -126,7 +145,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setManialink($manialink) {
$this->manialink = $manialink;
$this->manialink = (string) $manialink;
return $this;
}
@ -146,7 +165,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setStyle($style) {
$this->style = $style;
$this->style = (string) $style;
return $this;
}
@ -156,7 +175,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setSubStyle($subStyle) {
$this->subStyle = $subStyle;
$this->subStyle = (string) $subStyle;
return $this;
}
@ -176,40 +195,46 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @see \FML\Control::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
$xmlElement = parent::render($domDocument);
if ($this->image) {
$xml->setAttribute('image', $this->image);
$xmlElement->setAttribute('image', $this->image);
}
if ($this->imageFocus) {
$xml->setAttribute('imagefocus', $this->imageFocus);
$xmlElement->setAttribute('imagefocus', $this->imageFocus);
}
if ($this->colorize) {
$xml->setAttribute('colorize', $this->colorize);
$xmlElement->setAttribute('colorize', $this->colorize);
}
if ($this->modulizeColor) {
$xml->setAttribute('modulizecolor', $this->modulizeColor);
$xmlElement->setAttribute('modulizecolor', $this->modulizeColor);
}
if (!$this->autoScale) {
$xmlElement->setAttribute('autoscale', $this->autoScale);
}
if ($this->action) {
$xml->setAttribute('action', $this->action);
$xmlElement->setAttribute('action', $this->action);
}
if ($this->actionKey >= 0) {
$xmlElement->setAttribute('actionkey', $this->actionKey);
}
if ($this->bgColor) {
$xml->setAttribute('bgcolor', $this->bgColor);
$xmlElement->setAttribute('bgcolor', $this->bgColor);
}
if ($this->url) {
$xml->setAttribute('url', $this->url);
$xmlElement->setAttribute('url', $this->url);
}
if ($this->manialink) {
$xml->setAttribute('manialink', $this->manialink);
$xmlElement->setAttribute('manialink', $this->manialink);
}
if ($this->scriptEvents) {
$xml->setAttribute('scriptevents', $this->scriptEvents);
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
if ($this->style) {
$xml->setAttribute('style', $this->style);
$xmlElement->setAttribute('style', $this->style);
}
if ($this->subStyle) {
$xml->setAttribute('substyle', $this->subStyle);
$xmlElement->setAttribute('substyle', $this->subStyle);
}
return $xml;
return $xmlElement;
}
}

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style '321Go'
* Quad Class for '321Go' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'BgRaceScore2'
* Quad Class for 'BgRaceScore2' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Bgs1'
* Quad Class for 'Bgs1' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Bgs1InRace'
* Quad Class for 'Bgs1InRace' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'BgsChallengeMedals'
* Quad Class for 'BgsChallengeMedals' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'BgsPlayerCard'
* Quad Class for 'BgsPlayerCard' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Copilot'
* Quad Class for 'Copilot' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Emblems'
* Quad Class for 'Emblems' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'EnergyBar'
* Quad Class for 'EnergyBar' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Hud3dEchelons'
* Quad Class for 'Hud3dEchelons' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Icons128x128_1'
* Quad Class for 'Icons128x128_1' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Icons128x128_Blink'
* Quad Class for 'Icons128x128_Blink' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Icons128x32_1'
* Quad Class for 'Icons128x32_1' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Icons64x64_1'
* Quad Class for 'Icons64x64_1' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'Icons64x64_2'
* Quad Class for 'Icons64x64_2' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'ManiaPlanetLogos'
* Quad Class for 'ManiaPlanetLogos' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'ManiaplanetSystem'
* Quad Class for 'ManiaplanetSystem' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'MedalsBig'
* Quad Class for 'MedalsBig' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'TitleLogos'
* Quad Class for 'TitleLogos' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'UIConstruction_Buttons'
* Quad Class for 'UIConstruction_Buttons' Style
*
* @author steeffeen
*/

View File

@ -5,7 +5,7 @@ namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for style 'UiSMSpectatorScoreBig'
* Quad Class for 'UiSMSpectatorScoreBig' Style
*
* @author steeffeen
*/

View File

@ -2,30 +2,120 @@
namespace FML\Controls;
use FML\Types\Playable;
use FML\Types\Scriptable;
/**
* Class representing video (CMlMediaPlayer)
* Video Element
* (CMlMediaPlayer)
*
* @author steeffeen
*/
class Video extends Control implements Playable, Scriptable {
/**
* Protected Properties
*/
protected $data = '';
protected $play = 0;
protected $looping = 0;
protected $music = 0;
protected $volume = 1.;
protected $scriptEvents = 0;
/**
* Construct a new Video Control
*
* @param string $id
* Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
$this->tagName = 'video';
}
/**
*
* @see \FML\Types\Playable::setData()
* @return \FML\Controls\Video
*/
public function setData($data) {
$this->data = (string) $data;
return $this;
}
/**
*
* @see \FML\Types\Playable::setPlay()
* @return \FML\Controls\Video
*/
public function setPlay($play) {
$this->play = ($play ? 1 : 0);
return $this;
}
/**
*
* @see \FML\Types\Playable::setLooping()
* @return \FML\Controls\Video
*/
public function setLooping($looping) {
$this->looping = ($looping ? 1 : 0);
return $this;
}
/**
*
* @see \FML\Types\Playable::setMusic()
* @return \FML\Controls\Video
*/
public function setMusic($music) {
$this->music = ($music ? 1 : 0);
return $this;
}
/**
*
* @see \FML\Types\Playable::setVolume()
* @return \FML\Controls\Video
*/
public function setVolume($volume) {
$this->volume = (float) $volume;
return $this;
}
/**
*
* @see \FML\Types\Scriptable::setScriptEvents()
* @return \FML\Controls\Video
*/
public function setScriptEvents($scriptEvents) {
$this->scriptEvents = ($scriptEvents ? 1 : 0);
return $this;
}
/**
*
* @see \FML\Control::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
return $xml;
$xmlElement = parent::render($domDocument);
if ($this->data) {
$xmlElement->setAttribute('data', $this->data);
}
if ($this->play) {
$xmlElement->setAttribute('play', $this->play);
}
if ($this->looping) {
$xmlElement->setAttribute('looping', $this->looping);
}
if ($this->music) {
$xmlElement->setAttribute('music', $this->music);
}
if ($this->volume != 1.) {
$xmlElement->setAttribute('volume', $this->volume);
}
if ($this->scriptEvents) {
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
return $xmlElement;
}
}