FML Update

This commit is contained in:
steeffeen
2014-07-04 23:50:43 +02:00
parent c072019047
commit f037392acf
7 changed files with 128 additions and 0 deletions

View File

@ -19,6 +19,13 @@ use FML\Types\SubStyleable;
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Quad extends Control implements Actionable, BgColorable, Linkable, Scriptable, Styleable, SubStyleable {
/*
* Constants
*/
const KEEP_RATIO_INACTIVE = 'inactive';
const KEEP_RATIO_CLIP = 'Clip';
const KEEP_RATIO_FIT = 'Fit';
/*
* Protected properties
*/
@ -30,6 +37,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
protected $colorize = null;
protected $modulizeColor = null;
protected $autoScale = 1;
protected $keepRatio = null;
protected $action = null;
protected $actionKey = -1;
protected $bgColor = null;
@ -40,6 +48,8 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
protected $scriptEvents = null;
protected $style = null;
protected $subStyle = null;
protected $styleSelected = null;
protected $opacity = null;
/**
* @see \FML\Controls\Control::getManiaScriptClass()
@ -125,6 +135,17 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
return $this;
}
/**
* Set Keep Ratio Mode
*
* @param string $keepRatio Keep Ratio Mode
* @return static
*/
public function setKeepRatio($keepRatio) {
$this->keepRatio = (string)$keepRatio;
return $this;
}
/**
* @see \FML\Types\Actionable::getAction()
*/
@ -221,6 +242,28 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
return $this;
}
/**
* Set selected mode
*
* @param bool $styleSelected
* @return static
*/
public function setStyleSelected($styleSelected) {
$this->styleSelected = ($styleSelected ? 1 : 0);
return $this;
}
/**
* Set opacity
*
* @param float $opacity
* @return static
*/
public function setOpacity($opacity) {
$this->opacity = (float)$opacity;
return $this;
}
/**
* Apply the given CheckBox Design
*
@ -258,6 +301,9 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
if (!$this->autoScale) {
$xmlElement->setAttribute('autoscale', $this->autoScale);
}
if ($this->keepRatio) {
$xmlElement->setAttribute('keepratio', $this->keepRatio);
}
if (strlen($this->action) > 0) {
$xmlElement->setAttribute('action', $this->action);
}
@ -282,6 +328,12 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
if ($this->subStyle) {
$xmlElement->setAttribute('substyle', $this->subStyle);
}
if ($this->styleSelected) {
$xmlElement->setAttribute('styleselected', $this->styleSelected);
}
if ($this->opacity !== 1.) {
$xmlElement->setAttribute('opacity', $this->opacity);
}
return $xmlElement;
}
}