diff options
author | wei <> | 2007-01-25 05:49:22 +0000 |
---|---|---|
committer | wei <> | 2007-01-25 05:49:22 +0000 |
commit | 682f7ef6933f4ad485baedddf7a30367d003d7bf (patch) | |
tree | f0eb02ab8373f481b212b5406bfdb95e48b03b10 /framework/Web/UI/WebControls | |
parent | 9b4174135679398eaed518db99f3c72545aa3876 (diff) |
Fixed #502
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r-- | framework/Web/UI/WebControls/TStyle.php | 62 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TWebControl.php | 16 |
2 files changed, 76 insertions, 2 deletions
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php index cc383766..73ff4adf 100644 --- a/framework/Web/UI/WebControls/TStyle.php +++ b/framework/Web/UI/WebControls/TStyle.php @@ -43,6 +43,10 @@ class TStyle extends TComponent * @var string CSS style string (those not represented by specific fields of TStyle)
*/
private $_customStyle=null;
+ /**
+ * @var string display style
+ */
+ private $_displayStyle='Fixed';
/**
* Constructor.
@@ -173,7 +177,7 @@ class TStyle extends TComponent $this->_font=new TFont;
return $this->_font;
}
-
+
/**
* @return boolean true if font is set.
*/
@@ -183,6 +187,37 @@ class TStyle extends TComponent }
/**
+ * @param TDisplayStyle control display style, default is TDisplayStyle::Fixed
+ */
+ public function setDisplayStyle($value)
+ {
+ $this->_displayStyle = TPropertyValue::ensureEnum($value, 'TDisplayStyle');
+ switch($this->_displayStyle)
+ {
+ case TDisplayStyle::None:
+ $this->_fields['display'] = 'none';
+ break;
+ case TDisplayStyle::Dynamic:
+ $this->_fields['display'] = ''; //remove the display property
+ break;
+ case TDisplayStyle::Fixed:
+ $this->_fields['visibility'] = 'visible';
+ break;
+ case TDisplayStyle::Hidden:
+ $this->_fields['visibility'] = 'hidden';
+ break;
+ }
+ }
+
+ /**
+ * @return TDisplayStyle display style
+ */
+ public function getDisplayStyle()
+ {
+ return $this->_displayStyle;
+ }
+
+ /**
* @return string the foreground color of the control
*/
public function getForeColor()
@@ -362,7 +397,7 @@ class TStyle extends TComponent if($this->_class!==null)
$writer->addAttribute('class',$this->_class);
}
-
+
/**
* @return array list of style fields.
*/
@@ -373,6 +408,29 @@ class TStyle extends TComponent }
/**
+ * TDisplayStyle defines the enumerable type for the possible styles
+ * that a web control can display.
+ *
+ * The following enumerable values are defined:
+ * - None: the control is not displayed and not included in the layout.
+ * - Dynamic: the control is displayed and included in the layout, the layout flow is dependent on the control (equivalent to display:'' in css).
+ * - Fixed: Similar to Dynamic with CSS "visibility" set "shown".
+ * - Hidden: the control is not displayed and is included in the layout.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Id$
+ * @package System.Web.UI.WebControls
+ * @since 3.1
+ */
+class TDisplayStyle extends TEnumerable
+{
+ const None='None';
+ const Dynamic='Dynamic';
+ const Fixed='Fixed';
+ const Hidden='Hidden';
+}
+
+/**
* TTableStyle class.
* TTableStyle represents the CSS style specific for HTML table.
*
diff --git a/framework/Web/UI/WebControls/TWebControl.php b/framework/Web/UI/WebControls/TWebControl.php index a45bab05..78c1aa98 100644 --- a/framework/Web/UI/WebControls/TWebControl.php +++ b/framework/Web/UI/WebControls/TWebControl.php @@ -194,6 +194,22 @@ class TWebControl extends TControl }
/**
+ * @param TDisplayStyle display style of the control, default is TDisplayStyle::Fixed
+ */
+ public function setDisplay($value)
+ {
+ $this->getStyle()->setDisplayStyle($value);
+ }
+
+ /**
+ * @return TDisplayStyle display style of the control, default is TDisplayStyle::Fixed
+ */
+ public function getDisplay()
+ {
+ return $this->getStyle()->getDisplayStyle();
+ }
+
+ /**
* @param string the css class of the control
*/
public function setCssClass($value)
|