Tizen Native API  4.0

Button is a base class for different kinds of buttons. More...

Inheritance diagram for Dali::Toolkit::Button:
Dali::Toolkit::Control Dali::CustomActor Dali::Actor Dali::Handle Dali::BaseHandle Dali::Toolkit::CheckBoxButton Dali::Toolkit::PushButton Dali::Toolkit::RadioButton

Classes

struct  Property
 Enumeration for the instance of properties belonging to the Button class. More...

Public Types

enum  PropertyRange
 Enumeration for the start and end property ranges for this control. More...
typedef Signal< bool(Button) > ButtonSignalType
 Button signal type.

Public Member Functions

 Button ()
 Creates an uninitialized Button.
 Button (const Button &button)
 Copy constructor.
Buttonoperator= (const Button &button)
 Assignment operator.
 ~Button ()
 Destructor.
void SetDisabled (bool disabled) DALI_DEPRECATED_API
 Sets the button as disabled.
bool IsDisabled () const DALI_DEPRECATED_API
 Returns if the button is disabled.
void SetAutoRepeating (bool autoRepeating) DALI_DEPRECATED_API
 Sets the autorepeating property.
bool IsAutoRepeating () const DALI_DEPRECATED_API
 Returns if the autorepeating property is set.
void SetInitialAutoRepeatingDelay (float initialAutoRepeatingDelay) DALI_DEPRECATED_API
 Sets the initial autorepeating delay.
float GetInitialAutoRepeatingDelay () const DALI_DEPRECATED_API
 Gets the initial autorepeating delay in seconds.
void SetNextAutoRepeatingDelay (float nextAutoRepeatingDelay) DALI_DEPRECATED_API
 Sets the next autorepeating delay.
float GetNextAutoRepeatingDelay () const DALI_DEPRECATED_API
 Gets the next autorepeating delay in seconds.
void SetTogglableButton (bool togglable) DALI_DEPRECATED_API
 Sets the togglable property.
bool IsTogglableButton () const DALI_DEPRECATED_API
 Returns if the togglable property is set.
void SetSelected (bool selected) DALI_DEPRECATED_API
 Sets the button as selected or unselected.
bool IsSelected () const DALI_DEPRECATED_API
 Returns if the selected property is set and the button is togglable.
void SetAnimationTime (float animationTime) DALI_DEPRECATED_API
 Sets the animation time.
float GetAnimationTime () const DALI_DEPRECATED_API
 Retrieves button's animation time.
void SetLabelText (const std::string &label) DALI_DEPRECATED_API
 Sets the button's label.
std::string GetLabelText () const DALI_DEPRECATED_API
 Gets the label.
void SetUnselectedImage (const std::string &filename) DALI_DEPRECATED_API
 Sets the unselected button image.
void SetBackgroundImage (const std::string &filename) DALI_DEPRECATED_API
 Sets the background image.
void SetSelectedImage (const std::string &filename) DALI_DEPRECATED_API
 Sets the selected image.
void SetSelectedBackgroundImage (const std::string &filename) DALI_DEPRECATED_API
 Sets the selected background image.
void SetDisabledBackgroundImage (const std::string &filename) DALI_DEPRECATED_API
 Sets the disabled background image.
void SetDisabledImage (const std::string &filename) DALI_DEPRECATED_API
 Sets the disabled button image.
void SetDisabledSelectedImage (const std::string &filename) DALI_DEPRECATED_API
 Sets the disabled selected button image.
void SetLabel (Actor label) DALI_DEPRECATED_API
 Sets the label with an actor.
void SetButtonImage (Image image) DALI_DEPRECATED_API
 Sets the button image.
void SetSelectedImage (Image image) DALI_DEPRECATED_API
 Sets the selected image.
Actor GetButtonImage () const DALI_DEPRECATED_API
 Gets the button image.
Actor GetSelectedImage () const DALI_DEPRECATED_API
 Gets the selected image.
ButtonSignalTypePressedSignal ()
 This signal is emitted when the button is touched.
ButtonSignalTypeReleasedSignal ()
 This signal is emitted when the button is touched and the touch point leaves the boundary of the button.
ButtonSignalTypeClickedSignal ()
 This signal is emitted when the button is touched and the touch point doesn't leave the boundary of the button.
ButtonSignalTypeStateChangedSignal ()
 This signal is emitted when the button's state is changed.

Static Public Member Functions

static Button DownCast (BaseHandle handle)
 Downcasts a handle to Button handle.

Detailed Description

Button is a base class for different kinds of buttons.

This class provides the disabled property and the clicked signal.

A ClickedSignal() is emitted when the button is touched and the touch point doesn't leave the boundary of the button.

When the disabled property is set to true, no signal is emitted.

Button provides the following properties which modify the signals emitted:

'Visual' describes not just traditional images like png, bmp but refers to whatever is used to show the button, it could be a color, gradient or some other kind of renderer.

The button's appearance can be modified by setting properties for the various visuals/images.

It is not mandatory to set all visuals. A button could be defined only by setting its background visual or by setting its background and selected visuals.

