From: Ferran Sole Date: Wed, 18 Feb 2015 14:34:16 +0000 (+0000) Subject: [dali_1.0.30] Merge branch 'tizen' X-Git-Tag: dali_1.9.8~5^2~258 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=3b16ae16f01bd50a26e6c44e6e20ebb8499b4f91;hp=f4d559ea999cbbc44b1ecd489c4ca3711d37feca [dali_1.0.30] Merge branch 'tizen' Change-Id: I012842251d83d6bef14bee9ada8ce2fb0129033b --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp index 9885e19..500b653 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp @@ -18,10 +18,10 @@ #include #include +#include #include #include #include -#include using namespace Dali; @@ -30,10 +30,10 @@ using namespace Toolkit; namespace { -static bool gPushButtonToggleState = false; -bool PushButtonToggled( Button button, bool toggled ) +static bool gPushButtonSelectedState = false; +bool PushButtonSelected( Button button, bool selected ) { - gPushButtonToggleState = toggled && ( toggled == static_cast( button ).IsToggled() ); + gPushButtonSelectedState = selected && ( selected == static_cast( button ).IsSelected() ); return true; } @@ -67,15 +67,15 @@ class TETButton; } /** - * Creates a Button to test if interrupt events are handled correctly. + * Creates a PushButton to test if interrupt events are handled correctly. */ -class TETButton : public Button +class TETButton : public PushButton { public: // PushButton Pressed - typedef Signal< bool ( Button ) > PressedSignalType; + typedef Signal< bool ( PushButton ) > ButtonSignalType; - PressedSignalType& PressedSignal(); + ButtonSignalType& PressedSignal(); /** * Default constructor. @@ -85,7 +85,7 @@ public: /** * Copy constructor. */ - TETButton( const Button& button ); + TETButton( const PushButton& button ); /** * Assignment operator. @@ -121,7 +121,7 @@ namespace Internal /** * Internal implementation */ -class TETButton : public Button +class TETButton : public PushButton { public: /** @@ -142,7 +142,7 @@ public: /** * @return the pressed signal. */ - Toolkit::TETButton::PressedSignalType& PressedSignal(); + Toolkit::TETButton::ButtonSignalType& PressedSignal(); /** * Callback called when an interrupt events is received. @@ -154,7 +154,7 @@ public: */ void OnButtonDown(); - Toolkit::TETButton::PressedSignalType mPressedSignal; ///< Signal emitted when the button is pressed. + Toolkit::TETButton::ButtonSignalType mPressedSignal; ///< Signal emitted when the button is pressed. }; } // namespace Internal @@ -163,8 +163,8 @@ TETButton::TETButton() { } -TETButton::TETButton( const Button& button ) -: Button( button ) +TETButton::TETButton( const PushButton& button ) +: PushButton( button ) { } @@ -172,7 +172,7 @@ TETButton& TETButton::operator=( const TETButton& button ) { if( &button != this ) { - Button::operator=( button ); + PushButton::operator=( button ); } return *this; } @@ -187,7 +187,7 @@ TETButton TETButton::DownCast( BaseHandle handle ) return Control::DownCast(handle); } -TETButton::PressedSignalType& TETButton::PressedSignal() +TETButton::ButtonSignalType& TETButton::PressedSignal() { TETButton button( *this ); DALI_ASSERT_ALWAYS( button ); @@ -198,11 +198,11 @@ TETButton::PressedSignalType& TETButton::PressedSignal() } TETButton::TETButton( Internal::TETButton& implementation ) -: Button( implementation ) +: PushButton( implementation ) {} TETButton::TETButton( Dali::Internal::CustomActor* internal ) -: Button( internal ) +: PushButton( internal ) { VerifyCustomActorPointer(internal); } @@ -211,7 +211,7 @@ namespace Internal { TETButton::TETButton() -: Button(), +: PushButton(), mPressedSignal() { } @@ -235,7 +235,7 @@ Toolkit::TETButton TETButton::New() return tetButton; } -Toolkit::TETButton::PressedSignalType& TETButton::PressedSignal() +Toolkit::TETButton::ButtonSignalType& TETButton::PressedSignal() { return mPressedSignal; } @@ -277,7 +277,7 @@ public: { } - bool Callback( Button button ) + bool Callback( PushButton button ) { switch( mTest ) { @@ -660,18 +660,18 @@ int UtcDaliPushButtonProperties(void) DALI_TEST_EQUALS( 4.0f, button.GetProperty< float >( Button::PROPERTY_NEXT_AUTO_REPEATING_DELAY ), TEST_LOCATION ); // Button::PROPERTY_TOGGLABLE - button.SetToggleButton( false ); + button.SetTogglableButton( false ); DALI_TEST_CHECK( ! button.GetProperty< bool >( Button::PROPERTY_TOGGLABLE ) ); button.SetProperty( Button::PROPERTY_TOGGLABLE, true ); - DALI_TEST_CHECK( button.IsToggleButton() ) ; + DALI_TEST_CHECK( button.IsTogglableButton() ) ; DALI_TEST_CHECK( button.GetProperty< bool >( Button::PROPERTY_TOGGLABLE ) ); - // Button::PROPERTY_TOGGLED - button.SetToggled( false ); - DALI_TEST_CHECK( ! button.GetProperty< bool >( Button::PROPERTY_TOGGLED ) ); - button.SetProperty( Button::PROPERTY_TOGGLED, true ); - DALI_TEST_CHECK( button.IsToggled() ) ; - DALI_TEST_CHECK( button.GetProperty< bool >( Button::PROPERTY_TOGGLED ) ); + // Button::PROPERTY_SELECTED + button.SetSelected( false ); + DALI_TEST_CHECK( ! button.GetProperty< bool >( Button::PROPERTY_SELECTED ) ); + button.SetProperty( Button::PROPERTY_SELECTED, true ); + DALI_TEST_CHECK( button.IsSelected() ) ; + DALI_TEST_CHECK( button.GetProperty< bool >( Button::PROPERTY_SELECTED ) ); // Button::PROPERTY_NORMAL_STATE_ACTOR { diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp index 7f784b6..e2b419e 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp @@ -50,10 +50,9 @@ DummyControl& DummyControl::operator=(const DummyControl& control) } // Used to test signal connections -void DummyControlImpl::CustomSlot1( Actor actor, const Vector3& value ) +void DummyControlImpl::CustomSlot1( Actor actor ) { mCustomSlot1Called = true; - mCustomSlot1Value = value; } DummyControl DummyControlImpl::New() @@ -66,8 +65,7 @@ DummyControl DummyControlImpl::New() DummyControlImpl::DummyControlImpl() : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ), - mCustomSlot1Called(false), - mCustomSlot1Value(Vector3::ZERO) + mCustomSlot1Called(false) { } diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h index 96f10b2..d923ac18 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h @@ -72,10 +72,9 @@ public: inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); } // Used to test signal connections - void CustomSlot1( Actor actor, const Vector3& value ); + void CustomSlot1( Actor actor ); bool mCustomSlot1Called; - Vector3 mCustomSlot1Value; protected: diff --git a/automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp index f016900..6892c84 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp @@ -27,9 +27,9 @@ namespace { static bool gCheckBoxButtonState = false; -bool CheckBoxButtonClicked( Button button, bool state ) +bool CheckBoxButtonClicked( Button button ) { - gCheckBoxButtonState = state; + gCheckBoxButtonState = button.IsSelected(); return true; } @@ -69,10 +69,10 @@ void checkbox_button_cleanup(void) test_return_value = TET_PASS; } -int UtcDaliCheckBoxButtonSetGetChecked(void) +int UtcDaliCheckBoxButtonSetGetSelected(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliCheckBoxButtonSetGetChecked"); + tet_infoline(" UtcDaliCheckBoxButtonSetGetSelected"); CheckBoxButton checkBoxButton = CheckBoxButton::New(); checkBoxButton.StateChangedSignal().Connect( &CheckBoxButtonClicked ); @@ -80,19 +80,19 @@ int UtcDaliCheckBoxButtonSetGetChecked(void) // global var used to check if CheckBoxButtonClicked is called; gCheckBoxButtonState = false; - checkBoxButton.SetChecked( true ); + checkBoxButton.SetSelected( true ); - DALI_TEST_CHECK( checkBoxButton.IsChecked() ); + DALI_TEST_CHECK( checkBoxButton.IsSelected() ); DALI_TEST_CHECK( gCheckBoxButtonState ); - checkBoxButton.SetChecked( false ); + checkBoxButton.SetSelected( false ); - DALI_TEST_CHECK( !checkBoxButton.IsChecked() ); + DALI_TEST_CHECK( !checkBoxButton.IsSelected() ); DALI_TEST_CHECK( !gCheckBoxButtonState ); - checkBoxButton.SetChecked( true ); + checkBoxButton.SetSelected( true ); - DALI_TEST_CHECK( checkBoxButton.IsChecked() ); + DALI_TEST_CHECK( checkBoxButton.IsSelected() ); DALI_TEST_CHECK( gCheckBoxButtonState ); END_TEST; } @@ -148,22 +148,22 @@ int UtcDaliCheckBoxButtonSetImages(void) DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION ); DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION ); - checkBoxButton.SetCheckedImage( image02 ); + checkBoxButton.SetSelectedImage( image02 ); application.SendNotification(); application.Render(); - size = checkBoxButton.GetCheckedImage().GetCurrentSize(); + size = checkBoxButton.GetSelectedImage().GetCurrentSize(); DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION ); DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION ); - checkBoxButton.SetCheckedImage( imageActor02 ); + checkBoxButton.SetSelectedImage( imageActor02 ); application.SendNotification(); application.Render(); - size = checkBoxButton.GetCheckedImage().GetCurrentSize(); + size = checkBoxButton.GetSelectedImage().GetCurrentSize(); DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION ); DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION ); @@ -188,22 +188,22 @@ int UtcDaliCheckBoxButtonSetImages(void) DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION ); DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION ); - checkBoxButton.SetDisabledCheckedImage( image04 ); + checkBoxButton.SetDisabledSelectedImage( image04 ); application.SendNotification(); application.Render(); - size = checkBoxButton.GetDisabledCheckedImage().GetCurrentSize(); + size = checkBoxButton.GetDisabledSelectedImage().GetCurrentSize(); DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION ); DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION ); - checkBoxButton.SetDisabledCheckedImage( imageActor04 ); + checkBoxButton.SetDisabledSelectedImage( imageActor04 ); application.SendNotification(); application.Render(); - size = checkBoxButton.GetDisabledCheckedImage().GetCurrentSize(); + size = checkBoxButton.GetDisabledSelectedImage().GetCurrentSize(); DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION ); DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp index c58bb83..95136ce 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp @@ -271,28 +271,24 @@ int UtcDaliControlSignalConnectDisconnect(void) DummyControl dummy = DummyControlImpl::New(); Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION ); Toolkit::Internal::Control& control = dummy.GetImplementation(); DummyControlImpl* dummyImpl = dynamic_cast(&control); DALI_TEST_CHECK( dummyImpl ); - actor.SetSizeSignal().Connect( dummyImpl, &DummyControlImpl::CustomSlot1 ); - DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 1u, TEST_LOCATION ); + actor.OnStageSignal().Connect( dummyImpl, &DummyControlImpl::CustomSlot1 ); + DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 1u, TEST_LOCATION ); DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, false, TEST_LOCATION ); - DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Value, Vector3::ZERO, TEST_LOCATION ); - const Vector3 newSize( 10, 10, 0 ); - actor.SetSize( newSize ); + Stage::GetCurrent().Add( actor ); DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Value, newSize, TEST_LOCATION ); dummyImpl->mCustomSlot1Called = false; - actor.SetSizeSignal().Disconnect( dummyImpl, &DummyControlImpl::CustomSlot1 ); - DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION ); - const Vector3 ignoredSize( 20, 20, 0 ); - actor.SetSize( ignoredSize ); + actor.OnStageSignal().Disconnect( dummyImpl, &DummyControlImpl::CustomSlot1 ); + DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION ); + Stage::GetCurrent().Remove( actor ); + Stage::GetCurrent().Add( actor ); DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, false, TEST_LOCATION ); - DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Value, newSize/*not ignoredSize*/, TEST_LOCATION ); } END_TEST; } @@ -309,19 +305,17 @@ int UtcDaliControlSignalAutomaticDisconnect(void) DummyControlImpl* dummyImpl = dynamic_cast(&control); DALI_TEST_CHECK( dummyImpl ); - actor.SetSizeSignal().Connect( dummyImpl, &DummyControlImpl::CustomSlot1 ); - DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 1u, TEST_LOCATION ); + actor.OnStageSignal().Connect( dummyImpl, &DummyControlImpl::CustomSlot1 ); + DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 1u, TEST_LOCATION ); DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, false, TEST_LOCATION ); - DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Value, Vector3::ZERO, TEST_LOCATION ); - const Vector3 newSize( 10, 10, 0 ); - actor.SetSize( newSize ); + Stage::GetCurrent().Add( actor ); DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Value, newSize, TEST_LOCATION ); + Stage::GetCurrent().Remove( actor ); } // dummyControl automatically disconnects - DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION ); const Vector3 ignoredSize( 20, 20, 0 ); actor.SetSize( ignoredSize ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp index 2f0b7fc..7313afc 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp @@ -42,10 +42,10 @@ void utc_dali_toolkit_pushbutton_cleanup(void) namespace { -static bool gPushButtonToggleState = false; -bool PushButtonToggled( Button button, bool toggled ) +static bool gPushButtonSelectedState = false; +bool PushButtonSelected( Button button ) { - gPushButtonToggleState = toggled && ( toggled == static_cast( button ).IsToggled() ); + gPushButtonSelectedState = button.IsSelected(); return true; } @@ -118,101 +118,101 @@ int UtcDaliPushButtonSetGetAutoRepeating(void) END_TEST; } -int UtcDaliPushButtonSetGetToggleButton(void) +int UtcDaliPushButtonSetGetTogglableButton(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliPushButtonSetGetToggleButton"); + tet_infoline(" UtcDaliPushButtonSetGetTogglableButton"); PushButton pushButton = PushButton::New(); - pushButton.SetToggleButton( true ); + pushButton.SetTogglableButton( true ); - DALI_TEST_CHECK( pushButton.IsToggleButton() ); + DALI_TEST_CHECK( pushButton.IsTogglableButton() ); - pushButton.SetToggleButton( false ); + pushButton.SetTogglableButton( false ); - DALI_TEST_CHECK( !pushButton.IsToggleButton() ); + DALI_TEST_CHECK( !pushButton.IsTogglableButton() ); - pushButton.SetToggleButton( true ); + pushButton.SetTogglableButton( true ); - DALI_TEST_CHECK( pushButton.IsToggleButton() ); + DALI_TEST_CHECK( pushButton.IsTogglableButton() ); END_TEST; } -int UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton(void) +int UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton"); + tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton"); PushButton pushButton = PushButton::New(); pushButton.SetAutoRepeating( true ); - pushButton.SetToggleButton( true ); + pushButton.SetTogglableButton( true ); - DALI_TEST_CHECK( pushButton.IsToggleButton() ); + DALI_TEST_CHECK( pushButton.IsTogglableButton() ); DALI_TEST_CHECK( !pushButton.IsAutoRepeating() ); - pushButton.SetToggleButton( true ); + pushButton.SetTogglableButton( true ); pushButton.SetAutoRepeating( true ); DALI_TEST_CHECK( pushButton.IsAutoRepeating() ); - DALI_TEST_CHECK( !pushButton.IsToggleButton() ); + DALI_TEST_CHECK( !pushButton.IsTogglableButton() ); END_TEST; } -int UtcDaliPushButtonSetGetToggled01(void) +int UtcDaliPushButtonSetGetSelected01(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliPushButtonSetGetToggled01"); + tet_infoline(" UtcDaliPushButtonSetGetSelected01"); PushButton pushButton = PushButton::New(); - pushButton.SetToggleButton( true ); - pushButton.StateChangedSignal().Connect( &PushButtonToggled ); + pushButton.SetTogglableButton( true ); + pushButton.StateChangedSignal().Connect( &PushButtonSelected ); - gPushButtonToggleState = false; - pushButton.SetToggled( true ); + gPushButtonSelectedState = false; + pushButton.SetSelected( true ); - DALI_TEST_CHECK( pushButton.IsToggled() ); - DALI_TEST_CHECK( gPushButtonToggleState ); + DALI_TEST_CHECK( pushButton.IsSelected() ); + DALI_TEST_CHECK( gPushButtonSelectedState ); - pushButton.SetToggled( false ); + pushButton.SetSelected( false ); - DALI_TEST_CHECK( !pushButton.IsToggled() ); - DALI_TEST_CHECK( !gPushButtonToggleState ); + DALI_TEST_CHECK( !pushButton.IsSelected() ); + DALI_TEST_CHECK( !gPushButtonSelectedState ); - pushButton.SetToggled( true ); + pushButton.SetSelected( true ); - DALI_TEST_CHECK( pushButton.IsToggled() ); - DALI_TEST_CHECK( gPushButtonToggleState ); + DALI_TEST_CHECK( pushButton.IsSelected() ); + DALI_TEST_CHECK( gPushButtonSelectedState ); END_TEST; } -int UtcDaliPushButtonSetGetToggled02(void) +int UtcDaliPushButtonSetGetSelected02(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliPushButtonSetGetToggled02"); + tet_infoline(" UtcDaliPushButtonSetGetSelected02"); PushButton pushButton = PushButton::New(); - pushButton.SetToggleButton( false ); - pushButton.StateChangedSignal().Connect( &PushButtonToggled ); + pushButton.SetTogglableButton( false ); + pushButton.StateChangedSignal().Connect( &PushButtonSelected ); - gPushButtonToggleState = false; - pushButton.SetToggled( true ); + gPushButtonSelectedState = false; + pushButton.SetSelected( true ); - DALI_TEST_CHECK( !pushButton.IsToggled() ); - DALI_TEST_CHECK( !gPushButtonToggleState ); + DALI_TEST_CHECK( !pushButton.IsSelected() ); + DALI_TEST_CHECK( !gPushButtonSelectedState ); - pushButton.SetToggled( false ); + pushButton.SetSelected( false ); - DALI_TEST_CHECK( !pushButton.IsToggled() ); - DALI_TEST_CHECK( !gPushButtonToggleState ); + DALI_TEST_CHECK( !pushButton.IsSelected() ); + DALI_TEST_CHECK( !gPushButtonSelectedState ); - pushButton.SetToggled( true ); + pushButton.SetSelected( true ); - DALI_TEST_CHECK( !pushButton.IsToggled() ); - DALI_TEST_CHECK( !gPushButtonToggleState ); + DALI_TEST_CHECK( !pushButton.IsSelected() ); + DALI_TEST_CHECK( !gPushButtonSelectedState ); END_TEST; } @@ -551,10 +551,10 @@ int UtcDaliPushButtonReleased(void) END_TEST; } -int UtcDaliPushButtonToggled(void) +int UtcDaliPushButtonSelected(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliPushButtonToggled"); + tet_infoline(" UtcDaliPushButtonSelected"); PushButton pushButton = PushButton::New(); pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); @@ -568,13 +568,13 @@ int UtcDaliPushButtonToggled(void) application.Render(); // connect to its touch signal - pushButton.StateChangedSignal().Connect( &PushButtonToggled ); + pushButton.StateChangedSignal().Connect( &PushButtonSelected ); Dali::Integration::TouchEvent event; - // Test1. No toggle button. + // Test1. No togglable button. - gPushButtonToggleState = false; + gPushButtonSelectedState = false; event = Dali::Integration::TouchEvent(); event.AddPoint( pointDownInside ); application.ProcessEvent( event ); @@ -583,13 +583,13 @@ int UtcDaliPushButtonToggled(void) event.AddPoint( pointUpInside ); application.ProcessEvent( event ); - DALI_TEST_CHECK( !gPushButtonToggleState ); + DALI_TEST_CHECK( !gPushButtonSelectedState ); - // Set toggle property. - pushButton.SetToggleButton( true ); + // Set togglable property. + pushButton.SetTogglableButton( true ); // Test2. Touch point down and up inside the button twice. - gPushButtonToggleState = false; + gPushButtonSelectedState = false; event = Dali::Integration::TouchEvent(); event.AddPoint( pointDownInside ); application.ProcessEvent( event ); @@ -598,7 +598,7 @@ int UtcDaliPushButtonToggled(void) event.AddPoint( pointUpInside ); application.ProcessEvent( event ); - DALI_TEST_CHECK( gPushButtonToggleState ); + DALI_TEST_CHECK( gPushButtonSelectedState ); event = Dali::Integration::TouchEvent(); event.AddPoint( pointDownInside ); @@ -608,11 +608,11 @@ int UtcDaliPushButtonToggled(void) event.AddPoint( pointUpInside ); application.ProcessEvent( event ); - DALI_TEST_CHECK( !gPushButtonToggleState ); + DALI_TEST_CHECK( !gPushButtonSelectedState ); // Test3. Touch point down and up outside the button. - gPushButtonToggleState = false; + gPushButtonSelectedState = false; event = Dali::Integration::TouchEvent(); event.AddPoint( pointDownOutside ); application.ProcessEvent( event ); @@ -621,11 +621,11 @@ int UtcDaliPushButtonToggled(void) event.AddPoint( pointUpOutside ); application.ProcessEvent( event ); - DALI_TEST_CHECK( !gPushButtonToggleState ); + DALI_TEST_CHECK( !gPushButtonSelectedState ); // Test4. Touch point down inside and up outside the button. - gPushButtonToggleState = false; + gPushButtonSelectedState = false; event = Dali::Integration::TouchEvent(); event.AddPoint( pointDownInside ); application.ProcessEvent( event ); @@ -638,11 +638,11 @@ int UtcDaliPushButtonToggled(void) event.AddPoint( pointUpOutside ); application.ProcessEvent( event ); - DALI_TEST_CHECK( !gPushButtonToggleState ); + DALI_TEST_CHECK( !gPushButtonSelectedState ); // Test5. Touch point down outside and up inside the button. - gPushButtonToggleState = false; + gPushButtonSelectedState = false; event = Dali::Integration::TouchEvent(); event.AddPoint( pointDownOutside ); application.ProcessEvent( event ); @@ -655,6 +655,6 @@ int UtcDaliPushButtonToggled(void) event.AddPoint( pointUpInside ); application.ProcessEvent( event ); - DALI_TEST_CHECK( !gPushButtonToggleState ); + DALI_TEST_CHECK( !gPushButtonSelectedState ); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp index 66bb90d..9b3c9e5 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp @@ -117,21 +117,13 @@ int UtcDaliRadioButtonLabelActor(void) END_TEST; } -int UtcDaliRadioButtonActive(void) +int UtcDaliRadioButtonSelected(void) { ToolkitTestApplication application; RadioButton radioButton = RadioButton::New(); - // Default active - DALI_TEST_CHECK( radioButton.IsSelected() == false ); - - // False to true - radioButton.ToggleState(); - DALI_TEST_CHECK( radioButton.IsSelected() == true ); - - // True to false - radioButton.ToggleState(); + // Default selected DALI_TEST_CHECK( radioButton.IsSelected() == false ); // False @@ -149,10 +141,10 @@ int UtcDaliRadioButtonActive(void) END_TEST; } -int UtcDaliRadioButtonActiveProperty(void) +int UtcDaliRadioButtonSelectedProperty(void) { ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline(" UtcDaliRadioButtonActiveProperty"); + tet_infoline(" UtcDaliRadioButtonSelectedProperty"); // Create the RadioButton actor RadioButton radioButton = RadioButton::New(); @@ -161,20 +153,20 @@ int UtcDaliRadioButtonActiveProperty(void) radioButton.SetAnchorPoint(ParentOrigin::TOP_LEFT); radioButton.SetPosition( 0.0f, 0.0f ); - // Default active - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + // Default selected + DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_SELECTED ) == false ); - // Setting false active - radioButton.SetProperty( Button::PROPERTY_TOGGLED, false ); - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + // Setting false selected + radioButton.SetProperty( Button::PROPERTY_SELECTED, false ); + DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_SELECTED ) == false ); - // Setting true active - radioButton.SetProperty( Button::PROPERTY_TOGGLED, true ); - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_TOGGLED ) == true ); + // Setting true selected + radioButton.SetProperty( Button::PROPERTY_SELECTED, true ); + DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_SELECTED ) == true ); // Setting false again - radioButton.SetProperty( Button::PROPERTY_TOGGLED, false ); - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + radioButton.SetProperty( Button::PROPERTY_SELECTED, false ); + DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_SELECTED ) == false ); // Test selecting radio buttons RadioButton radioButton2 = RadioButton::New( "label" ); @@ -201,71 +193,91 @@ int UtcDaliRadioButtonActiveProperty(void) application.Render(); // Simulate touch events - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == false ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == false ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == false ); // Select first radio { - Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event1 = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event2 = Dali::Integration::TouchEvent(); + const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 10.0f ); const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 10.0f ); - event.AddPoint( pointUp ); - application.ProcessEvent( event ); + event1.AddPoint( pointDown ); + application.ProcessEvent( event1 ); + + event2.AddPoint( pointUp ); + application.ProcessEvent( event2 ); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == true ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == true ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == false ); } // Select an already selected radio { - Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event1 = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event2 = Dali::Integration::TouchEvent(); - const Dali::TouchPoint pointDown( 0, TouchPoint::Up, 10.0f, 10.0f ); - event.AddPoint( pointDown ); + const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 10.0f ); + const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 10.0f ); + + event1.AddPoint( pointDown ); + application.ProcessEvent( event1 ); - application.ProcessEvent( event ); + event2.AddPoint( pointUp ); + application.ProcessEvent( event2 ); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == true ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == true ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == false ); } // Select second radio { - Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event1 = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event2 = Dali::Integration::TouchEvent(); - const Dali::TouchPoint pointDown( 0, TouchPoint::Up, 10.0f, 50.0f ); - event.AddPoint( pointDown ); + const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 50.0f ); + const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 50.0f ); - application.ProcessEvent( event ); + event1.AddPoint( pointDown ); + application.ProcessEvent( event1 ); + + event2.AddPoint( pointUp ); + application.ProcessEvent( event2 ); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == false ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == true ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == false ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == true ); } // Select outside radio group { - Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event1 = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event2 = Dali::Integration::TouchEvent(); + + const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 500.0f ); + const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 500.0f ); - const Dali::TouchPoint pointDown( 0, TouchPoint::Up, 10.0f, 500.0f ); - event.AddPoint( pointDown ); + event1.AddPoint( pointDown ); + application.ProcessEvent( event1 ); - application.ProcessEvent( event ); + event2.AddPoint( pointUp ); + application.ProcessEvent( event2 ); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == false ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == true ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == false ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == true ); } END_TEST; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp index 7fe943a..b32c92e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp @@ -39,7 +39,6 @@ namespace const char* const PROPERTY_NAME_ROWS = "rows"; const char* const PROPERTY_NAME_COLUMNS = "columns"; const char* const PROPERTY_NAME_CELL_PADDING = "cell-padding"; -const char* const PROPERTY_NAME_LAYOUT_ANIMATION_DURATION = "layout-animation-duration"; const char* const PROPERTY_NAME_LAYOUT_ROWS = "layout-rows"; const char* const PROPERTY_NAME_LAYOUT_COLUMNS = "layout-columns"; @@ -74,8 +73,7 @@ static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor& DALI_TEST_CHECK(tableView); Stage::GetCurrent().Add( tableView ); - tableView.ApplyConstraint( Constraint::New( Actor::SIZE, Constraint100() ) ); - tableView.SetLayoutAnimationDuration(0.0f); + tableView.SetSize( Dali::Vector3( 100.0f, 100.0f, 100.0f ) ); actor1 = Actor::New(); actor2 = Actor::New(); @@ -220,23 +218,6 @@ int UtcDaliTableViewMetricsRelative(void) } -// Test animation duration setting. -int UtcDaliTableViewAnimation(void) -{ - ToolkitTestApplication application; - - tet_infoline("UtcDaliTableViewAnimation"); - TableView tableView = TableView::New(10,10); - DALI_TEST_CHECK(tableView); - - tableView.SetLayoutAnimationDuration(5.0f); - DALI_TEST_EQUALS(tableView.GetLayoutAnimationDuration(), 5.0f, TEST_LOCATION); - - tableView.SetLayoutAnimationDuration(2.5f); - DALI_TEST_EQUALS(tableView.GetLayoutAnimationDuration(), 2.5f, TEST_LOCATION); - END_TEST; -} - // Test Adding/Removing/Finding Children. int UtcDaliTableViewChild(void) { @@ -585,14 +566,6 @@ int UtcDaliTableViewSetGetProperty(void) DALI_TEST_EQUALS( tableView.GetCellPadding(), Size(6.f, 8.f), TEST_LOCATION ); DALI_TEST_EQUALS( tableView.GetProperty(TableView::PROPERTY_CELL_PADDING).Get(), Vector2(6.f,8.f), TEST_LOCATION ); - // Test "layout-animation-duration" property - DALI_TEST_CHECK( tableView.GetPropertyIndex(PROPERTY_NAME_LAYOUT_ANIMATION_DURATION) == TableView::PROPERTY_LAYOUT_ANIMATION_DURATION ); - - tableView.SetProperty( TableView::PROPERTY_LAYOUT_ANIMATION_DURATION, 1.5f ); - - DALI_TEST_EQUALS( tableView.GetLayoutAnimationDuration(), 1.5f, TEST_LOCATION ); - DALI_TEST_EQUALS( tableView.GetProperty(TableView::PROPERTY_LAYOUT_ANIMATION_DURATION).Get(), 1.5f, TEST_LOCATION ); - //{ "policy": "fixed", "value": 30.0 }, Property::Map item1; item1[ "policy" ] = "fixed"; diff --git a/build/tizen/docs-internal/.gitignore b/build/tizen/docs-internal/.gitignore new file mode 100644 index 0000000..412a27f --- /dev/null +++ b/build/tizen/docs-internal/.gitignore @@ -0,0 +1 @@ +build.*.log diff --git a/build/tizen/docs-internal/build.sh b/build/tizen/docs-internal/build.sh new file mode 100755 index 0000000..d995272 --- /dev/null +++ b/build/tizen/docs-internal/build.sh @@ -0,0 +1,16 @@ +# Run doxygen to generate extremely verbose documentation and print the time it took to do so. + +LOG_FILE="build.`date +%Y_%m_%d_%H_%M_%S`.log" + +export START_TIME=`date +%s` +ionice -c 3 nice doxygen ./dali_internal.doxy 2>&1 | tee "$LOG_FILE" +export END_TIME=`date +%s` + +let "BUILD_TIME = $END_TIME - $START_TIME" +let "BUILD_TIME_MINS = $BUILD_TIME / 60" +let "BUILD_TIME_EXTRA_SECONDS = $BUILD_TIME % 60" +BUILD_TIME_MSG="Build ran from $START_TIME until $END_TIME, $BUILD_TIME_MINS minutes and $BUILD_TIME_EXTRA_SECONDS seconds, finishing: `date`." +echo "$BUILD_TIME_MSG" + +WARNINGS=`egrep ": warning: " < $LOG_FILE | wc -l` +echo -e "\nWARNING COUNT: $WARNINGS" diff --git a/build/tizen/docs-internal/dali_internal.doxy b/build/tizen/docs-internal/dali_internal.doxy new file mode 100644 index 0000000..65c3807 --- /dev/null +++ b/build/tizen/docs-internal/dali_internal.doxy @@ -0,0 +1,1458 @@ +# Doxyfile 1.5.6 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "Dali Internal Documentation" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../../../docs/generated-internal + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = YES + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, +# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, +# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, +# and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +#! ToTRY: + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 2 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = Yes + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +# Previous: GENERATE_DEPRECATEDLIST= YES +GENERATE_DEPRECATEDLIST = NO + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +#! ToDo: Fiddle with this (default=NO) +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = ../../../docs/DaliLayout.xml + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = NO + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../../../docs/content \ + ../../../../dali/dali \ + ../../../../dali-core/dali \ + ../../../../dali-adaptor/adaptors/public-api \ + ../../../../dali-adaptor/adaptors/base \ + ../../../../dali-adaptor/adaptors/common \ + ../../../../dali-adaptor/plugins \ + ../../../../dali-adaptor/platform-abstractions/interfaces \ + ../../../../dali-adaptor/platform-abstractions/portable \ + ../../../../dali-adaptor/platform-abstractions/slp \ + ../../../dali-toolkit \ + ../../../texture-atlas-exporter \ + ../../../../dali/automated-tests \ + ../../../../dali-core/automated-tests \ + ../../../../dali-adaptor/automated-tests \ + ../../../automated-tests \ + + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = ../../../docs/content/images + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +#HTML_HEADER = header.html +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. +# HTML_FOOTER = footer.html +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to FRAME, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. Other possible values +# for this tag are: HIERARCHIES, which will generate the Groups, Directories, +# and Class Hiererachy pages using a tree view instead of an ordered list; +# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which +# disables this behavior completely. For backwards compatibility with previous +# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE +# respectively. + +GENERATE_TREEVIEW = TRUE + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = ../../../../dali/dali \ + ../../../../dali-adaptor/adaptors \ + ../../../../dali-adaptor/plugins \ + ../../../../dali-adaptor/platform-abstractions \ + ../../../texture-atlas-exporter/dali-exporter \ + ../../../dali-toolkit \ + /usr/local/include \ + /usr/include + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 500 # 50 is default + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 8 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is enabled by default, which results in a transparent +# background. Warning: Depending on the platform used, enabling this option +# may lead to badly anti-aliased labels on the edges of a graph (i.e. they +# become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/dali-toolkit/internal/controls/alignment/alignment-impl.cpp b/dali-toolkit/internal/controls/alignment/alignment-impl.cpp index e887cb4..97b6f64 100644 --- a/dali-toolkit/internal/controls/alignment/alignment-impl.cpp +++ b/dali-toolkit/internal/controls/alignment/alignment-impl.cpp @@ -301,60 +301,65 @@ struct PositionConstraint const Vector3& currentSize( currentSizeProperty.GetVector3() ); const Vector3& parentSize( parentSizeProperty.GetVector3() ); + return GetPosition( currentSize, parentSize ); + } + + inline Vector3 GetPosition( const Vector3& currentSize, const Vector3& parentSize ) + { Vector3 position( 0.f, 0.f, 0.f ); switch( mHorizontalAlignment ) { - case Dali::Toolkit::Alignment::HorizontalLeft: - { - position.x += mPadding.left; - break; - } - case Dali::Toolkit::Alignment::HorizontalCenter: - { - if( currentSize.width + mPadding.left + mPadding.right >= parentSize.width ) - { - position.x += 0.5f * ( mPadding.left - mPadding.right ); - } - break; - } - case Dali::Toolkit::Alignment::HorizontalRight: - { - position.x -= mPadding.right; - break; - } - default: + case Dali::Toolkit::Alignment::HorizontalLeft: + { + position.x += mPadding.left; + break; + } + case Dali::Toolkit::Alignment::HorizontalCenter: + { + if( currentSize.width + mPadding.left + mPadding.right >= parentSize.width ) { - DALI_ASSERT_ALWAYS( !"Wrong horizontal alignment value" ); - break; + position.x += 0.5f * ( mPadding.left - mPadding.right ); } + break; + } + case Dali::Toolkit::Alignment::HorizontalRight: + { + position.x -= mPadding.right; + break; + } + default: + { + DALI_ASSERT_ALWAYS( !"Wrong horizontal alignment value" ); + break; + } } switch( mVerticalAlignment ) { - case Dali::Toolkit::Alignment::VerticalTop: - { - position.y += mPadding.top; - break; - } - case Dali::Toolkit::Alignment::VerticalCenter: - { - if( currentSize.height + mPadding.top + mPadding.bottom >= parentSize.height ) - { - position.y += 0.5f * ( mPadding.top - mPadding.bottom ); - } - break; - } - case Dali::Toolkit::Alignment::VerticalBottom: - { - position.y -= mPadding.bottom; - break; - } - default: + case Dali::Toolkit::Alignment::VerticalTop: + { + position.y += mPadding.top; + break; + } + case Dali::Toolkit::Alignment::VerticalCenter: + { + if( currentSize.height + mPadding.top + mPadding.bottom >= parentSize.height ) { - DALI_ASSERT_ALWAYS( !"Wrong vertical alignment value" ); - break; + position.y += 0.5f * ( mPadding.top - mPadding.bottom ); } + break; + } + case Dali::Toolkit::Alignment::VerticalBottom: + { + position.y -= mPadding.bottom; + break; + } + default: + { + DALI_ASSERT_ALWAYS( !"Wrong vertical alignment value" ); + break; + } } return position; @@ -364,15 +369,6 @@ struct PositionConstraint const Toolkit::Alignment::Type mHorizontalAlignment; const Toolkit::Alignment::Type mVerticalAlignment; }; - -void SetPositionConstraint( Actor actor, const Toolkit::Alignment::Padding& padding, Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical ) -{ - Constraint constraint = Constraint::New( Actor::POSITION, - LocalSource( Actor::SIZE ), - ParentSource( Actor::SIZE ), - PositionConstraint( padding, horizontal, vertical ) ); - actor.ApplyConstraint( constraint ); -} } // namespace Toolkit::Alignment Alignment::New( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical ) @@ -486,61 +482,51 @@ void Alignment::OnRelayout( const Vector2& size, ActorSizeContainer& container ) actor.SetAnchorPoint( anchorPointAndParentOrigin ); actor.SetParentOrigin( anchorPointAndParentOrigin ); - if( Toolkit::Alignment::ScaleNone != mScaling ) - { - actor.RemoveConstraints(); - } - - Vector3 actorSize ( actor.GetCurrentSize() ); + Vector3 actorSize ( actor.GetSize() ); Toolkit::Control control( Toolkit::Control::DownCast( actor ) ); if ( actorSize == Vector3::ZERO && control ) { actorSize = control.GetNaturalSize(); } - Vector2 childSize; + Vector3 childSize; switch( mScaling ) { case Toolkit::Alignment::ScaleNone: { // Nothing to do but needed just to not to jump to the default. - childSize = size; + childSize = actorSize; break; } case Toolkit::Alignment::ScaleToFill: { ScaleToFillConstraint constraint( mPadding ); - childSize = Vector2( constraint.GetSize( actorSize, Vector3(size) ) ); - SetPositionConstraint( actor, mPadding, mHorizontal, mVertical ); + childSize = constraint.GetSize( actorSize, Vector3(size) ) ; break; } case Toolkit::Alignment::ScaleToFitKeepAspect: { ScaleToFitKeepAspectConstraint constraint( mPadding ); - childSize = Vector2( constraint.GetSize( actorSize, Vector3(size) ) ); - SetPositionConstraint( actor, mPadding, mHorizontal, mVertical ); + childSize = constraint.GetSize( actorSize, Vector3(size) ) ; break; } case Toolkit::Alignment::ScaleToFillKeepAspect: { ScaleToFillKeepAspectConstraint constraint( mPadding ); - childSize = Vector2( constraint.GetSize( actorSize, Vector3(size) ) ); - SetPositionConstraint( actor, mPadding, mHorizontal, mVertical ); + childSize = constraint.GetSize( actorSize, Vector3(size) ); break; } case Toolkit::Alignment::ShrinkToFit: { ShrinkToFitConstraint constraint( mPadding ); - childSize = Vector2( constraint.GetSize( actorSize, Vector3(size) ) ); - SetPositionConstraint( actor, mPadding, mHorizontal, mVertical ); + childSize = constraint.GetSize( actorSize, Vector3(size) ); break; } case Toolkit::Alignment::ShrinkToFitKeepAspect: { ShrinkToFitKeepAspectConstraint constraint( mPadding ); - childSize = Vector2( constraint.GetSize( actorSize, Vector3(size) ) ); - SetPositionConstraint( actor, mPadding, mHorizontal, mVertical ); + childSize = constraint.GetSize( actorSize, Vector3(size) ); break; } default: @@ -550,7 +536,15 @@ void Alignment::OnRelayout( const Vector2& size, ActorSizeContainer& container ) } } - Relayout( actor, childSize, container ); + PositionConstraint positionConstraint(mPadding, mHorizontal, mVertical); + actor.SetPosition( positionConstraint.GetPosition(childSize, actorSize) ); + + if( !control ) + { + actor.SetScale(childSize / actorSize); + } + + Relayout( actor, Vector2(childSize), container ); } } diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index 2cb3d72..eef0cd8 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -21,6 +21,9 @@ // EXTERNAL INCLUDES #include #include +#include +#include +#include namespace Dali { @@ -33,7 +36,7 @@ const Property::Index Button::PROPERTY_AUTO_REPEATING = Internal:: const Property::Index Button::PROPERTY_INITIAL_AUTO_REPEATING_DELAY = Internal::Button::BUTTON_PROPERTY_START_INDEX + 2; const Property::Index Button::PROPERTY_NEXT_AUTO_REPEATING_DELAY = Internal::Button::BUTTON_PROPERTY_START_INDEX + 3; const Property::Index Button::PROPERTY_TOGGLABLE = Internal::Button::BUTTON_PROPERTY_START_INDEX + 4; -const Property::Index Button::PROPERTY_TOGGLED = Internal::Button::BUTTON_PROPERTY_START_INDEX + 5; +const Property::Index Button::PROPERTY_SELECTED = Internal::Button::BUTTON_PROPERTY_START_INDEX + 5; const Property::Index Button::PROPERTY_NORMAL_STATE_ACTOR = Internal::Button::BUTTON_PROPERTY_START_INDEX + 6; const Property::Index Button::PROPERTY_SELECTED_STATE_ACTOR = Internal::Button::BUTTON_PROPERTY_START_INDEX + 7; const Property::Index Button::PROPERTY_DISABLED_STATE_ACTOR = Internal::Button::BUTTON_PROPERTY_START_INDEX + 8; @@ -45,6 +48,9 @@ namespace Internal namespace { +const unsigned int INITIAL_AUTOREPEATING_DELAY( 0.15f ); +const unsigned int NEXT_AUTOREPEATING_DELAY( 0.05f ); + BaseHandle Create() { // empty handle as we cannot create button (but type registered for clicked signal) @@ -53,15 +59,19 @@ BaseHandle Create() TypeRegistration typeRegistration( typeid(Toolkit::Button), typeid(Toolkit::Control), Create ); -SignalConnectorType signalConnector1( typeRegistration, Toolkit::Button::SIGNAL_CLICKED, &Button::DoConnectSignal ); -SignalConnectorType signalConnector2( typeRegistration, Toolkit::Button::SIGNAL_STATE_CHANGED, &Button::DoConnectSignal ); +SignalConnectorType signalConnector1( typeRegistration, Toolkit::Button::SIGNAL_PRESSED , &Button::DoConnectSignal ); +SignalConnectorType signalConnector2( typeRegistration, Toolkit::Button::SIGNAL_RELEASED, &Button::DoConnectSignal ); +SignalConnectorType signalConnector3( typeRegistration, Toolkit::Button::SIGNAL_CLICKED, &Button::DoConnectSignal ); +SignalConnectorType signalConnector4( typeRegistration, Toolkit::Button::SIGNAL_STATE_CHANGED, &Button::DoConnectSignal ); + +TypeAction action1( typeRegistration, Toolkit::Button::ACTION_BUTTON_CLICK, &Button::DoAction ); PropertyRegistration property1( typeRegistration, "disabled", Toolkit::Button::PROPERTY_DISABLED, Property::BOOLEAN, &Button::SetProperty, &Button::GetProperty ); PropertyRegistration property2( typeRegistration, "auto-repeating", Toolkit::Button::PROPERTY_AUTO_REPEATING, Property::BOOLEAN, &Button::SetProperty, &Button::GetProperty ); PropertyRegistration property3( typeRegistration, "initial-auto-repeating-delay", Toolkit::Button::PROPERTY_INITIAL_AUTO_REPEATING_DELAY, Property::FLOAT, &Button::SetProperty, &Button::GetProperty ); PropertyRegistration property4( typeRegistration, "next-auto-repeating-delay", Toolkit::Button::PROPERTY_NEXT_AUTO_REPEATING_DELAY, Property::FLOAT, &Button::SetProperty, &Button::GetProperty ); PropertyRegistration property5( typeRegistration, "togglable", Toolkit::Button::PROPERTY_TOGGLABLE, Property::BOOLEAN, &Button::SetProperty, &Button::GetProperty ); -PropertyRegistration property6( typeRegistration, "toggled", Toolkit::Button::PROPERTY_TOGGLED, Property::BOOLEAN, &Button::SetProperty, &Button::GetProperty ); +PropertyRegistration property6( typeRegistration, "selected", Toolkit::Button::PROPERTY_SELECTED, Property::BOOLEAN, &Button::SetProperty, &Button::GetProperty ); PropertyRegistration property7( typeRegistration, "normal-state-actor", Toolkit::Button::PROPERTY_NORMAL_STATE_ACTOR, Property::MAP, &Button::SetProperty, &Button::GetProperty ); PropertyRegistration property8( typeRegistration, "selected-state-actor", Toolkit::Button::PROPERTY_SELECTED_STATE_ACTOR, Property::MAP, &Button::SetProperty, &Button::GetProperty ); PropertyRegistration property9( typeRegistration, "disabled-state-actor", Toolkit::Button::PROPERTY_DISABLED_STATE_ACTOR, Property::MAP, &Button::SetProperty, &Button::GetProperty ); @@ -71,14 +81,27 @@ PropertyRegistration property10( typeRegistration, "label-actor", Button::Button() : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ), + mTogglableButton( false ), + mSelected( false ), mPainter( NULL ), - mState( ButtonUp ), - mDisabled( false ) + mAutoRepeatingTimer(), + mDisabled( false ), + mAutoRepeating( false ), +// mTogglableButton( false ), +// mSelected( false ), + mInitialAutoRepeatingDelay( INITIAL_AUTOREPEATING_DELAY ), + mNextAutoRepeatingDelay( NEXT_AUTOREPEATING_DELAY ), + mClickActionPerforming( false ), + mState( ButtonUp ) { } Button::~Button() { + if( mAutoRepeatingTimer ) + { + mAutoRepeatingTimer.Reset(); + } } void Button::SetDisabled( bool disabled ) @@ -98,6 +121,94 @@ bool Button::IsDisabled() const return mDisabled; } +void Button::SetAutoRepeating( bool autoRepeating ) +{ + mAutoRepeating = autoRepeating; + + // An autorepeating button can't be a togglable button. + if( autoRepeating ) + { + mTogglableButton = false; + if( mSelected ) + { + // Emit a signal is not wanted, only change the appearance. + Toolkit::Button handle( GetOwner() ); + mPainter->Selected( handle ); + mSelected = false; + } + } + + // Notifies the painter. + mPainter->SetAutoRepeating( mAutoRepeating ); +} + +bool Button::IsAutoRepeating() const +{ + return mAutoRepeating; +} + +void Button::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ) +{ + DALI_ASSERT_ALWAYS( initialAutoRepeatingDelay > 0.f ); + mInitialAutoRepeatingDelay = initialAutoRepeatingDelay; +} + +float Button::GetInitialAutoRepeatingDelay() const +{ + return mInitialAutoRepeatingDelay; +} + +void Button::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ) +{ + DALI_ASSERT_ALWAYS( nextAutoRepeatingDelay > 0.f ); + mNextAutoRepeatingDelay = nextAutoRepeatingDelay; +} + +float Button::GetNextAutoRepeatingDelay() const +{ + return mNextAutoRepeatingDelay; +} + +void Button::SetTogglableButton( bool togglable ) +{ + mTogglableButton = togglable; + + // A togglable button can't be an autorepeating button. + if( togglable ) + { + mAutoRepeating = false; + + // Notifies the painter. + mPainter->SetAutoRepeating( mAutoRepeating ); + } +} + +bool Button::IsTogglableButton() const +{ + return mTogglableButton; +} + +void Button::SetSelected( bool selected ) +{ + if( !mDisabled && mTogglableButton && ( selected != mSelected ) ) + { + mSelected = selected; + + Toolkit::Button handle( GetOwner() ); + + // Notifies the painter the button has been selected. + mPainter->Selected( handle ); + + // Emit signal. + mStateChangedSignal.Emit( handle ); + } +} + +bool Button::IsSelected() const +{ + return mTogglableButton && mSelected; +} + void Button::SetAnimationTime( float animationTime ) { OnAnimationTimeSet( animationTime ); @@ -108,32 +219,325 @@ float Button::GetAnimationTime() const return OnAnimationTimeRequested(); } +void Button::SetLabel( const std::string& label ) +{ + Toolkit::TextView textView = Toolkit::TextView::New( label ); + textView.SetWidthExceedPolicy( Toolkit::TextView::ShrinkToFit ); // Make sure our text always fits inside the button + SetLabel( textView ); + + RelayoutRequest(); +} + +void Button::SetLabel( Actor label ) +{ + Toolkit::Button handle( GetOwner() ); + + mPainter->SetLabel( handle, label ); +} + +Actor Button::GetLabel() const +{ + return mLabel; +} + +Actor& Button::GetLabel() +{ + return mLabel; +} + +void Button::SetButtonImage( Image image ) +{ + SetButtonImage( ImageActor::New( image ) ); +} + +void Button::SetButtonImage( Actor image ) +{ + Toolkit::Button handle( GetOwner() ); + mPainter->SetButtonImage( handle, image ); +} + +Actor Button::GetButtonImage() const +{ + return mButtonImage; +} + +Actor& Button::GetButtonImage() +{ + return mButtonImage; +} + +void Button::SetSelectedImage( Image image ) +{ + SetSelectedImage( ImageActor::New( image ) ); +} + +void Button::SetSelectedImage( Actor image ) +{ + Toolkit::Button handle( GetOwner() ); + mPainter->SetSelectedImage( handle, image ); +} + +Actor Button::GetSelectedImage() const +{ + return mSelectedImage; +} + +Actor& Button::GetSelectedImage() +{ + return mSelectedImage; +} + +void Button::SetBackgroundImage( Image image ) +{ + SetBackgroundImage( ImageActor::New( image ) ); +} + +void Button::SetBackgroundImage( Actor image ) +{ + Toolkit::Button handle( GetOwner() ); + mPainter->SetBackgroundImage( handle, image ); +} + +Actor Button::GetBackgroundImage() const +{ + return mBackgroundImage; +} + +Actor& Button::GetBackgroundImage() +{ + return mBackgroundImage; +} + +void Button::SetDisabledImage( Image image ) +{ + SetDisabledImage( ImageActor::New( image ) ); +} + +void Button::SetDisabledImage( Actor image ) +{ + Toolkit::Button handle( GetOwner() ); + mPainter->SetDisabledImage( handle, image ); +} + +Actor Button::GetDisabledImage() const +{ + return mDisabledImage; +} + +Actor& Button::GetDisabledImage() +{ + return mDisabledImage; +} + +void Button::SetDisabledSelectedImage( Image image ) +{ + SetDisabledSelectedImage( ImageActor::New( image ) ); +} + +void Button::SetDisabledSelectedImage( Actor image ) +{ + Toolkit::Button handle( GetOwner() ); + mPainter->SetDisabledSelectedImage( handle, image ); +} + +Actor Button::GetDisabledSelectedImage() const +{ + return mDisabledSelectedImage; +} + +Actor& Button::GetDisabledSelectedImage() +{ + return mDisabledSelectedImage; +} + +void Button::SetDisabledBackgroundImage( Image image ) +{ + SetDisabledBackgroundImage( ImageActor::New( image ) ); +} + +void Button::SetDisabledBackgroundImage( Actor image ) +{ + Toolkit::Button handle( GetOwner() ); + mPainter->SetDisabledBackgroundImage( handle, image ); +} + +Actor Button::GetDisabledBackgroundImage() const +{ + return mDisabledBackgroundImage; +} + +Actor& Button::GetDisabledBackgroundImage() +{ + return mDisabledBackgroundImage; +} + +Actor& Button::GetFadeOutButtonImage() +{ + return mFadeOutButtonImage; +} + +Actor& Button::GetFadeOutSelectedImage() +{ + return mFadeOutSelectedImage; +} + +Actor& Button::GetFadeOutBackgroundImage() +{ + return mFadeOutBackgroundImage; +} + +bool Button::DoAction( BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes ) +{ + bool ret = false; + + Dali::BaseHandle handle( object ); + + Toolkit::Button button = Toolkit::Button::DownCast( handle ); + + DALI_ASSERT_ALWAYS( button ); + + if( Toolkit::Button::ACTION_BUTTON_CLICK == actionName ) + { + GetImplementation( button ).DoClickAction( attributes ); + ret = true; + } + + return ret; +} + +void Button::DoClickAction( const PropertyValueContainer& attributes ) +{ + // Prevents the button signals from doing a recursive loop by sending an action + // and re-emitting the signals. + if( !mClickActionPerforming ) + { + mClickActionPerforming = true; + OnButtonDown(); + mState = ButtonDown; + OnButtonUp(); + mClickActionPerforming = false; + } +} + void Button::OnAnimationTimeSet( float animationTime ) { - // nothing to do. + mPainter->SetAnimationTime( animationTime ); +} + +float Button::OnAnimationTimeRequested() const +{ + return mPainter->GetAnimationTime(); +} + +void Button::OnButtonStageDisconnection() +{ + if( ButtonDown == mState ) + { + if( !mTogglableButton ) + { + Toolkit::Button handle( GetOwner() ); + + // Notifies the painter the button has been released. + mPainter->Released( handle ); + + if( mAutoRepeating ) + { + mAutoRepeatingTimer.Reset(); + } + } + } } void Button::OnButtonDown() { + if( !mTogglableButton ) + { + Toolkit::Button handle( GetOwner() ); + // Notifies the painter the button has been pressed. + mPainter->Pressed( handle ); + + if( mAutoRepeating ) + { + SetUpTimer( mInitialAutoRepeatingDelay ); + } + + //Emit signal. + mPressedSignal.Emit( handle ); + } } void Button::OnButtonUp() { + if( ButtonDown == mState ) + { + if( mTogglableButton ) + { + SetSelected( !mSelected ); + } + else + { + Toolkit::Button handle( GetOwner() ); + + // Notifies the painter the button has been clicked. + mPainter->Released( handle ); + mPainter->Clicked( handle ); + if( mAutoRepeating ) + { + mAutoRepeatingTimer.Reset(); + } + + //Emit signal. + mReleasedSignal.Emit( handle ); + mClickedSignal.Emit( handle ); + } + } } -float Button::OnAnimationTimeRequested() const +void Button::OnTouchPointLeave() { - return 0.f; + if( ButtonDown == mState ) + { + if( !mTogglableButton ) + { + Toolkit::Button handle( GetOwner() ); + + // Notifies the painter the button has been released. + mPainter->Released( handle ); + + if( mAutoRepeating ) + { + mAutoRepeatingTimer.Reset(); + } + + //Emit signal. + mReleasedSignal.Emit( handle ); + } + } +} + +void Button::OnTouchPointInterrupted() +{ + OnTouchPointLeave(); +} + +Toolkit::Button::ButtonSignalType& Button::PressedSignal() +{ + return mPressedSignal; } -Toolkit::Button::ClickedSignalType& Button::ClickedSignal() +Toolkit::Button::ButtonSignalType& Button::ReleasedSignal() +{ + return mReleasedSignal; +} + +Toolkit::Button::ButtonSignalType& Button::ClickedSignal() { return mClickedSignal; } -Toolkit::Button::StateChangedSignalType& Button::StateChangedSignal() +Toolkit::Button::ButtonSignalType& Button::StateChangedSignal() { return mStateChangedSignal; } @@ -145,7 +549,15 @@ bool Button::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tr bool connected( true ); Toolkit::Button button = Toolkit::Button::DownCast(handle); - if( Dali::Toolkit::Button::SIGNAL_CLICKED == signalName ) + if( Toolkit::Button::SIGNAL_PRESSED == signalName ) + { + button.PressedSignal().Connect( tracker, functor ); + } + else if( Toolkit::Button::SIGNAL_RELEASED == signalName ) + { + button.ReleasedSignal().Connect( tracker, functor ); + } + else if( Dali::Toolkit::Button::SIGNAL_CLICKED == signalName ) { button.ClickedSignal().Connect( tracker, functor ); } @@ -246,6 +658,13 @@ void Button::OnInitialize() self.SetKeyboardFocusable( true ); } +void Button::OnActivated() +{ + // When the button is activated, it performs the click action + PropertyValueContainer attributes; + DoClickAction( attributes ); +} + void Button::OnControlSizeSet(const Vector3& targetSize) { Toolkit::Button handle( GetOwner() ); @@ -260,32 +679,203 @@ void Button::OnTap(Actor actor, const TapGesture& tap) // Do nothing. } +void Button::SetUpTimer( float delay ) +{ + mAutoRepeatingTimer = Dali::Timer::New( static_cast( 1000.f * delay ) ); + mAutoRepeatingTimer.TickSignal().Connect( this, &Button::AutoRepeatingSlot ); + mAutoRepeatingTimer.Start(); +} + +bool Button::AutoRepeatingSlot() +{ + bool consumed = false; + if( !mDisabled ) + { + // Restart the autorepeat timer. + SetUpTimer( mNextAutoRepeatingDelay ); + + Toolkit::Button handle( GetOwner() ); + + // Notifies the painter the button has been pressed. + mPainter->Pressed( handle ); + + //Emit signal. + consumed = mReleasedSignal.Emit( handle ); + consumed |= mClickedSignal.Emit( handle ); + consumed |= mPressedSignal.Emit( handle ); + } + + return consumed; +} + void Button::OnControlStageDisconnection() { OnButtonStageDisconnection(); // Notification for derived classes. mState = ButtonUp; } +void Button::SetPainter(ButtonPainterPtr painter) +{ + mPainter = painter; +} + +Button::ButtonState Button::GetState() +{ + return mState; +} + 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_DISABLED ) ) + if ( button ) { - GetImplementation( button ).SetDisabled( value.Get() ); + switch ( index ) + { + case Toolkit::Button::PROPERTY_DISABLED: + { + GetImplementation( button ).SetDisabled( value.Get() ); + break; + } + + case Toolkit::Button::PROPERTY_AUTO_REPEATING: + { + GetImplementation( button ).SetAutoRepeating( value.Get< bool >() ); + break; + } + + case Toolkit::Button::PROPERTY_INITIAL_AUTO_REPEATING_DELAY: + { + GetImplementation( button ).SetInitialAutoRepeatingDelay( value.Get< float >() ); + break; + } + + case Toolkit::Button::PROPERTY_NEXT_AUTO_REPEATING_DELAY: + { + GetImplementation( button ).SetNextAutoRepeatingDelay( value.Get< float >() ); + break; + } + + case Toolkit::Button::PROPERTY_TOGGLABLE: + { + GetImplementation( button ).SetTogglableButton( value.Get< bool >() ); + break; + } + + case Toolkit::Button::PROPERTY_SELECTED: + { + GetImplementation( button ).SetSelected( value.Get< bool >() ); + break; + } + + case Toolkit::Button::PROPERTY_NORMAL_STATE_ACTOR: + { + GetImplementation( button ).SetButtonImage( Scripting::NewActor( value.Get< Property::Map >() ) ); + break; + } + + case Toolkit::Button::PROPERTY_SELECTED_STATE_ACTOR: + { + GetImplementation( button ).SetSelectedImage( Scripting::NewActor( value.Get< Property::Map >() ) ); + break; + } + + case Toolkit::Button::PROPERTY_DISABLED_STATE_ACTOR: + { + GetImplementation( button ).SetDisabledImage( Scripting::NewActor( value.Get< Property::Map >() ) ); + break; + } + + case Toolkit::Button::PROPERTY_LABEL_ACTOR: + { + GetImplementation( button ).SetLabel( Scripting::NewActor( value.Get< Property::Map >() ) ); + break; + } + } } } Property::Value Button::GetProperty( BaseObject* object, Property::Index propertyIndex ) { + Property::Value value; + Toolkit::Button button = Toolkit::Button::DownCast( Dali::BaseHandle( object ) ); - if ( button && ( propertyIndex == Toolkit::Button::PROPERTY_DISABLED ) ) + if ( button ) { - return Property::Value( GetImplementation( button ).mDisabled ); + switch ( propertyIndex ) + { + case Toolkit::Button::PROPERTY_DISABLED: + { + value = GetImplementation( button ).mDisabled; + break; + } + + case Toolkit::Button::PROPERTY_AUTO_REPEATING: + { + value = GetImplementation( button ).mAutoRepeating; + break; + } + + case Toolkit::Button::PROPERTY_INITIAL_AUTO_REPEATING_DELAY: + { + value = GetImplementation( button ).mInitialAutoRepeatingDelay; + break; + } + + case Toolkit::Button::PROPERTY_NEXT_AUTO_REPEATING_DELAY: + { + value = GetImplementation( button ).mNextAutoRepeatingDelay; + break; + } + + case Toolkit::Button::PROPERTY_TOGGLABLE: + { + value = GetImplementation( button ).mTogglableButton; + break; + } + + case Toolkit::Button::PROPERTY_SELECTED: + { + value = GetImplementation( button ).mSelected; + break; + } + + case Toolkit::Button::PROPERTY_NORMAL_STATE_ACTOR: + { + Property::Map map; + Scripting::CreatePropertyMap( GetImplementation( button ).mButtonImage, map ); + value = map; + break; + } + + case Toolkit::Button::PROPERTY_SELECTED_STATE_ACTOR: + { + Property::Map map; + Scripting::CreatePropertyMap( GetImplementation( button ).mSelectedImage, map ); + value = map; + break; + } + + case Toolkit::Button::PROPERTY_DISABLED_STATE_ACTOR: + { + Property::Map map; + Scripting::CreatePropertyMap( GetImplementation( button ).mDisabledImage, map ); + value = map; + break; + } + + case Toolkit::Button::PROPERTY_LABEL_ACTOR: + { + Property::Map map; + Scripting::CreatePropertyMap( GetImplementation( button ).mLabel, map ); + value = map; + break; + } + } } - return Property::Value(); + return value; } } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/button-impl.h b/dali-toolkit/internal/controls/buttons/button-impl.h index 3881cc1..f0884e1 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.h +++ b/dali-toolkit/internal/controls/buttons/button-impl.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include @@ -73,6 +76,56 @@ public: bool IsDisabled() const; /** + * @copydoc Dali::Toolkit::Button::SetAutoRepeating( bool autoRepeating ) + */ + void SetAutoRepeating( bool autoRepeating ); + + /** + * @copydoc Dali::Toolkit::Button::IsAutoRepeating() const + */ + bool IsAutoRepeating() const; + + /** + * @copydoc Dali::Toolkit::Button::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ) + */ + void SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ); + + /** + * @copydoc Dali::Toolkit::Button::GetInitialAutoRepeatingDelay() const + */ + float GetInitialAutoRepeatingDelay() const; + + /** + * @copydoc Dali::Toolkit::Button::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ) + */ + void SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ); + + /** + * @copydoc Dali::Toolkit::Button::GetNextAutoRepeatingDelay() const + */ + float GetNextAutoRepeatingDelay() const; + + /** + * @copydoc Dali::Toolkit::Button::SetTogglableButton( bool togglable ) + */ + void SetTogglableButton( bool togglable ); + + /** + * @copydoc Dali::Toolkit::Button::IsTogglableButton() const + */ + bool IsTogglableButton() const; + + /** + * @copydoc Dali::Toolkit::Button::SetSelected( bool selected ) + */ + virtual void SetSelected( bool selected ); + + /** + * @copydoc Dali::Toolkit::Button::IsSelected() const + */ + bool IsSelected() const; + + /** * @copydoc Dali::Toolkit::Button::SetAnimationTime() */ void SetAnimationTime( float animationTime ); @@ -82,7 +135,186 @@ public: */ float GetAnimationTime() const; + /** + * @copydoc Dali::Toolkit::Button::SetLabel( const std::string& label ) + */ + void SetLabel( const std::string& label ); + + /** + * @copydoc Dali::Toolkit::Button::SetLabel( Actor label ) + */ + virtual void SetLabel( Actor label ); // TODO: After refactoring painter, virtual will be removed + + /** + * @copydoc Dali::Toolkit::Button::GetLabel() + */ + Actor GetLabel() const; + + /** + * Used by the painter only. + * @return A reference to the label actor. + */ + Actor& GetLabel(); + + /** + * @copydoc Dali::Toolkit::PushButton::SetButtonImage( const Image image ) + */ + void SetButtonImage( Image image ); + + /** + * @copydoc Dali::Toolkit::PushButton::SetButtonImage( Actor image ) + */ + void SetButtonImage( Actor image ); + + /** + * @copydoc Dali::Toolkit::PushButton::GetButtonImage() + */ + Actor GetButtonImage() const; + + /** + * Used by the painter only. + * @return A reference to the button image. + */ + Actor& GetButtonImage(); + + /** + * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( const Image image ) + */ + void SetSelectedImage( Image image ); + + /** + * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image ) + */ + void SetSelectedImage( Actor image ); + + /** + * @copydoc Dali::Toolkit::PushButton::GetSelectedImage() + */ + Actor GetSelectedImage() const; + + /** + * Used by the painter only. + * @return A reference to the selected image. + */ + Actor& GetSelectedImage(); + + /** + * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( const Image image ) + */ + void SetBackgroundImage( Image image ); + + /** + * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( Actor image ) + */ + void SetBackgroundImage( Actor image ); + + /** + * @copydoc Dali::Toolkit::PushButton::GetBackgroundImage() + */ + Actor GetBackgroundImage() const; + + /** + * Used by the painter only. + * @return A reference to the background image. + */ + Actor& GetBackgroundImage(); + + /** + * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Image image ) + */ + void SetDisabledImage( Image image ); + + /** + * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image ) + */ + void SetDisabledImage( Actor image ); + + /** + * @copydoc Dali::Toolkit::PushButton::GetDisabledImage() + */ + Actor GetDisabledImage() const; + + /** + * Used by the painter only. + * @return A reference to the disabled button image. + */ + Actor& GetDisabledImage(); + + /** + * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledSelectedImage( Image image ) + */ + void SetDisabledSelectedImage( Image image ); + + /** + * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledSelectedImage( Actor image ) + */ + void SetDisabledSelectedImage( Actor image ); + + /** + * @copydoc Dali::Toolkit::CheckBoxButton::GetDisabledSelectedImage() + */ + Actor GetDisabledSelectedImage() const; + + /** + * Used by the painter only. + * @return A reference to the disabled selected image. + */ + Actor& GetDisabledSelectedImage(); + + /** + * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Image image ) + */ + void SetDisabledBackgroundImage( Image image ); + + /** + * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Actor image ) + */ + void SetDisabledBackgroundImage( Actor image ); + + /** + * @copydoc Dali::Toolkit::PushButton::GetDisabledBackgroundImage() + */ + Actor GetDisabledBackgroundImage() const; + + /** + * Used by the painter only. + * @return A reference to the disabled background image. + */ + Actor& GetDisabledBackgroundImage(); + + /** + * Used by the painter only. + * @return A reference to the button image that is fading out. + */ + Actor& GetFadeOutButtonImage(); + + /** + * Used by the painter only. + * @return A reference to the selected image that is fading out. + */ + Actor& GetFadeOutSelectedImage(); + + /** + * Used by the painter only. + * @return A reference to the background image that is fading out. + */ + Actor& GetFadeOutBackgroundImage(); + + /** + * 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. + * @param[in] attributes The attributes with which to perfrom this action. + * @return true if action has been accepted by this control + */ + static bool DoAction( BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes ); + private: + /** + * Perform the click action to click the button. + * @param[in] attributes The attributes to perfrom this action. + */ + void DoClickAction( const PropertyValueContainer& attributes ); /** * This method is called after the button initialization. @@ -107,13 +339,13 @@ private: * more than one touch points are received. * Could be reimplemented in subclasses to provide specific behaviour. */ - virtual void OnTouchPointLeave() { } + virtual void OnTouchPointLeave(); /** * This method is called from the OnTouchEvent method when the touch point is interrupted. * Could be reimplemented in subclasses to provide specific behaviour. */ - virtual void OnTouchPointInterrupted() { } + virtual void OnTouchPointInterrupted(); /** * This method is called when the animation time is set. @@ -133,19 +365,29 @@ private: * This method is called when the button is removed from the stage. * Could be reimplemented in subclasses to provide specific behaviour. */ - virtual void OnButtonStageDisconnection() { } + virtual void OnButtonStageDisconnection(); public: /** + * @copydoc Dali::Toolkit::PushButton::PressedSignal() + */ + Toolkit::Button::ButtonSignalType& PressedSignal(); + + /** + * @copydoc Dali::Toolkit::PushButton::ReleasedSignal() + */ + Toolkit::Button::ButtonSignalType& ReleasedSignal(); + + /** * @copydoc Dali::Toolkit::Button::ClickedSignal() */ - Toolkit::Button::ClickedSignalType& ClickedSignal(); + Toolkit::Button::ButtonSignalType& ClickedSignal(); /** * @copydoc Dali::Toolkit::Button::StateChangedSignal() */ - Toolkit::Button::StateChangedSignalType& StateChangedSignal(); + Toolkit::Button::ButtonSignalType& StateChangedSignal(); /** * Connects a callback function with the object's signals. @@ -191,6 +433,11 @@ private: // From Control virtual void OnInitialize(); /** + * @copydoc Toolkit::Control::OnActivated() + */ + virtual void OnActivated(); + + /** * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize ) */ virtual void OnControlSizeSet( const Vector3& targetSize ); @@ -213,6 +460,33 @@ private: */ void OnTap(Actor actor, const TapGesture& tap); + /** + * Sets up the autorepeating timer. + * @param[in] delay The delay time in seconds. + */ + void SetUpTimer( float delay ); + + /** + * Slot called when Dali::Timer::SignalTick signal. Resets the autorepeating timer. + */ + bool AutoRepeatingSlot(); + +protected: + + enum ButtonState + { + ButtonUp, ///< The button is up. + ButtonDown, ///< The button is down. + }; + + void SetPainter(ButtonPainterPtr painter); + + ButtonState GetState(); + + Actor mLabel; //TODO: After refactoring painter, this will be private + bool mTogglableButton; //TODO: After refactoring painter, this will be private + bool mSelected; //TODO: After refactoring painter, this will be private + private: // Undefined @@ -221,24 +495,44 @@ private: // Undefined Button& operator = ( const Button& ); -protected: +private: - enum ButtonState - { - ButtonUp, ///< The button is up. - ButtonDown, ///< The button is down. - }; + ButtonPainterPtr mPainter; ///< Pointer to a ButtonPainter base class. + + // Signals + Toolkit::Button::ButtonSignalType mPressedSignal; ///< Signal emitted when the button is pressed. + Toolkit::Button::ButtonSignalType mReleasedSignal; ///< Signal emitted when the button is released. + Toolkit::Button::ButtonSignalType mClickedSignal; ///< Signal emitted when the button is clicked. + Toolkit::Button::ButtonSignalType mStateChangedSignal; ///< Signal emitted when the button's state is changed. + + Timer mAutoRepeatingTimer; ///< Timer used to implement the autorepeating property. - ButtonPainterPtr mPainter; ///< Pointer to a ButtonPainter base class. +// Actor mLabel; ///< Stores the button label. - Toolkit::Button::ClickedSignalType mClickedSignal; ///< Signal emitted when the button is clicked. - Toolkit::Button::StateChangedSignalType mStateChangedSignal; ///< Signal emitted when the button's state is changed. + Actor mButtonImage; ///< Stores the unselected image. + Actor mSelectedImage; ///< Stores the selected image. + Actor mBackgroundImage; ///< Stores the background image. + Actor mDisabledImage; ///< Stores the disabled image. + Actor mDisabledSelectedImage; ///< Stores the disabled selected image. + Actor mDisabledBackgroundImage; ///< Stores the disabled background image. + + Actor mFadeOutButtonImage; ///< Stores a foreground image, which is in a fade out animation, to be removed when the animation finishes. + Actor mFadeOutSelectedImage; ///< Stores a foreground image, which is in a fade out animation, to be removed when the animation finishes. + Actor mFadeOutBackgroundImage; ///< Stores a background image, which is in a fade out animation, to be removed when the animation finishes. TapGestureDetector mTapDetector; - ButtonState mState; ///< Stores the button state. + bool mDisabled; ///< Stores the disabled property. + bool mAutoRepeating; ///< Stores the autorepeating property. +// bool mTogglableButton; ///< Stores the togglable property. +// bool mSelected; ///< Stores the selected state. + float mInitialAutoRepeatingDelay; ///< Stores the initial autorepeating delay in seconds. + float mNextAutoRepeatingDelay; ///< Stores the next autorepeating delay in seconds. + + // Actions + bool mClickActionPerforming; - bool mDisabled; ///< Stores the disabled property. + ButtonState mState; ///< Stores the button state. }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/button-painter-impl.h b/dali-toolkit/internal/controls/buttons/button-painter-impl.h index 70215c5..3014a75 100644 --- a/dali-toolkit/internal/controls/buttons/button-painter-impl.h +++ b/dali-toolkit/internal/controls/buttons/button-painter-impl.h @@ -81,7 +81,7 @@ public: virtual void SetSize( Toolkit::Button& button, const Vector3& size ) = 0; /** - * This method is called from the Dali::Toolkit::Internal::PushButton when the \e disabled property changes. + * This method is called from the Dali::Toolkit::Internal::Button when the \e disabled property changes. * * @param[inout] button The button in which all actors that form its appearance are going to be added. * @param[in] disabled The disabled state. @@ -89,6 +89,12 @@ public: virtual void SetDisabled( Toolkit::Button& button, bool disabled ) = 0; /** + * This method is called from the Dali::Toolkit::Internal::PushButton when the \e autorepeating property changes. + * @param[in] autorepeating property. + */ + virtual void SetAutoRepeating( bool autorepeating ) {} + + /** * Sets the animation time. * @param [in] animationTime The animation time in seconds. */ @@ -99,6 +105,94 @@ public: * @return The animation time in seconds. */ virtual float GetAnimationTime() const = 0; + + /** + * Sets the label. + * It adds the label to the root actor. + * @param[inout] button The button in which all actors that form its appearance are going to be added. + * @param[in] label Button label. + */ + virtual void SetLabel( Toolkit::Button& button, Actor label ) {} + + /** + * Sets the button image. + * It adds the button image to the root actor and creates the image transition if needed. + * @param[inout] button The button in which all actors that form its appearance are going to be added. + * @param[in] image The button image. + */ + virtual void SetButtonImage( Toolkit::Button& button, Actor image ) {} + + /** + * Sets the selected image. + * It adds the selected image to the root actor and creates the image transition if needed. + * @param[inout] button The button in which all actors that form its appearance are going to be added. + * @param[in] image The selected image. + */ + virtual void SetSelectedImage( Toolkit::Button& button, Actor image ) {} + + /** + * Sets the background image. + * It adds the background image to the root actor and creates the image transition if needed. + * @param[inout] button The button in which all actors that form its appearance are going to be added. + * @param[in] image The background image. + */ + virtual void SetBackgroundImage( Toolkit::Button& button, Actor image ) {} + + /** + * Sets the disabled image. + * It adds the disabled image to the root actor and creates the image transition if needed. + * @param[inout] button The button in which all actors that form its appearance are going to be added. + * @param[in] image The disabled button image. + */ + virtual void SetDisabledImage( Toolkit::Button& button, Actor image ) {} + + /** + * Sets the disabled selected image. + * It adds the disabled selected image to the root actor and creates the image transition if needed. + * @param[inout] button The button in which all actors that form its appearance are going to be added. + * @param[in] image The disabled selected image. + */ + virtual void SetDisabledSelectedImage( Toolkit::Button& button, Actor image ) {} + + /** + * Sets the disabled background image. + * It adds the disabled background image to the root actor and creates the image transition if needed. + * @param[inout] button The button in which all actors that form its appearance are going to be added. + * @param[in] image The disabled background image. + */ + virtual void SetDisabledBackgroundImage( Toolkit::Button& button, Actor image ) {} + + /** + * This method is called when the Dali::Toolkit::Internal::Button, in which this + * object is registered, is pressed. + * @param[inout] button The Dali::Toolkit::Button, linked to the internal + * implementation, in which this object is registered. + */ + virtual void Pressed( Toolkit::Button& button ) {} + + /** + * This method is called when the Dali::Toolkit::Internal::Button, in which this + * object is registered, is released. + * @param[inout] button The Dali::Toolkit::Button, linked to the internal + * implementation, in which this object is registered. + */ + virtual void Released( Toolkit::Button& button ) {} + + /** + * This method is called when the Dali::Toolkit::Internal::Button, in which this + * object is registered, is clicked. + * @param[inout] button The Dali::Toolkit::Button, linked to the internal + * implementation, in which this object is registered. + */ + virtual void Clicked( Toolkit::Button& button ) {} + + /** + * This method is called when the Dali::Toolkit::Internal::Button, in which this + * object is registered, changes its state. + * @param[inout] button The Dali::Toolkit::Button, linked to the internal + * implementation, in which this object is registered. + */ + virtual void Selected( Toolkit::Button& button ) {} }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.cpp b/dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.cpp index 3885f5f..d18afb5 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.cpp @@ -65,7 +65,7 @@ inline const Toolkit::Internal::CheckBoxButton& GetCheckBoxButtonImpl( const Too CheckBoxButtonDefaultPainter::CheckBoxButtonDefaultPainter() : CheckBoxButtonPainter(), mDisabled( false ), - mPaintState( UncheckedState ), + mPaintState( UnselectedState ), mButton(NULL), mAnimationTime( ANIMATION_TIME ) { @@ -83,303 +83,13 @@ CheckBoxButtonDefaultPainter::~CheckBoxButtonDefaultPainter() } } -void CheckBoxButtonDefaultPainter::SetBackgroundImage( Toolkit::CheckBoxButton& checkBox, Actor image ) -{ - Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetImplementation( checkBox ); - Actor& backgroundImage = checkBoxImpl.GetBackgroundImage(); - Actor& fadeOutBackgroundImage = checkBoxImpl.GetFadeOutBackgroundImage(); - - switch( mPaintState ) - { - case UncheckedState: // FALLTHROUGH - case CheckedState: - case UncheckedCheckedTransition: - case CheckedUncheckedTransition: - { - if( backgroundImage && backgroundImage.GetParent() ) - { - StopCheckOutAnimation( checkBox ); - FadeOutImage( checkBox, Background, backgroundImage ); - - backgroundImage = image; - - FadeInImage( checkBox, backgroundImage ); - - StartCheckOutAnimation( checkBox ); - StartCheckInAnimation(); - } - else - { - backgroundImage = image; - checkBox.Add( backgroundImage ); - } - break; - } - case DisabledUncheckedTransition: // FALLTHROUGH - case DisabledCheckedTransition: - { - StopCheckInAnimation(); - checkBox.Remove( backgroundImage ); - - backgroundImage = image; - - FadeInImage( checkBox, backgroundImage ); - StartCheckInAnimation(); - break; - } - case CheckedDisabledTransition: // FALLTHROUGH - case UncheckedDisabledTransition: - { - float opacity = 1.f; - if( fadeOutBackgroundImage ) - { - opacity = fadeOutBackgroundImage.GetCurrentOpacity(); - } - StopCheckOutAnimation( checkBox ); - - // Replaces the button image. - backgroundImage = image; - - checkBox.Add( backgroundImage ); - FadeOutImage( checkBox, Background, backgroundImage, opacity ); - - StartCheckOutAnimation( checkBox ); - break; - } - default: - { - backgroundImage = image; - break; - } - } - - backgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - backgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - ApplyConstraint( backgroundImage, BACKGROUND_DEPTH ); -} - -void CheckBoxButtonDefaultPainter::SetCheckedImage( Toolkit::CheckBoxButton& checkBox, Actor image ) -{ - Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetImplementation( checkBox ); - Actor& checkedImage = checkBoxImpl.GetCheckedImage(); - Actor& fadeOutCheckedImage = checkBoxImpl.GetFadeOutCheckedImage(); - - switch( mPaintState ) - { - case CheckedState: - { - if( checkedImage && checkedImage.GetParent() ) - { - StopCheckOutAnimation( checkBox ); - FadeOutImage( checkBox, Foreground, checkedImage ); - - checkedImage = image; - - FadeInImage( checkBox, checkedImage ); - - StartCheckOutAnimation( checkBox ); - StartCheckInAnimation(); - } - else - { - checkedImage = image; - checkBox.Add( checkedImage ); - } - break; - } - case UncheckedCheckedTransition: // FALLTHROUGH - case DisabledCheckedTransition: - { - StopCheckInAnimation(); - checkBox.Remove( checkedImage ); - - checkedImage = image; - - FadeInImage( checkBox, checkedImage ); - StartCheckInAnimation(); - break; - } - case CheckedUncheckedTransition: // FALLTHROUGH - case CheckedDisabledTransition: - { - float opacity = 1.f; - if( fadeOutCheckedImage ) - { - opacity = fadeOutCheckedImage.GetCurrentOpacity(); - } - StopCheckOutAnimation( checkBox ); - - // Replaces the button image. - checkedImage = image; - - checkBox.Add( checkedImage ); - FadeOutImage( checkBox, Foreground, checkedImage, opacity ); - - StartCheckOutAnimation( checkBox ); - break; - } - default: - { - checkedImage = image; - break; - } - } - - checkedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - checkedImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - ApplyCheckedConstraint( checkedImage, FOREGROUND_DEPTH ); -} - -void CheckBoxButtonDefaultPainter::SetDisabledCheckedImage( Toolkit::CheckBoxButton& checkBox, Actor image ) -{ - Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetImplementation( checkBox ); - Actor& disabledCheckedImage = checkBoxImpl.GetDisabledCheckedImage(); - Actor& fadeOutCheckedImage = checkBoxImpl.GetFadeOutCheckedImage(); - - switch( mPaintState ) - { - case DisabledCheckedState: - { - if( disabledCheckedImage && disabledCheckedImage.GetParent() ) - { - StopCheckOutAnimation( checkBox ); - FadeOutImage( checkBox, Foreground, disabledCheckedImage ); - - disabledCheckedImage = image; - - FadeInImage( checkBox, disabledCheckedImage ); - - StartCheckOutAnimation( checkBox ); - StartCheckInAnimation(); - } - else - { - disabledCheckedImage = image; - checkBox.Add( disabledCheckedImage ); - } - break; - } - case CheckedDisabledTransition: - { - StopCheckInAnimation(); - checkBox.Remove( disabledCheckedImage ); - - disabledCheckedImage = image; - - FadeInImage( checkBox, disabledCheckedImage ); - StartCheckInAnimation(); - break; - } - case DisabledCheckedTransition: - { - float opacity = 1.f; - if( fadeOutCheckedImage ) - { - opacity = fadeOutCheckedImage.GetCurrentOpacity(); - } - StopCheckOutAnimation( checkBox ); - - // Replaces the button image. - disabledCheckedImage = image; - - checkBox.Add( disabledCheckedImage ); - FadeOutImage( checkBox, Foreground, disabledCheckedImage, opacity ); - - StartCheckOutAnimation( checkBox ); - break; - } - default: - { - disabledCheckedImage = image; - break; - } - } - - disabledCheckedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - disabledCheckedImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - ApplyConstraint( disabledCheckedImage, FOREGROUND_DEPTH ); -} - -void CheckBoxButtonDefaultPainter::SetDisabledBackgroundImage( Toolkit::CheckBoxButton& checkBox, Actor image ) -{ - Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetImplementation( checkBox ); - Actor& disabledBackgroundImage = checkBoxImpl.GetDisabledBackgroundImage(); - Actor& fadeOutBackgroundImage = checkBoxImpl.GetFadeOutBackgroundImage(); - - switch( mPaintState ) - { - case DisabledCheckedState: // FALLTHROUGH - case DisabledUncheckedState: - { - if( disabledBackgroundImage && disabledBackgroundImage.GetParent() ) - { - StopCheckOutAnimation( checkBox ); - FadeOutImage( checkBox, Background, disabledBackgroundImage ); - - disabledBackgroundImage = image; - - FadeInImage( checkBox, disabledBackgroundImage ); - - StartCheckOutAnimation( checkBox ); - StartCheckInAnimation(); - } - else - { - disabledBackgroundImage = image; - checkBox.Add( disabledBackgroundImage ); - } - break; - } - case UncheckedDisabledTransition: // FALLTHROUGH - case CheckedDisabledTransition: - { - StopCheckInAnimation(); - checkBox.Remove( disabledBackgroundImage ); - - disabledBackgroundImage = image; - - FadeInImage( checkBox, disabledBackgroundImage ); - StartCheckInAnimation(); - break; - } - case DisabledUncheckedTransition: // FALLTHROUGH - case DisabledCheckedTransition: - { - float opacity = 1.f; - if( fadeOutBackgroundImage ) - { - opacity = fadeOutBackgroundImage.GetCurrentOpacity(); - } - StopCheckOutAnimation( checkBox ); - - // Replaces the button image. - disabledBackgroundImage = image; - - checkBox.Add( disabledBackgroundImage ); - FadeOutImage( checkBox, Background, disabledBackgroundImage, opacity ); - - StartCheckOutAnimation( checkBox ); - break; - } - default: - { - disabledBackgroundImage = image; - break; - } - } - - disabledBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - disabledBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - ApplyConstraint( disabledBackgroundImage, BACKGROUND_DEPTH ); -} - void CheckBoxButtonDefaultPainter::Initialize( Toolkit::Button& button ) { Toolkit::Internal::CheckBoxButton& buttonImpl = GetCheckBoxButtonImpl( button ); Actor& backgroundImage = buttonImpl.GetBackgroundImage(); - Actor& checkedImage = buttonImpl.GetCheckedImage(); + Actor& selectedImage = buttonImpl.GetSelectedImage(); Actor& disabledBackgroundImage = buttonImpl.GetDisabledBackgroundImage(); - Actor& disabledCheckedImage = buttonImpl.GetDisabledCheckedImage(); + Actor& disabledSelectedImage = buttonImpl.GetDisabledSelectedImage(); Toolkit::CheckBoxButton& checkBox = static_cast( button ); @@ -388,9 +98,9 @@ void CheckBoxButtonDefaultPainter::Initialize( Toolkit::Button& button ) SetBackgroundImage( checkBox, backgroundImage ); } - if( checkedImage ) + if( selectedImage ) { - SetCheckedImage( checkBox, checkedImage ); + SetSelectedImage( checkBox, selectedImage ); } if( disabledBackgroundImage ) @@ -398,9 +108,9 @@ void CheckBoxButtonDefaultPainter::Initialize( Toolkit::Button& button ) SetDisabledBackgroundImage( checkBox, disabledBackgroundImage ); } - if( disabledCheckedImage ) + if( disabledSelectedImage ) { - SetDisabledCheckedImage( checkBox, disabledCheckedImage ); + SetDisabledSelectedImage( checkBox, disabledSelectedImage ); } SetDisabled( button, mDisabled ); @@ -410,13 +120,13 @@ void CheckBoxButtonDefaultPainter::SetSize( Toolkit::Button& button, const Vecto { Toolkit::Internal::CheckBoxButton& buttonImpl = GetCheckBoxButtonImpl( button ); Actor& backgroundImage = buttonImpl.GetBackgroundImage(); - Actor& checkedImage = buttonImpl.GetCheckedImage(); + Actor& selectedImage = buttonImpl.GetSelectedImage(); Actor& disabledBackgroundImage = buttonImpl.GetDisabledBackgroundImage(); - Actor& disabledCheckedImage = buttonImpl.GetDisabledCheckedImage(); + Actor& disabledSelectedImage = buttonImpl.GetDisabledSelectedImage(); - ApplyCheckedConstraint( checkedImage, FOREGROUND_DEPTH ); + ApplySelectedConstraint( selectedImage, FOREGROUND_DEPTH ); ApplyConstraint( backgroundImage, BACKGROUND_DEPTH ); - ApplyConstraint( disabledCheckedImage, FOREGROUND_DEPTH ); + ApplyConstraint( disabledSelectedImage, FOREGROUND_DEPTH ); ApplyConstraint( disabledBackgroundImage, BACKGROUND_DEPTH ); } @@ -426,17 +136,17 @@ void CheckBoxButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool di Toolkit::Internal::CheckBoxButton& buttonImpl = GetCheckBoxButtonImpl( button ); Actor& backgroundImage = buttonImpl.GetBackgroundImage(); - Actor& checkedImage = buttonImpl.GetCheckedImage(); + Actor& selectedImage = buttonImpl.GetSelectedImage(); Actor& disabledBackgroundImage = buttonImpl.GetDisabledBackgroundImage(); - Actor& disabledCheckedImage = buttonImpl.GetDisabledCheckedImage(); - Actor& fadeOutCheckedImage = buttonImpl.GetFadeOutCheckedImage(); + Actor& disabledSelectedImage = buttonImpl.GetDisabledSelectedImage(); + Actor& fadeOutSelectedImage = buttonImpl.GetFadeOutSelectedImage(); Actor& fadeOutBackgroundImage = buttonImpl.GetFadeOutBackgroundImage(); Toolkit::CheckBoxButton& checkBox = static_cast( button ); switch( mPaintState ) { - case UncheckedState: + case UnselectedState: { if( disabled ) { @@ -446,27 +156,27 @@ void CheckBoxButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool di StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = UncheckedDisabledTransition; + mPaintState = UnselectedDisabledTransition; } break; } - case CheckedState: + case SelectedState: { if( disabled ) { StopCheckOutAnimation( checkBox ); FadeOutImage( checkBox, Background, backgroundImage ); - FadeOutImage( checkBox, Foreground, checkedImage ); - FadeInImage( checkBox, disabledCheckedImage ); + FadeOutImage( checkBox, Foreground, selectedImage ); + FadeInImage( checkBox, disabledSelectedImage ); FadeInImage( checkBox, disabledBackgroundImage ); StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = CheckedDisabledTransition; + mPaintState = SelectedDisabledTransition; } break; } - case DisabledUncheckedState: + case DisabledUnselectedState: { if( !disabled ) { @@ -476,65 +186,65 @@ void CheckBoxButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool di StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = DisabledUncheckedTransition; + mPaintState = DisabledUnselectedTransition; } break; } - case DisabledCheckedState: + case DisabledSelectedState: { if( !disabled ) { StopCheckOutAnimation( checkBox ); FadeOutImage( checkBox, Background, disabledBackgroundImage ); - FadeOutImage( checkBox, Foreground, disabledCheckedImage ); + FadeOutImage( checkBox, Foreground, disabledSelectedImage ); FadeInImage( checkBox, backgroundImage ); - FadeInImage( checkBox, checkedImage ); + FadeInImage( checkBox, selectedImage ); StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = DisabledCheckedTransition; + mPaintState = DisabledSelectedTransition; } break; } - case UncheckedCheckedTransition: + case UnselectedSelectedTransition: { if( disabled ) { float opacity = 1.f; - if( checkedImage ) + if( selectedImage ) { - opacity = checkedImage.GetCurrentOpacity(); + opacity = selectedImage.GetCurrentOpacity(); } StopCheckOutAnimation( checkBox ); StopCheckInAnimation(); - FadeOutImage( checkBox, Foreground, checkedImage, opacity ); + FadeOutImage( checkBox, Foreground, selectedImage, opacity ); FadeOutImage( checkBox, Background, backgroundImage ); - FadeInImage( checkBox, disabledCheckedImage ); + FadeInImage( checkBox, disabledSelectedImage ); FadeInImage( checkBox, disabledBackgroundImage ); StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = CheckedDisabledTransition; + mPaintState = SelectedDisabledTransition; } break; } - case CheckedUncheckedTransition: + case SelectedUnselectedTransition: { if( disabled ) { float opacity = 1.f; - if( fadeOutCheckedImage ) + if( fadeOutSelectedImage ) { - opacity = fadeOutCheckedImage.GetCurrentOpacity(); + opacity = fadeOutSelectedImage.GetCurrentOpacity(); } StopCheckOutAnimation( checkBox ); StopCheckInAnimation(); - button.Add( disabledCheckedImage ); - FadeOutImage( checkBox, Foreground, disabledCheckedImage, opacity ); + button.Add( disabledSelectedImage ); + FadeOutImage( checkBox, Foreground, disabledSelectedImage, opacity ); FadeOutImage( checkBox, Background, backgroundImage ); FadeInImage( checkBox, disabledBackgroundImage ); @@ -542,11 +252,11 @@ void CheckBoxButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool di StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = UncheckedDisabledTransition; + mPaintState = UnselectedDisabledTransition; } break; } - case UncheckedDisabledTransition: + case UnselectedDisabledTransition: { if( !disabled ) { @@ -564,11 +274,11 @@ void CheckBoxButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool di StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = DisabledUncheckedTransition; + mPaintState = DisabledUnselectedTransition; } break; } - case DisabledUncheckedTransition: + case DisabledUnselectedTransition: { if( disabled ) { @@ -586,11 +296,11 @@ void CheckBoxButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool di StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = UncheckedDisabledTransition; + mPaintState = UnselectedDisabledTransition; } break; } - case CheckedDisabledTransition: + case SelectedDisabledTransition: { if( !disabled ) { @@ -602,19 +312,19 @@ void CheckBoxButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool di StopCheckOutAnimation( checkBox, false ); StopCheckInAnimation(); - FadeOutImage( checkBox, Foreground, disabledCheckedImage, 1.f - opacity ); + FadeOutImage( checkBox, Foreground, disabledSelectedImage, 1.f - opacity ); FadeOutImage( checkBox, Background, disabledBackgroundImage, 1.f - opacity ); - FadeInImage( checkBox, checkedImage, opacity ); + FadeInImage( checkBox, selectedImage, opacity ); FadeInImage( checkBox, backgroundImage, opacity ); StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = DisabledCheckedTransition; + mPaintState = DisabledSelectedTransition; } break; } - case DisabledCheckedTransition: + case DisabledSelectedTransition: { if( disabled ) { @@ -626,15 +336,15 @@ void CheckBoxButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool di StopCheckOutAnimation( checkBox, false ); StopCheckInAnimation(); - FadeOutImage( checkBox, Foreground, checkedImage, 1.f - opacity ); + FadeOutImage( checkBox, Foreground, selectedImage, 1.f - opacity ); FadeOutImage( checkBox, Background, backgroundImage, 1.f - opacity ); - FadeInImage( checkBox, disabledCheckedImage, opacity ); + FadeInImage( checkBox, disabledSelectedImage, opacity ); FadeInImage( checkBox, disabledBackgroundImage, opacity ); StartCheckOutAnimation( checkBox ); StartCheckInAnimation(); - mPaintState = CheckedDisabledTransition; + mPaintState = SelectedDisabledTransition; } break; } @@ -653,65 +363,365 @@ float CheckBoxButtonDefaultPainter::GetAnimationTime() const return mAnimationTime; } -void CheckBoxButtonDefaultPainter::Checked( Toolkit::CheckBoxButton& button ) +void CheckBoxButtonDefaultPainter::SetSelectedImage( Toolkit::Button& button, Actor image ) { Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetCheckBoxButtonImpl( button ); - Actor& checkedImage = checkBoxImpl.GetCheckedImage(); - Actor& fadeOutCheckedImage = checkBoxImpl.GetFadeOutCheckedImage(); + Actor& selectedImage = checkBoxImpl.GetSelectedImage(); + Actor& fadeOutSelectedImage = checkBoxImpl.GetFadeOutSelectedImage(); + + Toolkit::CheckBoxButton& checkBox = static_cast( button ); + + switch( mPaintState ) + { + case SelectedState: + { + if( selectedImage && selectedImage.GetParent() ) + { + StopCheckOutAnimation( checkBox ); + FadeOutImage( checkBox, Foreground, selectedImage ); + + selectedImage = image; + + FadeInImage( checkBox, selectedImage ); + + StartCheckOutAnimation( checkBox ); + StartCheckInAnimation(); + } + else + { + selectedImage = image; + checkBox.Add( selectedImage ); + } + break; + } + case UnselectedSelectedTransition: // FALLTHROUGH + case DisabledSelectedTransition: + { + StopCheckInAnimation(); + checkBox.Remove( selectedImage ); + + selectedImage = image; + + FadeInImage( checkBox, selectedImage ); + StartCheckInAnimation(); + break; + } + case SelectedUnselectedTransition: // FALLTHROUGH + case SelectedDisabledTransition: + { + float opacity = 1.f; + if( fadeOutSelectedImage ) + { + opacity = fadeOutSelectedImage.GetCurrentOpacity(); + } + StopCheckOutAnimation( checkBox ); + + // Replaces the button image. + selectedImage = image; + + checkBox.Add( selectedImage ); + FadeOutImage( checkBox, Foreground, selectedImage, opacity ); + + StartCheckOutAnimation( checkBox ); + break; + } + default: + { + selectedImage = image; + break; + } + } + + selectedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + selectedImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); + ApplySelectedConstraint( selectedImage, FOREGROUND_DEPTH ); +} + +void CheckBoxButtonDefaultPainter::SetBackgroundImage( Toolkit::Button& button, Actor image ) +{ + Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetCheckBoxButtonImpl( button ); + Actor& backgroundImage = checkBoxImpl.GetBackgroundImage(); + Actor& fadeOutBackgroundImage = checkBoxImpl.GetFadeOutBackgroundImage(); + + Toolkit::CheckBoxButton& checkBox = static_cast( button ); + + switch( mPaintState ) + { + case UnselectedState: // FALLTHROUGH + case SelectedState: + case UnselectedSelectedTransition: + case SelectedUnselectedTransition: + { + if( backgroundImage && backgroundImage.GetParent() ) + { + StopCheckOutAnimation( checkBox ); + FadeOutImage( checkBox, Background, backgroundImage ); + + backgroundImage = image; + + FadeInImage( checkBox, backgroundImage ); + + StartCheckOutAnimation( checkBox ); + StartCheckInAnimation(); + } + else + { + backgroundImage = image; + checkBox.Add( backgroundImage ); + } + break; + } + case DisabledUnselectedTransition: // FALLTHROUGH + case DisabledSelectedTransition: + { + StopCheckInAnimation(); + checkBox.Remove( backgroundImage ); + + backgroundImage = image; + + FadeInImage( checkBox, backgroundImage ); + StartCheckInAnimation(); + break; + } + case SelectedDisabledTransition: // FALLTHROUGH + case UnselectedDisabledTransition: + { + float opacity = 1.f; + if( fadeOutBackgroundImage ) + { + opacity = fadeOutBackgroundImage.GetCurrentOpacity(); + } + StopCheckOutAnimation( checkBox ); + + // Replaces the button image. + backgroundImage = image; + + checkBox.Add( backgroundImage ); + FadeOutImage( checkBox, Background, backgroundImage, opacity ); + + StartCheckOutAnimation( checkBox ); + break; + } + default: + { + backgroundImage = image; + break; + } + } + + backgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + backgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); + ApplyConstraint( backgroundImage, BACKGROUND_DEPTH ); +} + +void CheckBoxButtonDefaultPainter::SetDisabledSelectedImage( Toolkit::Button& button, Actor image ) +{ + Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetCheckBoxButtonImpl( button ); + Actor& disabledSelectedImage = checkBoxImpl.GetDisabledSelectedImage(); + Actor& fadeOutSelectedImage = checkBoxImpl.GetFadeOutSelectedImage(); + + Toolkit::CheckBoxButton& checkBox = static_cast( button ); + + switch( mPaintState ) + { + case DisabledSelectedState: + { + if( disabledSelectedImage && disabledSelectedImage.GetParent() ) + { + StopCheckOutAnimation( checkBox ); + FadeOutImage( checkBox, Foreground, disabledSelectedImage ); + + disabledSelectedImage = image; + + FadeInImage( checkBox, disabledSelectedImage ); + + StartCheckOutAnimation( checkBox ); + StartCheckInAnimation(); + } + else + { + disabledSelectedImage = image; + checkBox.Add( disabledSelectedImage ); + } + break; + } + case SelectedDisabledTransition: + { + StopCheckInAnimation(); + checkBox.Remove( disabledSelectedImage ); + + disabledSelectedImage = image; + + FadeInImage( checkBox, disabledSelectedImage ); + StartCheckInAnimation(); + break; + } + case DisabledSelectedTransition: + { + float opacity = 1.f; + if( fadeOutSelectedImage ) + { + opacity = fadeOutSelectedImage.GetCurrentOpacity(); + } + StopCheckOutAnimation( checkBox ); + + // Replaces the button image. + disabledSelectedImage = image; + + checkBox.Add( disabledSelectedImage ); + FadeOutImage( checkBox, Foreground, disabledSelectedImage, opacity ); + + StartCheckOutAnimation( checkBox ); + break; + } + default: + { + disabledSelectedImage = image; + break; + } + } + + disabledSelectedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + disabledSelectedImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); + ApplyConstraint( disabledSelectedImage, FOREGROUND_DEPTH ); +} + +void CheckBoxButtonDefaultPainter::SetDisabledBackgroundImage( Toolkit::Button& button, Actor image ) +{ + Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetCheckBoxButtonImpl( button ); + Actor& disabledBackgroundImage = checkBoxImpl.GetDisabledBackgroundImage(); + Actor& fadeOutBackgroundImage = checkBoxImpl.GetFadeOutBackgroundImage(); + + Toolkit::CheckBoxButton& checkBox = static_cast( button ); + + switch( mPaintState ) + { + case DisabledSelectedState: // FALLTHROUGH + case DisabledUnselectedState: + { + if( disabledBackgroundImage && disabledBackgroundImage.GetParent() ) + { + StopCheckOutAnimation( checkBox ); + FadeOutImage( checkBox, Background, disabledBackgroundImage ); + + disabledBackgroundImage = image; + + FadeInImage( checkBox, disabledBackgroundImage ); + + StartCheckOutAnimation( checkBox ); + StartCheckInAnimation(); + } + else + { + disabledBackgroundImage = image; + checkBox.Add( disabledBackgroundImage ); + } + break; + } + case UnselectedDisabledTransition: // FALLTHROUGH + case SelectedDisabledTransition: + { + StopCheckInAnimation(); + checkBox.Remove( disabledBackgroundImage ); + + disabledBackgroundImage = image; + + FadeInImage( checkBox, disabledBackgroundImage ); + StartCheckInAnimation(); + break; + } + case DisabledUnselectedTransition: // FALLTHROUGH + case DisabledSelectedTransition: + { + float opacity = 1.f; + if( fadeOutBackgroundImage ) + { + opacity = fadeOutBackgroundImage.GetCurrentOpacity(); + } + StopCheckOutAnimation( checkBox ); + + // Replaces the button image. + disabledBackgroundImage = image; + + checkBox.Add( disabledBackgroundImage ); + FadeOutImage( checkBox, Background, disabledBackgroundImage, opacity ); + + StartCheckOutAnimation( checkBox ); + break; + } + default: + { + disabledBackgroundImage = image; + break; + } + } + + disabledBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + disabledBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); + ApplyConstraint( disabledBackgroundImage, BACKGROUND_DEPTH ); +} + +void CheckBoxButtonDefaultPainter::Selected( Toolkit::Button& button ) +{ + Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetCheckBoxButtonImpl( button ); + Actor& selectedImage = checkBoxImpl.GetSelectedImage(); + Actor& fadeOutSelectedImage = checkBoxImpl.GetFadeOutSelectedImage(); + + Toolkit::CheckBoxButton& checkBoxButton = static_cast( button ); switch( mPaintState ) { - case UncheckedState: + case UnselectedState: { // Fade in the 'check' actor. - FadeInImage( button, checkedImage ); - SetupCheckedAnimation( button, checkedImage ); // Animate in the check actor + FadeInImage( checkBoxButton, selectedImage ); + SetupSelectedAnimation( checkBoxButton, selectedImage ); // Animate in the check actor StartCheckInAnimation(); - mPaintState = UncheckedCheckedTransition; + mPaintState = UnselectedSelectedTransition; break; } - case CheckedState: + case SelectedState: { // Fade out the 'check' actor. - StopCheckOutAnimation( button ); - FadeOutImage( button, Foreground, checkedImage ); - StartCheckOutAnimation( button ); + StopCheckOutAnimation( checkBoxButton ); + FadeOutImage( checkBoxButton, Foreground, selectedImage ); + StartCheckOutAnimation( checkBoxButton ); - mPaintState = UncheckedState; + mPaintState = UnselectedState; break; } - case UncheckedCheckedTransition: + case UnselectedSelectedTransition: { // Stop fade in and start fade out. - StopCheckOutAnimation( button ); + StopCheckOutAnimation( checkBoxButton ); StopCheckInAnimation(); float opacity = 0.f; - if( checkedImage ) + if( selectedImage ) { - opacity = checkedImage.GetCurrentOpacity(); + opacity = selectedImage.GetCurrentOpacity(); } - FadeOutImage( button, Foreground, checkedImage, opacity ); - StartCheckOutAnimation( button ); + FadeOutImage( checkBoxButton, Foreground, selectedImage, opacity ); + StartCheckOutAnimation( checkBoxButton ); - mPaintState = UncheckedState; + mPaintState = UnselectedState; break; } - case CheckedUncheckedTransition: + case SelectedUnselectedTransition: { // Stop fade out and start fade in. float opacity = 1.f; - if( fadeOutCheckedImage ) + if( fadeOutSelectedImage ) { - opacity = fadeOutCheckedImage.GetCurrentOpacity(); + opacity = fadeOutSelectedImage.GetCurrentOpacity(); } - StopCheckOutAnimation( button ); + StopCheckOutAnimation( checkBoxButton ); - FadeInImage( button, checkedImage, opacity ); + FadeInImage( checkBoxButton, selectedImage, opacity ); StartCheckInAnimation(); - mPaintState = UncheckedCheckedTransition; + mPaintState = UnselectedSelectedTransition; break; } default: @@ -729,7 +739,7 @@ void CheckBoxButtonDefaultPainter::ApplyConstraint( Actor& actor, float depth ) } } -void CheckBoxButtonDefaultPainter::ApplyCheckedConstraint( Actor& actor, float depth ) +void CheckBoxButtonDefaultPainter::ApplySelectedConstraint( Actor& actor, float depth ) { if( actor ) { @@ -799,14 +809,14 @@ void CheckBoxButtonDefaultPainter::StopCheckOutAnimation( Toolkit::CheckBoxButto } Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetCheckBoxButtonImpl( checkBox ); - Actor& fadeOutCheckedImage = checkBoxImpl.GetFadeOutCheckedImage(); + Actor& fadeOutSelectedImage = checkBoxImpl.GetFadeOutSelectedImage(); Actor& fadeOutBackgroundImage = checkBoxImpl.GetFadeOutBackgroundImage(); if( remove ) { - if( fadeOutCheckedImage && fadeOutCheckedImage.GetParent() ) + if( fadeOutSelectedImage && fadeOutSelectedImage.GetParent() ) { - fadeOutCheckedImage.GetParent().Remove( fadeOutCheckedImage ); + fadeOutSelectedImage.GetParent().Remove( fadeOutSelectedImage ); } if( fadeOutBackgroundImage && fadeOutBackgroundImage.GetParent() ) @@ -814,7 +824,7 @@ void CheckBoxButtonDefaultPainter::StopCheckOutAnimation( Toolkit::CheckBoxButto fadeOutBackgroundImage.GetParent().Remove( fadeOutBackgroundImage ); } - fadeOutCheckedImage.Reset(); + fadeOutSelectedImage.Reset(); fadeOutBackgroundImage.Reset(); } } @@ -837,10 +847,10 @@ void CheckBoxButtonDefaultPainter::FadeOutImage( Toolkit::CheckBoxButton& checkB if( image ) { Toolkit::Internal::CheckBoxButton& checkBoxImpl = GetCheckBoxButtonImpl( checkBox ); - Actor& fadeOutCheckedImage = checkBoxImpl.GetFadeOutCheckedImage(); + Actor& fadeOutSelectedImage = checkBoxImpl.GetFadeOutSelectedImage(); Actor& fadeOutBackgroundImage = checkBoxImpl.GetFadeOutBackgroundImage(); - Actor& actorLayer = ( ( Background == layer ) ? fadeOutBackgroundImage : fadeOutCheckedImage ); + Actor& actorLayer = ( ( Background == layer ) ? fadeOutBackgroundImage : fadeOutSelectedImage ); actorLayer = image; @@ -863,7 +873,7 @@ void CheckBoxButtonDefaultPainter::AddToCheckInAnimation( const Actor& actor ) mCheckInAnimation.AnimateTo( Property( handle, Actor::SCALE_X ), 1.0f); } -void CheckBoxButtonDefaultPainter::SetupCheckedAnimation( Toolkit::CheckBoxButton& checkBox, Actor& image ) +void CheckBoxButtonDefaultPainter::SetupSelectedAnimation( Toolkit::CheckBoxButton& checkBox, Actor& image ) { if( image ) { @@ -892,34 +902,34 @@ void CheckBoxButtonDefaultPainter::EndCheckOutAnimation() { switch( mPaintState ) { - case UncheckedCheckedTransition: + case UnselectedSelectedTransition: { - mPaintState = CheckedState; + mPaintState = SelectedState; break; } - case CheckedUncheckedTransition: + case SelectedUnselectedTransition: { - mPaintState = UncheckedState; + mPaintState = UnselectedState; break; } - case UncheckedDisabledTransition: + case UnselectedDisabledTransition: { - mPaintState = DisabledUncheckedState; + mPaintState = DisabledUnselectedState; break; } - case DisabledUncheckedTransition: + case DisabledUnselectedTransition: { - mPaintState = UncheckedState; + mPaintState = UnselectedState; break; } - case CheckedDisabledTransition: + case SelectedDisabledTransition: { - mPaintState = DisabledCheckedState; + mPaintState = DisabledSelectedState; break; } - case DisabledCheckedTransition: + case DisabledSelectedTransition: { - mPaintState = CheckedState; + mPaintState = SelectedState; break; } default: @@ -942,34 +952,34 @@ void CheckBoxButtonDefaultPainter::CheckInAnimationFinished( Dali::Animation& so { switch( mPaintState ) { - case UncheckedCheckedTransition: + case UnselectedSelectedTransition: { - mPaintState = CheckedState; + mPaintState = SelectedState; break; } - case CheckedUncheckedTransition: + case SelectedUnselectedTransition: { - mPaintState = UncheckedState; + mPaintState = UnselectedState; break; } - case UncheckedDisabledTransition: + case UnselectedDisabledTransition: { - mPaintState = DisabledUncheckedState; + mPaintState = DisabledUnselectedState; break; } - case DisabledUncheckedTransition: + case DisabledUnselectedTransition: { - mPaintState = UncheckedState; + mPaintState = UnselectedState; break; } - case CheckedDisabledTransition: + case SelectedDisabledTransition: { - mPaintState = DisabledCheckedState; + mPaintState = DisabledSelectedState; break; } - case DisabledCheckedTransition: + case DisabledSelectedTransition: { - mPaintState = CheckedState; + mPaintState = SelectedState; break; } default: diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.h b/dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.h index 0addbb4..a5b5a29 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.h +++ b/dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.h @@ -68,88 +68,54 @@ public: */ ~CheckBoxButtonDefaultPainter(); + ///////////////////////////////////////////////////////////////////////////// + // ButtonPainter interface + ///////////////////////////////////////////////////////////////////////////// + /** - * Sets the background image. - * - * It adds the background image to the root actor and creates the image transition if needed. - * - * @param[inout] checkBox The button in which all actors that form its appearance are going to be added. - * @param[in] image The background image. + * @copydoc ButtonPainter::Initialize( Toolkit::Button& button ) */ - void SetBackgroundImage( Toolkit::CheckBoxButton& checkBox, Actor image ); + virtual void Initialize( Toolkit::Button& button ); /** - * Sets the checked image. - * - * It adds the checked image to the root actor and creates the image transition if needed. - * - * @param[inout] checkBox The button in which all actors that form its appearance are going to be added. - * @param[in] image The checked image. + * @copydoc ButtonPainter::SetSize( Toolkit::Button& button, const Vector3& size ) */ - void SetCheckedImage( Toolkit::CheckBoxButton& checkBox, Actor image ); + virtual void SetSize( Toolkit::Button& button, const Vector3& size ); /** - * Sets the disabled backgroundimage. - * - * It adds the disabled backgroundimage to the root actor and creates the image transition if needed. - * - * @param[inout] checkBox The button in which all actors that form its appearance are going to be added. - * @param[in] image The disabled backgroundimage. + * @copydoc ButtonPainter::SetDisabled( Toolkit::Button& button, bool disabled ) */ - void SetDisabledBackgroundImage( Toolkit::CheckBoxButton& checkBox, Actor image ); + virtual void SetDisabled( Toolkit::Button& button, bool disabled ); /** - * Sets the disabled checked image. - * - * It adds the disabled checked image to the root actor and creates the image transition if needed. - * - * @param[inout] checkBox The button in which all actors that form its appearance are going to be added. - * @param[in] image The disabled checked image. + * @copydoc ButtonPainter::SetAnimationTime( float animationTime ) */ - void SetDisabledCheckedImage( Toolkit::CheckBoxButton& checkBox, Actor image ); - - ///////////////////////////////////////////////////////////////////////////// - // ButtonPainter interface - ///////////////////////////////////////////////////////////////////////////// + virtual void SetAnimationTime( float animationTime ); /** - * Initializes the painter by setting the default images. - * - * @param[inout] button The button in which all actors that form its appearance are going to be added. + * @copydoc ButtonPainter::GetAnimationTime() */ - void Initialize( Toolkit::Button& button ); + virtual float GetAnimationTime() const; /** - * Sets the new size. - * - * Resizes images. It applies size constraints. - * - * @param[inout] button The button which stores button's images. - * @param[in] size The new size. + * @copydoc ButtonPainter::SetSelectedImage( Toolkit::Button& button, Actor image ) */ - void SetSize( Toolkit::Button& button, const Vector3& size ); + virtual void SetSelectedImage( Toolkit::Button& button, Actor image ); /** - * Changes the Vega::Toolkit::CheckBoxButton for the given disabled state. - * - * It creates the image transition if needed. - * - * @param[inout] button The button in which all actors that form its appearance are going to be added. - * @param[in] disabled The disabled state. + * @copydoc ButtonPainter::SetBackgroundImage( Toolkit::Button& button, Actor image ) */ - void SetDisabled( Toolkit::Button& button, bool disabled ); + virtual void SetBackgroundImage( Toolkit::Button& button, Actor image ); /** - * Sets the animation time. - * @param[in] animationTime The animation time. + * @copydoc ButtonPainter::SetDisabledSelectedImage( Toolkit::Button& button, Actor image ) */ - void SetAnimationTime( float animationTime ); + virtual void SetDisabledSelectedImage( Toolkit::Button& button, Actor image ); /** - * Retrieves the animation time. - * @return The animation time. + * @copydoc ButtonPainter::SetDisabledBackgroundImage( Toolkit::Button& button, Actor image ) */ - float GetAnimationTime() const; + virtual void SetDisabledBackgroundImage( Toolkit::Button& button, Actor image ); ///////////////////////////////////////////////////////////////////////////// // CheckBoxButtonPainter interface @@ -161,7 +127,7 @@ public: * * @param[inout] checkBox The Dali::Toolkit::CheckBoxButton in which this object is registered. */ - void Checked( Toolkit::CheckBoxButton& checkBox ); + void Selected( Toolkit::Button& checkBox ); private: @@ -178,16 +144,16 @@ private: */ enum PaintState { - UncheckedState, ///< The check box button is unchecked. - CheckedState, ///< The check box button is checked. - DisabledUncheckedState, ///< The check box button is disabled and unchecked. - DisabledCheckedState, ///< The check box button is disabled and checked. - UncheckedCheckedTransition, ///< The check box button is in transition from unchecked to checked. - CheckedUncheckedTransition, ///< The check box button is in transition from checked to unchecked. - UncheckedDisabledTransition, ///< The check box button is in transition from unchecked to disabled. - DisabledUncheckedTransition, ///< The check box button is in transition from disabled to unchecked. - CheckedDisabledTransition, ///< The check box button is in transition from checked to disabled. - DisabledCheckedTransition ///< The check box button is in transition from disabled to checked. + UnselectedState, ///< The check box button is unselected. + SelectedState, ///< The check box button is selected. + DisabledUnselectedState, ///< The check box button is disabled and unselected. + DisabledSelectedState, ///< The check box button is disabled and selected. + UnselectedSelectedTransition, ///< The check box button is in transition from unselected to selected. + SelectedUnselectedTransition, ///< The check box button is in transition from selected to unselected. + UnselectedDisabledTransition, ///< The check box button is in transition from unselected to disabled. + DisabledUnselectedTransition, ///< The check box button is in transition from disabled to unselected. + SelectedDisabledTransition, ///< The check box button is in transition from selected to disabled. + DisabledSelectedTransition ///< The check box button is in transition from disabled to selected. }; /** @@ -214,7 +180,7 @@ private: * @param[inout] actor The actor. * @param[in] depth Depth position. */ - void ApplyCheckedConstraint( Actor& actor, float depth ); + void ApplySelectedConstraint( Actor& actor, float depth ); /** * Adds the actor to the fade in animation. It creates a fade in animation if needed. @@ -255,7 +221,7 @@ private: * Stops the fade out animation. * * It removes the actor stored in CheckBoxButtonDefaultPainter::mFadeOutBackgroundImage and - * CheckBoxButtonDefaultPainter::mFadeOutCheckedImage. + * CheckBoxButtonDefaultPainter::mFadeOutSelectedImage. * * @param[inout] checkBox The button which holds images. * @param[in] remove If true, removes the fadeout actor from root. @@ -275,7 +241,7 @@ private: * It adds the actor fade out animation and stores it to be removed when the animation finishes. * * @param[inout] checkBox The button which holds images. - * @param[in] layer Defines if the actor is going to be stored in the mFadeOutBackgroundImage or mFadeOutCheckedImage member. + * @param[in] layer Defines if the actor is going to be stored in the mFadeOutBackgroundImage or mFadeOutSelectedImage member. * @param[inout] image The actor. * @param[in] opacity The initial opacity. */ @@ -294,7 +260,7 @@ private: * @param[inout] checkBox The button which holds images. * @param[inout] image The actor. */ - void SetupCheckedAnimation( Toolkit::CheckBoxButton& checkBox, Actor& image ); + void SetupSelectedAnimation( Toolkit::CheckBoxButton& checkBox, Actor& image ); /** * Signal end of check out animation diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp index c15c15e..9c898c7 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp @@ -19,8 +19,6 @@ #include "check-box-button-impl.h" // EXTERNAL INCLUDES -#include -#include #include // INTERNAL INCLUDES @@ -45,19 +43,8 @@ BaseHandle Create() TypeRegistration mType( typeid(Toolkit::CheckBoxButton), typeid(Toolkit::Button), Create ); -TypeAction a1(mType, Toolkit::CheckBoxButton::ACTION_CHECK_BOX_BUTTON_CLICK, &CheckBoxButton::DoAction); - } -namespace -{ - // Helper function used to cast a ButtonPainterPtr to CheckBoxButtonDefaultPainterPtr - CheckBoxButtonDefaultPainterPtr GetCheckBoxButtonPainter( ButtonPainterPtr painter ) - { - return static_cast( painter.Get() ); - } -} // namespace - Dali::Toolkit::CheckBoxButton CheckBoxButton::New() { // Create the implementation, temporarily owned on stack @@ -73,193 +60,19 @@ Dali::Toolkit::CheckBoxButton CheckBoxButton::New() return checkBoxButton; } -void CheckBoxButton::SetChecked( bool checked ) -{ - if( !mDisabled && ( checked != mChecked ) ) - { - // Stores the state. - mChecked = checked; - - Toolkit::CheckBoxButton handle( GetOwner() ); - - // Notifies the painter the checkbox has been checked. - GetCheckBoxButtonPainter( mPainter )->Checked( handle ); - - // Raise state changed signal - mStateChangedSignal.Emit( handle, mChecked ); - } -} - -bool CheckBoxButton::IsChecked() const -{ - return mChecked; -} - -void CheckBoxButton::SetBackgroundImage( Image image ) -{ - SetBackgroundImage( ImageActor::New( image ) ); -} - -void CheckBoxButton::SetBackgroundImage( Actor image ) -{ - Toolkit::CheckBoxButton handle( GetOwner() ); - GetCheckBoxButtonPainter( mPainter )->SetBackgroundImage( handle, image ); -} - -Actor& CheckBoxButton::GetBackgroundImage() -{ - return mBackgroundImage; -} - -Actor CheckBoxButton::GetBackgroundImage() const -{ - return mBackgroundImage; -} - -void CheckBoxButton::SetCheckedImage( Image image ) -{ - SetCheckedImage( ImageActor::New( image ) ); -} - -void CheckBoxButton::SetCheckedImage( Actor image ) -{ - Toolkit::CheckBoxButton handle( GetOwner() ); - GetCheckBoxButtonPainter( mPainter )->SetCheckedImage( handle, image ); -} - -Actor& CheckBoxButton::GetCheckedImage() -{ - return mCheckedImage; -} - -Actor CheckBoxButton::GetCheckedImage() const -{ - return mCheckedImage; -} - -void CheckBoxButton::SetDisabledBackgroundImage( Image image ) -{ - SetDisabledBackgroundImage( ImageActor::New( image ) ); -} - -void CheckBoxButton::SetDisabledBackgroundImage( Actor image ) -{ - Toolkit::CheckBoxButton handle( GetOwner() ); - GetCheckBoxButtonPainter( mPainter )->SetDisabledBackgroundImage( handle, image ); -} - -Actor& CheckBoxButton::GetDisabledBackgroundImage() -{ - return mDisabledBackgroundImage; -} - -Actor CheckBoxButton::GetDisabledBackgroundImage() const -{ - return mDisabledBackgroundImage; -} - -void CheckBoxButton::SetDisabledCheckedImage( Image image ) -{ - SetDisabledCheckedImage( ImageActor::New( image ) ); -} - -void CheckBoxButton::SetDisabledCheckedImage( Actor image ) -{ - Toolkit::CheckBoxButton handle( GetOwner() ); - GetCheckBoxButtonPainter( mPainter )->SetDisabledCheckedImage( handle, image ); -} - -Actor& CheckBoxButton::GetDisabledCheckedImage() -{ - return mDisabledCheckedImage; -} - -Actor CheckBoxButton::GetDisabledCheckedImage() const -{ - return mDisabledCheckedImage; -} - -Actor& CheckBoxButton::GetFadeOutBackgroundImage() -{ - return mFadeOutBackgroundImage; -} - -Actor& CheckBoxButton::GetFadeOutCheckedImage() -{ - return mFadeOutCheckedImage; -} - -void CheckBoxButton::OnButtonInitialize() -{ -} - -void CheckBoxButton::OnButtonUp() -{ - if( ButtonDown == mState ) - { - // Stores the state, notifies the painter and emits a signal. - SetChecked( !mChecked ); - } -} - -void CheckBoxButton::OnAnimationTimeSet( float animationTime ) -{ - GetCheckBoxButtonPainter( mPainter )->SetAnimationTime( animationTime ); -} - -float CheckBoxButton::OnAnimationTimeRequested() const -{ - return GetCheckBoxButtonPainter( mPainter )->GetAnimationTime(); -} - -void CheckBoxButton::OnActivated() -{ - // When the button is activated, it performs the click action - PropertyValueContainer attributes; - DoClickAction(attributes); -} - -void CheckBoxButton::DoClickAction(const PropertyValueContainer& attributes) -{ - // Prevents the button signals from doing a recursive loop by sending an action - // and re-emitting the signals. - if(!mClickActionPerforming) - { - mClickActionPerforming = true; - SetChecked( !mChecked ); - mClickActionPerforming = false; - } -} - -bool CheckBoxButton::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes) -{ - bool ret = false; - - Dali::BaseHandle handle(object); - - Toolkit::CheckBoxButton button = Toolkit::CheckBoxButton::DownCast(handle); - - if(Toolkit::CheckBoxButton::ACTION_CHECK_BOX_BUTTON_CLICK == actionName) - { - GetImplementation(button).DoClickAction(attributes); - ret = true; - } - - return ret; -} - CheckBoxButton::CheckBoxButton() -: Button(), - mChecked( false ), - mClickActionPerforming(false) +: Button() { // Creates specific painter. - mPainter = new CheckBoxButtonDefaultPainter(); + ButtonPainterPtr painter = new CheckBoxButtonDefaultPainter(); + SetPainter( painter ); + + SetTogglableButton( true ); } CheckBoxButton::~CheckBoxButton() { - mPainter = NULL; + SetPainter( NULL ); } } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-impl.h b/dali-toolkit/internal/controls/buttons/check-box-button-impl.h index cb5e08c..619a571 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/check-box-button-impl.h @@ -49,162 +49,6 @@ public: */ static Dali::Toolkit::CheckBoxButton New(); - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetChecked( bool checked ) - */ - void SetChecked( bool checked ); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::IsChecked() - */ - bool IsChecked() const; - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetBackgroundImage( Image image ) - */ - void SetBackgroundImage( Image image ); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetBackgroundImage( Actor image ) - */ - void SetBackgroundImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the background image. - */ - Actor& GetBackgroundImage(); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::GetBackgroundImage() - */ - Actor GetBackgroundImage() const; - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetCheckedImage( Image image ) - */ - void SetCheckedImage( Image image ); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetCheckedImage( Actor image ) - */ - void SetCheckedImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the checked image. - */ - Actor& GetCheckedImage(); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::GetCheckedImage() - */ - Actor GetCheckedImage() const; - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledBackgroundImage( Image image ) - */ - void SetDisabledBackgroundImage( Image image ); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledBackgroundImage( Actor image ) - */ - void SetDisabledBackgroundImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the disabled background image. - */ - Actor& GetDisabledBackgroundImage(); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::GetDisabledBackgroundImage() - */ - Actor GetDisabledBackgroundImage() const; - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledCheckedImage( Image image ) - */ - void SetDisabledCheckedImage( Image image ); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledCheckedImage( Actor image ) - */ - void SetDisabledCheckedImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the disabled checked image. - */ - Actor& GetDisabledCheckedImage(); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::GetDisabledCheckedImage() - */ - Actor GetDisabledCheckedImage() const; - - /** - * Used by the painter only. - * @return A reference to the background image that is fading out. - */ - Actor& GetFadeOutBackgroundImage(); - - /** - * Used by the painter only. - * @return A reference to the checked image that is fading out. - */ - Actor& GetFadeOutCheckedImage(); - -protected: // From Control - - /** - * Respond the activate notification. - */ - virtual void OnActivated(); - -private: - - /** - * Perform the click action to click the button. - * @param[in] attributes The attributes to perfrom this action. - */ - void DoClickAction(const PropertyValueContainer& attributes); - -public: - /** - * 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. - * @param[in] attributes The attributes with which to perfrom this action. - * @return true if action has been accepted by this control - */ - static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes); - -protected: // From Button - - /** - * Registers properties - */ - virtual void OnButtonInitialize(); - - /** - * Emits signals and notifies the painter accordingly with the set button - * properties when the button is released. - */ - virtual void OnButtonUp(); - - /** - * Sets the push button animation time. - * @param animationTime The animation time in seconds. - */ - virtual void OnAnimationTimeSet( float animationTime ); - - /** - * Retrieves the animation time. - * @return The animation time in seconds. - */ - virtual float OnAnimationTimeRequested() const; - protected: /** @@ -224,20 +68,6 @@ private: // Undefined CheckBoxButton& operator=( const CheckBoxButton& ); - - -private: - bool mChecked; ///< Stores the check state. - - Actor mBackgroundImage; ///< Stores the background image. - Actor mCheckedImage; ///< Stores the checked image. - Actor mDisabledCheckedImage; ///< Stores the disabled checked image. - Actor mDisabledBackgroundImage; ///< Stores the disabled background image. - Actor mFadeOutBackgroundImage; ///< Stores a background image, which is in a fade out animation, to be removed when the animation finishes. - Actor mFadeOutCheckedImage; ///< Stores a foreground image, which is in a fade out animation, to be removed when the animation finishes. - - // Actions - bool mClickActionPerforming; }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-painter-impl.h b/dali-toolkit/internal/controls/buttons/check-box-button-painter-impl.h index c4224d4..3151809 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-painter-impl.h +++ b/dali-toolkit/internal/controls/buttons/check-box-button-painter-impl.h @@ -53,14 +53,6 @@ public: */ virtual ~CheckBoxButtonPainter() {} - /** - * This method is called when the Dali::Toolkit::Internal::CheckBoxButton, in which this - * object is registered, changes its state. - * @param[inout] button The Dali::Toolkit::CheckBoxButton, linked to the internal - * implementation, in which this object is registered. - */ - virtual void Checked( Toolkit::CheckBoxButton& button ) = 0; - ///////////////////////////////////////////////////////////////////////////// // ButtonPainter interface ///////////////////////////////////////////////////////////////////////////// diff --git a/dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.cpp b/dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.cpp index cf0cf92..5a60a1d 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.cpp @@ -26,7 +26,6 @@ // INTERNAL INCLUDES #include -#include #include "push-button-impl.h" namespace Dali @@ -89,180 +88,190 @@ PushButtonDefaultPainter::~PushButtonDefaultPainter() } } -void PushButtonDefaultPainter::SetButtonImage( Toolkit::PushButton& pushButton, Actor image ) +void PushButtonDefaultPainter::Initialize( Toolkit::Button& button ) { - Toolkit::Internal::PushButton& pushButtonImpl = GetImplementation( pushButton ); + Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); Actor& buttonImage = pushButtonImpl.GetButtonImage(); - Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); + Actor& selectedImage = pushButtonImpl.GetSelectedImage(); + Actor& backgroundImage = pushButtonImpl.GetBackgroundImage(); + Actor& disabledImage = pushButtonImpl.GetDisabledImage(); + Actor& disabledBackgroundImage = pushButtonImpl.GetDisabledBackgroundImage(); + Actor& label = pushButtonImpl.GetLabel(); - switch( mPaintState ) + Toolkit::PushButton& pushButton = static_cast( button ); + + if( buttonImage ) { - case ReleasedState: - { - if( buttonImage && buttonImage.GetParent() ) - { - StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Foreground, buttonImage ); + SetButtonImage( pushButton, buttonImage ); + } - buttonImage = image; + if( backgroundImage ) + { + SetBackgroundImage( pushButton, backgroundImage ); + } - FadeInImage( pushButton, buttonImage ); + if( selectedImage ) + { + SetSelectedImage( pushButton, selectedImage ); + } - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); - } - else - { - buttonImage = image; - pushButton.Add( buttonImage ); - } - break; - } - case ReleasedPressedTransition: // FALLTHROUGH - case ReleasedDisabledTransition: - { - float opacity = 1.f; - if( fadeOutButtonImage ) - { - opacity = fadeOutButtonImage.GetCurrentOpacity(); - } - StopFadeOutAnimation( pushButton ); + if( disabledImage ) + { + SetDisabledImage( pushButton, disabledImage ); + } - // Replaces the button image. - buttonImage = image; + if( disabledBackgroundImage ) + { + SetDisabledBackgroundImage( pushButton, disabledBackgroundImage ); + } - pushButton.Add( buttonImage ); - FadeOutImage( pushButton, Foreground, buttonImage, opacity ); + if( label ) + { + SetLabel( pushButton, label ); + } - StartFadeOutAnimation( pushButton ); - break; - } - case PressedReleasedTransition: // FALLTHROUGH - case DisabledReleasedTransition: - { - StopFadeInAnimation(); - pushButton.Remove( buttonImage ); + SetDisabled( pushButton, mDisabled ); +} - buttonImage = image; +void PushButtonDefaultPainter::SetSize( Toolkit::Button& button, const Vector3& size ) +{ + if( size != mSize ) + { + mSize = size; - FadeInImage( pushButton, buttonImage ); - StartFadeInAnimation(); - break; + Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); + Actor& buttonImage = pushButtonImpl.GetButtonImage(); + Actor& selectedImage = pushButtonImpl.GetSelectedImage(); + Actor& backgroundImage = pushButtonImpl.GetBackgroundImage(); + Actor& disabledImage = pushButtonImpl.GetDisabledImage(); + Actor& disabledBackgroundImage = pushButtonImpl.GetDisabledBackgroundImage(); + Actor& label = pushButtonImpl.GetLabel(); + + ApplyConstraint( buttonImage, FOREGROUND_DEPTH ); + ApplyConstraint( backgroundImage, BACKGROUND_DEPTH ); + ApplyConstraint( selectedImage, FOREGROUND_DEPTH ); + ApplyConstraint( disabledImage, FOREGROUND_DEPTH ); + ApplyConstraint( disabledBackgroundImage, BACKGROUND_DEPTH ); + + if( label ) + { + label.SetPosition( 0.f, 0.f, LABEL_DEPTH ); + label.SetSize( mSize ); } - default: - buttonImage = image; - break; } - - buttonImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - buttonImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - ApplyConstraint( buttonImage, FOREGROUND_DEPTH ); } -void PushButtonDefaultPainter::SetBackgroundImage( Toolkit::PushButton& pushButton, Actor image ) +void PushButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool disabled ) { - Toolkit::Internal::PushButton& pushButtonImpl = GetImplementation( pushButton ); + Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); + Actor& buttonImage = pushButtonImpl.GetButtonImage(); + Actor& selectedImage = pushButtonImpl.GetSelectedImage(); Actor& backgroundImage = pushButtonImpl.GetBackgroundImage(); - Actor& fadeOutBackgroundImage = pushButtonImpl.GetFadeOutBackgroundImage(); + Actor& disabledImage = pushButtonImpl.GetDisabledImage(); + Actor& disabledBackgroundImage = pushButtonImpl.GetDisabledBackgroundImage(); + Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); + + Toolkit::PushButton& pushButton = static_cast( button ); + + mDisabled = disabled; switch( mPaintState ) { - case ReleasedState: // FALLTHROUGH - case PressedState: - case ReleasedPressedTransition: - case PressedReleasedTransition: + case ReleasedState: + { + if( disabled ) { - if( backgroundImage && backgroundImage.GetParent() ) - { - StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Background, backgroundImage ); - - backgroundImage = image; - - FadeInImage( pushButton, backgroundImage ); + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Background, backgroundImage ); + FadeOutImage( pushButton, Foreground, buttonImage ); + FadeInImage( pushButton, disabledBackgroundImage ); + FadeInImage( pushButton, disabledImage ); + StartFadeOutAnimation( pushButton ); + StartFadeInAnimation(); - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); + if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) + { + mPaintState = ReleasedDisabledTransition; } else { - backgroundImage = image; - pushButton.Add( backgroundImage ); + mPaintState = DisabledReleasedState; } - break; } - case ReleasedDisabledTransition: // FALLTHROUGH - case PressedDisabledTransition: + break; + } + case PressedState: + { + if( disabled ) { - float opacity = 1.f; - if( fadeOutBackgroundImage ) - { - opacity = fadeOutBackgroundImage.GetCurrentOpacity(); - } StopFadeOutAnimation( pushButton ); - - // Replaces the button image. - backgroundImage = image; - - pushButton.Add( backgroundImage ); - FadeOutImage( pushButton, Background, backgroundImage, opacity ); - + FadeOutImage( pushButton, Background, backgroundImage ); + FadeOutImage( pushButton, Foreground, selectedImage ); + FadeInImage( pushButton, disabledBackgroundImage ); + FadeInImage( pushButton, disabledImage ); StartFadeOutAnimation( pushButton ); - break; + StartFadeInAnimation(); + + if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) + { + mPaintState = PressedDisabledTransition; + } + else + { + mPaintState = DisabledPressedState; + } } - case DisabledReleasedTransition: // FALLTHROUGH - case DisabledPressedTransition: + break; + } + case DisabledReleasedState: + { + if( !disabled ) { - StopFadeInAnimation(); - pushButton.Remove( backgroundImage ); - - backgroundImage = image; - + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Background, disabledBackgroundImage ); + FadeOutImage( pushButton, Foreground, disabledImage ); FadeInImage( pushButton, backgroundImage ); + FadeInImage( pushButton, buttonImage ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); - break; - } - default: - backgroundImage = image; - break; - } - - backgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - backgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - ApplyConstraint( backgroundImage, BACKGROUND_DEPTH ); -} -void PushButtonDefaultPainter::SetSelectedImage( Toolkit::PushButton& pushButton, Actor image ) -{ - Toolkit::Internal::PushButton& pushButtonImpl = GetImplementation( pushButton ); - Actor& selectedImage = pushButtonImpl.GetSelectedImage(); - Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); - - switch( mPaintState ) + if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) + { + mPaintState = DisabledReleasedTransition; + } + else + { + mPaintState = ReleasedState; + } + } + break; + } + case DisabledPressedState: { - case PressedState: + if( !disabled ) { - if( selectedImage && selectedImage.GetParent() ) - { - StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Foreground, selectedImage ); - - selectedImage = image; - - FadeInImage( pushButton, selectedImage ); + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Background, disabledBackgroundImage ); + FadeOutImage( pushButton, Foreground, disabledImage ); + FadeInImage( pushButton, backgroundImage ); + FadeInImage( pushButton, selectedImage ); + StartFadeOutAnimation( pushButton ); + StartFadeInAnimation(); - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); + if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) + { + mPaintState = DisabledPressedTransition; } else { - selectedImage = image; - pushButton.Add( selectedImage ); + mPaintState = PressedState; } - break; } - case PressedReleasedTransition: // FALLTHROUGH - case PressedDisabledTransition: + break; + } + case ReleasedPressedTransition: + { + if( disabled ) { float opacity = 1.f; if( fadeOutButtonImage ) @@ -270,604 +279,608 @@ void PushButtonDefaultPainter::SetSelectedImage( Toolkit::PushButton& pushButton opacity = fadeOutButtonImage.GetCurrentOpacity(); } StopFadeOutAnimation( pushButton ); + StopFadeInAnimation(); - // Replaces the button image. - selectedImage = image; + FadeOutImage( pushButton, Foreground, selectedImage, 1.f - opacity ); + FadeOutImage( pushButton, Background, backgroundImage ); - pushButton.Add( selectedImage ); - FadeOutImage( pushButton, Foreground, selectedImage, opacity ); + FadeInImage( pushButton, disabledImage ); + FadeInImage( pushButton, disabledBackgroundImage ); StartFadeOutAnimation( pushButton ); - break; - } - case ReleasedPressedTransition: // FALLTHROUGH - case DisabledPressedTransition: - { - StopFadeInAnimation(); - pushButton.Remove( selectedImage ); - - selectedImage = image; - - FadeInImage( pushButton, selectedImage ); StartFadeInAnimation(); - break; - } - default: - selectedImage = image; - break; - } - - selectedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - selectedImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - ApplyConstraint( selectedImage, FOREGROUND_DEPTH ); -} - -void PushButtonDefaultPainter::SetDisabledImage( Toolkit::PushButton& pushButton, Actor image ) -{ - Toolkit::Internal::PushButton& pushButtonImpl = GetImplementation( pushButton ); - Actor& disabledImage = pushButtonImpl.GetDisabledImage(); - Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); - switch( mPaintState ) - { - case DisabledReleasedState: // FALLTHROUGH - case DisabledPressedState: - { - if( disabledImage && disabledImage.GetParent() ) + if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) { - StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Foreground, disabledImage ); - - disabledImage = image; - - FadeInImage( pushButton, disabledImage ); - - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); + mPaintState = PressedDisabledTransition; } else { - disabledImage = image; - pushButton.Add( disabledImage ); + mPaintState = DisabledPressedState; } - break; } - case ReleasedDisabledTransition: // FALLTHROUGH - case PressedDisabledTransition: + break; + } + case PressedReleasedTransition: + { + if( disabled ) { + float opacity = 1.f; + if( fadeOutButtonImage ) + { + opacity = fadeOutButtonImage.GetCurrentOpacity(); + } + StopFadeOutAnimation( pushButton ); StopFadeInAnimation(); - pushButton.Remove( disabledImage ); - disabledImage = image; + FadeOutImage( pushButton, Foreground, buttonImage, 1.f - opacity ); + FadeOutImage( pushButton, Background, backgroundImage ); FadeInImage( pushButton, disabledImage ); + FadeInImage( pushButton, disabledBackgroundImage ); + + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); - break; + + if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) + { + mPaintState = ReleasedDisabledTransition; + } + else + { + mPaintState = DisabledReleasedState; + } } - case DisabledReleasedTransition: // FALLTHROUGH - case DisabledPressedTransition: + break; + } + case ReleasedDisabledTransition: + { + if( !disabled ) { float opacity = 1.f; if( fadeOutButtonImage ) { opacity = fadeOutButtonImage.GetCurrentOpacity(); } - StopFadeOutAnimation( pushButton ); - - // Replaces the button image. - disabledImage = image; + StopFadeOutAnimation( pushButton, false ); + StopFadeInAnimation(); - pushButton.Add( disabledImage ); - FadeOutImage( pushButton, Foreground, disabledImage, opacity ); + FadeOutImage( pushButton, Foreground, disabledImage, 1.f - opacity ); + FadeOutImage( pushButton, Background, disabledBackgroundImage, 1.f - opacity ); + FadeInImage( pushButton, buttonImage, opacity ); + FadeInImage( pushButton, backgroundImage, opacity ); StartFadeOutAnimation( pushButton ); - break; + StartFadeInAnimation(); + + if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) + { + mPaintState = DisabledReleasedTransition; + } + else + { + mPaintState = ReleasedState; + } } - default: - disabledImage = image; - break; + break; } - - disabledImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - disabledImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - ApplyConstraint( disabledImage, FOREGROUND_DEPTH ); -} - -void PushButtonDefaultPainter::SetDisabledBackgroundImage( Toolkit::PushButton& pushButton, Actor image ) -{ - Toolkit::Internal::PushButton& pushButtonImpl = GetImplementation( pushButton ); - Actor& disabledBackgroundImage = pushButtonImpl.GetDisabledBackgroundImage(); - Actor& fadeOutBackgroundImage = pushButtonImpl.GetFadeOutBackgroundImage(); - - switch( mPaintState ) + case DisabledReleasedTransition: { - case DisabledReleasedState: // FALLTHROUGH - case DisabledPressedState: + if( disabled ) { - if( disabledBackgroundImage && disabledBackgroundImage.GetParent() ) + float opacity = 1.f; + if( fadeOutButtonImage ) { - StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Background, disabledBackgroundImage ); + opacity = fadeOutButtonImage.GetCurrentOpacity(); + } + StopFadeOutAnimation( pushButton, false ); + StopFadeInAnimation(); - disabledBackgroundImage = image; + FadeOutImage( pushButton, Foreground, buttonImage, 1.f - opacity ); + FadeOutImage( pushButton, Background, backgroundImage, 1.f - opacity ); + FadeInImage( pushButton, disabledImage, opacity ); + FadeInImage( pushButton, disabledBackgroundImage, opacity ); - FadeInImage( pushButton, disabledBackgroundImage ); + StartFadeOutAnimation( pushButton ); + StartFadeInAnimation(); - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); + if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) + { + mPaintState = ReleasedDisabledTransition; } else { - disabledBackgroundImage = image; - pushButton.Add( disabledBackgroundImage ); + mPaintState = DisabledReleasedState; } - break; } - case ReleasedDisabledTransition: // FALLTHROUGH - case PressedDisabledTransition: + break; + } + case PressedDisabledTransition: + { + if( !disabled ) { + float opacity = 1.f; + if( fadeOutButtonImage ) + { + opacity = fadeOutButtonImage.GetCurrentOpacity(); + } + StopFadeOutAnimation( pushButton, false ); StopFadeInAnimation(); - pushButton.Remove( disabledBackgroundImage ); - disabledBackgroundImage = image; + FadeOutImage( pushButton, Foreground, disabledImage, 1.f - opacity ); + FadeOutImage( pushButton, Background, disabledBackgroundImage, 1.f - opacity ); + FadeInImage( pushButton, selectedImage, opacity ); + FadeInImage( pushButton, backgroundImage, opacity ); - FadeInImage( pushButton, disabledBackgroundImage ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); - break; + + if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) + { + mPaintState = DisabledPressedTransition; + } + else + { + mPaintState = PressedState; + } } - case DisabledReleasedTransition: // FALLTHROUGH - case DisabledPressedTransition: + break; + } + case DisabledPressedTransition: + { + if( disabled ) { float opacity = 1.f; - if( fadeOutBackgroundImage ) + if( fadeOutButtonImage ) { - opacity = fadeOutBackgroundImage.GetCurrentOpacity(); + opacity = fadeOutButtonImage.GetCurrentOpacity(); } - StopFadeOutAnimation( pushButton ); - - // Replaces the button image. - disabledBackgroundImage = image; + StopFadeOutAnimation( pushButton, false ); + StopFadeInAnimation(); - pushButton.Add( disabledBackgroundImage ); - FadeOutImage( pushButton, Background, disabledBackgroundImage, opacity ); + FadeOutImage( pushButton, Foreground, selectedImage, 1.f - opacity ); + FadeOutImage( pushButton, Background, backgroundImage, 1.f - opacity ); + FadeInImage( pushButton, disabledImage, opacity ); + FadeInImage( pushButton, disabledBackgroundImage, opacity ); StartFadeOutAnimation( pushButton ); - break; + StartFadeInAnimation(); + + if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) + { + mPaintState = PressedDisabledTransition; + } + else + { + mPaintState = DisabledPressedState; + } } - default: - disabledBackgroundImage = image; - break; + break; + } + default: + break; } - - disabledBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - disabledBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - ApplyConstraint( disabledBackgroundImage, BACKGROUND_DEPTH ); } -void PushButtonDefaultPainter::SetLabel( Toolkit::PushButton& pushButton, Actor label ) +void PushButtonDefaultPainter::SetAnimationTime( float animationTime ) { - Toolkit::Internal::PushButton& pushButtonImpl = GetImplementation( pushButton ); - Actor& labelActor = pushButtonImpl.GetLabel(); - - if( labelActor && labelActor.GetParent() ) - { - labelActor.GetParent().Remove( labelActor ); - } - - labelActor = label; - labelActor.SetAnchorPoint( AnchorPoint::CENTER ); - labelActor.SetParentOrigin( ParentOrigin::CENTER ); + mAnimationTime = animationTime; +} - labelActor.SetPosition( 0.f, 0.f, LABEL_DEPTH ); - labelActor.SetSize( mSize ); +float PushButtonDefaultPainter::GetAnimationTime() const +{ + return mAnimationTime; +} - pushButton.Add( labelActor ); +void PushButtonDefaultPainter::SetAutoRepeating( bool autorepeating ) +{ + mAutoRepeating = autorepeating; } -void PushButtonDefaultPainter::Initialize( Toolkit::Button& button ) +void PushButtonDefaultPainter::SetLabel( Toolkit::Button& button, Actor label ) { Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); - Actor& buttonImage = pushButtonImpl.GetButtonImage(); - Actor& selectedImage = pushButtonImpl.GetSelectedImage(); - Actor& backgroundImage = pushButtonImpl.GetBackgroundImage(); - Actor& disabledImage = pushButtonImpl.GetDisabledImage(); - Actor& disabledBackgroundImage = pushButtonImpl.GetDisabledBackgroundImage(); - Actor& label = pushButtonImpl.GetLabel(); + Actor& labelActor = pushButtonImpl.GetLabel(); Toolkit::PushButton& pushButton = static_cast( button ); - if( buttonImage ) - { - SetButtonImage( pushButton, buttonImage ); - } - - if( backgroundImage ) - { - SetBackgroundImage( pushButton, backgroundImage ); - } - - if( selectedImage ) - { - SetSelectedImage( pushButton, selectedImage ); - } - - if( disabledImage ) - { - SetDisabledImage( pushButton, disabledImage ); - } - - if( disabledBackgroundImage ) - { - SetDisabledBackgroundImage( pushButton, disabledBackgroundImage ); - } - - if( label ) + if( labelActor && labelActor.GetParent() ) { - SetLabel( pushButton, label ); + labelActor.GetParent().Remove( labelActor ); } - SetDisabled( pushButton, mDisabled ); -} - -void PushButtonDefaultPainter::SetSize( Toolkit::Button& button, const Vector3& size ) -{ - if( size != mSize ) - { - mSize = size; - - Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); - Actor& buttonImage = pushButtonImpl.GetButtonImage(); - Actor& selectedImage = pushButtonImpl.GetSelectedImage(); - Actor& backgroundImage = pushButtonImpl.GetBackgroundImage(); - Actor& disabledImage = pushButtonImpl.GetDisabledImage(); - Actor& disabledBackgroundImage = pushButtonImpl.GetDisabledBackgroundImage(); - Actor& label = pushButtonImpl.GetLabel(); - - ApplyConstraint( buttonImage, FOREGROUND_DEPTH ); - ApplyConstraint( backgroundImage, BACKGROUND_DEPTH ); - ApplyConstraint( selectedImage, FOREGROUND_DEPTH ); - ApplyConstraint( disabledImage, FOREGROUND_DEPTH ); - ApplyConstraint( disabledBackgroundImage, BACKGROUND_DEPTH ); + labelActor = label; + labelActor.SetAnchorPoint( AnchorPoint::CENTER ); + labelActor.SetParentOrigin( ParentOrigin::CENTER ); - if( label ) - { - label.SetPosition( 0.f, 0.f, LABEL_DEPTH ); - label.SetSize( mSize ); - } - } + labelActor.SetPosition( 0.f, 0.f, LABEL_DEPTH ); + labelActor.SetSize( mSize ); + + pushButton.Add( labelActor ); } -void PushButtonDefaultPainter::SetDisabled( Toolkit::Button& button, bool disabled ) +void PushButtonDefaultPainter::SetButtonImage( Toolkit::Button& button, Actor image ) { Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); Actor& buttonImage = pushButtonImpl.GetButtonImage(); - Actor& selectedImage = pushButtonImpl.GetSelectedImage(); - Actor& backgroundImage = pushButtonImpl.GetBackgroundImage(); - Actor& disabledImage = pushButtonImpl.GetDisabledImage(); - Actor& disabledBackgroundImage = pushButtonImpl.GetDisabledBackgroundImage(); Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); Toolkit::PushButton& pushButton = static_cast( button ); - mDisabled = disabled; - switch( mPaintState ) { - case ReleasedState: - { - if( disabled ) + case ReleasedState: { - StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Background, backgroundImage ); - FadeOutImage( pushButton, Foreground, buttonImage ); - FadeInImage( pushButton, disabledBackgroundImage ); - FadeInImage( pushButton, disabledImage ); - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); - - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) + if( buttonImage && buttonImage.GetParent() ) { - mPaintState = ReleasedDisabledTransition; + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Foreground, buttonImage ); + + buttonImage = image; + + FadeInImage( pushButton, buttonImage ); + + StartFadeOutAnimation( pushButton ); + StartFadeInAnimation(); } else { - mPaintState = DisabledReleasedState; + buttonImage = image; + pushButton.Add( buttonImage ); } + break; } - break; - } - case PressedState: - { - if( disabled ) + case ReleasedPressedTransition: // FALLTHROUGH + case ReleasedDisabledTransition: { - StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Background, backgroundImage ); - FadeOutImage( pushButton, Foreground, selectedImage ); - FadeInImage( pushButton, disabledBackgroundImage ); - FadeInImage( pushButton, disabledImage ); - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); - - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = PressedDisabledTransition; - } - else + float opacity = 1.f; + if( fadeOutButtonImage ) { - mPaintState = DisabledPressedState; + opacity = fadeOutButtonImage.GetCurrentOpacity(); } + StopFadeOutAnimation( pushButton ); + + // Replaces the button image. + buttonImage = image; + + pushButton.Add( buttonImage ); + FadeOutImage( pushButton, Foreground, buttonImage, opacity ); + + StartFadeOutAnimation( pushButton ); + break; } - break; - } - case DisabledReleasedState: - { - if( !disabled ) + case PressedReleasedTransition: // FALLTHROUGH + case DisabledReleasedTransition: { - StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Background, disabledBackgroundImage ); - FadeOutImage( pushButton, Foreground, disabledImage ); - FadeInImage( pushButton, backgroundImage ); + StopFadeInAnimation(); + pushButton.Remove( buttonImage ); + + buttonImage = image; + FadeInImage( pushButton, buttonImage ); - StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); + break; + } + default: + buttonImage = image; + break; + } - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) + buttonImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + buttonImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); + ApplyConstraint( buttonImage, FOREGROUND_DEPTH ); +} + +void PushButtonDefaultPainter::SetSelectedImage( Toolkit::Button& button, Actor image ) +{ + Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); + Actor& selectedImage = pushButtonImpl.GetSelectedImage(); + Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); + + Toolkit::PushButton& pushButton = static_cast( button ); + + switch( mPaintState ) + { + case PressedState: + { + if( selectedImage && selectedImage.GetParent() ) { - mPaintState = DisabledReleasedTransition; + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Foreground, selectedImage ); + + selectedImage = image; + + FadeInImage( pushButton, selectedImage ); + + StartFadeOutAnimation( pushButton ); + StartFadeInAnimation(); } else { - mPaintState = ReleasedState; + selectedImage = image; + pushButton.Add( selectedImage ); } + break; } - break; - } - case DisabledPressedState: - { - if( !disabled ) + case PressedReleasedTransition: // FALLTHROUGH + case PressedDisabledTransition: { + float opacity = 1.f; + if( fadeOutButtonImage ) + { + opacity = fadeOutButtonImage.GetCurrentOpacity(); + } StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Background, disabledBackgroundImage ); - FadeOutImage( pushButton, Foreground, disabledImage ); - FadeInImage( pushButton, backgroundImage ); - FadeInImage( pushButton, selectedImage ); + + // Replaces the button image. + selectedImage = image; + + pushButton.Add( selectedImage ); + FadeOutImage( pushButton, Foreground, selectedImage, opacity ); + StartFadeOutAnimation( pushButton ); + break; + } + case ReleasedPressedTransition: // FALLTHROUGH + case DisabledPressedTransition: + { + StopFadeInAnimation(); + pushButton.Remove( selectedImage ); + + selectedImage = image; + + FadeInImage( pushButton, selectedImage ); StartFadeInAnimation(); + break; + } + default: + selectedImage = image; + break; + } - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) + selectedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + selectedImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); + ApplyConstraint( selectedImage, FOREGROUND_DEPTH ); +} + +void PushButtonDefaultPainter::SetBackgroundImage( Toolkit::Button& button, Actor image ) +{ + Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); + Actor& backgroundImage = pushButtonImpl.GetBackgroundImage(); + Actor& fadeOutBackgroundImage = pushButtonImpl.GetFadeOutBackgroundImage(); + + Toolkit::PushButton& pushButton = static_cast( button ); + + switch( mPaintState ) + { + case ReleasedState: // FALLTHROUGH + case PressedState: + case ReleasedPressedTransition: + case PressedReleasedTransition: + { + if( backgroundImage && backgroundImage.GetParent() ) { - mPaintState = DisabledPressedTransition; + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Background, backgroundImage ); + + backgroundImage = image; + + FadeInImage( pushButton, backgroundImage ); + + StartFadeOutAnimation( pushButton ); + StartFadeInAnimation(); } else { - mPaintState = PressedState; + backgroundImage = image; + pushButton.Add( backgroundImage ); } + break; } - break; - } - case ReleasedPressedTransition: - { - if( disabled ) + case ReleasedDisabledTransition: // FALLTHROUGH + case PressedDisabledTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( fadeOutBackgroundImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = fadeOutBackgroundImage.GetCurrentOpacity(); } StopFadeOutAnimation( pushButton ); + + // Replaces the button image. + backgroundImage = image; + + pushButton.Add( backgroundImage ); + FadeOutImage( pushButton, Background, backgroundImage, opacity ); + + StartFadeOutAnimation( pushButton ); + break; + } + case DisabledReleasedTransition: // FALLTHROUGH + case DisabledPressedTransition: + { StopFadeInAnimation(); + pushButton.Remove( backgroundImage ); - FadeOutImage( pushButton, Foreground, selectedImage, 1.f - opacity ); - FadeOutImage( pushButton, Background, backgroundImage ); + backgroundImage = image; + + FadeInImage( pushButton, backgroundImage ); + StartFadeInAnimation(); + break; + } + default: + backgroundImage = image; + break; + } + + backgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + backgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); + ApplyConstraint( backgroundImage, BACKGROUND_DEPTH ); +} + +void PushButtonDefaultPainter::SetDisabledImage( Toolkit::Button& button, Actor image ) +{ + Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); + Actor& disabledImage = pushButtonImpl.GetDisabledImage(); + Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); + + Toolkit::PushButton& pushButton = static_cast( button ); + + switch( mPaintState ) + { + case DisabledReleasedState: // FALLTHROUGH + case DisabledPressedState: + { + if( disabledImage && disabledImage.GetParent() ) + { + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Foreground, disabledImage ); - FadeInImage( pushButton, disabledImage ); - FadeInImage( pushButton, disabledBackgroundImage ); + disabledImage = image; - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); + FadeInImage( pushButton, disabledImage ); - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = PressedDisabledTransition; + StartFadeOutAnimation( pushButton ); + StartFadeInAnimation(); } else { - mPaintState = DisabledPressedState; + disabledImage = image; + pushButton.Add( disabledImage ); } + break; } - break; - } - case PressedReleasedTransition: - { - if( disabled ) + case ReleasedDisabledTransition: // FALLTHROUGH + case PressedDisabledTransition: { - float opacity = 1.f; - if( fadeOutButtonImage ) - { - opacity = fadeOutButtonImage.GetCurrentOpacity(); - } - StopFadeOutAnimation( pushButton ); StopFadeInAnimation(); + pushButton.Remove( disabledImage ); - FadeOutImage( pushButton, Foreground, buttonImage, 1.f - opacity ); - FadeOutImage( pushButton, Background, backgroundImage ); + disabledImage = image; FadeInImage( pushButton, disabledImage ); - FadeInImage( pushButton, disabledBackgroundImage ); - - StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); - - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = ReleasedDisabledTransition; - } - else - { - mPaintState = DisabledReleasedState; - } + break; } - break; - } - case ReleasedDisabledTransition: - { - if( !disabled ) + case DisabledReleasedTransition: // FALLTHROUGH + case DisabledPressedTransition: { float opacity = 1.f; if( fadeOutButtonImage ) { opacity = fadeOutButtonImage.GetCurrentOpacity(); } - StopFadeOutAnimation( pushButton, false ); - StopFadeInAnimation(); + StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Foreground, disabledImage, 1.f - opacity ); - FadeOutImage( pushButton, Background, disabledBackgroundImage, 1.f - opacity ); - FadeInImage( pushButton, buttonImage, opacity ); - FadeInImage( pushButton, backgroundImage, opacity ); + // Replaces the button image. + disabledImage = image; - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); + pushButton.Add( disabledImage ); + FadeOutImage( pushButton, Foreground, disabledImage, opacity ); - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = DisabledReleasedTransition; - } - else - { - mPaintState = ReleasedState; - } + StartFadeOutAnimation( pushButton ); + break; } - break; + default: + disabledImage = image; + break; } - case DisabledReleasedTransition: + + disabledImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + disabledImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); + ApplyConstraint( disabledImage, FOREGROUND_DEPTH ); +} + +void PushButtonDefaultPainter::SetDisabledBackgroundImage( Toolkit::Button& button, Actor image ) +{ + Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); + Actor& disabledBackgroundImage = pushButtonImpl.GetDisabledBackgroundImage(); + Actor& fadeOutBackgroundImage = pushButtonImpl.GetFadeOutBackgroundImage(); + + Toolkit::PushButton& pushButton = static_cast( button ); + + switch( mPaintState ) { - if( disabled ) + case DisabledReleasedState: // FALLTHROUGH + case DisabledPressedState: { - float opacity = 1.f; - if( fadeOutButtonImage ) + if( disabledBackgroundImage && disabledBackgroundImage.GetParent() ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); - } - StopFadeOutAnimation( pushButton, false ); - StopFadeInAnimation(); + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Background, disabledBackgroundImage ); - FadeOutImage( pushButton, Foreground, buttonImage, 1.f - opacity ); - FadeOutImage( pushButton, Background, backgroundImage, 1.f - opacity ); - FadeInImage( pushButton, disabledImage, opacity ); - FadeInImage( pushButton, disabledBackgroundImage, opacity ); + disabledBackgroundImage = image; - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); + FadeInImage( pushButton, disabledBackgroundImage ); - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = ReleasedDisabledTransition; + StartFadeOutAnimation( pushButton ); + StartFadeInAnimation(); } else { - mPaintState = DisabledReleasedState; + disabledBackgroundImage = image; + pushButton.Add( disabledBackgroundImage ); } + break; } - break; - } - case PressedDisabledTransition: - { - if( !disabled ) + case ReleasedDisabledTransition: // FALLTHROUGH + case PressedDisabledTransition: { - float opacity = 1.f; - if( fadeOutButtonImage ) - { - opacity = fadeOutButtonImage.GetCurrentOpacity(); - } - StopFadeOutAnimation( pushButton, false ); StopFadeInAnimation(); + pushButton.Remove( disabledBackgroundImage ); - FadeOutImage( pushButton, Foreground, disabledImage, 1.f - opacity ); - FadeOutImage( pushButton, Background, disabledBackgroundImage, 1.f - opacity ); - FadeInImage( pushButton, selectedImage, opacity ); - FadeInImage( pushButton, backgroundImage, opacity ); + disabledBackgroundImage = image; - StartFadeOutAnimation( pushButton ); + FadeInImage( pushButton, disabledBackgroundImage ); StartFadeInAnimation(); - - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = DisabledPressedTransition; - } - else - { - mPaintState = PressedState; - } + break; } - break; - } - case DisabledPressedTransition: - { - if( disabled ) + case DisabledReleasedTransition: // FALLTHROUGH + case DisabledPressedTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( fadeOutBackgroundImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = fadeOutBackgroundImage.GetCurrentOpacity(); } - StopFadeOutAnimation( pushButton, false ); - StopFadeInAnimation(); + StopFadeOutAnimation( pushButton ); - FadeOutImage( pushButton, Foreground, selectedImage, 1.f - opacity ); - FadeOutImage( pushButton, Background, backgroundImage, 1.f - opacity ); - FadeInImage( pushButton, disabledImage, opacity ); - FadeInImage( pushButton, disabledBackgroundImage, opacity ); + // Replaces the button image. + disabledBackgroundImage = image; - StartFadeOutAnimation( pushButton ); - StartFadeInAnimation(); + pushButton.Add( disabledBackgroundImage ); + FadeOutImage( pushButton, Background, disabledBackgroundImage, opacity ); - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = PressedDisabledTransition; - } - else - { - mPaintState = DisabledPressedState; - } + StartFadeOutAnimation( pushButton ); + break; } - break; - } - default: - break; + default: + disabledBackgroundImage = image; + break; } -} - -void PushButtonDefaultPainter::SetAnimationTime( float animationTime ) -{ - mAnimationTime = animationTime; -} - -float PushButtonDefaultPainter::GetAnimationTime() const -{ - return mAnimationTime; -} -void PushButtonDefaultPainter::SetAutoRepeating( bool autorepeating ) -{ - mAutoRepeating = autorepeating; + disabledBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + disabledBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); + ApplyConstraint( disabledBackgroundImage, BACKGROUND_DEPTH ); } -void PushButtonDefaultPainter::Pressed( Toolkit::PushButton& button ) +void PushButtonDefaultPainter::Pressed( Toolkit::Button& button ) { Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); Actor& selectedImage = pushButtonImpl.GetSelectedImage(); Actor& buttonImage = pushButtonImpl.GetButtonImage(); Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); + Toolkit::PushButton& pushButton = static_cast( button ); + switch( mPaintState ) { case ReleasedState: { - StopFadeOutAnimation( button ); - FadeOutImage( button, Foreground, buttonImage ); - FadeInImage( button, selectedImage ); - StartFadeOutAnimation( button ); + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Foreground, buttonImage ); + FadeInImage( pushButton, selectedImage ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); if( buttonImage || selectedImage ) @@ -895,13 +908,13 @@ void PushButtonDefaultPainter::Pressed( Toolkit::PushButton& button ) { opacity = fadeOutButtonImage.GetCurrentOpacity(); } - StopFadeOutAnimation( button, false ); + StopFadeOutAnimation( pushButton, false ); StopFadeInAnimation(); - FadeOutImage( button, Foreground, buttonImage, 1.f - opacity ); - FadeInImage( button, selectedImage, opacity ); + FadeOutImage( pushButton, Foreground, buttonImage, 1.f - opacity ); + FadeInImage( pushButton, selectedImage, opacity ); - StartFadeOutAnimation( button ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); if( buttonImage || selectedImage ) @@ -919,21 +932,23 @@ void PushButtonDefaultPainter::Pressed( Toolkit::PushButton& button ) } } -void PushButtonDefaultPainter::Released( Toolkit::PushButton& button ) +void PushButtonDefaultPainter::Released( Toolkit::Button& button ) { Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); Actor& selectedImage = pushButtonImpl.GetSelectedImage(); Actor& buttonImage = pushButtonImpl.GetButtonImage(); Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); + Toolkit::PushButton& pushButton = static_cast( button ); + switch( mPaintState ) { case PressedState: { - StopFadeOutAnimation( button ); - FadeOutImage( button, Foreground, selectedImage ); - FadeInImage( button, buttonImage ); - StartFadeOutAnimation( button ); + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Foreground, selectedImage ); + FadeInImage( pushButton, buttonImage ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); if( buttonImage || selectedImage ) @@ -953,13 +968,13 @@ void PushButtonDefaultPainter::Released( Toolkit::PushButton& button ) { opacity = fadeOutButtonImage.GetCurrentOpacity(); } - StopFadeOutAnimation( button, false ); + StopFadeOutAnimation( pushButton, false ); StopFadeInAnimation(); - FadeOutImage( button, Foreground, selectedImage, 1.f - opacity ); - FadeInImage( button, buttonImage, opacity ); + FadeOutImage( pushButton, Foreground, selectedImage, 1.f - opacity ); + FadeInImage( pushButton, buttonImage, opacity ); - StartFadeOutAnimation( button ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); if( buttonImage || selectedImage ) @@ -979,26 +994,28 @@ void PushButtonDefaultPainter::Released( Toolkit::PushButton& button ) } } -void PushButtonDefaultPainter::Clicked( Toolkit::PushButton& button ) +void PushButtonDefaultPainter::Clicked( Toolkit::Button& button ) { Released( button ); } -void PushButtonDefaultPainter::Toggled( Toolkit::PushButton& button ) +void PushButtonDefaultPainter::Selected( Toolkit::Button& button ) { Toolkit::Internal::PushButton& pushButtonImpl = GetPushButtonImpl( button ); Actor& selectedImage = pushButtonImpl.GetSelectedImage(); Actor& buttonImage = pushButtonImpl.GetButtonImage(); Actor& fadeOutButtonImage = pushButtonImpl.GetFadeOutButtonImage(); + Toolkit::PushButton& pushButton = static_cast( button ); + switch( mPaintState ) { case ReleasedState: { - StopFadeOutAnimation( button ); - FadeOutImage( button, Foreground, buttonImage ); - FadeInImage( button, selectedImage ); - StartFadeOutAnimation( button ); + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Foreground, buttonImage ); + FadeInImage( pushButton, selectedImage ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); if( buttonImage || selectedImage ) @@ -1013,10 +1030,10 @@ void PushButtonDefaultPainter::Toggled( Toolkit::PushButton& button ) } case PressedState: { - StopFadeOutAnimation( button ); - FadeOutImage( button, Foreground, selectedImage ); - FadeInImage( button, buttonImage ); - StartFadeOutAnimation( button ); + StopFadeOutAnimation( pushButton ); + FadeOutImage( pushButton, Foreground, selectedImage ); + FadeInImage( pushButton, buttonImage ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); if( buttonImage || selectedImage ) @@ -1036,13 +1053,13 @@ void PushButtonDefaultPainter::Toggled( Toolkit::PushButton& button ) { opacity = fadeOutButtonImage.GetCurrentOpacity(); } - StopFadeOutAnimation( button, false ); + StopFadeOutAnimation( pushButton, false ); StopFadeInAnimation(); - FadeOutImage( button, Foreground, selectedImage, 1.f - opacity ); - FadeInImage( button, buttonImage, opacity ); + FadeOutImage( pushButton, Foreground, selectedImage, 1.f - opacity ); + FadeInImage( pushButton, buttonImage, opacity ); - StartFadeOutAnimation( button ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); if( buttonImage || selectedImage ) @@ -1062,13 +1079,13 @@ void PushButtonDefaultPainter::Toggled( Toolkit::PushButton& button ) { opacity = 1.f - fadeOutButtonImage.GetCurrentOpacity(); } - StopFadeOutAnimation( button, false ); + StopFadeOutAnimation( pushButton, false ); StopFadeInAnimation(); - FadeOutImage( button, Foreground, buttonImage, 1.f - opacity ); - FadeInImage( button, selectedImage, opacity ); + FadeOutImage( pushButton, Foreground, buttonImage, 1.f - opacity ); + FadeInImage( pushButton, selectedImage, opacity ); - StartFadeOutAnimation( button ); + StartFadeOutAnimation( pushButton ); StartFadeInAnimation(); if( buttonImage || selectedImage ) diff --git a/dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.h b/dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.h index 2ef708c..ed13641 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.h +++ b/dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.h @@ -68,150 +68,89 @@ public: */ ~PushButtonDefaultPainter(); + ///////////////////////////////////////////////////////////////////////////// + // ButtonPainter interface + ///////////////////////////////////////////////////////////////////////////// + /** - * Sets the button image. - * - * It adds the button image to the root actor and creates the image transition if needed. - * - * @param[inout] pushButton The button in which all actors that form its appearance are going to be added. - * @param[in] image The button image. + * @copydoc ButtonPainter::Initialize( Toolkit::Button& button ) */ - void SetButtonImage( Toolkit::PushButton& pushButton, Actor image ); + virtual void Initialize( Toolkit::Button& button ); /** - * Sets the background image. - * - * It adds the background image to the root actor and creates the image transition if needed. - * - * @param[inout] pushButton The button in which all actors that form its appearance are going to be added. - * @param[in] image The background image. + * @copydoc ButtonPainter::SetSize( Toolkit::Button& button, const Vector3& size ) */ - void SetBackgroundImage( Toolkit::PushButton& pushButton, Actor image ); + virtual void SetSize( Toolkit::Button& button, const Vector3& size ); /** - * Sets the selected image. - * - * It adds the selected image to the root actor and creates the image transition if needed. - * - * @param[inout] pushButton The button in which all actors that form its appearance are going to be added. - * @param[in] image The selected image. + * @copydoc ButtonPainter::SetDisabled( Toolkit::Button& button, bool disabled ) */ - void SetSelectedImage( Toolkit::PushButton& pushButton, Actor image ); + virtual void SetDisabled( Toolkit::Button& button, bool disabled ); /** - * Sets the disabled background image. - * - * It adds the disabled background image to the root actor and creates the image transition if needed. - * - * @param[inout] pushButton The button in which all actors that form its appearance are going to be added. - * @param[in] image The disabled background image. + * @copydoc ButtonPainter::SetAnimationTime( float animationTime ) */ - void SetDisabledBackgroundImage( Toolkit::PushButton& pushButton, Actor image ); + virtual void SetAnimationTime( float animationTime ); /** - * Sets the disabled image. - * - * It adds the disabled image to the root actor and creates the image transition if needed. - * - * @param[inout] pushButton The button in which all actors that form its appearance are going to be added. - * @param[in] image The image. + * @copydoc ButtonPainter::GetAnimationTime() */ - void SetDisabledImage( Toolkit::PushButton& pushButton, Actor image ); + virtual float GetAnimationTime() const; /** - * Sets the label. - * - * It adds the label to the root actor. - * - * @param[inout] pushButton The button in which all actors that form its appearance are going to be added. - * @param[in] label Button label. + * @copydoc ButtonPainter::SetLabel( Toolkit::Button& button, Actor label ) */ - void SetLabel( Toolkit::PushButton& pushButton, Actor label ); - - ///////////////////////////////////////////////////////////////////////////// - // ButtonPainter interface - ///////////////////////////////////////////////////////////////////////////// + virtual void SetLabel( Toolkit::Button& button, Actor label ); /** - * Initializes the painter by setting the default images. - * - * @param[inout] button The button in which all actors that form its appearance are going to be added. + * @copydoc ButtonPainter::SetAutoRepeating( bool autorepeating ) */ - void Initialize( Toolkit::Button& button ); + virtual void SetAutoRepeating( bool autorepeating ); /** - * Sets the new size. - * - * Resizes actors. It applies size constraints. - * - * @param[inout] button The button which stores button's images. - * @param[in] size The new size. + * @copydoc ButtonPainter::SetButtonImage( Toolkit::Button& button, Actor image ) */ - void SetSize( Toolkit::Button& button, const Vector3& size ); + virtual void SetButtonImage( Toolkit::Button& button, Actor image ); /** - * This method is called when the \e disabled property in the Dali::Toolkit::PushButton changes. - * - * Creates image transitions if needed. - * - * @param[inout] button The button in which all actors that form its appearance are going to be added. - * @param[in] disabled property. + * @copydoc ButtonPainter::SetSelectedImage( Toolkit::Button& button, Actor image ) */ - void SetDisabled( Toolkit::Button& button, bool disabled ); + virtual void SetSelectedImage( Toolkit::Button& button, Actor image ); /** - * Sets the animation time. - * @param[in] animationTime The animation time. + * @copydoc ButtonPainter::SetBackgroundImage( Toolkit::Button& button, Actor image ) */ - void SetAnimationTime( float animationTime ); + virtual void SetBackgroundImage( Toolkit::Button& button, Actor image ); /** - * Retrieves the animation time. - * @return The animation time. + * @copydoc ButtonPainter::SetDisabledImage( Toolkit::Button& button, Actor image ) */ - float GetAnimationTime() const; - - ///////////////////////////////////////////////////////////////////////////// - // PushButtonPainter interface - ///////////////////////////////////////////////////////////////////////////// + virtual void SetDisabledImage( Toolkit::Button& button, Actor image ); /** - * This method is called when the \e autorepeating property in the Dali::Toolkit::PushButton changes. - * @param[in] autorepeating property. + * @copydoc ButtonPainter::SetDisabledBackgroundImage( Toolkit::Button& button, Actor image ) */ - void SetAutoRepeating( bool autorepeating ); + virtual void SetDisabledBackgroundImage( Toolkit::Button& button, Actor image ); /** - * This method is called when the Dali::Toolkit::Internal::PushButton in which this object is registered - * is pressed. It changes to the selected image with a transition. - * - * @param[inout] button The Dali::Toolkit::PushButton in which this object is registered. + * @copydoc ButtonPainter::Pressed( Toolkit::Button& button ) */ - void Pressed( Toolkit::PushButton& button ); + void Pressed( Toolkit::Button& button ); /** - * This method is called when the Dali::Toolkit::Internal::PushButton in which this object is registered - * is released. It changes to the button image with a transition. - * - * @param[inout] button The Dali::Toolkit::PushButton in which this object is registered. + * @copydoc ButtonPainter::Released( Toolkit::Button& button ) */ - void Released( Toolkit::PushButton& button ); + void Released( Toolkit::Button& button ); /** - * This method is called when the Dali::Toolkit::Internal::PushButton in which this object is registered - * is clicked. - * - * @param[inout] button The Dali::Toolkit::PushButton in which this object is registered. + * @copydoc ButtonPainter::Clicked( Toolkit::Button& button ) */ - void Clicked( Toolkit::PushButton& button ); + void Clicked( Toolkit::Button& button ); /** - * This method is called when the Dali::Toolkit::Internal::PushButton in which this object is registered - * is toggled. - * - * @param[inout] button The Dali::Toolkit::PushButton in which this object is registered. + * @copydoc ButtonPainter::Selected( Toolkit::Button& button ) */ - void Toggled( Toolkit::PushButton& button ); + void Selected( Toolkit::Button& button ); private: diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp index 450b038..0df4e3c 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp @@ -22,7 +22,6 @@ #include #include #include -#include // INTERNAL INCLUDES #include "push-button-default-painter-impl.h" @@ -49,27 +48,13 @@ BaseHandle Create() TypeRegistration typeRegistration( typeid(Toolkit::PushButton), typeid(Toolkit::Button), Create ); -SignalConnectorType signalConnector1( typeRegistration, Toolkit::PushButton::SIGNAL_PRESSED , &PushButton::DoConnectSignal ); -SignalConnectorType signalConnector2( typeRegistration, Toolkit::PushButton::SIGNAL_RELEASED, &PushButton::DoConnectSignal ); - -TypeAction action1( typeRegistration, Toolkit::PushButton::ACTION_PUSH_BUTTON_CLICK, &PushButton::DoAction ); - } // unnamed namespace namespace { -const unsigned int INITIAL_AUTOREPEATING_DELAY( 0.15f ); -const unsigned int NEXT_AUTOREPEATING_DELAY( 0.05f ); - const float TEXT_PADDING = 12.0f; -// Helper function used to cast a ButtonPainter to PushButtonDefaultPainter -PushButtonDefaultPainterPtr GetPushButtonPainter( Dali::Toolkit::Internal::ButtonPainterPtr painter ) -{ - return static_cast( painter.Get() ); -} - /** * Find the first image actor in the actor hierarchy */ @@ -109,376 +94,6 @@ Dali::Toolkit::PushButton PushButton::New() return pushButton; } -void PushButton::SetAutoRepeating( bool autoRepeating ) -{ - mAutoRepeating = autoRepeating; - - // An autorepeating button can't be a toggle button. - if( autoRepeating ) - { - mToggleButton = false; - if( mToggled ) - { - // Emit a signal is not wanted, only change the appearance. - Toolkit::PushButton handle( GetOwner() ); - GetPushButtonPainter( mPainter )->Toggled( handle ); - mToggled = false; - } - } - - // Notifies the painter. - GetPushButtonPainter( mPainter )->SetAutoRepeating( mAutoRepeating ); -} - -bool PushButton::IsAutoRepeating() const -{ - return mAutoRepeating; -} - -void PushButton::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ) -{ - DALI_ASSERT_ALWAYS( initialAutoRepeatingDelay > 0.f ); - mInitialAutoRepeatingDelay = initialAutoRepeatingDelay; -} - -float PushButton::GetInitialAutoRepeatingDelay() const -{ - return mInitialAutoRepeatingDelay; -} - -void PushButton::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ) -{ - DALI_ASSERT_ALWAYS( nextAutoRepeatingDelay > 0.f ); - mNextAutoRepeatingDelay = nextAutoRepeatingDelay; -} - -float PushButton::GetNextAutoRepeatingDelay() const -{ - return mNextAutoRepeatingDelay; -} - -void PushButton::SetToggleButton( bool toggle ) -{ - mToggleButton = toggle; - - // A toggle button can't be an autorepeating button. - if( toggle ) - { - mAutoRepeating = false; - - // Notifies the painter. - GetPushButtonPainter( mPainter )->SetAutoRepeating( mAutoRepeating ); - } -} - -bool PushButton::IsToggleButton() const -{ - return mToggleButton; -} - -void PushButton::SetToggled( bool toggle ) -{ - if( !mDisabled && mToggleButton && ( toggle != mToggled ) ) - { - mToggled = toggle; - - Toolkit::PushButton handle( GetOwner() ); - - // Notifies the painter the button has been toggled. - GetPushButtonPainter( mPainter )->Toggled( handle ); - - // Emit signal. - mStateChangedSignal.Emit( handle, mToggled ); - } -} - -bool PushButton::IsToggled() const -{ - return mToggleButton && mToggled; -} - -void PushButton::SetButtonImage( Image image ) -{ - SetButtonImage( ImageActor::New( image ) ); -} - -void PushButton::SetButtonImage( Actor image ) -{ - Toolkit::PushButton handle( GetOwner() ); - GetPushButtonPainter( mPainter )->SetButtonImage( handle, image ); -} - -Actor& PushButton::GetButtonImage() -{ - return mButtonImage; -} - -Actor PushButton::GetButtonImage() const -{ - return mButtonImage; -} - -void PushButton::SetBackgroundImage( Image image ) -{ - SetBackgroundImage( ImageActor::New( image ) ); -} - -void PushButton::SetBackgroundImage( Actor image ) -{ - Toolkit::PushButton handle( GetOwner() ); - GetPushButtonPainter( mPainter )->SetBackgroundImage( handle, image ); -} - -Actor& PushButton::GetBackgroundImage() -{ - return mBackgroundImage; -} - -Actor PushButton::GetBackgroundImage() const -{ - return mBackgroundImage; -} - -void PushButton::SetSelectedImage( Image image ) -{ - SetSelectedImage( ImageActor::New( image ) ); -} - -void PushButton::SetSelectedImage( Actor image ) -{ - Toolkit::PushButton handle( GetOwner() ); - GetPushButtonPainter( mPainter )->SetSelectedImage( handle, image ); -} - -Actor& PushButton::GetSelectedImage() -{ - return mSelectedImage; -} - -Actor PushButton::GetSelectedImage() const -{ - return mSelectedImage; -} - -void PushButton::SetDisabledBackgroundImage( Image image ) -{ - SetDisabledBackgroundImage( ImageActor::New( image ) ); -} - -void PushButton::SetDisabledBackgroundImage( Actor image ) -{ - Toolkit::PushButton handle( GetOwner() ); - GetPushButtonPainter( mPainter )->SetDisabledBackgroundImage( handle, image ); -} - -Actor& PushButton::GetDisabledBackgroundImage() -{ - return mDisabledBackgroundImage; -} - -Actor PushButton::GetDisabledBackgroundImage() const -{ - return mDisabledBackgroundImage; -} - -void PushButton::SetDisabledImage( Image image ) -{ - SetDisabledImage( ImageActor::New( image ) ); -} - -void PushButton::SetDisabledImage( Actor image ) -{ - Toolkit::PushButton handle( GetOwner() ); - GetPushButtonPainter( mPainter )->SetDisabledImage( handle, image ); -} - -Actor& PushButton::GetDisabledImage() -{ - return mDisabledImage; -} - -Actor PushButton::GetDisabledImage() const -{ - return mDisabledImage; -} - -void PushButton::SetLabel( const std::string& label ) -{ - Toolkit::TextView textView ( Toolkit::TextView::New( label ) ); - textView.SetWidthExceedPolicy( Toolkit::TextView::ShrinkToFit ); // Make sure our text always fits inside the button - SetLabel( textView ); -} - -void PushButton::SetLabel( Actor label ) -{ - Toolkit::PushButton handle( GetOwner() ); - GetPushButtonPainter( mPainter )->SetLabel( handle, label ); -} - -Actor PushButton::GetLabel() const -{ - return mLabel; -} - -Actor& PushButton::GetLabel() -{ - return mLabel; -} - -Actor& PushButton::GetFadeOutBackgroundImage() -{ - return mFadeOutBackgroundImage; -} - -Actor& PushButton::GetFadeOutButtonImage() -{ - return mFadeOutButtonImage; -} - -Toolkit::PushButton::PressedSignalType& PushButton::PressedSignal() -{ - return mPressedSignal; -} - -Toolkit::PushButton::ReleasedSignalType& PushButton::ReleasedSignal() -{ - return mReleasedSignal; -} - -bool PushButton::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) -{ - Dali::BaseHandle handle( object ); - - bool connected( true ); - Toolkit::PushButton button = Toolkit::PushButton::DownCast(handle); - - if( Toolkit::PushButton::SIGNAL_STATE_CHANGED == signalName ) - { - button.StateChangedSignal().Connect( tracker, functor ); - } - else if( Toolkit::PushButton::SIGNAL_PRESSED == signalName ) - { - button.PressedSignal().Connect( tracker, functor ); - } - else if( Toolkit::PushButton::SIGNAL_RELEASED == signalName ) - { - button.ReleasedSignal().Connect( tracker, functor ); - } - else - { - // signalName does not match any signal - connected = false; - } - - 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 ) ); - - if ( propertyIndex == Toolkit::Button::PROPERTY_AUTO_REPEATING ) - { - pushButtonImpl.SetAutoRepeating( value.Get< bool >() ); - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_INITIAL_AUTO_REPEATING_DELAY ) - { - pushButtonImpl.SetInitialAutoRepeatingDelay( value.Get< float >() ); - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_NEXT_AUTO_REPEATING_DELAY ) - { - pushButtonImpl.SetNextAutoRepeatingDelay( value.Get< float >() ); - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_TOGGLABLE ) - { - pushButtonImpl.SetToggleButton( value.Get< bool >() ); - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_TOGGLED ) - { - pushButtonImpl.SetToggled( value.Get< bool >() ); - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_NORMAL_STATE_ACTOR ) - { - pushButtonImpl.SetButtonImage( Scripting::NewActor( value.Get< Property::Map >() ) ); - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_SELECTED_STATE_ACTOR ) - { - pushButtonImpl.SetSelectedImage( Scripting::NewActor( value.Get< Property::Map >() ) ); - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_DISABLED_STATE_ACTOR ) - { - pushButtonImpl.SetDisabledImage( Scripting::NewActor( value.Get< Property::Map >() ) ); - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_LABEL_ACTOR ) - { - pushButtonImpl.SetLabel( Scripting::NewActor( value.Get< Property::Map >() ) ); - } - } -} - -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 ) ); - - if ( propertyIndex == Toolkit::Button::PROPERTY_AUTO_REPEATING ) - { - value = pushButtonImpl.mAutoRepeating; - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_INITIAL_AUTO_REPEATING_DELAY ) - { - value = pushButtonImpl.mInitialAutoRepeatingDelay; - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_NEXT_AUTO_REPEATING_DELAY ) - { - value = pushButtonImpl.mNextAutoRepeatingDelay; - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_TOGGLABLE ) - { - value = pushButtonImpl.mToggleButton; - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_TOGGLED ) - { - value = pushButtonImpl.mToggled; - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_NORMAL_STATE_ACTOR ) - { - Property::Map map; - Scripting::CreatePropertyMap( pushButtonImpl.mButtonImage, map ); - value = map; - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_SELECTED_STATE_ACTOR ) - { - Property::Map map; - Scripting::CreatePropertyMap( pushButtonImpl.mSelectedImage, map ); - value = map; - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_DISABLED_STATE_ACTOR ) - { - Property::Map map; - Scripting::CreatePropertyMap( pushButtonImpl.mDisabledImage, map ); - value = map; - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_LABEL_ACTOR ) - { - Property::Map map; - Scripting::CreatePropertyMap( pushButtonImpl.mLabel, map ); - value = map; - } - } - - return value; -} - void PushButton::OnButtonInitialize() { // Push button requires the Leave event. @@ -486,175 +101,17 @@ void PushButton::OnButtonInitialize() root.SetLeaveRequired( true ); } -void PushButton::OnButtonDown() -{ - if( !mToggleButton ) - { - Toolkit::PushButton handle( GetOwner() ); - - // Notifies the painter the button has been pressed. - GetPushButtonPainter( mPainter )->Pressed( handle ); - - if( mAutoRepeating ) - { - SetUpTimer( mInitialAutoRepeatingDelay ); - } - - //Emit signal. - mPressedSignal.Emit( handle ); - } -} - -void PushButton::OnButtonUp() -{ - if( ButtonDown == mState ) - { - if( mToggleButton ) - { - mToggled = !mToggled; - - Toolkit::PushButton handle( GetOwner() ); - - // Notifies the painter the button has been toggled. - GetPushButtonPainter( mPainter )->Toggled( handle ); - - // Emit signal. - mStateChangedSignal.Emit( handle, mToggled ); - } - else - { - Toolkit::PushButton handle( GetOwner() ); - - // Notifies the painter the button has been clicked. - GetPushButtonPainter( mPainter )->Released( handle ); - GetPushButtonPainter( mPainter )->Clicked( handle ); - - if( mAutoRepeating ) - { - mAutoRepeatingTimer.Reset(); - } - - //Emit signal. - mReleasedSignal.Emit( handle ); - mClickedSignal.Emit( handle ); - } - } -} - -void PushButton::OnTouchPointLeave() -{ - if( ButtonDown == mState ) - { - if( !mToggleButton ) - { - Toolkit::PushButton handle( GetOwner() ); - - // Notifies the painter the button has been released. - GetPushButtonPainter( mPainter )->Released( handle ); - - if( mAutoRepeating ) - { - mAutoRepeatingTimer.Reset(); - } - - //Emit signal. - mReleasedSignal.Emit( handle ); - } - } -} - -void PushButton::OnTouchPointInterrupted() -{ - OnTouchPointLeave(); -} - -void PushButton::OnAnimationTimeSet( float animationTime ) -{ - GetPushButtonPainter( mPainter )->SetAnimationTime( animationTime ); -} - -float PushButton::OnAnimationTimeRequested() const -{ - return GetPushButtonPainter( mPainter )->GetAnimationTime(); -} - -void PushButton::OnButtonStageDisconnection() -{ - if( ButtonDown == mState ) - { - if( !mToggleButton ) - { - Toolkit::PushButton handle( GetOwner() ); - - // Notifies the painter the button has been released. - GetPushButtonPainter( mPainter )->Released( handle ); - - if( mAutoRepeating ) - { - mAutoRepeatingTimer.Reset(); - } - } - } -} - PushButton::PushButton() -: Button(), - mAutoRepeating( false ), - mInitialAutoRepeatingDelay( INITIAL_AUTOREPEATING_DELAY ), - mNextAutoRepeatingDelay( NEXT_AUTOREPEATING_DELAY ), - mToggleButton( false ), - mAutoRepeatingTimer(), - mToggled( false ), - mClickActionPerforming(false) +: Button() { - // Creates specific painter. - mPainter = PushButtonDefaultPainterPtr( new PushButtonDefaultPainter() ); + // Creates specific painter.GetBu + ButtonPainterPtr painter = PushButtonDefaultPainterPtr( new PushButtonDefaultPainter() ); + SetPainter( painter ); } PushButton::~PushButton() { - if( mAutoRepeatingTimer ) - { - mAutoRepeatingTimer.Reset(); - } - - mPainter = NULL; -} - -void PushButton::SetUpTimer( float delay ) -{ - mAutoRepeatingTimer = Dali::Timer::New( static_cast( 1000.f * delay ) ); - mAutoRepeatingTimer.TickSignal().Connect( this, &PushButton::AutoRepeatingSlot ); - mAutoRepeatingTimer.Start(); -} - -bool PushButton::AutoRepeatingSlot() -{ - bool consumed = false; - if( !mDisabled ) - { - // Restart the autorepeat timer. - SetUpTimer( mNextAutoRepeatingDelay ); - - Toolkit::PushButton handle( GetOwner() ); - - // Notifies the painter the button has been pressed. - GetPushButtonPainter( mPainter )->Pressed( handle ); - - //Emit signal. - consumed = mReleasedSignal.Emit( handle ); - consumed |= mClickedSignal.Emit( handle ); - consumed |= mPressedSignal.Emit( handle ); - } - - return consumed; -} - -void PushButton::OnActivated() -{ - // When the button is activated, it performs the click action - PropertyValueContainer attributes; - DoClickAction(attributes); + SetPainter( NULL ); } Vector3 PushButton::GetNaturalSize() @@ -667,7 +124,7 @@ Vector3 PushButton::GetNaturalSize() if( widthIsZero || heightIsZero ) { // If background and background not scale9 try get size from that - ImageActor imageActor = FindImageActor( mButtonImage ); + ImageActor imageActor = FindImageActor( GetButtonImage() ); if( imageActor && imageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH ) { Vector3 imageSize = RelayoutHelper::GetNaturalSize( imageActor ); @@ -683,7 +140,7 @@ Vector3 PushButton::GetNaturalSize() } } - ImageActor backgroundImageActor = FindImageActor( mBackgroundImage ); + ImageActor backgroundImageActor = FindImageActor( GetBackgroundImage() ); if( backgroundImageActor && backgroundImageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH ) { Vector3 imageSize = RelayoutHelper::GetNaturalSize( backgroundImageActor ); @@ -700,7 +157,7 @@ Vector3 PushButton::GetNaturalSize() } // If label, test against it's size - Toolkit::TextView textView = Toolkit::TextView::DownCast( mLabel ); + Toolkit::TextView textView = Toolkit::TextView::DownCast( GetLabel() ); if( textView ) { Vector3 textViewSize = textView.GetNaturalSize(); @@ -720,39 +177,6 @@ Vector3 PushButton::GetNaturalSize() return size; } -void PushButton::DoClickAction(const PropertyValueContainer& attributes) -{ - // Prevents the button signals from doing a recursive loop by sending an action - // and re-emitting the signals. - if(!mClickActionPerforming) - { - mClickActionPerforming = true; - OnButtonDown(); - mState = ButtonDown; - OnButtonUp(); - mClickActionPerforming = false; - } -} - -bool PushButton::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes) -{ - bool ret = false; - - Dali::BaseHandle handle(object); - - Toolkit::PushButton button = Toolkit::PushButton::DownCast(handle); - - DALI_ASSERT_ALWAYS(button); - - if(Toolkit::PushButton::ACTION_PUSH_BUTTON_CLICK == actionName) - { - GetImplementation(button).DoClickAction(attributes); - ret = true; - } - - return ret; -} - } // namespace Internal } // namespace Toolkit diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.h b/dali-toolkit/internal/controls/buttons/push-button-impl.h index 1297fef..730b746 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.h @@ -19,7 +19,6 @@ */ // EXTERNAL INCLUDES -#include #include // INTERNAL INCLUDES @@ -50,231 +49,6 @@ public: */ static Dali::Toolkit::PushButton New(); - /** - * @copydoc Dali::Toolkit::PushButton::SetAutoRepeating( bool autoRepeating ) - */ - void SetAutoRepeating( bool autoRepeating ); - - /** - * @copydoc Dali::Toolkit::PushButton::IsAutoRepeating() const - */ - bool IsAutoRepeating() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ) - */ - void SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ); - - /** - * @copydoc Dali::Toolkit::PushButton::GetInitialAutoRepeatingDelay() const - */ - float GetInitialAutoRepeatingDelay() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ) - */ - void SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ); - - /** - * @copydoc Dali::Toolkit::PushButton::GetNextAutoRepeatingDelay() const - */ - float GetNextAutoRepeatingDelay() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetToggleButton( bool toggle ) - */ - void SetToggleButton( bool toggle ); - - /** - * @copydoc Dali::Toolkit::PushButton::IsToggleButton() const - */ - bool IsToggleButton() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetToggled( bool toggle ) - */ - void SetToggled( bool toggle ); - - /** - * @copydoc Dali::Toolkit::PushButton::IsToggled() const - */ - bool IsToggled() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetButtonImage( const Image image ) - */ - void SetButtonImage( Image image ); - - /** - * @copydoc Dali::Toolkit::PushButton::SetButtonImage( Actor image ) - */ - void SetButtonImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the button image. - */ - Actor& GetButtonImage(); - - /** - * @copydoc Dali::Toolkit::PushButton:: - */ - Actor GetButtonImage() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( const Image image ) - */ - void SetBackgroundImage( Image image ); - - /** - * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( Actor image ) - */ - void SetBackgroundImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the background image. - */ - Actor& GetBackgroundImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::GetBackgroundImage() - */ - Actor GetBackgroundImage() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( const Image image ) - */ - void SetSelectedImage( Image image ); - - /** - * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image ) - */ - void SetSelectedImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the selected image. - */ - Actor& GetSelectedImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::GetSelectedImage() - */ - Actor GetSelectedImage() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Image image ) - */ - void SetDisabledBackgroundImage( Image image ); - - /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Actor image ) - */ - void SetDisabledBackgroundImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the disabled background image. - */ - Actor& GetDisabledBackgroundImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::GetDisabledBackgroundImage() - */ - Actor GetDisabledBackgroundImage() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Image image ) - */ - void SetDisabledImage( Image image ); - - /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image ) - */ - void SetDisabledImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the disabled button image. - */ - Actor& GetDisabledImage(); - - /** - * @copydoc Dali::Toolkit::PushButton::GetDisabledImage() - */ - Actor GetDisabledImage() const; - - /** - * @copydoc Dali::Toolkit::PushButton::SetLabel( const std::string& label ) - */ - void SetLabel( const std::string& label ); - - /** - * @copydoc Dali::Toolkit::PushButton::SetLabel( Actor label ) - */ - void SetLabel( Actor label ); - - /** - * @copydoc Dali::Toolkit::PushButton::GetLabel() - */ - Actor GetLabel() const; - - /** - * Used by the painter only. - * @return A reference to the label actor. - */ - Actor& GetLabel(); - - /** - * Used by the painter only. - * @return A reference to the background image that is fading out. - */ - Actor& GetFadeOutBackgroundImage(); - - /** - * Used by the painter only. - * @return A reference to the button image that is fading out. - */ - Actor& GetFadeOutButtonImage(); - -public: - - // Signals - - /** - * @copydoc Dali::Toolkit::PushButton::PressedSignal() - */ - Toolkit::PushButton::PressedSignalType& PressedSignal(); - - /** - * @copydoc Dali::Toolkit::PushButton::ReleasedSignal() - */ - Toolkit::PushButton::ReleasedSignalType& ReleasedSignal(); - - /** - * Connects a callback function with the object's signals. - * @param[in] object The object providing the signal. - * @param[in] tracker Used to disconnect the signal. - * @param[in] signalName The signal to connect to. - * @param[in] functor A newly allocated FunctorDelegate. - * @return True if the signal was connected. - * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. - */ - 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 /** @@ -282,77 +56,13 @@ protected: // From Button */ virtual void OnButtonInitialize(); - /** - * Emits signals and notifies the painter accordingly with the set button - * properties when the button is pressed. - */ - virtual void OnButtonDown(); - - /** - * Emits signals and notifies the painter accordingly with the set button - * properties when the button is released. - */ - virtual void OnButtonUp(); - - /** - * Emits signals and notifies the painter accordingly with the set button - * properties when the touch point leaves the boundary of the button. - */ - virtual void OnTouchPointLeave(); - - /** - * Currently it doesn't need different behaviour than @see OnTouchPointLeave() - */ - virtual void OnTouchPointInterrupted(); - - /** - * Sets the push button animation time. - * @param animationTime The animation time in seconds. - */ - virtual void OnAnimationTimeSet( float animationTime ); - - /** - * Retrieves the animation time. - * @return The animation time in seconds. - */ - virtual float OnAnimationTimeRequested() const; - - /** - * This method is called when the button is removed from the stage. - */ - virtual void OnButtonStageDisconnection(); - protected: // From Control /** - * Respond the activate notification. - */ - virtual void OnActivated(); - - /** * @copydoc Control::GetNaturalSize() */ virtual Vector3 GetNaturalSize(); -private: - - /** - * Perform the click action to click the button. - * @param[in] attributes The attributes to perfrom this action. - */ - void DoClickAction(const PropertyValueContainer& attributes); - -public: - - /** - * 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. - * @param[in] attributes The attributes with which to perfrom this action. - * @return true if action has been accepted by this control - */ - static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes); - /** * Construct a new PushButton. */ @@ -370,47 +80,6 @@ private: // Undefined PushButton& operator=( const PushButton& ); - - /** - * Sets up the autorepeating timer. - * @param[in] delay The delay time in seconds. - */ - void SetUpTimer( float delay ); - - /** - * Slot called when Dali::Timer::SignalTick signal. Resets the autorepeating timer. - */ - bool AutoRepeatingSlot(); - -private: - bool mAutoRepeating; ///< Stores the autorepeating property. - float mInitialAutoRepeatingDelay; ///< Stores the initial autorepeating delay in seconds. - float mNextAutoRepeatingDelay; ///< Stores the next autorepeating delay in seconds. - bool mToggleButton; ///< Stores the toggle property. - - // AutoRepeating - Timer mAutoRepeatingTimer; ///< Timer used to implement the autorepeating property. - - // Toggle - bool mToggled; ///< Stores the toggle state. - - // Signals - Toolkit::PushButton::PressedSignalType mPressedSignal; ///< Signal emitted when the button is pressed. - Toolkit::PushButton::ReleasedSignalType mReleasedSignal; ///< Signal emitted when the button is released. - - Actor mButtonImage; ///< Stores the unselected image. - Actor mBackgroundImage; ///< Stores the background image. - Actor mSelectedImage; ///< Stores the selected image. - Actor mDisabledImage; ///< Stores the disabled image. - Actor mDisabledBackgroundImage; ///< Stores the disabled background image. - - Actor mLabel; ///< Stores the text label. - - Actor mFadeOutBackgroundImage; ///< Stores a background image, which is in a fade out animation, to be removed when the animation finishes. - Actor mFadeOutButtonImage; ///< Stores a foreground image, which is in a fade out animation, to be removed when the animation finishes. - - // Actions - bool mClickActionPerforming; }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/push-button-painter-impl.h b/dali-toolkit/internal/controls/buttons/push-button-painter-impl.h index cc85e62..9c43fe9 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-painter-impl.h +++ b/dali-toolkit/internal/controls/buttons/push-button-painter-impl.h @@ -54,45 +54,6 @@ public: */ virtual ~PushButtonPainter() {} - /** - * This method is called from the Dali::Toolkit::Internal::PushButton when the - * \e autorepeating property changes. - * @param[in] autorepeating property. - */ - virtual void SetAutoRepeating( bool autorepeating ) = 0; - - /** - * This method is called when the Dali::Toolkit::Internal::PushButton, in which this - * object is registered, is pressed. - * @param[inout] button The Dali::Toolkit::PushButton, linked to the internal - * implementation, in which this object is registered. - */ - virtual void Pressed( Toolkit::PushButton& button ) = 0; - - /** - * This method is called when the Dali::Toolkit::Internal::PushButton, in which this - * object is registered, is released. - * @param[inout] button The Dali::Toolkit::PushButton, linked to the internal - * implementation, in which this object is registered. - */ - virtual void Released( Toolkit::PushButton& button ) = 0; - - /** - * This method is called when the Dali::Toolkit::Internal::PushButton, in which this - * object is registered, is clicked. - * @param[inout] button The Dali::Toolkit::PushButton, linked to the internal - * implementation, in which this object is registered. - */ - virtual void Clicked( Toolkit::PushButton& button ) = 0; - - /** - * This method is called when the Dali::Toolkit::Internal::PushButton, in which this - * object is registered, is toggled. - * @param[inout] button The Dali::Toolkit::PushButton, linked to the internal - * implementation, in which this object is registered. - */ - virtual void Toggled( Toolkit::PushButton& button ) = 0; - ///////////////////////////////////////////////////////////////////////////// // ButtonPainter interface ///////////////////////////////////////////////////////////////////////////// diff --git a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp index 2bcb901..08d10bf 100644 --- a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp @@ -20,9 +20,7 @@ #include "radio-button-impl.h" // EXTERNAL INCLUDES -#include #include -#include using namespace Dali; using namespace Dali::Toolkit::Internal; @@ -59,35 +57,21 @@ Dali::Toolkit::RadioButton RadioButton::New() } RadioButton::RadioButton() - : mSelected(false) { mUnselectedImage = Dali::Image::New( UNSELECTED_BUTTON_IMAGE_DIR ); mSelectedImage = Dali::Image::New( SELECTED_BUTTON_IMAGE_DIR ); mRadioIcon = Dali::ImageActor::New( mUnselectedImage ); + +// SetTogglableButton(true); + mTogglableButton = true; // TODO: Use SetTogglableButton() after refactoring painter } RadioButton::~RadioButton() { } -void RadioButton::SetLabel(const std::string& label) -{ - TextActor textActor = TextActor::DownCast( mLabel ); - if( textActor ) - { - textActor.SetText( label ); - } - else - { - Toolkit::TextView newTextView = Toolkit::TextView::New( label ); - SetLabel( newTextView ); - } - - RelayoutRequest(); -} - -void RadioButton::SetLabel(Actor label) +void RadioButton::SetLabel( Actor label ) { if( mLabel != label ) { @@ -110,14 +94,9 @@ void RadioButton::SetLabel(Actor label) } } -Actor RadioButton::GetLabel() const +void RadioButton::SetSelected( bool selected ) { - return mLabel; -} - -void RadioButton::SetSelected(bool selected) -{ - if( mSelected != selected ) + if( IsSelected() != selected ) { if( selected ) { @@ -146,36 +125,28 @@ void RadioButton::SetSelected(bool selected) // Raise state changed signal Toolkit::RadioButton handle( GetOwner() ); - mStateChangedSignal.Emit( handle, mSelected ); + StateChangedSignal().Emit( handle ); RelayoutRequest(); } } -bool RadioButton::IsSelected()const -{ - return mSelected; -} - -void RadioButton::ToggleState() -{ - SetSelected(!mSelected); -} - void RadioButton::OnRelayout( const Vector2& /*size*/, ActorSizeContainer& container ) { Vector3 newSize( mRadioIcon.GetNaturalSize() ); - if( mLabel ) + Actor& label = GetLabel(); + + if( label ) { // Offset the label from the radio button image newSize.width += DISTANCE_BETWEEN_IMAGE_AND_LABEL.width; // Find the size of the control using size negotiation - Vector3 actorNaturalSize( mLabel.GetNaturalSize() ); - Control::Relayout( mLabel, Vector2( actorNaturalSize.width, actorNaturalSize.height ), container ); + Vector3 actorNaturalSize( label.GetNaturalSize() ); + Control::Relayout( label, Vector2( actorNaturalSize.width, actorNaturalSize.height ), container ); - Vector3 actorSize( mLabel.GetSize() ); + Vector3 actorSize( label.GetSize() ); newSize.width += actorSize.width; newSize.height = std::max( newSize.height, actorSize.height ); } @@ -194,53 +165,12 @@ void RadioButton::OnInitialize() void RadioButton::OnButtonUp() { - // Don't allow selection on an already selected radio button - if( !mSelected ) - { - ToggleState(); - } -} - -void RadioButton::SetProperty(BaseObject* object, Property::Index propertyIndex, const Property::Value& value) -{ - Toolkit::RadioButton radioButton = Toolkit::RadioButton::DownCast( Dali::BaseHandle( object ) ); - - if( radioButton ) + if( ButtonDown == GetState() ) { - RadioButton& radioButtonImpl( GetImplementation( radioButton ) ); - - if ( propertyIndex == Toolkit::Button::PROPERTY_TOGGLED ) + // Don't allow selection on an already selected radio button + if( !IsSelected() ) { - radioButtonImpl.SetSelected( value.Get< bool >( ) ); - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_LABEL_ACTOR ) - { - radioButtonImpl.SetLabel( Scripting::NewActor( value.Get< Property::Map >( ) ) ); + SetSelected(!IsSelected()); } } } - -Property::Value RadioButton::GetProperty(BaseObject* object, Property::Index propertyIndex) -{ - Property::Value value; - - Toolkit::RadioButton radioButton = Toolkit::RadioButton::DownCast( Dali::BaseHandle(object) ); - - if( radioButton ) - { - RadioButton& radioButtonImpl( GetImplementation( radioButton ) ); - - if ( propertyIndex == Toolkit::Button::PROPERTY_TOGGLED ) - { - value = radioButtonImpl.mSelected; - } - else if ( propertyIndex == Toolkit::Button::PROPERTY_LABEL_ACTOR ) - { - Property::Map map; - Scripting::CreatePropertyMap( radioButtonImpl.mLabel, map ); - value = map; - } - } - - return value; -} diff --git a/dali-toolkit/internal/controls/buttons/radio-button-impl.h b/dali-toolkit/internal/controls/buttons/radio-button-impl.h index 07c622b..dc31882 100644 --- a/dali-toolkit/internal/controls/buttons/radio-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/radio-button-impl.h @@ -58,12 +58,12 @@ class RadioButton: public Button /** * Construct a new PushButton with label. */ - RadioButton(const std::string& label); + RadioButton( const std::string& label ); /** * Construct a new PushButton with label. */ - RadioButton(Actor label); + RadioButton( Actor label ); /** * A reference counted object may only be deleted by calling Unreference() @@ -71,53 +71,20 @@ class RadioButton: public Button virtual ~RadioButton(); /** - * @copydoc Dali::Toolkit::RadioButton::SetLabel(const std::string& label) + * @copydoc Dali::Toolkit::Button::SetLabel( Actor label ) */ - void SetLabel(const std::string& label); + virtual void SetLabel( Actor label ); // TODO: After refactoring painter, this will be removed /** - * @copydoc Dali::Toolkit::RadioButton::SetLabel(Actor label) + * @copydoc Dali::Toolkit::Button::SetSelected( bool selected ) */ - void SetLabel(Actor label); - - /** - * @copydoc Dali::Toolkit::RadioButton::GetLabel() - */ - Actor GetLabel() const; - - /** - * @copydoc Dali::Toolkit::RadioButton::SetSelected(bool selected) - */ - void SetSelected(bool selected); - - /** - * @copydoc Dali::Toolkit::RadioButton::IsSelected() - */ - bool IsSelected()const; - - /** - * @copydoc Dali::Toolkit::RadioButton::ToggleState() - */ - void ToggleState(); + virtual void SetSelected( bool selected ); /** * @copydoc Dali::Toolkit::Control::OnRelayout() */ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container ); - public: - // 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 Control /** @@ -134,17 +101,15 @@ class RadioButton: public Button private: // Undefined - RadioButton(const RadioButton& origin); + RadioButton( const RadioButton& origin ); // Undefined - RadioButton& operator=(const RadioButton& origin); + RadioButton& operator=( const RadioButton& origin ); Image mUnselectedImage; ///< Stores the unselected image Image mSelectedImage; ///< Stores the selected image ImageActor mRadioIcon; ///< Stores the current image - Actor mLabel; ///< Stores the button label - bool mSelected; ///< Stores the selected state -} ; +}; } // namespace Internal diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index 1134b6e..83ea7eb 100755 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -55,78 +55,39 @@ const Vector3 DEFAULT_BOTTOM_SIZE = Vector3(1.0f, 0.2f, 0.0f); const char* const PROPERTY_TITLE = "title"; const char* const PROPERTY_STATE = "state"; -// Constraints /////////////////////////////////////////////////////////////////////////// - /** - * BackgroundSizeConstraint - * * The background size should be at least as big as the Dialog. * In some cases a background may have graphics which are visible * outside of the Dialog, e.g. A Shadow. For this we need to alter * the size of Background. + * + * @param[in] outerBorder The border to extend beyond parent's Size. + * @param[in] parentSize The parent's size */ -struct BackgroundSizeConstraint +Vector3 BackgroundSize(const Vector4& outerBoarder, const Vector3& parentSize) { - /** - * Constraint that sets size to parent's size plus a border. - * - * @param[in] outerBorder The border to extend beyond parent's Size. - */ - BackgroundSizeConstraint( Vector4 outerBorder ) - : mOuterBorder( outerBorder ) - { - } - - /** - * (render thread code) - * @param[in] current The current size. - * @param[in] parentSizeProperty The parent's size - */ - Vector3 operator()( const Vector3& current, - const PropertyInput& parentSizeProperty ) - { - Vector3 size = parentSizeProperty.GetVector3(); - - size.width += mOuterBorder.x + mOuterBorder.y; - size.height += mOuterBorder.z + mOuterBorder.w; - - return size; - } + Vector3 size( parentSize ); + size.width += outerBoarder.x + outerBoarder.y; + size.height += outerBoarder.z + outerBoarder.w; - const Vector4 mOuterBorder; ///< The size of the outer-border (Set to 0.0, 0.0f, 0.0f, 0.0f if doesn't exist). -}; + return size; +} -struct ButtonAreaSizeConstraint -{ /** - * Constraint that sets size to parent's size plus a border. + * sets button area size to parent's size plus a border. * * @param[in] outerBorder The border to extend beyond parent's Size. + * @param[in] parentSize The parent's size */ - ButtonAreaSizeConstraint( Vector4 outerBorder ) - : mOuterBorder( outerBorder ) - { - } - - /** - * (render thread code) - * @param[in] current The current size. - * @param[in] parentSizeProperty The parent's size - */ - Vector3 operator()( const Vector3& current, - const PropertyInput& parentSizeProperty ) - { - Vector3 size = parentSizeProperty.GetVector3(); - - size.width += mOuterBorder.x + mOuterBorder.y; - size.width -= (POPUP_OUT_MARGIN_WIDTH + POPUP_OUT_MARGIN_WIDTH); - size.height = POPUP_BUTTON_BG_HEIGHT; - - return size; - } +Vector3 ButtonAreaSize( const Vector4& outBoarder, const Vector3& parentSize ) +{ + Vector3 size( parentSize ); + size.width += outBoarder.x + outBoarder.y; + size.width -= (POPUP_OUT_MARGIN_WIDTH + POPUP_OUT_MARGIN_WIDTH); + size.height = POPUP_BUTTON_BG_HEIGHT; - const Vector4 mOuterBorder; ///< The size of the outer-border (Set to 0.0, 0.0f, 0.0f, 0.0f if doesn't exist). -}; + return size; +} } // unnamed namespace @@ -199,13 +160,11 @@ void Popup::OnInitialize() mLayer.SetParentOrigin(ParentOrigin::CENTER); mLayer.SetAnchorPoint(AnchorPoint::CENTER); mLayer.RaiseToTop(); - mLayer.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); self.Add(mLayer); mPopupBg = Actor::New(); mPopupBg.SetParentOrigin(ParentOrigin::CENTER); mPopupBg.SetAnchorPoint(AnchorPoint::CENTER); - mPopupBg.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); mLayer.Add(mPopupBg); // Any content after this point which is added to Self() will be reparented to @@ -666,6 +625,23 @@ void Popup::OnControlChildAdd( Actor& child ) } } +void Popup::OnControlSizeSet( const Vector3& targetSize ) +{ + mLayer.SetSize( targetSize ); + mPopupBg.SetSize( targetSize ); + + const Vector4 outerBorder = mPopupStyle->backgroundOuterBorder; + if( mBackgroundImage ) + { + mBackgroundImage.SetSize( BackgroundSize( outerBorder,targetSize ) ); + } + if( mButtonAreaImage ) + { + mButtonAreaImage.SetSize( ButtonAreaSize( outerBorder, targetSize ) ); + } + +} + void Popup::OnRelayout( const Vector2& size, ActorSizeContainer& container ) { // Set the popup size @@ -683,13 +659,7 @@ void Popup::OnRelayout( const Vector2& size, ActorSizeContainer& container ) if( mBackgroundImage ) { - Constraint constraint = Constraint::New( Actor::SIZE, - ParentSource( Actor::SIZE ), - BackgroundSizeConstraint(outerBorder) ); - - mBackgroundImage.RemoveConstraints(); - mBackgroundImage.ApplyConstraint( constraint ); - + mBackgroundImage.SetSize(BackgroundSize(outerBorder, Vector3(size))); mBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); mBackgroundImage.SetPosition( -outerBorder.x, -outerBorder.y, 0.0f ); @@ -704,13 +674,7 @@ void Popup::OnRelayout( const Vector2& size, ActorSizeContainer& container ) } else { - Constraint constraint = Constraint::New( Actor::SIZE, - ParentSource( Actor::SIZE ), - ButtonAreaSizeConstraint(outerBorder) ); - - mButtonAreaImage.RemoveConstraints(); - mButtonAreaImage.ApplyConstraint( constraint ); - + mButtonAreaImage.SetSize( ButtonAreaSize(outerBorder, Vector3(size)) ); mButtonAreaImage.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); mButtonAreaImage.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); mButtonAreaImage.SetY( -outerBorder.z - POPUP_OUT_MARGIN_HEIGHT ); @@ -865,6 +829,11 @@ Vector3 Popup::GetNaturalSize() Vector3 contentSize = RelayoutHelper::GetNaturalSize( mContent ); // Choose the biggest width naturalSize.width = std::max( naturalSize.width, contentSize.width ); + if( naturalSize.width > maxWidth ) + { + naturalSize.width = maxWidth; + contentSize.height = RelayoutHelper::GetHeightForWidth( mContent, maxWidth ); + } naturalSize.height += contentSize.height + mPopupStyle->margin; } diff --git a/dali-toolkit/internal/controls/popup/popup-impl.h b/dali-toolkit/internal/controls/popup/popup-impl.h index b716c09..b6ee02b 100755 --- a/dali-toolkit/internal/controls/popup/popup-impl.h +++ b/dali-toolkit/internal/controls/popup/popup-impl.h @@ -251,7 +251,12 @@ private: virtual void OnControlChildAdd( Actor& child ); /** - * @copydoc Control::OnRelayout() + * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& size ) + */ + virtual void OnControlSizeSet( const Vector3& size ); + + /** + * @copydoc Control::OnRelayOut() */ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container ); diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp index 1191db6..02267f5 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -40,35 +40,15 @@ const float DEFAULT_PAN_GESTURE_PROCESS_TIME(16.7f); // 16.7 milliseconds, i.e. const float DEFAULT_INDICATOR_FIXED_HEIGHT(80.0f); /** - * Indicator size constraint * Indicator size depends on both indicator's parent size and the scroll content size */ -struct IndicatorSizeConstraint +Vector3 IndicatorSize( const Vector3& parentSize, float contentSize) { - /** - * @param[in] contentSize The size of scrollable content - */ - IndicatorSizeConstraint(float contentSize) - : mContentSize(contentSize) - { - } - - /** - * Constraint operator - * @param[in] current The current indicator size - * @param[in] parentSizeProperty The parent size of scroll indicator. - * @return The new scroll indicator size. - */ - Vector3 operator()(const Vector3& current, - const PropertyInput& parentSizeProperty) - { - const Vector3& parentSize = parentSizeProperty.GetVector3(); - float height = mContentSize > parentSize.height ? parentSize.height * ( parentSize.height / mContentSize ) : parentSize.height * ( (parentSize.height - mContentSize * 0.5f) / parentSize.height); - return Vector3( parentSize.width, std::max(MINIMUM_INDICATOR_HEIGHT, height), parentSize.depth ); - } - - float mContentSize; ///< The size of scrollable content -}; + float height = contentSize > parentSize.height ? + parentSize.height * ( parentSize.height / contentSize ) : + parentSize.height * ( (parentSize.height - contentSize * 0.5f) / parentSize.height); + return Vector3( parentSize.width, std::max(MINIMUM_INDICATOR_HEIGHT, height), parentSize.depth ); +} /** * Indicator position constraint @@ -228,10 +208,7 @@ void ScrollBar::ApplyConstraints() } else { - constraint = Constraint::New( Actor::SIZE, - ParentSource( Actor::SIZE ), - IndicatorSizeConstraint( mScrollConnector.GetContentLength() ) ); - mIndicatorSizeConstraint = mIndicator.ApplyConstraint( constraint ); + mIndicator.SetSize( IndicatorSize( Self().GetCurrentSize(), mScrollConnector.GetContentLength() ) ); } if(mIndicatorPositionConstraint) @@ -245,16 +222,6 @@ void ScrollBar::ApplyConstraints() Source( mScrollPositionObject, Toolkit::ScrollConnector::SCROLL_POSITION ), IndicatorPositionConstraint( mScrollConnector.GetMinLimit(), mScrollConnector.GetMaxLimit() ) ); mIndicatorPositionConstraint = mIndicator.ApplyConstraint( constraint ); - - if( mBackground ) - { - mBackground.RemoveConstraints(); - - constraint = Constraint::New(Actor::SIZE, - ParentSource(Actor::SIZE), - EqualToConstraint()); - mBackground.ApplyConstraint(constraint); - } } } @@ -397,6 +364,14 @@ void ScrollBar::OnPan( PanGesture gesture ) } } +void ScrollBar::OnControlSizeSet( const Vector3& size ) +{ + if(mIndicatorHeightPolicy != Toolkit::ScrollBar::Fixed && mScrollConnector) + { + mIndicator.SetSize( IndicatorSize( size, mScrollConnector.GetContentLength() ) ); + } +} + void ScrollBar::OnScrollDomainChanged(float minPosition, float maxPosition, float contentSize) { // Reapply constraints when the scroll domain is changed diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h index 5cfca6a..989ffa4 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h @@ -186,6 +186,11 @@ private: // from Control */ virtual void OnPan( PanGesture gesture ); + /** + * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& size ) + */ + virtual void OnControlSizeSet( const Vector3& size ); + private: /** @@ -225,7 +230,6 @@ private: Constrainable mScrollPositionObject; ///< From mScrollConnector - ImageActor mBackground; ///< Background image of scroll bar. ImageActor mIndicator; ///< Image of scroll indicator. Animation mAnimation; ///< Scroll indicator Show/Hide Animation. diff --git a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp index 0db4cbf..76eab51 100644 --- a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp +++ b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp @@ -20,8 +20,6 @@ // EXTERNAL INCLUDES #include -#include -#include #include #include #include @@ -34,39 +32,17 @@ namespace const float DEFAULT_CONSTRAINT_DURATION = 0.0f; /** - * Constraint that sets a child property relative to parents Width or Height + * sets a child property relative to parents size and applies a unit based padding before the relative calculation. + * @param[in] scale of parent minus padding between 0 and 1 + * @param[in] padding in world coordinate units + * @param[in] fixed part in world coordinate units + * @param[in] size of the parent + * @return The relative size with padding. */ -struct RelativeToWidthOrHeight +Vector2 RelativeToSize( const Vector2& scale, const Vector2& padding, const Vector2& fixed, const Vector2& parentSize) { - /** - * Constraint that is relative (%) to parent width/height and applies a - * unit based padding before the relative calculation. - * @param scale of parent minus padding between 0 and 1 - * @param padding in world coordinate units - * @param fixed part in world coordinate units - */ - RelativeToWidthOrHeight( float scale, float padding, float fixed ) - : mScaleFactor( scale ), - mPadding( padding ), - mFixed( fixed ) - { - } - - inline float operator()( const float& parentWidthOrHeight ) - { - return mFixed + ( parentWidthOrHeight - mPadding ) * mScaleFactor; - } - - float operator()( const float& current, - const PropertyInput& parentWidthOrHeight ) - { - return operator()( parentWidthOrHeight.GetFloat() ); - } - - float mScaleFactor; - float mPadding; - float mFixed; -}; + return fixed + ( parentSize - padding ) * scale; +} #if defined(DEBUG_ENABLED) // debugging support, very useful when new features are added or bugs are hunted down @@ -137,9 +113,8 @@ namespace Toolkit const Property::Index TableView::PROPERTY_ROWS( Internal::TableView::TABLEVIEW_PROPERTY_START_INDEX ); const Property::Index TableView::PROPERTY_COLUMNS( Internal::TableView::TABLEVIEW_PROPERTY_START_INDEX + 1 ); const Property::Index TableView::PROPERTY_CELL_PADDING( Internal::TableView::TABLEVIEW_PROPERTY_START_INDEX + 2 ); -const Property::Index TableView::PROPERTY_LAYOUT_ANIMATION_DURATION( Internal::TableView::TABLEVIEW_PROPERTY_START_INDEX + 3 ); -const Property::Index TableView::PROPERTY_LAYOUT_ROWS( Internal::TableView::TABLEVIEW_PROPERTY_START_INDEX + 4 ); -const Property::Index TableView::PROPERTY_LAYOUT_COLUMNS( Internal::TableView::TABLEVIEW_PROPERTY_START_INDEX + 5 ); +const Property::Index TableView::PROPERTY_LAYOUT_ROWS( Internal::TableView::TABLEVIEW_PROPERTY_START_INDEX + 3 ); +const Property::Index TableView::PROPERTY_LAYOUT_COLUMNS( Internal::TableView::TABLEVIEW_PROPERTY_START_INDEX + 4 ); namespace Internal { @@ -166,9 +141,8 @@ TypeRegistration mType( typeid(Toolkit::TableView), typeid(Toolkit::Control), Cr PropertyRegistration property1( mType, "rows", Toolkit::TableView::PROPERTY_ROWS, Property::UNSIGNED_INTEGER, &TableView::SetProperty, &TableView::GetProperty ); PropertyRegistration property2( mType, "columns", Toolkit::TableView::PROPERTY_COLUMNS, Property::UNSIGNED_INTEGER, &TableView::SetProperty, &TableView::GetProperty ); PropertyRegistration property3( mType, "cell-padding", Toolkit::TableView::PROPERTY_CELL_PADDING, Property::VECTOR2, &TableView::SetProperty, &TableView::GetProperty ); -PropertyRegistration property4( mType, "layout-animation-duration", Toolkit::TableView::PROPERTY_LAYOUT_ANIMATION_DURATION, Property::FLOAT, &TableView::SetProperty, &TableView::GetProperty ); -PropertyRegistration property5( mType, "layout-rows", Toolkit::TableView::PROPERTY_LAYOUT_ROWS, Property::MAP, &TableView::SetProperty, &TableView::GetProperty ); -PropertyRegistration property6( mType, "layout-columns", Toolkit::TableView::PROPERTY_LAYOUT_COLUMNS, Property::MAP, &TableView::SetProperty, &TableView::GetProperty ); +PropertyRegistration property4( mType, "layout-rows", Toolkit::TableView::PROPERTY_LAYOUT_ROWS, Property::MAP, &TableView::SetProperty, &TableView::GetProperty ); +PropertyRegistration property5( mType, "layout-columns", Toolkit::TableView::PROPERTY_LAYOUT_COLUMNS, Property::MAP, &TableView::SetProperty, &TableView::GetProperty ); } // namespace @@ -615,16 +589,6 @@ float TableView::GetRelativeWidth( unsigned int columnIndex ) const return mRelativeWidths[ columnIndex ]; } -void TableView::SetLayoutAnimationDuration( float duration ) -{ - mConstraintDuration = duration; -} - -float TableView::GetLayoutAnimationDuration() -{ - return mConstraintDuration; -} - void TableView::OnRelayout( const Vector2& size, ActorSizeContainer& container ) { float fixedHeightsTotal = 0.0f; @@ -679,23 +643,8 @@ void TableView::OnRelayout( const Vector2& size, ActorSizeContainer& container ) Vector2 fixedPosition( ( colPos + 1.0f ) * mPadding.width + cumulatedFixedWidth, ( rowPos + 1.0f ) * mPadding.height + cumulatedFixedHeight ); - Constraint widthConstraint = Constraint::New( Actor::POSITION_X, - ParentSource( Actor::SIZE_WIDTH ), - RelativeToWidthOrHeight( relativePosition.x, positionPadding.x, fixedPosition.x ) ); - - Constraint heightConstraint = Constraint::New( Actor::POSITION_Y, - ParentSource( Actor::SIZE_HEIGHT ), - RelativeToWidthOrHeight( relativePosition.y, positionPadding.y, fixedPosition.y ) ); - - widthConstraint.SetApplyTime( mConstraintDuration ); - heightConstraint.SetApplyTime( mConstraintDuration ); - - // bake constrained position value if constraint is removed - widthConstraint.SetRemoveAction( Constraint::Bake ); - heightConstraint.SetRemoveAction( Constraint::Bake ); - - actor.ApplyConstraint( widthConstraint ); - actor.ApplyConstraint( heightConstraint ); + Vector3 actorPosition( RelativeToSize( relativePosition, positionPadding, fixedPosition, size ) ); + actor.SetPosition( actorPosition ); // 2. set size // constrain the actor size to be relative to the size of table @@ -731,29 +680,11 @@ void TableView::OnRelayout( const Vector2& size, ActorSizeContainer& container ) fixedSize.width += ( position.columnSpan - 1.0f ) * mPadding.width; fixedSize.height += ( position.rowSpan - 1.0f ) * mPadding.height; - RelativeToWidthOrHeight relativeWidthFunctor( relativeSize.x, sizePadding.x, fixedSize.x ); - RelativeToWidthOrHeight relativeHeightFunctor( relativeSize.y, sizePadding.y, fixedSize.y ); - - widthConstraint = Constraint::New( Actor::SIZE_WIDTH, - ParentSource( Actor::SIZE_WIDTH ), - relativeWidthFunctor ); - - heightConstraint = Constraint::New( Actor::SIZE_HEIGHT, - ParentSource( Actor::SIZE_HEIGHT ), - relativeHeightFunctor ); - - widthConstraint.SetApplyTime( mConstraintDuration ); - heightConstraint.SetApplyTime( mConstraintDuration ); - - // bake constrained size value if constraint is removed - widthConstraint.SetRemoveAction( Constraint::Bake ); - heightConstraint.SetRemoveAction( Constraint::Bake ); - - actor.ApplyConstraint( widthConstraint ); - actor.ApplyConstraint( heightConstraint ); + Vector2 actorSize( RelativeToSize( relativeSize, sizePadding, fixedSize, size ) ); + actor.SetSize(actorSize.x, actorSize.y); // Relayout Children - Relayout ( actor, Vector2( relativeWidthFunctor( size.width ), relativeHeightFunctor( size.height ) ), container ); + Relayout ( actor, actorSize, container ); } // for position we need to keep track of current fixed width and relative width // increase for next column @@ -807,11 +738,6 @@ void TableView::SetProperty( BaseObject* object, Property::Index index, const Pr tableViewImpl.SetCellPadding( value.Get() ); break; } - case Toolkit::TableView::PROPERTY_LAYOUT_ANIMATION_DURATION: - { - tableViewImpl.SetLayoutAnimationDuration( value.Get() ); - break; - } case Toolkit::TableView::PROPERTY_LAYOUT_ROWS: { SetHeightOrWidthProperty( tableViewImpl, &TableView::SetFixedHeight, &TableView::SetRelativeHeight, value ); @@ -852,11 +778,6 @@ Property::Value TableView::GetProperty( BaseObject* object, Property::Index inde value = tableViewImpl.GetCellPadding(); break; } - case Toolkit::TableView::PROPERTY_LAYOUT_ANIMATION_DURATION: - { - value = tableViewImpl.GetLayoutAnimationDuration(); - break; - } case Toolkit::TableView::PROPERTY_LAYOUT_ROWS: { value = tableViewImpl.GetRowHeightsPropertyValue(); @@ -953,8 +874,7 @@ void TableView::OnControlChildRemove( Actor& child ) TableView::TableView( unsigned int initialRows, unsigned int initialColumns ) : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ), mCellData( initialRows, initialColumns ), - mLayoutingChild( false ), - mConstraintDuration( DEFAULT_CONSTRAINT_DURATION ) + mLayoutingChild( false ) { SetKeyboardNavigationSupport( true ); ResizeContainers( initialRows, initialColumns ); diff --git a/dali-toolkit/internal/controls/table-view/table-view-impl.h b/dali-toolkit/internal/controls/table-view/table-view-impl.h index 82110a3..9939a05 100644 --- a/dali-toolkit/internal/controls/table-view/table-view-impl.h +++ b/dali-toolkit/internal/controls/table-view/table-view-impl.h @@ -174,17 +174,6 @@ public: float GetRelativeWidth( unsigned int columnIndex ) const; /** - * @copydoc Toolkit::TableView::SetLayoutAnimationDuration - */ - void SetLayoutAnimationDuration( float duration ); - - /** - * @copydoc Toolkit::TableView::GetLayoutAnimationDuration - */ - float GetLayoutAnimationDuration(); - - - /** * @copydoc Toolkit::TableView::GetRows */ unsigned int GetRows(); @@ -376,7 +365,6 @@ private: // Data std::vector mRelativeWidths; Size mPadding; bool mLayoutingChild; - float mConstraintDuration; }; diff --git a/dali-toolkit/public-api/controls/buttons/button.cpp b/dali-toolkit/public-api/controls/buttons/button.cpp index 89aefc5..3b251da 100644 --- a/dali-toolkit/public-api/controls/buttons/button.cpp +++ b/dali-toolkit/public-api/controls/buttons/button.cpp @@ -29,9 +29,13 @@ namespace Dali namespace Toolkit { +const char* const Button::SIGNAL_PRESSED = "pressed"; +const char* const Button::SIGNAL_RELEASED = "released"; const char* const Button::SIGNAL_CLICKED = "clicked"; const char* const Button::SIGNAL_STATE_CHANGED = "state-changed"; +const char* const Button::ACTION_BUTTON_CLICK = "button-click"; + Button::Button() {} @@ -68,6 +72,56 @@ bool Button::IsDisabled() const return Dali::Toolkit::GetImplementation( *this ).IsDisabled(); } +void Button::SetAutoRepeating( bool autoRepeating ) +{ + Dali::Toolkit::GetImplementation( *this ).SetAutoRepeating( autoRepeating ); +} + +bool Button::IsAutoRepeating() const +{ + return Dali::Toolkit::GetImplementation( *this ).IsAutoRepeating(); +} + +void Button::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ) +{ + Dali::Toolkit::GetImplementation( *this ).SetInitialAutoRepeatingDelay( initialAutoRepeatingDelay ); +} + +float Button::GetInitialAutoRepeatingDelay() const +{ + return Dali::Toolkit::GetImplementation( *this ).GetInitialAutoRepeatingDelay(); +} + +void Button::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ) +{ + Dali::Toolkit::GetImplementation( *this ).SetNextAutoRepeatingDelay( nextAutoRepeatingDelay ); +} + +float Button::GetNextAutoRepeatingDelay() const +{ + return Dali::Toolkit::GetImplementation( *this ).GetNextAutoRepeatingDelay(); +} + +void Button::SetTogglableButton( bool togglable ) +{ + Dali::Toolkit::GetImplementation( *this ).SetTogglableButton( togglable ); +} + +bool Button::IsTogglableButton() const +{ + return Dali::Toolkit::GetImplementation( *this ).IsTogglableButton(); +} + +void Button::SetSelected( bool selected ) +{ + Dali::Toolkit::GetImplementation( *this ).SetSelected( selected ); +} + +bool Button::IsSelected() const +{ + return Dali::Toolkit::GetImplementation( *this ).IsSelected(); +} + void Button::SetAnimationTime( float animationTime ) { Dali::Toolkit::GetImplementation( *this ).SetAnimationTime( animationTime ); @@ -78,12 +132,37 @@ float Button::GetAnimationTime() const return Dali::Toolkit::GetImplementation( *this ).GetAnimationTime(); } -Button::ClickedSignalType& Button::ClickedSignal() +void Button::SetLabel( const std::string& label ) +{ + Dali::Toolkit::GetImplementation( *this ).SetLabel( label ); +} + +void Button::SetLabel( Actor label ) +{ + Dali::Toolkit::GetImplementation( *this ).SetLabel( label ); +} + +Actor Button::GetLabel() const +{ + return Dali::Toolkit::GetImplementation( *this ).GetLabel(); +} + +Button::ButtonSignalType& Button::PressedSignal() +{ + return Dali::Toolkit::GetImplementation( *this ).PressedSignal(); +} + +Button::ButtonSignalType& Button::ReleasedSignal() +{ + return Dali::Toolkit::GetImplementation( *this ).ReleasedSignal(); +} + +Button::ButtonSignalType& Button::ClickedSignal() { return Dali::Toolkit::GetImplementation( *this ).ClickedSignal(); } -Button::StateChangedSignalType& Button::StateChangedSignal() +Button::ButtonSignalType& Button::StateChangedSignal() { return Dali::Toolkit::GetImplementation( *this ).StateChangedSignal(); } diff --git a/dali-toolkit/public-api/controls/buttons/button.h b/dali-toolkit/public-api/controls/buttons/button.h index e693a11..2078413 100644 --- a/dali-toolkit/public-api/controls/buttons/button.h +++ b/dali-toolkit/public-api/controls/buttons/button.h @@ -47,17 +47,22 @@ class DALI_IMPORT_API Button : public Control public: // Signal Names + static const char* const SIGNAL_PRESSED; ///< name "pressed" + static const char* const SIGNAL_RELEASED; ///< name "released" static const char* const SIGNAL_CLICKED; ///< name "clicked" static const char* const SIGNAL_STATE_CHANGED; ///< name "state-changed" + //Action Names + static const char* const ACTION_BUTTON_CLICK; ///< name "button-click" + // Properties static const Property::Index PROPERTY_DISABLED; ///< name "disabled", @see SetDisabled(), type BOOLEAN 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_TOGGLED; ///< name "toggled", @see SetToggled(), type BOOLEAN - static const Property::Index PROPERTY_NORMAL_STATE_ACTOR; ///< name "button-state-actor", @see SetButtonImage(), type MAP + static const Property::Index PROPERTY_TOGGLABLE; ///< name "togglable", @see SetTogglableButton(), type BOOLEAN + static const Property::Index PROPERTY_SELECTED; ///< name "selected", @see SetSelected(), type BOOLEAN + static const Property::Index PROPERTY_NORMAL_STATE_ACTOR; ///< name "normal-state-actor", @see SetButtonImage(), type MAP static const Property::Index PROPERTY_SELECTED_STATE_ACTOR; ///< name "selected-state-actor", @see SetSelectedImage(), type MAP static const Property::Index PROPERTY_DISABLED_STATE_ACTOR; ///< name "disabled-state-actor", @see SetDisabledImage(), type MAP static const Property::Index PROPERTY_LABEL_ACTOR; ///< name "label-actor", @see SetLabel(), type MAP @@ -115,6 +120,81 @@ public: bool IsDisabled() const; /** + * @brief Sets the \e autorepeating property. + * + * If the \e autorepeating property is set to \e true, then the \e togglable property is set to false + * but no signal is emitted. + * + * @param[in] autoRepeating \e autorepeating property. + */ + void SetAutoRepeating( bool autoRepeating ); + + /** + * @return \e true if the \e autorepeating property is set. + */ + bool IsAutoRepeating() const; + + /** + * @brief Sets the initial autorepeating delay. + * + * By default this value is set to 0.15 seconds. + * + * @pre initialAutoRepeatingDelay must be greater than zero. + * @param[in] initialAutoRepeatingDelay in seconds. + */ + void SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ); + + /** + * @return the initial autorepeating delay in seconds. + */ + float GetInitialAutoRepeatingDelay() const; + + /** + * @brief Sets the next autorepeating delay. + * + * By default this value is set to 0.05 seconds. + * + * @pre nextAutoRepeatingDelay must be greater than zero. + * @param[in] nextAutoRepeatingDelay in seconds. + */ + void SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ); + + /** + * @return the next autorepeating delay in seconds. + */ + float GetNextAutoRepeatingDelay() const; + + /** + * @brief Sets the \e togglable property. + * + * If the \e togglable property is set to \e true, then the \e autorepeating property is set to false. + * + * @param[in] togglable property. + */ + void SetTogglableButton( bool togglable ); + + /** + * @return \e true if the \e togglable property is set. + */ + bool IsTogglableButton() const; + + /** + * Sets the button as selected or unselected. + * + * \e togglable property must be set to \e true. + * + * Emits a Button::StateChangedSignal() signal. + * + * @param[in] selected property. + */ + void SetSelected( bool selected ); + + /** + * @return \e true if the \e selected property is set and the button is togglable. + */ + bool IsSelected() const; + + /** * @brief Sets the animation time. * * @param [in] animationTime The animation time in seconds. @@ -128,27 +208,76 @@ public: */ float GetAnimationTime() const; + /** + * @brief Sets the button label. + * + * @param[in] label The button label. + */ + void SetLabel( const std::string& label ); + + /** + * @copydoc SetLabel( const std::string& label ) + */ + void SetLabel( Actor label ); + + /** + * @brief Gets the label. + * + * @return An actor with the label. + */ + Actor GetLabel() const; + public: //Signals /** - * @brief Button Clicked signal type + * @brief Button signal type */ - typedef Signal< bool ( Button ) > ClickedSignalType; + typedef Signal< bool ( Button ) > ButtonSignalType; /** - * @brief Button state changed signal type + * @brief This signal is emitted when the button is touched. + * + * A callback of the following type may be connected: + * @code + * bool YourCallbackName( Button button ); + * @endcode + * @return The signal to connect to. */ - typedef Signal< bool ( Button, bool ) > StateChangedSignalType; + ButtonSignalType& PressedSignal(); /** - * @brief Signal emitted when the button is touched and the touch point doesn't leave the boundary of the button. + * @brief 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: + * @code + * bool YourCallbackName( Button button ); + * @endcode + * @return The signal to connect to. */ - ClickedSignalType& ClickedSignal(); + ButtonSignalType& ReleasedSignal(); /** - * @brief Signal emitted when the button's state is changed. + * @brief 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: + * @code + * bool YourCallbackName( Button button ); + * @endcode + * @return The signal to connect to. + */ + ButtonSignalType& ClickedSignal(); + + /** + * @brief 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: + * @code + * bool YourCallbackName( Button button ); + * @endcode + * @return The signal to connect to. */ - StateChangedSignalType& StateChangedSignal(); + ButtonSignalType& StateChangedSignal(); public: // Not intended for application developers diff --git a/dali-toolkit/public-api/controls/buttons/check-box-button.cpp b/dali-toolkit/public-api/controls/buttons/check-box-button.cpp index e6b2a5e..b288451 100644 --- a/dali-toolkit/public-api/controls/buttons/check-box-button.cpp +++ b/dali-toolkit/public-api/controls/buttons/check-box-button.cpp @@ -29,8 +29,6 @@ namespace Dali namespace Toolkit { -const char* const CheckBoxButton::ACTION_CHECK_BOX_BUTTON_CLICK = "check-box-button-click"; - CheckBoxButton::CheckBoxButton() : Button() { @@ -64,16 +62,6 @@ CheckBoxButton CheckBoxButton::DownCast( BaseHandle handle ) return Control::DownCast(handle); } -void CheckBoxButton::SetChecked( bool checked ) -{ - Dali::Toolkit::GetImplementation( *this ).SetChecked( checked ); -} - -bool CheckBoxButton::IsChecked() const -{ - return Dali::Toolkit::GetImplementation( *this ).IsChecked(); -} - void CheckBoxButton::SetBackgroundImage( Image image ) { Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( image ); @@ -89,20 +77,20 @@ Actor CheckBoxButton::GetBackgroundImage() const return Dali::Toolkit::GetImplementation( *this ).GetBackgroundImage(); } -void CheckBoxButton::SetCheckedImage( Image image ) +void CheckBoxButton::SetSelectedImage( Image image ) { - Dali::Toolkit::GetImplementation( *this ).SetCheckedImage( image ); + Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( image ); } -void CheckBoxButton::SetCheckedImage( Actor image ) +void CheckBoxButton::SetSelectedImage( Actor image ) { - Dali::Toolkit::GetImplementation( *this ).SetCheckedImage( image ); + Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( image ); } -Actor CheckBoxButton::GetCheckedImage() const +Actor CheckBoxButton::GetSelectedImage() const { - return Dali::Toolkit::GetImplementation( *this ).GetCheckedImage(); + return Dali::Toolkit::GetImplementation( *this ).GetSelectedImage(); } void CheckBoxButton::SetDisabledBackgroundImage( Image image ) @@ -120,19 +108,19 @@ Actor CheckBoxButton::GetDisabledBackgroundImage() const return Dali::Toolkit::GetImplementation( *this ).GetDisabledBackgroundImage(); } -void CheckBoxButton::SetDisabledCheckedImage( Image image ) +void CheckBoxButton::SetDisabledSelectedImage( Image image ) { - Dali::Toolkit::GetImplementation( *this ).SetDisabledCheckedImage( image ); + Dali::Toolkit::GetImplementation( *this ).SetDisabledSelectedImage( image ); } -void CheckBoxButton::SetDisabledCheckedImage( Actor image ) +void CheckBoxButton::SetDisabledSelectedImage( Actor image ) { - Dali::Toolkit::GetImplementation( *this ).SetDisabledCheckedImage( image ); + Dali::Toolkit::GetImplementation( *this ).SetDisabledSelectedImage( image ); } -Actor CheckBoxButton::GetDisabledCheckedImage() const +Actor CheckBoxButton::GetDisabledSelectedImage() const { - return Dali::Toolkit::GetImplementation( *this ).GetDisabledCheckedImage(); + return Dali::Toolkit::GetImplementation( *this ).GetDisabledSelectedImage(); } CheckBoxButton::CheckBoxButton( Internal::CheckBoxButton& implementation ) diff --git a/dali-toolkit/public-api/controls/buttons/check-box-button.h b/dali-toolkit/public-api/controls/buttons/check-box-button.h index e321ce4..2e905d6 100644 --- a/dali-toolkit/public-api/controls/buttons/check-box-button.h +++ b/dali-toolkit/public-api/controls/buttons/check-box-button.h @@ -37,15 +37,15 @@ class CheckBoxButton; /** * CheckBoxButton provides a check box button which user can check or uncheck. * - * By default a CheckBoxButton emits a Button::ClickedSignal() signal when the button changes its state to checked or unchecked. + * By default a CheckBoxButton emits a Button::ClickedSignal() signal when the button changes its state to selected or unselected. * * The button's appearance could be modified by setting images or actors with CheckBoxButton::SetBackgroundImage, - * CheckBoxButton::SetCheckedImage, CheckBoxButton::SetDisabledBackgroundImage and CheckBoxButton::SetDisabledCheckedImage. + * CheckBoxButton::SetSelectedImage, CheckBoxButton::SetDisabledBackgroundImage and CheckBoxButton::SetDisabledSelectedImage. * - * When the button is not disabled, if it's not checked it only shows the \e background image. The \e checked image is shown over the - * \e background image when the box is checked (\e background image is not replaced by \e checked image). + * When the button is not disabled, if it's not selected it only shows the \e background image. The \e selected image is shown over the + * \e background image when the box is selected (\e background image is not replaced by \e selected image). * - * When the button is disabled, \e background image and \e checked image are replaced by \e disabled images. + * When the button is disabled, \e background image and \e selected image are replaced by \e disabled images. * * CheckBoxButton doesn't have a text. However, a Dali::Toolkit::TableView with a Dali::TextActor or a Dali::Toolkit::TextView * and a CheckBoxButton could be used instead. @@ -53,10 +53,6 @@ class CheckBoxButton; class DALI_IMPORT_API CheckBoxButton : public Button { public: - //Action Names - static const char* const ACTION_CHECK_BOX_BUTTON_CLICK; - -public: /** * Create an uninitialized CheckBoxButton; this can be initialized with CheckBoxButton::New() @@ -96,21 +92,6 @@ public: static CheckBoxButton DownCast( BaseHandle handle ); /** - * Sets the button as checked or unchecked. - * - * Emits a Button::ClickedSignal() signal if the checkbox is not disabled and the new state, - * given in the \e checked param, is different than the previous one. - * - * @param[in] checked state. - */ - void SetChecked( bool checked ); - - /** - * @return \e true if the button is checked. - */ - bool IsChecked() const; - - /** * Sets the background image. * * @param[in] image The background image. @@ -129,22 +110,22 @@ public: Actor GetBackgroundImage() const; /** - * Sets the checked image. + * Sets the selected image. * - * @param[in] image The checked image. + * @param[in] image The selected image. */ - void SetCheckedImage( Image image ); + void SetSelectedImage( Image image ); /** - * @copydoc SetCheckedImage( Image image ) + * @copydoc SetSelectedImage( Image image ) */ - void SetCheckedImage( Actor image ); + void SetSelectedImage( Actor image ); /** - * Gets the checked image. - * @return An actor with the checked image. + * Gets the selected image. + * @return An actor with the selected image. */ - Actor GetCheckedImage() const; + Actor GetSelectedImage() const; /** * Sets the disabled background image. @@ -165,22 +146,22 @@ public: Actor GetDisabledBackgroundImage() const; /** - * Sets the disabled checked image. + * Sets the disabled selected image. * - * @param[in] image The disabled checked image. + * @param[in] image The disabled selected image. */ - void SetDisabledCheckedImage( Image image ); + void SetDisabledSelectedImage( Image image ); /** - * @copydoc SetDisabledCheckedImage( Image image ) + * @copydoc SetDisabledSelectedImage( Image image ) */ - void SetDisabledCheckedImage( Actor image ); + void SetDisabledSelectedImage( Actor image ); /** - * Gets the disabled checked image. - * @return An actor with the disabled checked image. + * Gets the disabled selected image. + * @return An actor with the disabled selected image. */ - Actor GetDisabledCheckedImage() const; + Actor GetDisabledSelectedImage() const; public: // Not intended for application developers diff --git a/dali-toolkit/public-api/controls/buttons/push-button.cpp b/dali-toolkit/public-api/controls/buttons/push-button.cpp index 7133c03..b3d4dd2 100644 --- a/dali-toolkit/public-api/controls/buttons/push-button.cpp +++ b/dali-toolkit/public-api/controls/buttons/push-button.cpp @@ -29,11 +29,6 @@ namespace Dali namespace Toolkit { -const char* const PushButton::SIGNAL_PRESSED = "pressed"; -const char* const PushButton::SIGNAL_RELEASED = "released"; - -const char* const PushButton::ACTION_PUSH_BUTTON_CLICK = "push-button-click"; - PushButton::PushButton() : Button() { @@ -78,56 +73,6 @@ PushButton PushButton::DownCast( BaseHandle handle ) return Control::DownCast(handle); } -void PushButton::SetAutoRepeating( bool autoRepeating ) -{ - Dali::Toolkit::GetImplementation( *this ).SetAutoRepeating( autoRepeating ); -} - -bool PushButton::IsAutoRepeating() const -{ - return Dali::Toolkit::GetImplementation( *this ).IsAutoRepeating(); -} - -void PushButton::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ) -{ - Dali::Toolkit::GetImplementation( *this ).SetInitialAutoRepeatingDelay( initialAutoRepeatingDelay ); -} - -float PushButton::GetInitialAutoRepeatingDelay() const -{ - return Dali::Toolkit::GetImplementation( *this ).GetInitialAutoRepeatingDelay(); -} - -void PushButton::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ) -{ - Dali::Toolkit::GetImplementation( *this ).SetNextAutoRepeatingDelay( nextAutoRepeatingDelay ); -} - -float PushButton::GetNextAutoRepeatingDelay() const -{ - return Dali::Toolkit::GetImplementation( *this ).GetNextAutoRepeatingDelay(); -} - -void PushButton::SetToggleButton( bool toggle ) -{ - Dali::Toolkit::GetImplementation( *this ).SetToggleButton( toggle ); -} - -bool PushButton::IsToggleButton() const -{ - return Dali::Toolkit::GetImplementation( *this ).IsToggleButton(); -} - -void PushButton::SetToggled( bool toggle ) -{ - Dali::Toolkit::GetImplementation( *this ).SetToggled( toggle ); -} - -bool PushButton::IsToggled() const -{ - return Dali::Toolkit::GetImplementation( *this ).IsToggled(); -} - void PushButton::SetButtonImage( Image image ) { Dali::Toolkit::GetImplementation( *this ).SetButtonImage( image ); @@ -203,31 +148,6 @@ Actor PushButton::GetDisabledImage() const return Dali::Toolkit::GetImplementation( *this ).GetDisabledImage(); } -void PushButton::SetLabel( const std::string& label ) -{ - Dali::Toolkit::GetImplementation( *this ).SetLabel( label ); -} - -void PushButton::SetLabel( Actor label ) -{ - Dali::Toolkit::GetImplementation( *this ).SetLabel( label ); -} - -Actor PushButton::GetLabel() const -{ - return Dali::Toolkit::GetImplementation( *this ).GetLabel(); -} - -PushButton::PressedSignalType& PushButton::PressedSignal() -{ - return Dali::Toolkit::GetImplementation( *this ).PressedSignal(); -} - -PushButton::ReleasedSignalType& PushButton::ReleasedSignal() -{ - return Dali::Toolkit::GetImplementation( *this ).ReleasedSignal(); -} - } // namespace Toolkit } // namespace Dali diff --git a/dali-toolkit/public-api/controls/buttons/push-button.h b/dali-toolkit/public-api/controls/buttons/push-button.h index 09c480c..dfc3409 100644 --- a/dali-toolkit/public-api/controls/buttons/push-button.h +++ b/dali-toolkit/public-api/controls/buttons/push-button.h @@ -39,27 +39,27 @@ class PushButton; /** * @brief A PushButton changes its appearance when is pressed and returns to its original when is released. * - * By default a PushButton emits a PushButton::PressedSignal() signal when the button is pressed, a Button::ClickedSignal() signal when it's clicked - * and a PushButton::ReleasedSignal() signal when it's released or having pressed it, the touch point leaves the boundary of the button. + * By default a PushButton emits a Button::PressedSignal() signal when the button is pressed, a Button::ClickedSignal() signal when it's clicked + * and a Button::ReleasedSignal() signal when it's released or having pressed it, the touch point leaves the boundary of the button. * * PushButton provides the following properties which modify signals emitted: *
    *
  • \e autorepeating * - * When \e autorepeating is set to \e true, a PushButton::PressedSignal(), PushButton::ReleasedSignal() and Button::ClickedSignal() signals are emitted at regular + * When \e autorepeating is set to \e true, a Button::PressedSignal(), Button::ReleasedSignal() and Button::ClickedSignal() signals are emitted at regular * intervals while the button is touched. * * The intervals could be modified with the PushButton::SetInitialAutoRepeatingDelay and PushButton::SetNextAutoRepeatingDelay methods. * - * A \e toggle button can't be \e autorepeating. If the \e autorepeating property is set to \e true, then the \e toggled property is set to + * A \e togglable button can't be \e autorepeating. If the \e autorepeating property is set to \e true, then the \e togglable property is set to * false but no signal is emitted. * - *
  • \e toggle + *
  • \e togglable * - * When \e toggle is set to \e true, a Button::StateChangedSignal() signal is emitted, with the toggle state, every time the button is touched instead - * of emit PushButton::PressedSignal(), Button::ClickedSignal() and PushButton::ReleasedSignal() signals. + * When \e togglable is set to \e true, a Button::StateChangedSignal() signal is emitted, with the selected state, every time the button is touched instead + * of emit Button::PressedSignal(), Button::ClickedSignal() and Button::ReleasedSignal() signals. * - * An \e autorepeating button can't be \e toggle. If the \e toggled property is set to \e true, then the \e autorepeating property is set to false. + * An \e autorepeating button can't be \e togglable. If the \e togglable property is set to \e true, then the \e autorepeating property is set to false. *
