- Karma plugin
- ColorUtil - Minor improvements
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
namespace FML\Controls;
|
||||
|
||||
use FML\Types\Styleable;
|
||||
|
||||
/**
|
||||
* Class representing CMlGauge
|
||||
*
|
||||
@ -13,11 +15,13 @@ class Gauge extends Control implements Styleable {
|
||||
*/
|
||||
protected $ratio = 1.;
|
||||
protected $grading = 1.;
|
||||
protected $color = '';
|
||||
protected $rotation = 0.;
|
||||
protected $centered = 0;
|
||||
protected $clan = 0;
|
||||
protected $drawBg = 1;
|
||||
protected $drawBlockBg = 1;
|
||||
protected $style = '';
|
||||
|
||||
/**
|
||||
* Construct a new gauge control
|
||||
@ -26,70 +30,104 @@ class Gauge extends Control implements Styleable {
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->name = 'gauge';
|
||||
$this->tagName = 'gauge';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ratio
|
||||
*
|
||||
* @param real $ratio
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setRatio($ratio) {
|
||||
$this->ratio = $ratio;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set grading
|
||||
*
|
||||
* @param real $grading
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setGrading($grading) {
|
||||
$this->grading = $grading;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set color
|
||||
*
|
||||
* @param string $color
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setColor($color) {
|
||||
$this->color = $color;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set rotation
|
||||
*
|
||||
* @param real $rotation
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setRotation($rotation) {
|
||||
$this->rotation = $rotation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set centered
|
||||
*
|
||||
* @param bool $centered
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setCentered($centered) {
|
||||
$this->centered = ($centered ? 1 : 0);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set clan
|
||||
*
|
||||
* @param int $clan
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setClan($clan) {
|
||||
$this->clan = $clan;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set draw background
|
||||
*
|
||||
* @param bool $drawBg
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setDrawBg($drawBg) {
|
||||
$this->drawBg = ($drawBg ? 1 : 0);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set draw block background
|
||||
*
|
||||
* @param bool $drawBlockBg
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setDrawBlockBg($drawBlockBg) {
|
||||
$this->drawBlockBg = ($drawBlockBg ? 1 : 0);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Styleable::setStyle()
|
||||
*/
|
||||
public function setStyle($style) {
|
||||
$this->style = $style;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,11 +138,23 @@ class Gauge extends Control implements Styleable {
|
||||
$xml = parent::render($domDocument);
|
||||
$xml->setAttribute('ratio', $this->ratio);
|
||||
$xml->setAttribute('grading', $this->grading);
|
||||
$xml->setAttribute('rotation', $this->rotation);
|
||||
$xml->setAttribute('centered', $this->centered);
|
||||
$xml->setAttribute('clan', $this->clan);
|
||||
if ($this->color) {
|
||||
$xml->setAttribute('color', $this->color);
|
||||
}
|
||||
if ($this->rotation) {
|
||||
$xml->setAttribute('rotation', $this->rotation);
|
||||
}
|
||||
if ($this->centered) {
|
||||
$xml->setAttribute('centered', $this->centered);
|
||||
}
|
||||
if ($this->clan) {
|
||||
$xml->setAttribute('clan', $this->clan);
|
||||
}
|
||||
$xml->setAttribute('drawbg', $this->drawBg);
|
||||
$xml->setAttribute('drawblockbg', $this->drawBlockBg);
|
||||
if ($this->style) {
|
||||
$xml->setAttribute('style', $this->style);
|
||||
}
|
||||
return $xml;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user