From 5479507cbdcbc14685a443b1096171b5134f82bf Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 31 Dec 2005 15:23:57 +0000 Subject: Refactored TPanel by adding TPanelStyle. Added TPanel samples. --- framework/Web/UI/WebControls/TWebControl.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'framework/Web/UI/WebControls/TWebControl.php') diff --git a/framework/Web/UI/WebControls/TWebControl.php b/framework/Web/UI/WebControls/TWebControl.php index 4f20b227..6e2a2c89 100644 --- a/framework/Web/UI/WebControls/TWebControl.php +++ b/framework/Web/UI/WebControls/TWebControl.php @@ -210,6 +210,15 @@ class TWebControl extends TControl return $this->getViewState('Style',null)!==null; } + /** + * Creates a style object to be used by the control. + * This method may be overriden by controls to provide customized style. + */ + protected function createStyle() + { + return new TStyle; + } + /** * @return TStyle the object representing the css style of the control */ @@ -219,7 +228,7 @@ class TWebControl extends TControl return $style; else { - $style=new TStyle; + $style=$this->createStyle(); $this->setViewState('Style',$style,null); return $style; } @@ -234,7 +243,7 @@ class TWebControl extends TControl public function setStyle($value) { if(is_string($value)) - $this->getStyle()->setStyle($value); + $this->getStyle()->setCustomStyle($value); else throw new TInvalidDataValueException('webcontrol_style_invalid',get_class($this)); } -- cgit v1.2.3