From 0efe2d3e9e02ada6fe297af823b90fa967de85df Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 3 Feb 2006 06:11:57 +0000 Subject: Added TCheckBoxColumn. --- framework/Web/UI/WebControls/TStyle.php | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'framework/Web/UI/WebControls/TStyle.php') diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php index fd92df8a..fa3bcb28 100644 --- a/framework/Web/UI/WebControls/TStyle.php +++ b/framework/Web/UI/WebControls/TStyle.php @@ -44,6 +44,15 @@ class TStyle extends TComponent */ private $_customStyle=null; + /** + * Constructor. + * @param TStyle style to copy from + */ + public function __construct($style=null) + { + $this->copyFrom($style); + } + /** * @return string the background color of the control */ @@ -260,7 +269,6 @@ class TStyle extends TComponent */ public function reset() { - parent::reset(); $this->_fields=array(); $this->_font=null; $this->_class=null; @@ -274,9 +282,9 @@ class TStyle extends TComponent */ public function copyFrom($style) { - if($style!==null) + $this->reset(); + if($style instanceof TStyle) { - $this->reset(); $this->_fields=$style->_fields; $this->_class=$style->_class; $this->_customStyle=$style->_customStyle; @@ -295,9 +303,12 @@ class TStyle extends TComponent { if($style!==null) { + //$this->_fields=array_merge($this->_fields,$style->_fields); $this->_fields=array_merge($style->_fields,$this->_fields); if($this->_class===null) $this->_class=$style->_class; + if($this->_customStyle===null) + $this->_customStyle=$style->_customStyle; if($this->_font===null && $style->_font!==null) $this->getFont()->mergeWith($style->_font); } @@ -309,7 +320,7 @@ class TStyle extends TComponent */ public function addAttributesToRender($writer) { - if($this->_customStyle!=='') + if($this->_customStyle!==null) { foreach(explode(';',$this->_customStyle) as $style) { @@ -594,9 +605,12 @@ class TTableItemStyle extends TStyle public function copyFrom($style) { parent::copyFrom($style); - $this->_verticalAlign=$style->_verticalAlign; - $this->_horizontalAlign=$style->_horizontalAlign; - $this->_wrap=$style->_wrap; + if($style instanceof TTableItemStyle) + { + $this->_verticalAlign=$style->_verticalAlign; + $this->_horizontalAlign=$style->_horizontalAlign; + $this->_wrap=$style->_wrap; + } } /** -- cgit v1.2.3