class Button : public Control
{
-protected:
-
- /**
- * Construct a new Button.
- */
- Button();
-
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~Button();
-
public:
/**
- * @copydoc Dali::Toolkit::Button::SetDisabled( bool disabled )
+ * @copydoc Dali::Toolkit::Button::SetDisabled
*/
void SetDisabled( bool disabled );
/**
- * @copydoc Dali::Toolkit::Button::IsDisabled() const
+ * @copydoc Dali::Toolkit::Button::IsDisabled
*/
bool IsDisabled() const;
/**
- * @copydoc Dali::Toolkit::Button::SetAutoRepeating( bool autoRepeating )
+ * @copydoc Dali::Toolkit::Button::SetAutoRepeating
*/
void SetAutoRepeating( bool autoRepeating );
/**
- * @copydoc Dali::Toolkit::Button::IsAutoRepeating() const
+ * @copydoc Dali::Toolkit::Button::IsAutoRepeating
*/
bool IsAutoRepeating() const;
/**
- * @copydoc Dali::Toolkit::Button::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay )
+ * @copydoc Dali::Toolkit::Button::SetInitialAutoRepeatingDelay
*/
void SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay );
/**
- * @copydoc Dali::Toolkit::Button::GetInitialAutoRepeatingDelay() const
+ * @copydoc Dali::Toolkit::Button::GetInitialAutoRepeatingDelay
*/
float GetInitialAutoRepeatingDelay() const;
/**
- * @copydoc Dali::Toolkit::Button::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay )
+ * @copydoc Dali::Toolkit::Button::SetNextAutoRepeatingDelay
*/
void SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay );
/**
- * @copydoc Dali::Toolkit::Button::GetNextAutoRepeatingDelay() const
+ * @copydoc Dali::Toolkit::Button::GetNextAutoRepeatingDelay
*/
float GetNextAutoRepeatingDelay() const;
/**
- * @copydoc Dali::Toolkit::Button::SetTogglableButton( bool togglable )
+ * @copydoc Dali::Toolkit::Button::SetTogglableButton
*/
void SetTogglableButton( bool togglable );
/**
- * @copydoc Dali::Toolkit::Button::IsTogglableButton() const
+ * @copydoc Dali::Toolkit::Button::IsTogglableButton
*/
bool IsTogglableButton() const;
/**
- * @copydoc Dali::Toolkit::Button::SetSelected( bool selected )
+ * @copydoc Dali::Toolkit::Button::SetSelected
*/
void SetSelected( bool selected );
/**
- * @copydoc Dali::Toolkit::Button::IsSelected() const
+ * @copydoc Dali::Toolkit::Button::IsSelected
*/
bool IsSelected() const;
/**
- * @copydoc Dali::Toolkit::Button::SetAnimationTime()
+ * @copydoc Dali::Toolkit::Button::SetAnimationTime
*/
void SetAnimationTime( float animationTime );
/**
- * @copydoc Dali::Toolkit::Button::GetAnimationTime()
+ * @copydoc Dali::Toolkit::Button::GetAnimationTime
*/
float GetAnimationTime() const;
std::string GetDisabledBackgroundImageFilename() const;
/**
+ * @brief Sets the specified properties on the button label.
+ * If the label does not exist yet, it is created.
+ * The derived buttons are notified if any properties are changed.
+ * @param[in] properties A Property::Map of key-value pairs of properties to set.
+ */
+ void ModifyLabel( const Property::Map& properties );
+
+ /**
* Performs actions as requested using the action name.
* @param[in] object The object on which to perform the action.
* @param[in] actionName The action to perform.
void SetDisabledBackgroundImage( Actor image );
/**
- * @copydoc Dali::Toolkit::Button::GetButtonImage()
+ * @copydoc Dali::Toolkit::Button::GetButtonImage
*/
Actor GetButtonImage() const;
/**
- * @copydoc Dali::Toolkit::Button::GetSelectedImage()
+ * @copydoc Dali::Toolkit::Button::GetSelectedImage
*/
Actor GetSelectedImage() const;
protected:
+ enum ButtonState
+ {
+ ButtonUp, ///< The button is up.
+ ButtonDown, ///< The button is down.
+ };
+
+ /**
+ * Button paint states.
+ */
+ enum PaintState
+ {
+ UnselectedState, ///< The button is unselected.
+ SelectedState, ///< The button is selected.
+ DisabledUnselectedState, ///< The button is disabled and unselected.
+ DisabledSelectedState, ///< The button is disabled and selected.
+ };
+
+ /**
+ * Enum to specify which decoration when getting and setting decorations.
+ */
+ enum DecorationState
+ {
+ UNSELECTED_DECORATION = 0,
+ SELECTED_DECORATION,
+ DECORATION_STATES
+ };
+
+ /**
+ * Construct a new Button.
+ */
+ Button();
+
+ /**
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~Button();
/**
* @return A reference to the label actor.
*/
bool DoClickAction( const Property::Map& attributes );
/**
- * This method is called after the button initialization.
- * Could be reimplemented in subclasses to provide specific behaviour.
- */
- virtual void OnButtonInitialize() { }
-
- /**
* This method is called when the label is set.
* @param[in] noPadding Used to bypass padding if the label is to be treated generically.
*/
virtual void OnDisabledBackgroundImageSet() {}
/**
- * This method is called from the OnTouchEvent method when the button is down.
+ * This method is called the button is down.
* Could be reimplemented in subclasses to provide specific behaviour.
*/
virtual void OnButtonDown();
/**
- * This method is called from the OnTouchEvent method when the button is up.
+ * This method is called when the button is up.
* Could be reimplemented in subclasses to provide specific behaviour.
*/
virtual void OnButtonUp();
/**
- * This method is called from the OnTouchEvent method when the touch point leaves the boundary of the button or
- * more than one touch points are received.
+ * This method is called when touch leaves the boundary of the button or several touch points are received.
* Could be reimplemented in subclasses to provide specific behaviour.
*/
virtual void OnTouchPointLeave();
/**
- * This method is called from the OnTouchEvent method when the touch point is interrupted.
+ * This method is called when the touch is interrupted.
* Could be reimplemented in subclasses to provide specific behaviour.
*/
virtual void OnTouchPointInterrupted();
/**
- * This method is called when the button is removed from the stage.
- * Could be reimplemented in subclasses to provide specific behaviour.
- */
- virtual void OnButtonStageDisconnection();
-
- /**
* This method is called when the \e selected property is changed.
*/
virtual void OnSelected() {}
*/
static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
-protected: // From CustomActorImpl
-
- /**
- * @copydoc Dali::CustomActorImpl::OnTouchEvent( const TouchEvent& event )
- */
- virtual bool OnTouchEvent( const TouchEvent& event );
-
-private: // From Control
+protected: // From Control
/**
* @copydoc Toolkit::Control::OnInitialize()
+ * @note If overridden by deriving button classes, then an up-call to Button::OnInitialize MUST be made at the start.
*/
virtual void OnInitialize();
virtual bool OnKeyboardEnter();
/**
- * Callback received when the button is disconnected from the stage.
- * It resets the button status.
+ * @copydoc Toolkit::Control::OnStageDisconnection()
+ * @note If overridden by deriving button classes, then an up-call to Button::OnStageDisconnection MUST be made at the end.
*/
- void OnControlStageDisconnection();
+ void OnStageDisconnection();
+
private:
/**
+ * @brief Handler for touch data
+ * @param[in] actor The touched actor.
+ * @param[in] touch The touch info.
+ * @return true, if consumed, false otherwise.
+ */
+ bool OnTouch( Actor actor, const TouchData& touch );
+
+ /**
* Handler for tap events.
* We do not actually do anything when we receive a tap as the button handles tap event through
* the touch event system itself as it requires more than just tap handling (e.g. leave events).
void SetupContent( Actor& actorToModify, Actor newActor );
/**
- * Sets the color of the unselected image.
- * If no image exists, it is created.
- * @param[in] color The color to use.
- */
- void SetUnselectedColor( const Vector4& color );
-
- /**
* Gets the unselected content color.
* @return The currently used unselected color.
*/
const Vector4 GetUnselectedColor() const;
/**
- * Sets the color of the selected image.
- * If no image exists, it is created.
+ * Sets the color of button in selected or unselected state, if image also supplied this color will be appplied to it.
+ * If no visual exists, it is created.
* @param[in] color The color to use.
+ * @param[in] selectedState The state to apply the color to, SelectedState or DisabledUnselectedState.
*/
- void SetSelectedColor( const Vector4& color );
+ void SetColor( const Vector4& color, PaintState selectedState );
/**
* Gets the selected content color.
protected:
- enum ButtonState
- {
- ButtonUp, ///< The button is up.
- ButtonDown, ///< The button is down.
- };
-
- /**
- * Button paint states.
- */
- enum PaintState
- {
- UnselectedState, ///< The button is unselected.
- SelectedState, ///< The button is selected.
- DisabledUnselectedState, ///< The button is disabled and unselected.
- DisabledSelectedState, ///< The button is disabled and selected.
- };
-
- /**
- * Enum to specify which decoration when getting and setting decorations.
- */
- enum DecorationState
- {
- UNSELECTED_DECORATION = 0,
- SELECTED_DECORATION,
- DECORATION_STATES
- };
-
ButtonState GetState();
PaintState GetPaintState();
void SetDecoration( DecorationState state, Actor actor );