void (*tet_cleanup)() = Cleanup;
}
-static void UtcDaliButtonNew();
-static void UtcDaliButtonSetProperty();
-static void UtcDaliButtonSetGetDimmed();
-static void UtcDaliButtonSize();
-static void UtcDaliButtonClicked();
-static void UtcDaliButtonConnectSignal();
-static void UtcDaliButtonSetGetAnimationTime();
-
enum {
POSITIVE_TC_IDX = 0x01,
NEGATIVE_TC_IDX,
};
-// Add test functionality for all APIs in the class (Positive and Negative)
+#define MAX_NUMBER_OF_TESTS 10000
extern "C" {
- struct tet_testlist tet_testlist[] = {
- { UtcDaliButtonNew, POSITIVE_TC_IDX },
- { UtcDaliButtonSetProperty, POSITIVE_TC_IDX },
- { UtcDaliButtonSetGetDimmed, POSITIVE_TC_IDX },
- { UtcDaliButtonSize, POSITIVE_TC_IDX },
- { UtcDaliButtonClicked, POSITIVE_TC_IDX },
- { UtcDaliButtonConnectSignal, POSITIVE_TC_IDX },
- { UtcDaliButtonSetGetAnimationTime, POSITIVE_TC_IDX },
- { NULL, 0 }
- };
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
}
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliButtonNew, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliButtonProperties, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliButtonSetGetDimmed, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliButtonSize, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliButtonClicked, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliButtonConnectSignal, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliButtonSetGetAnimationTime, POSITIVE_TC_IDX );
+
// Called only once before first test is run.
static void Startup()
{
DALI_TEST_CHECK( downCastCheckBoxButton2 );
}
-static void UtcDaliButtonSetProperty()
+static void UtcDaliButtonProperties()
{
tet_infoline("UtcDaliButtonSetProperty: ");
ToolkitTestApplication application;
PushButton pushButton = PushButton::New();
//Test various properties
- checkBoxButton.SetProperty(checkBoxButton.GetPropertyIndex("dimmed"), false);
+ checkBoxButton.SetProperty( Button::PROPERTY_DIMMED, false );
DALI_TEST_CHECK( false == checkBoxButton.IsDimmed() );
- checkBoxButton.SetProperty(checkBoxButton.GetPropertyIndex("dimmed"), true);
+ DALI_TEST_CHECK( false == checkBoxButton.GetProperty< bool >( Button::PROPERTY_DIMMED ) );
+ checkBoxButton.SetProperty( Button::PROPERTY_DIMMED, true );
DALI_TEST_CHECK( true == checkBoxButton.IsDimmed() );
+ DALI_TEST_CHECK( true == checkBoxButton.GetProperty< bool >( Button::PROPERTY_DIMMED ) );
- pushButton.SetProperty(pushButton.GetPropertyIndex("dimmed"), false);
+ pushButton.SetProperty( Button::PROPERTY_DIMMED, false );
DALI_TEST_CHECK( false == pushButton.IsDimmed() );
- pushButton.SetProperty(pushButton.GetPropertyIndex("dimmed"), true);
+ DALI_TEST_CHECK( false == pushButton.GetProperty< bool >( Button::PROPERTY_DIMMED ) );
+ pushButton.SetProperty( Button::PROPERTY_DIMMED, true );
DALI_TEST_CHECK( true == pushButton.IsDimmed() );
+ DALI_TEST_CHECK( true == pushButton.GetProperty< bool >( Button::PROPERTY_DIMMED ) );
}
static void UtcDaliButtonSetGetDimmed()
TEST_FUNCTION( UtcDaliPushButtonToggled, POSITIVE_TC_IDX );
TEST_FUNCTION( UtcDaliPushButtonInterruptEventWhenInsensitive, POSITIVE_TC_IDX );
TEST_FUNCTION( UtcDaliPushButtonInterruptEventWhenNonVisible, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonProperties, POSITIVE_TC_IDX );
// Called only once before first test is run.
static void Startup()
DALI_TEST_CHECK( !gOnTouchPointInterrupted );
}
+
+void UtcDaliPushButtonProperties()
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ // PushButton::PROPERTY_AUTO_REPEATING
+ button.SetAutoRepeating( false );
+ DALI_TEST_CHECK( ! button.GetProperty< bool >( PushButton::PROPERTY_AUTO_REPEATING ) );
+ button.SetProperty( PushButton::PROPERTY_AUTO_REPEATING, true );
+ DALI_TEST_CHECK( button.IsAutoRepeating() ) ;
+ DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_AUTO_REPEATING ) );
+
+ // PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY
+ button.SetInitialAutoRepeatingDelay( 10.0f );
+ DALI_TEST_EQUALS( 10.0f, button.GetProperty< float >( PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY ), TEST_LOCATION );
+ button.SetProperty( PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY, 25.0f );
+ DALI_TEST_EQUALS( 25.0f, button.GetInitialAutoRepeatingDelay(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 25.0f, button.GetProperty< float >( PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY ), TEST_LOCATION );
+
+ // PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY
+ button.SetNextAutoRepeatingDelay( 3.0f );
+ DALI_TEST_EQUALS( 3.0f, button.GetProperty< float >( PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY ), TEST_LOCATION );
+ button.SetProperty( PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY, 4.0f );
+ DALI_TEST_EQUALS( 4.0f, button.GetNextAutoRepeatingDelay(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 4.0f, button.GetProperty< float >( PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY ), TEST_LOCATION );
+
+ // PushButton::PROPERTY_TOGGLABLE
+ button.SetToggleButton( false );
+ DALI_TEST_CHECK( ! button.GetProperty< bool >( PushButton::PROPERTY_TOGGLABLE ) );
+ button.SetProperty( PushButton::PROPERTY_TOGGLABLE, true );
+ DALI_TEST_CHECK( button.IsToggleButton() ) ;
+ DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_TOGGLABLE ) );
+
+ // PushButton::PROPERTY_TOGGLE
+ button.SetToggled( false );
+ DALI_TEST_CHECK( ! button.GetProperty< bool >( PushButton::PROPERTY_TOGGLE ) );
+ button.SetProperty( PushButton::PROPERTY_TOGGLE, true );
+ DALI_TEST_CHECK( button.IsToggled() ) ;
+ DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_TOGGLE ) );
+
+ // PushButton::PROPERTY_BUTTON_IMAGE
+ DALI_TEST_CHECK( button.GetProperty< std::string >( PushButton::PROPERTY_BUTTON_IMAGE ).empty() );
+ button.SetButtonImage( Image::New( "FunctionButtonImage") );
+ DALI_TEST_EQUALS( "FunctionButtonImage", button.GetProperty< std::string >( PushButton::PROPERTY_BUTTON_IMAGE ), TEST_LOCATION );
+ button.SetProperty( PushButton::PROPERTY_BUTTON_IMAGE, "PropertyButtonImage" );
+ DALI_TEST_EQUALS( "PropertyButtonImage", button.GetProperty< std::string >( PushButton::PROPERTY_BUTTON_IMAGE ), TEST_LOCATION );
+
+ // PushButton::PROPERTY_PRESSED_IMAGE
+ DALI_TEST_CHECK( button.GetProperty< std::string >( PushButton::PROPERTY_PRESSED_IMAGE ).empty() );
+ button.SetPressedImage( Image::New( "FunctionPressedImage") );
+ DALI_TEST_EQUALS( "FunctionPressedImage", button.GetProperty< std::string >( PushButton::PROPERTY_PRESSED_IMAGE ), TEST_LOCATION );
+ button.SetProperty( PushButton::PROPERTY_PRESSED_IMAGE, "PropertyPressedImage" );
+ DALI_TEST_EQUALS( "PropertyPressedImage", button.GetProperty< std::string >( PushButton::PROPERTY_PRESSED_IMAGE ), TEST_LOCATION );
+
+ // PushButton::PROPERTY_DIMMED_IMAGE
+ DALI_TEST_CHECK( button.GetProperty< std::string >( PushButton::PROPERTY_DIMMED_IMAGE ).empty() );
+ button.SetDimmedImage( Image::New( "FunctionDimmedImage") );
+ DALI_TEST_EQUALS( "FunctionDimmedImage", button.GetProperty< std::string >( PushButton::PROPERTY_DIMMED_IMAGE ), TEST_LOCATION );
+ button.SetProperty( PushButton::PROPERTY_DIMMED_IMAGE, "PropertyDimmedImage" );
+ DALI_TEST_EQUALS( "PropertyDimmedImage", button.GetProperty< std::string >( PushButton::PROPERTY_DIMMED_IMAGE ), TEST_LOCATION );
+
+ // PushButton::PROPERTY_LABEL_TEXT
+ DALI_TEST_CHECK( button.GetProperty< std::string >( PushButton::PROPERTY_LABEL_TEXT ).empty() );
+ button.SetLabelText( "FunctionLabel" );
+ DALI_TEST_EQUALS( "FunctionLabel", button.GetProperty< std::string >( PushButton::PROPERTY_LABEL_TEXT ), TEST_LOCATION );
+ button.SetProperty( PushButton::PROPERTY_LABEL_TEXT, "PropertyLabel" );
+ DALI_TEST_EQUALS( "PropertyLabel", button.GetProperty< std::string >( PushButton::PROPERTY_LABEL_TEXT ), TEST_LOCATION );
+}
:include:/dali-internal-test-suite/text-view/tslist
##### DEBUG #####
+debug
+ /dali-test-suite/buttons/utc-Dali-PushButton
+
# EOF
// Signal Names
static const char* const SIGNAL_CLICKED;
+ // Properties
+ static const Property::Index PROPERTY_DIMMED; ///< name "dimmed", @see SetDimmed(), type BOOLEAN
+
public:
/**
{
public:
- //Signal Names
+ // Signal Names
static const char* const SIGNAL_TOGGLED;
static const char* const SIGNAL_PRESSED;
static const char* const SIGNAL_RELEASED;
- //Action Names
+ // Action Names
static const char* const ACTION_PUSH_BUTTON_CLICK;
+ // Properties
+ static const Property::Index PROPERTY_AUTO_REPEATING; ///< name "auto-repeating", @see SetAutoRepeating(), type BOOLEAN
+ static const Property::Index PROPERTY_INITIAL_AUTO_REPEATING_DELAY; ///< name "initial-auto-repeating-delay", @see SetInitialAutoRepeatingDelay(), type FLOAT
+ static const Property::Index PROPERTY_NEXT_AUTO_REPEATING_DELAY; ///< name "next-auto-repeating-delay", @see SetNextAutoRepeatingDelay(), type FLOAT
+ static const Property::Index PROPERTY_TOGGLABLE; ///< name "togglable", @see SetToggleButton(), type BOOLEAN
+ static const Property::Index PROPERTY_TOGGLE; ///< name "toggle", @see SetToggled(), type BOOLEAN
+ static const Property::Index PROPERTY_BUTTON_IMAGE; ///< name "button-image", @see SetButtonImage(Image), type STRING
+ static const Property::Index PROPERTY_PRESSED_IMAGE; ///< name "pressed-image", @see SetPressedImage(Image), type STRING
+ static const Property::Index PROPERTY_DIMMED_IMAGE; ///< name "dimmed-image", @see SetDimmedImage(Image), type STRING
+ static const Property::Index PROPERTY_LABEL_TEXT; ///< name "label-text", @see SetLabelText(const std::string&), type STRING
+
public:
/**
{
public:
+ // Properties
+ enum
+ {
+ CONTROL_PROPERTY_START_INDEX = PropertyRegistration::START_INDEX,
+ CONTROL_PROPERTY_END_INDEX = CONTROL_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices
+ };
+
// Creation
/**
{
public:
- //Action Names
+ // Action Names
static const char* const ACTION_CONTROL_ACTIVATED;
- //Signal Names
+ // Signal Names
static const char* const SIGNAL_KEY_EVENT;
/**
namespace Toolkit
{
-namespace Internal
-{
+const Property::Index Button::PROPERTY_DIMMED( Internal::Button::BUTTON_PROPERTY_START_INDEX );
namespace Internal
{
-using namespace Dali;
+namespace
+{
BaseHandle Create()
{
SignalConnectorType signalConnector1( typeRegistration, Toolkit::Button::SIGNAL_CLICKED, &Button::DoConnectSignal );
-}
+PropertyRegistration property1( typeRegistration, "dimmed", Toolkit::Button::PROPERTY_DIMMED, Property::BOOLEAN, &Button::SetProperty, &Button::GetProperty );
+
+} // unnamed namespace
Button::Button()
: ControlImpl( true ),
mPainter->Initialize( handle );
}
+ Actor self = Self();
+
mTapDetector = TapGestureDetector::New();
- mTapDetector.Attach(Self());
+ mTapDetector.Attach( self );
mTapDetector.DetectedSignal().Connect(this, &Button::OnTap);
OnButtonInitialize();
- Actor self = Self();
- mPropertyDimmed = self.RegisterProperty( PROPERTY_DIMMED, false, Property::READ_WRITE );
-
self.SetKeyboardFocusable( true );
}
}
}
-void Button::OnPropertySet( Property::Index index, Property::Value propertyValue )
-{
- if( index == mPropertyDimmed )
- {
- SetDimmed(propertyValue.Get<bool>());
- }
-}
-
void Button::OnTap(Actor actor, TapGesture tap)
{
// Do nothing.
}
}
+void Button::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+ Toolkit::Button button = Toolkit::Button::DownCast( Dali::BaseHandle( object ) );
+
+ if ( button && ( index == Toolkit::Button::PROPERTY_DIMMED ) )
+ {
+ GetImplementation( button ).SetDimmed( value.Get<bool>() );
+ }
+}
+
+Property::Value Button::GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+ Toolkit::Button button = Toolkit::Button::DownCast( Dali::BaseHandle( object ) );
+
+ if ( button && ( propertyIndex == Toolkit::Button::PROPERTY_DIMMED ) )
+ {
+ return Property::Value( GetImplementation( button ).mDimmed );
+ }
+
+ return Property::Value();
+}
+
} // namespace Internal
} // namespace Toolkit
*/
class Button : public ControlImpl
{
+public:
+
+ // Properties
+ enum
+ {
+ BUTTON_PROPERTY_START_INDEX = ControlImpl::CONTROL_PROPERTY_END_INDEX + 1,
+ BUTTON_PROPERTY_END_INDEX = BUTTON_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices
+ };
protected:
*/
static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ // Properties
+
+ /**
+ * Called when a property of an object of this type is set.
+ * @param[in] object The object whose property is set.
+ * @param[in] index The property index.
+ * @param[in] value The new property value.
+ */
+ static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+
+ /**
+ * Called to retrieve a property of an object of this type.
+ * @param[in] object The object whose property is to be retrieved.
+ * @param[in] index The property index.
+ * @return The current value of the property.
+ */
+ static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+
protected: // From CustomActorImpl
/**
*/
virtual void OnControlSizeSet( const Vector3& targetSize );
- /**
- * @copydoc Dali::CustomActorImpl::OnPropertySet()
- */
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
-
private:
/**
Toolkit::Button::ClickedSignalV2 mClickedSignalV2; ///< Signal emitted when the button is clicked.
TapGestureDetector mTapDetector;
-
- Property::Index mPropertyDimmed; ///< Property index for dimmed.
};
} // namespace Internal
namespace Toolkit
{
+const Property::Index PushButton::PROPERTY_AUTO_REPEATING = Internal::Button::BUTTON_PROPERTY_END_INDEX + 1;
+const Property::Index PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY = Internal::Button::BUTTON_PROPERTY_END_INDEX + 2;
+const Property::Index PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY = Internal::Button::BUTTON_PROPERTY_END_INDEX + 3;
+const Property::Index PushButton::PROPERTY_TOGGLABLE = Internal::Button::BUTTON_PROPERTY_END_INDEX + 4;
+const Property::Index PushButton::PROPERTY_TOGGLE = Internal::Button::BUTTON_PROPERTY_END_INDEX + 5;
+const Property::Index PushButton::PROPERTY_BUTTON_IMAGE = Internal::Button::BUTTON_PROPERTY_END_INDEX + 6;
+const Property::Index PushButton::PROPERTY_PRESSED_IMAGE = Internal::Button::BUTTON_PROPERTY_END_INDEX + 8;
+const Property::Index PushButton::PROPERTY_DIMMED_IMAGE = Internal::Button::BUTTON_PROPERTY_END_INDEX + 9;
+const Property::Index PushButton::PROPERTY_LABEL_TEXT = Internal::Button::BUTTON_PROPERTY_END_INDEX + 11;
+
namespace Internal
{
namespace
{
-using namespace Dali;
-
BaseHandle Create()
{
return Toolkit::PushButton::New();
TypeAction action1( typeRegistration, Toolkit::PushButton::ACTION_PUSH_BUTTON_CLICK, &PushButton::DoAction );
-}
+PropertyRegistration property1( typeRegistration, "auto-repeating", Toolkit::PushButton::PROPERTY_AUTO_REPEATING, Property::BOOLEAN, &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property2( typeRegistration, "initial-auto-repeating-delay", Toolkit::PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY, Property::FLOAT, &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property3( typeRegistration, "next-auto-repeating-delay", Toolkit::PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY, Property::FLOAT, &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property4( typeRegistration, "togglable", Toolkit::PushButton::PROPERTY_TOGGLABLE, Property::BOOLEAN, &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property5( typeRegistration, "toggle", Toolkit::PushButton::PROPERTY_TOGGLE, Property::BOOLEAN, &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property6( typeRegistration, "button-image", Toolkit::PushButton::PROPERTY_BUTTON_IMAGE, Property::STRING, &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property7( typeRegistration, "pressed-image", Toolkit::PushButton::PROPERTY_PRESSED_IMAGE, Property::STRING, &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property8( typeRegistration, "dimmed-image", Toolkit::PushButton::PROPERTY_DIMMED_IMAGE, Property::STRING, &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property9( typeRegistration, "label-text", Toolkit::PushButton::PROPERTY_LABEL_TEXT, Property::STRING, &PushButton::SetProperty, &PushButton::GetProperty );
+} // unnamed namespace
namespace
{
- const unsigned int INITIAL_AUTOREPEATING_DELAY( 0.15f );
- const unsigned int NEXT_AUTOREPEATING_DELAY( 0.05f );
- // Helper function used to cast a ButtonPainter to PushButtonDefaultPainter
- PushButtonDefaultPainterPtr GetPushButtonPainter( Dali::Toolkit::Internal::ButtonPainterPtr painter )
+const unsigned int INITIAL_AUTOREPEATING_DELAY( 0.15f );
+const unsigned int NEXT_AUTOREPEATING_DELAY( 0.05f );
+
+// Helper function used to cast a ButtonPainter to PushButtonDefaultPainter
+PushButtonDefaultPainterPtr GetPushButtonPainter( Dali::Toolkit::Internal::ButtonPainterPtr painter )
+{
+ return static_cast<PushButtonDefaultPainter*>( painter.Get() );
+}
+
+/**
+ * Helper function to checks if the specified actor is an ImageActor and if it has an Image with a path.
+ *
+ * @param[in] actor Actor handle to check.
+ * @param[out] path The image path will be applied to this parameter, if available.
+ * If not available then this will be an empty string.
+ */
+void GetImageActorFilename( Actor& actor, std::string& path )
+{
+ path = ""; // Just return an empty string if not using ImageActor with an image
+
+ if ( actor )
{
- return static_cast<PushButtonDefaultPainter*>( painter.Get() );
+ ImageActor imageActor = ImageActor::DownCast( actor );
+ if ( imageActor )
+ {
+ Image image = imageActor.GetImage();
+ if ( image )
+ {
+ path = image.GetFilename();
+ }
+ }
}
-} // namespace
+}
+
+} // unnamed namespace
Dali::Toolkit::PushButton PushButton::New()
{
return connected;
}
+void PushButton::SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
+{
+ Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( Dali::BaseHandle( object ) );
+
+ if ( pushButton )
+ {
+ PushButton& pushButtonImpl( GetImplementation( pushButton ) );
+
+ switch ( propertyIndex )
+ {
+ case Toolkit::PushButton::PROPERTY_AUTO_REPEATING:
+ {
+ pushButtonImpl.SetAutoRepeating( value.Get< bool >() );
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY:
+ {
+ pushButtonImpl.SetInitialAutoRepeatingDelay( value.Get< float >() );
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY:
+ {
+ pushButtonImpl.SetNextAutoRepeatingDelay( value.Get< float >() );
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_TOGGLABLE:
+ {
+ pushButtonImpl.SetToggleButton( value.Get< bool >() );
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_TOGGLE:
+ {
+ pushButtonImpl.SetToggled( value.Get< bool >() );
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_BUTTON_IMAGE:
+ {
+ Image image = Image::New( value.Get<std::string>() );
+ pushButtonImpl.SetButtonImage( image );
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_PRESSED_IMAGE:
+ {
+ Image image = Image::New( value.Get<std::string>() );
+ pushButtonImpl.SetPressedImage( image );
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_DIMMED_IMAGE:
+ {
+ Image image = Image::New( value.Get<std::string>() );
+ pushButtonImpl.SetDimmedImage( image );
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_LABEL_TEXT:
+ {
+ pushButtonImpl.SetLabelText( value.Get< std::string >() );
+ break;
+ }
+ }
+ }
+}
+
+Property::Value PushButton::GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+ Property::Value value;
+
+ Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( Dali::BaseHandle( object ) );
+
+ if ( pushButton )
+ {
+ PushButton& pushButtonImpl( GetImplementation( pushButton ) );
+
+ switch ( propertyIndex )
+ {
+ case Toolkit::PushButton::PROPERTY_AUTO_REPEATING:
+ {
+ value = pushButtonImpl.mAutoRepeating;
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY:
+ {
+ value = pushButtonImpl.mInitialAutoRepeatingDelay;
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY:
+ {
+ value = pushButtonImpl.mNextAutoRepeatingDelay;
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_TOGGLABLE:
+ {
+ value = pushButtonImpl.mToggleButton;
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_TOGGLE:
+ {
+ value = pushButtonImpl.mToggled;
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_BUTTON_IMAGE:
+ {
+ std::string path;
+ GetImageActorFilename( pushButtonImpl.mButtonImage, path );
+ value = path;
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_PRESSED_IMAGE:
+ {
+ std::string path;
+ GetImageActorFilename( pushButtonImpl.mPressedImage, path );
+ value = path;
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_DIMMED_IMAGE:
+ {
+ std::string path;
+ GetImageActorFilename( pushButtonImpl.mDimmedImage, path );
+ value = path;
+ break;
+ }
+
+ case Toolkit::PushButton::PROPERTY_LABEL_TEXT:
+ {
+ value = ""; // Just return an empty string if not using a TextView
+
+ if ( pushButtonImpl.mLabel )
+ {
+ Toolkit::TextView textView = Toolkit::TextView::DownCast( pushButtonImpl.mLabel );
+ if ( textView )
+ {
+ value = textView.GetText();
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ return value;
+}
+
void PushButton::OnButtonInitialize()
{
// Push button requires the Leave event.
*/
Actor& GetFadeOutButtonImage();
-public: // Signals
+public:
+
+ // Signals
/**
* @copydoc Dali::Toolkit::PushButton::ToggledSignal()
*/
static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ // Properties
+
+ /**
+ * @copydoc Button::SetProperty
+ */
+ static void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value );
+
+ /**
+ * @copydoc Button::GetProperty
+ */
+ static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+
protected: // From Button
/**