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

@ -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);
}

View File

@ -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);
}

View File

@ -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';
}

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;
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace FML\Controls\Quads;
use FML\Controls\Quad;
/**
* Quad class for 'BgsButtons' styles
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Quad_BgsButtons extends Quad {
/*
* Constants
*/
const STYLE = 'BgsButtons';
const SUBSTYLE_BgButtonLarge = 'BgButtonLarge';
const SUBSTYLE_BgButtonMedium = 'BgButtonMedium';
const SUBSTYLE_BgButtonMediumSelector = 'BgButtonMediumSelector';
const SUBSTYLE_BgButtonMediumSpecial = 'BgButtonMediumSpecial';
const SUBSTYLE_BgButtonSmall = 'BgButtonSmall';
const SUBSTYLE_BgButtonXSmall = 'BgButtonXSmall';
/*
* Protected properties
*/
protected $style = self::STYLE;
}

View File

@ -22,6 +22,7 @@ class Format implements BgColorable, Renderable, Styleable, TextFormatable {
protected $bgColor = null;
protected $style = null;
protected $textSize = -1;
protected $textFont = null;
protected $textColor = null;
protected $focusAreaColor1 = null;
protected $focusAreaColor2 = null;
@ -59,6 +60,14 @@ class Format implements BgColorable, Renderable, Styleable, TextFormatable {
return $this;
}
/**
* @see \FML\Types\TextFormatable::setTextFont()
*/
public function setTextFont($textFont) {
$this->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);
}

View File

@ -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
*