* * The button's appearance could be modified by setting images or actors with PushButton::SetButtonImage, PushButton::SetBackgroundImage, @@ -79,15 +79,6 @@ class DALI_IMPORT_API PushButton : public Button { public: - //Signal Names - static const char* const SIGNAL_PRESSED; ///< name "pressed" - static const char* const SIGNAL_RELEASED; ///< name "released" - - //Action Names - static const char* const ACTION_PUSH_BUTTON_CLICK; ///< name "push-button-click" - -public: - /** * @brief Create an uninitialized PushButton; this can be initialized with PushButton::New(). * @@ -131,81 +122,6 @@ public: static PushButton DownCast( BaseHandle handle ); /** - * @brief Sets the \e autorepeating property. - * - * If the \e autorepeating property is set to \e true, then the \e toggled property is set to false - * but no signal is emitted. - * - * @param[in] autoRepeating \e autorepeating property. - */ - void SetAutoRepeating( bool autoRepeating ); - - /** - * @return \e true if the \e autorepeating property is set. - */ - bool IsAutoRepeating() const; - - /** - * @brief Sets the initial autorepeating delay. - * - * By default this value is set to 0.15 seconds. - * - * @pre initialAutoRepeatingDelay must be greater than zero. - * @param[in] initialAutoRepeatingDelay in seconds. - */ - void SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ); - - /** - * @return the initial autorepeating delay in seconds. - */ - float GetInitialAutoRepeatingDelay() const; - - /** - * @brief Sets the next autorepeating delay. - * - * By default this value is set to 0.05 seconds. - * - * @pre nextAutoRepeatingDelay must be greater than zero. - * @param[in] nextAutoRepeatingDelay in seconds. - */ - void SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ); - - /** - * @return the next autorepeating delay in seconds. - */ - float GetNextAutoRepeatingDelay() const; - - /** - * @brief Sets the \e toggled property. - * - * If the \e toggled property is set to \e true, then the \e autorepeating property is set to false. - * - * @param[in] toggle property. - */ - void SetToggleButton( bool toggle ); - - /** - * @return \e true if the \e toggled property is set. - */ - bool IsToggleButton() const; - - /** - * @brief Sets the button as toggled or not toggled. - * - * \e toggled property must be set to \e true. - * - * Emits a Button::StateChangedSignal() signal. - * - * @param[in] toggle state. - */ - void SetToggled( bool toggle ); - - /** - * @return \e true if the \e toggled property is set and the button is toggled. - */ - bool IsToggled() const; - - /** * @brief Sets the button image. * * @param[in] image The button image. @@ -300,43 +216,6 @@ public: */ Actor GetDisabledImage() const; - /** - * @brief Sets the button label. - * - * @param[in] label The button label. - */ - void SetLabel( const std::string& label ); - - /** - * @copydoc SetLabel( const std::string& label ) - */ - void SetLabel( Actor label ); - - /** - * @brief Gets the label. - * - * @return An actor with the label. - */ - Actor GetLabel() const; - -public: //Signals - - /// @brief PushButton Pressed signal type. - typedef Signal< bool ( Button ) > PressedSignalType; - - /// @brief PushButton Released signal type. - typedef Signal< bool ( Button ) > ReleasedSignalType; - - /** - * @brief Signal emitted when the button is touched. - */ - PressedSignalType& PressedSignal(); - - /** - * @brief Signal emitted when the button is touched and the touch point leaves the boundary of the button. - */ - ReleasedSignalType& ReleasedSignal(); - public: // Not intended for application developers /** diff --git a/dali-toolkit/public-api/controls/buttons/radio-button.cpp b/dali-toolkit/public-api/controls/buttons/radio-button.cpp index e58f1c5..c698225 100644 --- a/dali-toolkit/public-api/controls/buttons/radio-button.cpp +++ b/dali-toolkit/public-api/controls/buttons/radio-button.cpp @@ -34,17 +34,17 @@ RadioButton::RadioButton() { } -RadioButton::RadioButton(Internal::RadioButton& implementation) - : Button(implementation) +RadioButton::RadioButton( Internal::RadioButton& implementation ) + : Button( implementation ) { } -RadioButton::RadioButton(const RadioButton& radioButton) - : Button(radioButton) +RadioButton::RadioButton( const RadioButton& radioButton ) + : Button( radioButton ) { } -RadioButton& RadioButton::operator=(const RadioButton& radioButton ) +RadioButton& RadioButton::operator=( const RadioButton& radioButton ) { if( &radioButton != this ) { @@ -53,8 +53,8 @@ RadioButton& RadioButton::operator=(const RadioButton& radioButton ) return *this; } -RadioButton::RadioButton(Dali::Internal::CustomActor* internal) - : Button(internal) +RadioButton::RadioButton( Dali::Internal::CustomActor* internal ) + : Button( internal ) { VerifyCustomActorPointer( internal ); } @@ -68,55 +68,25 @@ RadioButton RadioButton::New() return Internal::RadioButton::New(); } -RadioButton RadioButton::New(const std::string& label) +RadioButton RadioButton::New( const std::string& label ) { RadioButton radioButton = Internal::RadioButton::New(); - radioButton.SetLabel(label); + radioButton.SetLabel( label ); return radioButton; } -RadioButton RadioButton::New(Actor label) +RadioButton RadioButton::New( Actor label ) { RadioButton radioButton = Internal::RadioButton::New(); - radioButton.SetLabel(label); + radioButton.SetLabel( label ); return radioButton; } -RadioButton RadioButton::DownCast(BaseHandle handle) +RadioButton RadioButton::DownCast( BaseHandle handle ) { return Control::DownCast( handle ); } -void RadioButton::SetLabel(const std::string& label) -{ - Dali::Toolkit::GetImplementation(*this).SetLabel(label); -} - -void RadioButton::SetLabel(Actor label) -{ - Dali::Toolkit::GetImplementation(*this).SetLabel(label); -} - -Actor RadioButton::GetLabel() const -{ - return Dali::Toolkit::GetImplementation(*this).GetLabel(); -} - -void RadioButton::SetSelected(bool selected) -{ - Dali::Toolkit::GetImplementation(*this).SetSelected(selected); -} - -bool RadioButton::IsSelected()const -{ - return Dali::Toolkit::GetImplementation(*this).IsSelected(); -} - -void RadioButton::ToggleState() -{ - Dali::Toolkit::GetImplementation(*this).ToggleState(); -} - } // namespace Toolkit } // namespace Dali diff --git a/dali-toolkit/public-api/controls/buttons/radio-button.h b/dali-toolkit/public-api/controls/buttons/radio-button.h index 5f461b6..f8dbf59 100644 --- a/dali-toolkit/public-api/controls/buttons/radio-button.h +++ b/dali-toolkit/public-api/controls/buttons/radio-button.h @@ -41,9 +41,9 @@ class RadioButton; * * Radio buttons are designed to select one of many option at the same time. * - * Every button have its own \e label and \e state, which can be modified by RadioButton::SetLabel and RadioButton::SetSelected. + * Every button have its own \e label and \e state, which can be modified by RadioButton::SetLabel and Button::SetSelected. * - * RadioButton can change its current state using RadioButton::ToggleState. + * RadioButton can change its current state using Button::SetSelected. * * RadioButtons can be grouped. * Two or more RadioButtons are in one group when they have this same parent. @@ -51,7 +51,7 @@ class RadioButton; * So when RadioButton is set to \e selected, other RadioButtons in its group are set to \e unselected. * When \e selected RadioButton is set to \e unselected no other RadioButtons in his group is set to \e selected. * - * A Button::ClickedSignal() is emitted when the RadioButton change its state to \e selected or \e unselected. + * A Button::StateChangedSignal() is emitted when the RadioButton change its state to \e selected or \e unselected. */ class DALI_IMPORT_API RadioButton: public Button { @@ -66,12 +66,12 @@ class DALI_IMPORT_API RadioButton: public Button /** * @brief Copy constructor. */ - RadioButton(const RadioButton& radioButton); + RadioButton( const RadioButton& radioButton ); /** * @brief Assignment operator. */ - RadioButton& operator=(const RadioButton& radioButton); + RadioButton& operator=( const RadioButton& radioButton ); /** * @brief Destructor @@ -94,7 +94,7 @@ class DALI_IMPORT_API RadioButton: public Button * * @return A handle to a newly allocated Dali resource. */ - static RadioButton New(const std::string& label); + static RadioButton New( const std::string& label ); /** * @brief Create an initialized RadioButton with existing Actor. @@ -103,7 +103,7 @@ class DALI_IMPORT_API RadioButton: public Button * * @return A handle to a newly allocated Dali resource. */ - static RadioButton New(Actor label); + static RadioButton New( Actor label ); /** * @brief Downcast an Object handle to RadioButton. @@ -114,47 +114,7 @@ class DALI_IMPORT_API RadioButton: public Button * @param[in] handle Handle to an object * @return handle to a RadioButton or an uninitialized handle */ - static RadioButton DownCast(BaseHandle handle); - - /** - * @brief Sets the button label. - * - * @param[in] label The button label. - */ - void SetLabel(const std::string& label); - - /** - * @brief Sets the button label using existing Actor. - * - * @param[in] label An Actor with the label. - */ - void SetLabel(Actor label); - - /** - * @brief Gets the label. - * - * @return An Actor with the label. - */ - Actor GetLabel() const; - - /** - * @brief Sets the button as selected or unselected. - * - * @param[in] selected property - */ - void SetSelected(bool selected); - - /** - * @return true if button is selected, false if button is unselected. - */ - bool IsSelected()const; - - /** - * @brief Change button state. - * - * If button is selected unselect it. If button is unselected select it. - */ - void ToggleState(); + static RadioButton DownCast( BaseHandle handle ); public: // Not intended for application developers @@ -163,15 +123,14 @@ class DALI_IMPORT_API RadioButton: public Button * * @param[in] implementation The Control implementation. */ - DALI_INTERNAL RadioButton(Internal::RadioButton& implementation); + DALI_INTERNAL RadioButton( Internal::RadioButton& implementation ); /** * @brief Allows the creation of this Control from an Internal::CustomActor pointer. * * @param[in] internal A pointer to the internal CustomActor. */ - DALI_INTERNAL RadioButton(Dali::Internal::CustomActor* internal); - + DALI_INTERNAL RadioButton( Dali::Internal::CustomActor* internal ); }; } // namespace Toolkit diff --git a/dali-toolkit/public-api/controls/default-controls/check-button-factory.cpp b/dali-toolkit/public-api/controls/default-controls/check-button-factory.cpp index cff908b..5715e49 100644 --- a/dali-toolkit/public-api/controls/default-controls/check-button-factory.cpp +++ b/dali-toolkit/public-api/controls/default-controls/check-button-factory.cpp @@ -52,7 +52,7 @@ Alignment CreateAlignedImage( const std::string& imagePath ) } // namespace -CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& checkedImagePath, const std::string& disabledBackgroundImagePath, const std::string& disabledCheckedImagePath ) +CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& selectedImagePath, const std::string& disabledBackgroundImagePath, const std::string& disabledSelectedImagePath ) { CheckBoxButton button = Toolkit::CheckBoxButton::New(); @@ -61,9 +61,9 @@ CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, con button.SetBackgroundImage( CreateAlignedImage( backgroundImagePath ) ); } - if( !checkedImagePath.empty() ) + if( !selectedImagePath.empty() ) { - button.SetCheckedImage( CreateAlignedImage( checkedImagePath ) ); + button.SetSelectedImage( CreateAlignedImage( selectedImagePath ) ); } if( !disabledBackgroundImagePath.empty() ) @@ -71,15 +71,15 @@ CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, con button.SetDisabledBackgroundImage( CreateAlignedImage( disabledBackgroundImagePath ) ); } - if( !disabledCheckedImagePath.empty() ) + if( !disabledSelectedImagePath.empty() ) { - button.SetDisabledCheckedImage( CreateAlignedImage( disabledCheckedImagePath ) ); + button.SetDisabledSelectedImage( CreateAlignedImage( disabledSelectedImagePath ) ); } return button; } -CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedImageActor, Actor disabledBackgroundImageActor, Actor disabledCheckedImagActor ) +CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor selectedImageActor, Actor disabledBackgroundImageActor, Actor disabledSelectedImagActor ) { CheckBoxButton button = Toolkit::CheckBoxButton::New(); @@ -88,9 +88,9 @@ CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedIm button.SetBackgroundImage( CreateAlignedImage( backgroundImageActor ) ); } - if( checkedImageActor ) + if( selectedImageActor ) { - button.SetCheckedImage( CreateAlignedImage( checkedImageActor ) ); + button.SetSelectedImage( CreateAlignedImage( selectedImageActor ) ); } if( disabledBackgroundImageActor ) @@ -98,15 +98,15 @@ CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedIm button.SetDisabledBackgroundImage( CreateAlignedImage( disabledBackgroundImageActor ) ); } - if( disabledCheckedImagActor ) + if( disabledSelectedImagActor ) { - button.SetDisabledCheckedImage( CreateAlignedImage( disabledCheckedImagActor ) ); + button.SetDisabledSelectedImage( CreateAlignedImage( disabledSelectedImagActor ) ); } return button; } -CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& checkedImagePath ) +CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& selectedImagePath ) { CheckBoxButton button = Toolkit::CheckBoxButton::New(); @@ -115,15 +115,15 @@ CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, con button.SetBackgroundImage( CreateAlignedImage( backgroundImagePath ) ); } - if( !checkedImagePath.empty() ) + if( !selectedImagePath.empty() ) { - button.SetCheckedImage( CreateAlignedImage( checkedImagePath ) ); + button.SetSelectedImage( CreateAlignedImage( selectedImagePath ) ); } return button; } -CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedImageActor ) +CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor selectedImageActor ) { CheckBoxButton button = Toolkit::CheckBoxButton::New(); @@ -132,9 +132,9 @@ CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedIm button.SetBackgroundImage( CreateAlignedImage( backgroundImageActor ) ); } - if( checkedImageActor ) + if( selectedImageActor ) { - button.SetCheckedImage( CreateAlignedImage( checkedImageActor ) ); + button.SetSelectedImage( CreateAlignedImage( selectedImageActor ) ); } return button; diff --git a/dali-toolkit/public-api/controls/default-controls/check-button-factory.h b/dali-toolkit/public-api/controls/default-controls/check-button-factory.h index 8fe5cdb..3ca9a94 100644 --- a/dali-toolkit/public-api/controls/default-controls/check-button-factory.h +++ b/dali-toolkit/public-api/controls/default-controls/check-button-factory.h @@ -34,11 +34,11 @@ namespace Toolkit * @note If an image path is empty, this image is not set to the button. * * @param[in] backgroundImagePath Image path to be shown as button background. - * @param[in] checkedImagePath Image path to be shown as checked button. + * @param[in] selectedImagePath Image path to be shown as selected button. * @param[in] disabledBackgroundImagePath Image path to be shown as button isabled background. - * @param[in] disabledCheckedImagePath Image path to be shown as disabled checked button. + * @param[in] disabledSelectedImagePath Image path to be shown as disabled selected button. */ -DALI_IMPORT_API CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& checkedImagePath, const std::string& disabledBackgroundImagePath, const std::string& disabledCheckedImagePath ); +DALI_IMPORT_API CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& selectedImagePath, const std::string& disabledBackgroundImagePath, const std::string& disabledSelectedImagePath ); /** * Creates a check box button with the given images. @@ -47,31 +47,31 @@ DALI_IMPORT_API CheckBoxButton CreateCheckBoxButton( const std::string& backgrou * @note If an image is an empty handle, this image is not set to the button. * * @param[in] backgroundImageActor Image to be shown as button background. - * @param[in] checkedImageActor Image to be shown as checked button. + * @param[in] selectedImageActor Image to be shown as selected button. * @param[in] disabledBackgroundImageActor Image to be shown as button disabled background. - * @param[in] disabledCheckedImagActor Image to be shown as disabled checked button. + * @param[in] disabledSelectedImagActor Image to be shown as disabled selected button. */ -DALI_IMPORT_API CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedImageActor, Actor disabledBackgroundImageActor, Actor disabledCheckedImagActor ); +DALI_IMPORT_API CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor selectedImageActor, Actor disabledBackgroundImageActor, Actor disabledSelectedImagActor ); /** - * Creates a check box button with the given background and checked images. - * Background and checked images will be shrunk to fit the button size keeping their aspect ratio. - * @note Background and checked images won't be scaled to fill the whole button size. + * Creates a check box button with the given background and selected images. + * Background and selected images will be shrunk to fit the button size keeping their aspect ratio. + * @note Background and selected images won't be scaled to fill the whole button size. * * @param[in] backgroundImagePath Image path to be shown as button background. - * @param[in] checkedImagePath Image path to be shown as checked button. + * @param[in] selectedImagePath Image path to be shown as selected button. */ -DALI_IMPORT_API CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& checkedImagePath ); +DALI_IMPORT_API CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& selectedImagePath ); /** - * Creates a check box button with the given background and checked images. - * Background and checked images will be shrunk to fit the button size keeping their aspect ratio. - * @note Background and checked images won't be scaled to fill the whole button size. + * Creates a check box button with the given background and selected images. + * Background and selected images will be shrunk to fit the button size keeping their aspect ratio. + * @note Background and selected images won't be scaled to fill the whole button size. * * @param[in] backgroundImageActor Image to be shown as button background. - * @param[in] checkedImageActor Image to be shown as checked button. + * @param[in] selectedImageActor Image to be shown as selected button. */ -DALI_IMPORT_API CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedImageActor ); +DALI_IMPORT_API CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor selectedImageActor ); } // namespace Toolkit diff --git a/dali-toolkit/public-api/controls/table-view/table-view.cpp b/dali-toolkit/public-api/controls/table-view/table-view.cpp index 06c18a9..7c77387 100644 --- a/dali-toolkit/public-api/controls/table-view/table-view.cpp +++ b/dali-toolkit/public-api/controls/table-view/table-view.cpp @@ -175,16 +175,6 @@ float TableView::GetRelativeWidth( unsigned int columnIndex ) const return GetImpl(*this).GetRelativeWidth( columnIndex ); } -void TableView::SetLayoutAnimationDuration( float duration ) -{ - GetImpl(*this).SetLayoutAnimationDuration( duration ); -} - -float TableView::GetLayoutAnimationDuration() -{ - return GetImpl(*this).GetLayoutAnimationDuration(); -} - unsigned int TableView::GetRows() { return GetImpl(*this).GetRows(); diff --git a/dali-toolkit/public-api/controls/table-view/table-view.h b/dali-toolkit/public-api/controls/table-view/table-view.h index 1b4a332..d7c8ed3 100644 --- a/dali-toolkit/public-api/controls/table-view/table-view.h +++ b/dali-toolkit/public-api/controls/table-view/table-view.h @@ -50,7 +50,6 @@ public: static const Property::Index PROPERTY_ROWS; ///< name "rows", type UNSIGNED_INTEGER static const Property::Index PROPERTY_COLUMNS; ///< name "columns", type UNSIGNED_INTEGER static const Property::Index PROPERTY_CELL_PADDING; ///< name "cell-padding", type VECTOR2 - static const Property::Index PROPERTY_LAYOUT_ANIMATION_DURATION; ///< name "layout-animation-duration", type FLOAT /* * PROPERTY_LAYOUT_ROWS set the height of the rows @@ -333,19 +332,6 @@ public: float GetRelativeWidth( unsigned int columnIndex ) const; /** - * Sets the layout animation duration for add, remove and relayout - * @param duration for the layout animations - * @note The default duration is 0.0f. - */ - void SetLayoutAnimationDuration( float duration ); - - /** - * Gets the layout animation duration for add, remove and relayout - * @return duration for the layout animations - */ - float GetLayoutAnimationDuration(); - - /** * @return the amount of rows in the table */ unsigned int GetRows(); diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 5a1a4dc..f139b8d 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 0; -const unsigned int TOOLKIT_MICRO_VERSION = 29; +const unsigned int TOOLKIT_MICRO_VERSION = 30; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/docs/generated-internal/.gitignore b/docs/generated-internal/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/docs/generated-internal/.gitignore @@ -0,0 +1 @@ +* diff --git a/docs/generated-internal/README.md b/docs/generated-internal/README.md new file mode 100644 index 0000000..c79ec24 --- /dev/null +++ b/docs/generated-internal/README.md @@ -0,0 +1,25 @@ +Deep internal documentation for Dali Toolkit. + +Generate the documentation here as follows: + + # Go to dali-toolkit/build/tizen/docs-internal/ + cd ../../build/tizen/docs-internal/ + # Start doxygen: + ./build.sh + +Note, the doxfile assumes you have your Dali repositories checked-out +side by side with the following structure: + + . + ├── dali + ├── dali-adaptor + └── dali-toolkit + +If you have used different names or structure, you will need to adjust +the value of the `INPUT` variable in the doxyfile: + + build/tizen/docs-internal/dali_internal.doxy + + + + diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index ee0e474..225e80d 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.0.29 +Version: 1.0.30 Release: 1 Group: System/Libraries License: Apache-2.0