From f037392acfe784f67209d47f7bc112d2989c28e1 Mon Sep 17 00:00:00 2001 From: steeffeen Date: Fri, 4 Jul 2014 23:50:43 +0200 Subject: [PATCH] FML Update --- application/core/Libs/FML/Controls/Entry.php | 12 +++++ application/core/Libs/FML/Controls/Label.php | 12 +++++ .../Libs/FML/Controls/Labels/Label_Button.php | 2 + application/core/Libs/FML/Controls/Quad.php | 52 +++++++++++++++++++ .../FML/Controls/Quads/Quad_BgsButtons.php | 30 +++++++++++ application/core/Libs/FML/Elements/Format.php | 12 +++++ .../core/Libs/FML/Types/TextFormatable.php | 8 +++ 7 files changed, 128 insertions(+) create mode 100644 application/core/Libs/FML/Controls/Quads/Quad_BgsButtons.php diff --git a/application/core/Libs/FML/Controls/Entry.php b/application/core/Libs/FML/Controls/Entry.php index 12fd8a14..6aad5190 100644 --- a/application/core/Libs/FML/Controls/Entry.php +++ b/application/core/Libs/FML/Controls/Entry.php @@ -28,6 +28,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF protected $style = null; protected $textColor = null; protected $textSize = -1; + protected $textFont = null; protected $focusAreaColor1 = null; protected $focusAreaColor2 = null; protected $autoComplete = null; @@ -119,6 +120,14 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF return $this; } + /** + * @see \FML\Types\TextFormatable::setTextFont() + */ + public function setTextFont($textFont) { + $this->textFont = (string)$textFont; + return $this; + } + /** * @see \FML\Types\TextFormatable::setAreaColor() */ @@ -194,6 +203,9 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF if ($this->textSize >= 0.) { $xmlElement->setAttribute('textsize', $this->textSize); } + if ($this->textFont) { + $xmlElement->setAttribute('textfont', $this->textFont); + } if ($this->focusAreaColor1) { $xmlElement->setAttribute('focusareacolor1', $this->focusAreaColor1); } diff --git a/application/core/Libs/FML/Controls/Label.php b/application/core/Libs/FML/Controls/Label.php index 45abf15f..887b47c5 100644 --- a/application/core/Libs/FML/Controls/Label.php +++ b/application/core/Libs/FML/Controls/Label.php @@ -40,6 +40,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script protected $scriptEvents = null; protected $style = null; protected $textSize = -1; + protected $textFont = null; protected $textColor = null; protected $focusAreaColor1 = null; protected $focusAreaColor2 = null; @@ -204,6 +205,14 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script return $this; } + /** + * @see \FML\Types\TextFormatable::setTextFont() + */ + public function setTextFont($textFont) { + $this->textFont = (string)$textFont; + return $this; + } + /** * @see \FML\Types\TextFormatable::setTextColor() */ @@ -291,6 +300,9 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script if ($this->textSize >= 0) { $xmlElement->setAttribute('textsize', $this->textSize); } + if ($this->textFont) { + $xmlElement->setAttribute('textfont', $this->textFont); + } if ($this->textColor) { $xmlElement->setAttribute('textcolor', $this->textColor); } diff --git a/application/core/Libs/FML/Controls/Labels/Label_Button.php b/application/core/Libs/FML/Controls/Labels/Label_Button.php index 1a33d2c4..da2da5c8 100644 --- a/application/core/Libs/FML/Controls/Labels/Label_Button.php +++ b/application/core/Libs/FML/Controls/Labels/Label_Button.php @@ -33,4 +33,6 @@ class Label_Button extends Label { const STYLE_CardButtonSmallXXXL = 'CardButtonSmallXXXL'; const STYLE_CardMain_Quit = 'CardMain_Quit'; const STYLE_CardMain_Tool = 'CardMain_Tool'; + const STYLE_CardMain_Tool_NoBg = 'CardMain_Tool_NoBg'; + const STYLE_CardMain_Tool_NoBg2 = 'CardMain_Tool_NoBg2'; } diff --git a/application/core/Libs/FML/Controls/Quad.php b/application/core/Libs/FML/Controls/Quad.php index 570f2f12..f263f711 100644 --- a/application/core/Libs/FML/Controls/Quad.php +++ b/application/core/Libs/FML/Controls/Quad.php @@ -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; } } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_BgsButtons.php b/application/core/Libs/FML/Controls/Quads/Quad_BgsButtons.php new file mode 100644 index 00000000..ffaa7b4a --- /dev/null +++ b/application/core/Libs/FML/Controls/Quads/Quad_BgsButtons.php @@ -0,0 +1,30 @@ +textFont = (string)$textFont; + return $this; + } + /** * @see \FML\Types\TextFormatable::setTextColor() */ @@ -97,6 +106,9 @@ class Format implements BgColorable, Renderable, Styleable, TextFormatable { if ($this->textSize >= 0) { $formatXmlElement->setAttribute('textsize', $this->textSize); } + if ($this->textFont) { + $formatXmlElement->setAttribute('textfont', $this->textFont); + } if ($this->textColor) { $formatXmlElement->setAttribute('textcolor', $this->textColor); } diff --git a/application/core/Libs/FML/Types/TextFormatable.php b/application/core/Libs/FML/Types/TextFormatable.php index 9f4d4d18..161a8298 100644 --- a/application/core/Libs/FML/Types/TextFormatable.php +++ b/application/core/Libs/FML/Types/TextFormatable.php @@ -19,6 +19,14 @@ interface TextFormatable { */ public function setTextSize($textSize); + /** + * Set text font + * + * @param string $textFont + * @return static + */ + public function setTextFont($textFont); + /** * Set text color *