From e83edc3f20163ac25e2307f9c854e7bc9384970c Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 4 Sep 2006 18:12:17 +0000 Subject: Finished updating code related with enumerable data types. --- framework/Web/UI/WebControls/TButton.php | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'framework/Web/UI/WebControls/TButton.php') diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index d24f5ef4..09868b12 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -103,7 +103,7 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr */ protected function needPostBackScript() { - return $this->canCauseValidation() || ($this->getButtonType()!=='Submit' && + return $this->canCauseValidation() || ($this->getButtonType()!==TButtonType::Submit && ($this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand'))); } @@ -254,20 +254,41 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr } /** - * @return string the type of the button. Defaults to 'Submit'. + * @return TButtonType the type of the button. Defaults to TButtonType::Submit. */ public function getButtonType() { - return $this->getViewState('ButtonType','Submit'); + return $this->getViewState('ButtonType',TButtonType::Submit); } /** - * @param string the type of the button. Valid values include 'Submit', 'Reset', 'Button'. + * @param TButtonType the type of the button. */ public function setButtonType($value) { - $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Submit','Reset','Button'),'Submit'); + $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TButtonType'),TButtonType::Submit); } } +/** + * TButtonType class. + * TButtonType defines the enumerable type for the possible types that a {@link TButton} can take. + * + * The following enumerable values are defined: + * - Submit: a normal submit button + * - Reset: a reset button + * - Button: a client button (normally does not perform form submission) + * + * @author Qiang Xue + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + * @since 3.0.4 + */ +class TButtonType extends TEnumerable +{ + const Submit='Submit'; + const Reset='Reset'; + const Button='Button'; +} + ?> \ No newline at end of file -- cgit v1.2.3