diff options
Diffstat (limited to 'tests/FunctionalTests/tickets/protected/controls')
-rw-r--r-- | tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php | 45 | ||||
-rw-r--r-- | tests/FunctionalTests/tickets/protected/controls/down.gif | bin | 0 -> 1308 bytes | |||
-rw-r--r-- | tests/FunctionalTests/tickets/protected/controls/up.gif | bin | 0 -> 499 bytes |
3 files changed, 45 insertions, 0 deletions
diff --git a/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php b/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php new file mode 100644 index 00000000..80c16ce5 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php @@ -0,0 +1,45 @@ +<?php +/** + * + * + * @author Christophe BOULAIN (Christophe.Boulain@ceram.fr) + * @copyright Copyright © 2007, CERAM Sophia Antipolis + * @license url nameoflicense + * @version $Id$ + * + */ + +class ToggleImageButton extends TImageButton { + + public function getState () { + return $this->getViewState('state', ToggleImageButtonState::Down); + } + + public function setState($value) { + $this->setViewState('state', TPropertyValue::ensureEnum($value, ToggleImageButtonState)); + } + + public function toggleState () { + $this->setState(($this->getState()===ToggleImageButtonState::Down)?ToggleImageButtonState::Up:ToggleImageButtonState::Down); + } + + public function onClick ($param) { + $this->toggleState(); + parent::onClick($param); + } + + public function getImageUrl () { + $img=($this->getState()===ToggleImageButtonState::Down)?'down.gif':'up.gif'; + return $this->publishAsset($img); + } + + public function setImageUrl() { + throw new TUnsupportedOperationException('ImageUrl property is read-only'); + } +} + +class ToggleImageButtonState extends TEnumerable { + const Down='Down'; + const Up='Up'; +} +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/controls/down.gif b/tests/FunctionalTests/tickets/protected/controls/down.gif Binary files differnew file mode 100644 index 00000000..9f755b5d --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/controls/down.gif diff --git a/tests/FunctionalTests/tickets/protected/controls/up.gif b/tests/FunctionalTests/tickets/protected/controls/up.gif Binary files differnew file mode 100644 index 00000000..7eeb4896 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/controls/up.gif |