The button visual is shown over the background visual. When pressed the unselected visuals are replaced by the selected visual. The text label is always placed on the top of all images.

When the button is disabled, background, button and selected visuals are replaced by their disabled visuals.

Signals | Signal Name | Method | |------------------|-----------------------------| | pressed | PressedSignal() | | released | ReleasedSignal() | | clicked | ClickedSignal() | | stateChanged | StateChangedSignal() |

Actions | Action Name | Attributes | Description | |------------------|-------------------------|-----------------------------------------------| | buttonClick | Doesn't have attributes | Simulates a button click. See DoAction() |

Since:
3.0, DALi version 1.0.0

Member Typedef Documentation

Button signal type.

Since:
3.0, DALi version 1.0.0

Member Enumeration Documentation

Enumeration for the start and end property ranges for this control.

Since:
3.0, DALi version 1.0.0
Enumerator:
PROPERTY_START_INDEX 
Since:
3.0, DALi version 1.0.0
PROPERTY_END_INDEX 

Reserve property indices.

Since:
3.0, DALi version 1.0.0

Reimplemented from Dali::Toolkit::Control.

Reimplemented in Dali::Toolkit::PushButton.


Constructor & Destructor Documentation

Creates an uninitialized Button.

Only derived versions can be instantiated. Calling member functions with an uninitialized Dali::Object is not allowed.

Since:
3.0, DALi version 1.0.0

Copy constructor.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]buttonHandle to an object

Destructor.

This is non-virtual since derived Handle types must not contain data or virtual methods.

Since:
3.0, DALi version 1.0.0

Member Function Documentation

This signal is emitted when the button is touched and the touch point doesn't leave the boundary of the button.

A callback of the following type may be connected:

   bool YourCallbackName( Button button );
Since:
3.0, DALi version 1.0.0
Returns:
The signal to connect to
static Button Dali::Toolkit::Button::DownCast ( BaseHandle  handle) [static]

Downcasts a handle to Button handle.

If handle points to a Button, the downcast produces valid handle. If not the returned handle is left uninitialized.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]handleHandle to an object
Returns:
A handle to a Button or an uninitialized handle

Reimplemented from Dali::Toolkit::Control.

Reimplemented in Dali::Toolkit::PushButton, Dali::Toolkit::RadioButton, and Dali::Toolkit::CheckBoxButton.

Retrieves button's animation time.

DEPRECATED_1_1.32 Use Styling file to set animation

Since:
3.0, DALi version 1.0.0
Returns:
The animation time in seconds

Gets the button image.

Deprecated:
Deprecated since 3.0, DALi version 1.0.50
Since:
3.0, DALi version 1.0.0
Remarks:
Avoid using this method as it's a legacy code.
Returns:
An actor with the button image

Gets the initial autorepeating delay in seconds.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 GetProperty INITIAL_AUTO_REPEATING_DELAY
Since:
3.0, DALi version 1.0.0
Returns:
The initial autorepeating delay in seconds
std::string Dali::Toolkit::Button::GetLabelText ( ) const

Gets the label.

DEPRECATED_1_1.32 GetProperty LABEL

Since:
3.0, DALi version 1.0.0
Returns:
The label text

Gets the next autorepeating delay in seconds.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 GetProperty NEXT_AUTO_REPEATING_DELAY
Since:
3.0, DALi version 1.0.0
Returns:
The next autorepeating delay in seconds

Gets the selected image.

Deprecated:
Deprecated since 3.0, DALi version 1.0.50
Since:
3.0, DALi version 1.0.0
Remarks:
Avoid using this method as it's a legacy code.
Returns:
An actor with the selected image

Returns if the autorepeating property is set.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 GetProperty AUTO_REPEATING
Since:
3.0, DALi version 1.0.0
Returns:
true if the autorepeating property is set

Returns if the button is disabled.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Use GetProperty DISABLED
Since:
3.0, DALi version 1.0.0
Returns:
true if the button is disabled

Returns if the selected property is set and the button is togglable.

DEPRECATED_1_1.32 GetProperty SELECTED

Since:
3.0, DALi version 1.0.0
Returns:
true if the button is selected

Returns if the togglable property is set.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 GetProperty TOGGLABLE
Since:
3.0, DALi version 1.0.0
Returns:
true if the togglable property is set
Button& Dali::Toolkit::Button::operator= ( const Button button)

Assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]buttonHandle to an object
Returns:
A reference to this

This signal is emitted when the button is touched.

A callback of the following type may be connected:

   bool YourCallbackName( Button button );
Since:
3.0, DALi version 1.0.0
Returns:
The signal to connect to

This signal is emitted when the button is touched and the touch point leaves the boundary of the button.

A callback of the following type may be connected:

   bool YourCallbackName( Button button );
Since:
3.0, DALi version 1.0.0
Returns:
The signal to connect to
void Dali::Toolkit::Button::SetAnimationTime ( float  animationTime)

Sets the animation time.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Use Styling file to set animation
Since:
3.0, DALi version 1.0.0
Parameters:
[in]animationTimeThe animation time in seconds
void Dali::Toolkit::Button::SetAutoRepeating ( bool  autoRepeating)

