Updated FML to newest version

This commit is contained in:
Jocy
2017-04-02 16:32:57 +02:00
parent 83710a9269
commit c5926aded2
21 changed files with 1425 additions and 995 deletions

File diff suppressed because it is too large Load Diff

View File

@ -43,8 +43,8 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
protected $selectText = null;
/**
* @deprecated
* @var bool $autoNewLine Auto new line
* @deprecated
*/
protected $autoNewLine = null;

View File

@ -3,6 +3,7 @@
namespace FML\Controls;
use FML\Elements\Format;
use FML\Stylesheet\Style;
use FML\Types\Container;
use FML\Types\Renderable;
use FML\Types\ScriptFeatureable;
@ -25,6 +26,7 @@ class Frame extends Control implements Container
/**
* @var Format $format Format
* @deprecated
*/
protected $format = null;
@ -37,8 +39,8 @@ class Frame extends Control implements Container
}
/**
* @see Container::addChild()
* @deprecated use addChild() instead
* @deprecated Use addChild()
* @see Frame::addChild()
*/
public function add(Renderable $child)
{
@ -67,6 +69,15 @@ class Frame extends Control implements Container
return $this;
}
/**
* @deprecated Use removeAllChildren()
* @see Frame::removeAllChildren()
*/
public function removeChildren()
{
return $this->removeAllChildren();
}
/**
* @see Container::removeAllChildren()
*/
@ -77,15 +88,20 @@ class Frame extends Control implements Container
}
/**
* @see Container::getFormat()
* @deprecated Use Style
* @see Style
*/
public function getFormat()
public function getFormat($createIfEmpty = true)
{
if (!$this->format && $createIfEmpty) {
$this->setFormat(new Format());
}
return $this->format;
}
/**
* @see Container::setFormat()
* @deprecated Use Style
* @see Style
*/
public function setFormat(Format $format = null)
{

View File

@ -19,16 +19,21 @@ class Frame3d extends Frame implements Scriptable
/*
* 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';
const STYLE_BaseStation = "BaseStation";
const STYLE_BaseBoxCase = "BaseBoxCase";
const STYLE_TitleLogo = "TitleLogo";
/**
* @deprecated Use STYLE_TitleLogo
* @see Frame3d::STYLE_TitleLogo
*/
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";
/**
* @var string $style3dId Style3d id

View File

@ -25,6 +25,34 @@ class FrameInstance extends Control
*/
protected $model = null;
/**
* Create a new Frame Instance
*
* @api
* @param string $controlId (optional) Control Id
* @param string $modelId (optional) Model Id
* @return static
*/
public static function create($controlId = null, $modelId = null)
{
return new static($controlId, $modelId);
}
/**
* Construct a new Frame Instance
*
* @api
* @param string $controlId (optional) Control Id
* @param string $modelId (optional) Model Id
*/
public function __construct($controlId = null, $modelId = null)
{
parent::__construct($controlId);
if ($modelId) {
$this->setModelId($modelId);
}
}
/**
* Get the FrameModel id
*

View File

@ -192,9 +192,10 @@ class Gauge extends Control implements Colorable, Styleable
* Set draw background
*
* @api
* @param bool $drawBackground If the Gauges background should be drawn
* @param bool $drawBackground If the Gauge background should be drawn
* @return static
* @deprecated use setDrawBackground() instead
* @deprecated Use setDrawBackground()
* @see Gauge::setDrawBackground()
*/
public function setDrawBg($drawBackground)
{
@ -205,7 +206,7 @@ class Gauge extends Control implements Colorable, Styleable
* Set draw background
*
* @api
* @param bool $drawBackground If the Gauges background should be drawn
* @param bool $drawBackground If the Gauge background should be drawn
* @return static
*/
public function setDrawBackground($drawBackground)
@ -229,7 +230,7 @@ class Gauge extends Control implements Colorable, Styleable
* Set draw block background
*
* @api
* @param bool $drawBlockBackground If the Gauges block background should be drawn
* @param bool $drawBlockBackground If the Gauge block background should be drawn
* @return static
*/
public function setDrawBlockBackground($drawBlockBackground)
@ -280,7 +281,7 @@ class Gauge extends Control implements Colorable, Styleable
if ($this->ratio) {
$domElement->setAttribute("ratio", $this->ratio);
}
if ($this->grading != 1.) {
if ($this->grading !== 1.) {
$domElement->setAttribute("grading", $this->grading);
}
if ($this->color) {

View File

@ -95,7 +95,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, MultiL
/**
* @var float $lineSpacing Line spacing
*/
protected $lineSpacing = -1.;
protected $lineSpacing = 1.;
/**
* @var bool $scriptEvents Script events usage
@ -669,7 +669,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, MultiL
if ($this->autoNewLine) {
$domElement->setAttribute("autonewline", $this->autoNewLine);
}
if ($this->lineSpacing) {
if ($this->lineSpacing !== 1.) {
$domElement->setAttribute("linespacing", $this->lineSpacing);
}
if ($this->maxLines > 0) {

View File

@ -2,8 +2,10 @@
namespace FML\Controls;
use FML\Components\CheckBoxDesign;
use FML\Types\Actionable;
use FML\Types\BackgroundColorable;
use FML\Types\BgColorable;
use FML\Types\Imageable;
use FML\Types\Linkable;
use FML\Types\Scriptable;
@ -18,7 +20,7 @@ use FML\Types\SubStyleable;
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Quad extends Control implements Actionable, BackgroundColorable, Imageable, Linkable, Scriptable, Styleable, SubStyleable
class Quad extends Control implements Actionable, BackgroundColorable, BgColorable, Imageable, Linkable, Scriptable, Styleable, SubStyleable
{
/*
@ -83,6 +85,11 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable
*/
protected $backgroundColor = null;
/**
* @var string $focusBackgroundColor Focus background color
*/
protected $focusBackgroundColor = null;
/**
* @var string $action Action name
*/
@ -152,7 +159,8 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable
}
/**
* @deprecated use setImageUrl() instead
* @deprecated Use setImageUrl()
* @see Quad::setImageUrl()
*/
public function setImage($imageUrl)
{
@ -204,9 +212,13 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable
}
/**
* @param $imageFocusUrl
* @return \FML\Controls\Quad
* @deprecated
* Set the focus image url
*
* @api
* @param string $imageFocusUrl Focus image url
* @return static
* @deprecated Use setImageFocusUrl()
* @see Quad::setImageFocusUrl()
*/
public function setImageFocus($imageFocusUrl)
{
@ -403,7 +415,7 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable
}
/**
* @see BackgroundColorable::setBgColor()
* @see BackgroundColorable::setBackgroundColor()
*/
public function setBackgroundColor($backgroundColor)
{
@ -411,6 +423,32 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable
return $this;
}
/**
* @deprecated Use setBackgroundColor()
* @see Quad::setBackgroundColor()
*/
public function setBgColor($bgColor)
{
return $this->setBackgroundColor($bgColor);
}
/**
* @see BackgroundColorable::getFocusBackgroundColor()
*/
public function getFocusBackgroundColor()
{
return $this->focusBackgroundColor;
}
/**
* @see BackgroundColorable::setFocusBackgroundColor()
*/
public function setFocusBackgroundColor($focusBackgroundColor)
{
$this->focusBackgroundColor = (string)$focusBackgroundColor;
return $this;
}
/**
* @see Actionable::getAction()
*/
@ -632,6 +670,19 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable
return $this;
}
/**
* Apply the CheckBox Design
*
* @api
* @param CheckBoxDesign $checkBoxDesign CheckBox Design
* @return static
*/
public function applyCheckBoxDesign(CheckBoxDesign $checkBoxDesign)
{
$checkBoxDesign->applyToQuad($this);
return $this;
}
/**
* @see Control::getTagName()
*/
@ -687,6 +738,9 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable
if ($this->backgroundColor) {
$domElement->setAttribute("bgcolor", $this->backgroundColor);
}
if ($this->focusBackgroundColor) {
$domElement->setAttribute("bgcolorfocus", $this->focusBackgroundColor);
}
if ($this->action) {
$domElement->setAttribute("action", $this->action);
}

View File

@ -39,7 +39,7 @@ class TextEdit extends Control implements MultiLineable, Scriptable, Styleable,
/**
* @var float $lineSpacing Line spacing
*/
protected $lineSpacing = -1.;
protected $lineSpacing = 1.;
/**
* @var int $maxLines Maximum number of lines
@ -406,7 +406,7 @@ class TextEdit extends Control implements MultiLineable, Scriptable, Styleable,
if ($this->autoNewLine) {
$domElement->setAttribute("autonewline", 1);
}
if ($this->lineSpacing > 0) {
if ($this->lineSpacing !== 1.) {
$domElement->setAttribute("linespacing", $this->lineSpacing);
}
if ($this->maxLines > 0) {