Sets the autorepeating property.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 SetProperty AUTO_REPEATING or Styling file

If the autorepeating property is set to true, then the togglable property is set to false but no signal is emitted.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]autoRepeatingautorepeating property
void Dali::Toolkit::Button::SetBackgroundImage ( const std::string &  filename)

Sets the background image.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Use styling Set Control::Property::BACKGROUND which is same as un-selected background Or use DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL
Since:
3.0, DALi version 1.0.0
Parameters:
[in]filenameThe background image

Sets the button image.

Deprecated:
Deprecated since 3.0, DALi version 1.0.50. Instead, use SetUnselectedImage.
Since:
3.0, DALi version 1.0.0
Parameters:
[in]imageThe button image
void Dali::Toolkit::Button::SetDisabled ( bool  disabled)

Sets the button as disabled.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Use SetProperty DISABLED or Styling file

No signals are emitted when the disabled property is set.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]disabledDisabled property
void Dali::Toolkit::Button::SetDisabledBackgroundImage ( const std::string &  filename)

Sets the disabled background image.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Only able to set Property::DISABLED_STATE_IMAGE Or use DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL
Since:
3.0, DALi version 1.0.0
Parameters:
[in]filenameThe disabled background image
void Dali::Toolkit::Button::SetDisabledImage ( const std::string &  filename)

Sets the disabled button image.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Use styling file Property::DISABLED_STATE_IMAGE
Since:
3.0, DALi version 1.0.0
Parameters:
[in]filenameThe disabled button image
void Dali::Toolkit::Button::SetDisabledSelectedImage ( const std::string &  filename)

Sets the disabled selected button image.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Use Property::DISABLED_STATE_IMAGE which provides same disabled image for un/selected Or DevelButton::Property::DISABLED_SELECTED_VISUAL to disable selected visual.
Since:
3.0, DALi version 1.0.0
Parameters:
[in]filenameThe disabled selected button image
void Dali::Toolkit::Button::SetInitialAutoRepeatingDelay ( float  initialAutoRepeatingDelay)

Sets the initial autorepeating delay.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 SetProperty INITIAL_AUTO_REPEATING_DELAY or Styling file

By default, this value is set to 0.15 seconds.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]initialAutoRepeatingDelayin seconds
Precondition:
initialAutoRepeatingDelay must be greater than zero.

Sets the label with an actor.

Deprecated:
Deprecated since 3.0, DALi version 1.0.50. Instead, use SetLabelText
Since:
3.0, DALi version 1.0.0
Parameters:
[in]labelThe actor to use as a label
void Dali::Toolkit::Button::SetLabelText ( const std::string &  label)

Sets the button's label.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 SetProperty Property::LABEL or Styling file
Since:
3.0, DALi version 1.0.0
Parameters:
[in]labelThe label text
void Dali::Toolkit::Button::SetNextAutoRepeatingDelay ( float  nextAutoRepeatingDelay)

Sets the next autorepeating delay.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 SetProperty NEXT_AUTO_REPEATING_DELAY or Styling file

By default, this value is set to 0.05 seconds.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]nextAutoRepeatingDelayin seconds
Precondition:
nextAutoRepeatingDelay must be greater than zero.
void Dali::Toolkit::Button::SetSelected ( bool  selected)

Sets the button as selected or unselected.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 SetProperty SELECTED

togglable property must be set to true.

Emits a Button::StateChangedSignal() signal.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]selectedSelected property
void Dali::Toolkit::Button::SetSelectedBackgroundImage ( const std::string &  filename)

Sets the selected background image.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Set Control::Property::BACKGROUND which is same as un-selected background Or use DevelButton::Property::SELECTED_BACKGROUND_VISUAL
Since:
3.0, DALi version 1.0.0
Parameters:
[in]filenameThe selected background image
void Dali::Toolkit::Button::SetSelectedImage ( const std::string &  filename)

Sets the selected image.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Use styling file, Property::SELECTED_STATE_IMAGE
Since:
3.0, DALi version 1.0.0
Parameters:
[in]filenameThe selected image

Sets the selected image.

Deprecated:
Deprecated since 3.0, DALi version 1.0.50. Instead, use SetSelectedImage( const std::string& filename ).
Since:
3.0, DALi version 1.0.0
Parameters:
[in]imageThe selected image

Sets the togglable property.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 SetProperty TOGGLABLE or Styling file

If the togglable property is set to true, then the autorepeating property is set to false.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]togglableTogglable property
void Dali::Toolkit::Button::SetUnselectedImage ( const std::string &  filename)

Sets the unselected button image.

Deprecated:
Deprecated since 3.0, DALi version 1.1.32 Use Styling file Property::UNSELECTED_STATE_IMAGE
Since:
3.0, DALi version 1.0.0
Parameters:
[in]filenameThe button image

This signal is emitted when the button's state is changed.

The application can get the state by calling IsSelected().

A callback of the following type may be connected:

   bool YourCallbackName( Button button );
Since:
3.0, DALi version 1.0.0
Returns:
The signal to connect to