#include <iostream>
#include <stdlib.h>
+#include <dali-toolkit/internal/controls/buttons/push-button-impl.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali-toolkit/internal/controls/buttons/button-impl.h>
using namespace Dali;
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<PushButton&>( button ).IsToggled() );
+ gPushButtonSelectedState = selected && ( selected == static_cast<PushButton&>( button ).IsSelected() );
return true;
}
}
/**
- * 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.
/**
* Copy constructor.
*/
- TETButton( const Button& button );
+ TETButton( const PushButton& button );
/**
* Assignment operator.
/**
* Internal implementation
*/
-class TETButton : public Button
+class TETButton : public PushButton
{
public:
/**
/**
* @return the pressed signal.
*/
- Toolkit::TETButton::PressedSignalType& PressedSignal();
+ Toolkit::TETButton::ButtonSignalType& PressedSignal();
/**
* Callback called when an interrupt events is received.
*/
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
{
}
-TETButton::TETButton( const Button& button )
-: Button( button )
+TETButton::TETButton( const PushButton& button )
+: PushButton( button )
{
}
{
if( &button != this )
{
- Button::operator=( button );
+ PushButton::operator=( button );
}
return *this;
}
return Control::DownCast<TETButton, Internal::TETButton>(handle);
}
-TETButton::PressedSignalType& TETButton::PressedSignal()
+TETButton::ButtonSignalType& TETButton::PressedSignal()
{
TETButton button( *this );
DALI_ASSERT_ALWAYS( button );
}
TETButton::TETButton( Internal::TETButton& implementation )
-: Button( implementation )
+: PushButton( implementation )
{}
TETButton::TETButton( Dali::Internal::CustomActor* internal )
-: Button( internal )
+: PushButton( internal )
{
VerifyCustomActorPointer<Internal::TETButton>(internal);
}
{
TETButton::TETButton()
-: Button(),
+: PushButton(),
mPressedSignal()
{
}
return tetButton;
}
-Toolkit::TETButton::PressedSignalType& TETButton::PressedSignal()
+Toolkit::TETButton::ButtonSignalType& TETButton::PressedSignal()
{
return mPressedSignal;
}
{
}
- bool Callback( Button button )
+ bool Callback( PushButton button )
{
switch( mTest )
{
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
{
- button.SetButtonImage( Image::New( "IMAGE_PATH_1") );
+ button.SetButtonImage( ResourceImage::New( "IMAGE_PATH_1") );
DALI_TEST_EQUALS( "IMAGE_PATH_1", button.GetProperty( Button::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION );
Property::Map map;
// Button::PROPERTY_SELECTED_STATE_ACTOR
{
- button.SetSelectedImage( Image::New( "IMAGE_PATH_2") );
+ button.SetSelectedImage( ResourceImage::New( "IMAGE_PATH_2") );
DALI_TEST_EQUALS( "IMAGE_PATH_2", button.GetProperty( Button::PROPERTY_SELECTED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION );
Property::Map map;
// Button::PROPERTY_DISABLED_STATE_ACTOR
{
- button.SetDisabledImage( Image::New( "IMAGE_PATH_3") );
+ button.SetDisabledImage( ResourceImage::New( "IMAGE_PATH_3") );
DALI_TEST_EQUALS( "IMAGE_PATH_3", button.GetProperty( Button::PROPERTY_DISABLED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION );
Property::Map map;
{
static bool gCheckBoxButtonState = false;
-bool CheckBoxButtonClicked( Button button, bool state )
+bool CheckBoxButtonClicked( Button button )
{
- gCheckBoxButtonState = state;
+ gCheckBoxButtonState = button.IsSelected();
return true;
}
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 );
// 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;
}
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 );
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 );
DALI_TEST_CHECK( !control.GetBackgroundActor() );
DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
- Image image = Image::New("TestImage");
+ Image image = ResourceImage::New("TestImage");
control.SetBackground( image );
DALI_TEST_CHECK( control.GetBackgroundActor() );
DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::WHITE, TEST_LOCATION );
// Each gesture detector gets created when connecting to the gesture signals
DALI_TEST_CHECK( !control.GetTapGestureDetector() );
- control.ConnectSignal( &connectionTracker, Control::SIGNAL_TAPPED, &TestVoidCallback );
+ control.ConnectSignal( &connectionTracker, "tapped", &TestVoidCallback );
DALI_TEST_CHECK( control.GetTapGestureDetector() );
DALI_TEST_CHECK( !control.GetPanGestureDetector() );
- control.ConnectSignal( &connectionTracker, Control::SIGNAL_PANNED, &TestVoidCallback );
+ control.ConnectSignal( &connectionTracker, "panned", &TestVoidCallback );
DALI_TEST_CHECK( control.GetPanGestureDetector() );
DALI_TEST_CHECK( !control.GetPinchGestureDetector() );
- control.ConnectSignal( &connectionTracker, Control::SIGNAL_PINCHED, &TestVoidCallback );
+ control.ConnectSignal( &connectionTracker, "pinched", &TestVoidCallback );
DALI_TEST_CHECK( control.GetPinchGestureDetector() );
DALI_TEST_CHECK( !control.GetLongPressGestureDetector() );
- control.ConnectSignal( &connectionTracker, Control::SIGNAL_LONG_PRESSED, &TestVoidCallback );
+ control.ConnectSignal( &connectionTracker, "long-pressed", &TestVoidCallback );
DALI_TEST_CHECK( control.GetLongPressGestureDetector() );
END_TEST;
//check the size of the off screen rendered image
Wait( application, OFFSCREEN_RENDER_DURATION );
- ImageAttributes attributes( tile.GetImage().GetAttributes() );
- DALI_TEST_EQUALS( static_cast<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<float>(attributes.GetHeight()), VIEW_AREA_SIZE.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( tile.GetImage().GetWidth(), VIEW_AREA_SIZE.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( tile.GetImage().GetHeight(), VIEW_AREA_SIZE.y, TEST_LOCATION );
END_TEST;
}
//check the size of the off screen rendered image
Wait( application, OFFSCREEN_RENDER_DURATION );
- ImageAttributes attributes( tile.GetImage().GetAttributes() );
- DALI_TEST_EQUALS( static_cast<float>(attributes.GetWidth()), VIEW_AREA_SIZE.x, TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<float>(attributes.GetHeight()), VIEW_AREA_SIZE.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( tile.GetImage().GetWidth(), VIEW_AREA_SIZE.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( tile.GetImage().GetHeight(), VIEW_AREA_SIZE.y, TEST_LOCATION );
END_TEST;
}
tet_infoline(" UtcDaliCubeTransitionWaveEffectStartTransition ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
+ ImageActor imageActor = ImageActor::New(ResourceImage::New("Image.jpg"));
CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
waveEffect.SetTransitionDuration( TRANSITION_DURATION );
tet_infoline(" UtcDaliCubeTransitionCrossEffectStartTransition ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- ImageActor imageActor = CreateSolidColorImageActor(application, Color::BLUE,30,30);
+ ImageActor imageActor = ImageActor::New(ResourceImage::New("Image.jpg"));
CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS, VIEW_AREA_SIZE );
crossEffect.SetTransitionDuration( TRANSITION_DURATION );
Toolkit::DisplacementEffect effect = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::DISPLACED);
DALI_TEST_CHECK( effect );
- ImageActor actor = ImageActor::New( Image::New(TEST_IMAGE_FILE_NAME) );
+ ImageActor actor = ImageActor::New( ResourceImage::New(TEST_IMAGE_FILE_NAME) );
actor.SetSize( 100.0f, 100.0f );
actor.SetShaderEffect( effect );
Stage::GetCurrent().Add( actor );
Toolkit::DisplacementEffect effect2 = Toolkit::DisplacementEffect::New(Toolkit::DisplacementEffect::FIXED);
DALI_TEST_CHECK( effect );
- ImageActor actor2 = ImageActor::New( Image::New(TEST_IMAGE_FILE_NAME) );
+ ImageActor actor2 = ImageActor::New( ResourceImage::New(TEST_IMAGE_FILE_NAME) );
actor2.SetSize( 100.0f, 100.0f );
actor2.SetShaderEffect( effect2 );
Stage::GetCurrent().Add( actor2 );
view.Activate();
FrameBufferImage renderTarget = FrameBufferImage::New( 480.0f, 800.0f, Pixel::RGB888 );
- view.SetUserImageAndOutputRenderTarget(Image::New(TEST_IMAGE_FILE_NAME), renderTarget);
+ view.SetUserImageAndOutputRenderTarget(ResourceImage::New(TEST_IMAGE_FILE_NAME), renderTarget);
DALI_TEST_CHECK( view.GetBlurredRenderTarget() == renderTarget );
END_TEST;
}
virtual Actor NewItem(unsigned int itemId)
{
// Create an image actor for this item
- Image image = Image::New( TEST_IMAGE_FILE_NAME );
+ Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME );
Actor actor = ImageActor::New(image);
return actor;
DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left);
END_TEST;
}
-
-int UtcDaliItemLayoutGetScrollHints(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
-
- // Create a grid layout and add it to ItemView
- GridLayoutPtr gridLayout = GridLayout::New();
- view.AddLayout(*gridLayout);
-
- // Set the orientation of the layout to be horizontal from left to right
- ItemLayoutPtr layout = view.GetLayout(0);
-
- Vector2 axisScrollHint;
-
- layout->SetOrientation(ControlOrientation::Up);
- layout->GetXAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- layout->GetYAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
-
- layout->SetOrientation(ControlOrientation::Down);
- layout->GetXAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- layout->GetYAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
-
- layout->SetOrientation(ControlOrientation::Left);
- layout->GetXAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- layout->GetYAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
-
- layout->SetOrientation(ControlOrientation::Right);
- layout->GetXAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- layout->GetYAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- END_TEST;
-}
virtual Actor NewItem(unsigned int itemId)
{
// Create an image actor for this item
- Image image = Image::New( TEST_IMAGE_FILE_NAME );
+ Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME );
Actor actor = ImageActor::New(image);
return actor;
// [0]: testing PageTurnStartedSignal; [1]: testing PageTurnFinishedSignal
// [2]: testing PagePanStartedSignal; [3]: testing PagePanFinishedSignal
- bool signalVerified[4];
+ bool signalVerified[4] = {false, false, false, false};
PageTurnView currentView;
unsigned int pageIndex;
bool isTurningForwards;
namespace
{
-static bool gPushButtonToggleState = false;
-bool PushButtonToggled( Button button, bool toggled )
+static bool gPushButtonSelectedState = false;
+bool PushButtonSelected( Button button )
{
- gPushButtonToggleState = toggled && ( toggled == static_cast<PushButton&>( button ).IsToggled() );
+ gPushButtonSelectedState = button.IsSelected();
return true;
}
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;
}
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 );
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 );
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 );
event.AddPoint( pointUpInside );
application.ProcessEvent( event );
- DALI_TEST_CHECK( gPushButtonToggleState );
+ DALI_TEST_CHECK( gPushButtonSelectedState );
event = Dali::Integration::TouchEvent();
event.AddPoint( pointDownInside );
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 );
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 );
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 );
event.AddPoint( pointUpInside );
application.ProcessEvent( event );
- DALI_TEST_CHECK( !gPushButtonToggleState );
+ DALI_TEST_CHECK( !gPushButtonSelectedState );
END_TEST;
}
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
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();
radioButton.SetAnchorPoint(ParentOrigin::TOP_LEFT);
radioButton.SetPosition( 0.0f, 0.0f );
- // Default active
- DALI_TEST_CHECK( radioButton.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == false );
+ // Default selected
+ DALI_TEST_CHECK( radioButton.GetProperty<bool>( Button::PROPERTY_SELECTED ) == false );
- // Setting false active
- radioButton.SetProperty( Button::PROPERTY_TOGGLED, false );
- DALI_TEST_CHECK( radioButton.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == false );
+ // Setting false selected
+ radioButton.SetProperty( Button::PROPERTY_SELECTED, false );
+ DALI_TEST_CHECK( radioButton.GetProperty<bool>( Button::PROPERTY_SELECTED ) == false );
- // Setting true active
- radioButton.SetProperty( Button::PROPERTY_TOGGLED, true );
- DALI_TEST_CHECK( radioButton.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == true );
+ // Setting true selected
+ radioButton.SetProperty( Button::PROPERTY_SELECTED, true );
+ DALI_TEST_CHECK( radioButton.GetProperty<bool>( Button::PROPERTY_SELECTED ) == true );
// Setting false again
- radioButton.SetProperty( Button::PROPERTY_TOGGLED, false );
- DALI_TEST_CHECK( radioButton.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == false );
+ radioButton.SetProperty( Button::PROPERTY_SELECTED, false );
+ DALI_TEST_CHECK( radioButton.GetProperty<bool>( Button::PROPERTY_SELECTED ) == false );
// Test selecting radio buttons
RadioButton radioButton2 = RadioButton::New( "label" );
application.Render();
// Simulate touch events
- DALI_TEST_CHECK( radioButton2.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == false );
- DALI_TEST_CHECK( radioButton3.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == false );
+ DALI_TEST_CHECK( radioButton2.GetProperty<bool>( Button::PROPERTY_SELECTED ) == false );
+ DALI_TEST_CHECK( radioButton3.GetProperty<bool>( 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<bool>( Button::PROPERTY_TOGGLED ) == true );
- DALI_TEST_CHECK( radioButton3.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == false );
+ DALI_TEST_CHECK( radioButton2.GetProperty<bool>( Button::PROPERTY_SELECTED ) == true );
+ DALI_TEST_CHECK( radioButton3.GetProperty<bool>( 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<bool>( Button::PROPERTY_TOGGLED ) == true );
- DALI_TEST_CHECK( radioButton3.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == false );
+ DALI_TEST_CHECK( radioButton2.GetProperty<bool>( Button::PROPERTY_SELECTED ) == true );
+ DALI_TEST_CHECK( radioButton3.GetProperty<bool>( 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<bool>( Button::PROPERTY_TOGGLED ) == false );
- DALI_TEST_CHECK( radioButton3.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == true );
+ DALI_TEST_CHECK( radioButton2.GetProperty<bool>( Button::PROPERTY_SELECTED ) == false );
+ DALI_TEST_CHECK( radioButton3.GetProperty<bool>( 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<bool>( Button::PROPERTY_TOGGLED ) == false );
- DALI_TEST_CHECK( radioButton3.GetProperty<bool>( Button::PROPERTY_TOGGLED ) == true );
+ DALI_TEST_CHECK( radioButton2.GetProperty<bool>( Button::PROPERTY_SELECTED ) == false );
+ DALI_TEST_CHECK( radioButton3.GetProperty<bool>( Button::PROPERTY_SELECTED ) == true );
}
END_TEST;
END_TEST;
}
-int UtcDaliScrollViewTouchesRequired(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliScrollViewTouchesRequired");
-
- // Set up a scrollView...
- ScrollView scrollView = ScrollView::New();
- Stage::GetCurrent().Add( scrollView );
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- scrollView.SetSize(stageSize);
- scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
- scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-
- // Position rulers.
- RulerPtr rulerX = new DefaultRuler();
- RulerPtr rulerY = new DefaultRuler();
- rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
- rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
- scrollView.SetRulerX(rulerX);
- scrollView.SetRulerY(rulerY);
- scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
- scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
- scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
- scrollView.SnapStartedSignal().Connect( &OnSnapStart );
-
- scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
-
- // First try touches required being a minimum and maximum of 2.
- scrollView.SetTouchesRequiredForPanning(2, 2, true);
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
-
- DALI_TEST_CHECK( !gOnScrollStartCalled );
- DALI_TEST_CHECK( !gOnScrollUpdateCalled );
- DALI_TEST_CHECK( !gOnScrollCompleteCalled );
- DALI_TEST_CHECK( !gOnSnapStartCalled );
-
- scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
-
- // Second try touches required being a minimum and maximum of 1.
- scrollView.SetTouchesRequiredForPanning(1, 1, true);
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT * 0.1f, CLAMP_GESTURE_FRAMES * 0.1f, true);
-
- DALI_TEST_CHECK( gOnScrollStartCalled );
- DALI_TEST_CHECK( gOnScrollUpdateCalled );
- DALI_TEST_CHECK( gOnScrollCompleteCalled );
- DALI_TEST_CHECK( gOnSnapStartCalled );
- END_TEST;
-}
-
int UtcDaliScrollViewAxisAutoLock(void)
{
ToolkitTestApplication application;
#include <dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.h>
#include <dali-toolkit/public-api/shader-effects/page-turn-book-spine-effect.h>
#include <dali-toolkit/public-api/shader-effects/page-turn-effect.h>
+#include <dali-toolkit/public-api/shader-effects/quadratic-bezier.h>
#include <dali-toolkit/public-api/shader-effects/ripple-effect.h>
#include <dali-toolkit/public-api/shader-effects/ripple2d-effect.h>
#include <dali-toolkit/public-api/shader-effects/swirl-effect.h>
// EXTERNAL INCLUDES
#include <dali.h>
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/builder/tree-node.h>
#include <dali-toolkit/internal/builder/optional-value.h>
#include <boost/function.hpp>
#include <sstream>
-// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
+// INTERNAL INCLUDES
+
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/builder/json-parser.h>
// CLASS HEADER
#include <dali-toolkit/internal/builder/json-parser-impl.h>
-// EXTERNAL
+
+// EXTERNAL INCLUDES
#include <cstring>
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/builder/tree-node-manipulator.h>
#include <dali-toolkit/internal/builder/json-parser-state.h>
*
*/
+// EXTERNAL INCLUDES
#include <string>
#include <vector>
#include <list>
-//
#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/builder/json-parser.h>
#include <dali-toolkit/public-api/builder/tree-node.h>
// CLASS HEADER
#include <dali-toolkit/internal/builder/json-parser-state.h>
-// EXTERNAL
+// EXTERNAL INCLUDES
#include <algorithm>
namespace Dali
*
*/
+// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/builder/tree-node.h>
#include <dali-toolkit/internal/builder/tree-node-manipulator.h>
*
*/
-// INTERNAL INCLUDES
template <typename T>
struct OptionalTypes
{
*
*/
+// EXTERNAL INCLUDES
#include <dali/public-api/object/property-value.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/builder/builder.h>
#include <dali-toolkit/internal/builder/builder-get-is.inl.h>
*
*/
+// EXTERNAL INCLUDES
#include <utility> // pair
#include <iterator>
#include <vector>
#include <cstring>
-// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/builder/tree-node.h>
namespace Dali
*/
// CLASS HEADER
-
#include "alignment-impl.h"
// EXTERNAL INCLUDES
+#include <dali/public-api/object/property-input.h>
#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
// CLASS HEADER
#include "bloom-view-impl.h"
-#include "../gaussian-blur-view/gaussian-blur-view-impl.h"
// EXTERNAL INCLUDES
#include <sstream>
#include <iomanip>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/public-api/controls/bloom-view/bloom-view.h>
+#include "../gaussian-blur-view/gaussian-blur-view-impl.h"
namespace Dali
{
// Create render targets
// create off screen buffer of new size to render our child actors to
- mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::Unused );
- mBloomExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::Unused );
- mOutputRenderTarget = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::Unused );
+ mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
+ mBloomExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
+ mOutputRenderTarget = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED);
//////////////////////////////////////////////////////
#include <cmath>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/images/resource-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/shader-effects/bubble-effect/color-adjuster.h>
mBubbleRoot.SetSize(mMovementArea);
// Prepare the frame buffer to store the color adjusted background image
- mEffectImage = FrameBufferImage::New( mMovementArea.width/4.f, mMovementArea.height/4.f, Pixel::RGBA8888, Dali::Image::Unused );
+ mEffectImage = FrameBufferImage::New( mMovementArea.width/4.f, mMovementArea.height/4.f, Pixel::RGBA8888, Dali::Image::UNUSED );
// Generate the material object, which is used by all meshActors
GenMaterial();
mMeshActor[i] = MeshActor::New( mMesh[i] );
mMeshActor[i].SetAffectedByLighting( false );
mMeshActor[i].SetParentOrigin(ParentOrigin::TOP_LEFT);
- mEffect[i] = BubbleEffect::New( mNumBubblePerShader, mShapeImage.GetFilename() );
+ mEffect[i] = BubbleEffect::New( mNumBubblePerShader );
mEffect[i].SetEffectImage( mEffectImage );
mEffect[i].SetMovementArea( mMovementArea );
mMeshActor[i].SetShaderEffect( mEffect[i] );
mMeshActorForNoise = MeshActor::New( Mesh::New(meshDataForNoise) );
mMeshActorForNoise.SetAffectedByLighting( false );
mMeshActorForNoise.SetParentOrigin(ParentOrigin::TOP_LEFT);
- mEffectForNoise = BubbleEffect::New( mNumBubblePerShader, mShapeImage.GetFilename() );
+ mEffectForNoise = BubbleEffect::New( mNumBubblePerShader );
mEffectForNoise.SetMovementArea( mMovementArea );
mEffectForNoise.SetEffectImage( mEffectImage );
mMeshActorForNoise.SetShaderEffect( mEffectForNoise );
void BubbleEmitter::SetShapeImage( Image shapeImage )
{
mCustomMaterial.SetDiffuseTexture( shapeImage );
-
- //Get pixel width of the shape
- float width = Image::GetImageSize(shapeImage.GetFilename()).width;
-
- for(unsigned int i=0; i < mNumShader; i++ )
- {
- mEffect[i].SetShapeImageWidth(width);
- }
- mEffectForNoise.SetShapeImageWidth(width);
}
void BubbleEmitter::SetBubbleScale( float scale )
#include <dali-toolkit/public-api/controls/bubble-effect/bubble-emitter.h>
#include <dali-toolkit/public-api/shader-effects/bubble-effect/bubble-effect.h>
-#include <map>
-
namespace Dali
{
// EXTERNAL INCLUDES
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/actors/image-actor.h>
+#include <dali/public-api/scripting/scripting.h>
+
+// INTERNAL INCLUDES
namespace Dali
{
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;
namespace
{
+const unsigned int INITIAL_AUTOREPEATING_DELAY( 0.15f );
+const unsigned int NEXT_AUTOREPEATING_DELAY( 0.05f );
+
+// Signals
+
+const char* const SIGNAL_PRESSED = "pressed";
+const char* const SIGNAL_RELEASED = "released";
+const char* const SIGNAL_CLICKED = "clicked";
+const char* const SIGNAL_STATE_CHANGED = "state-changed";
+
+// Actions
+
+const char* const ACTION_BUTTON_CLICK = "button-click";
+
BaseHandle Create()
{
// empty handle as we cannot create button (but type registered for clicked signal)
return BaseHandle();
}
-TypeRegistration typeRegistration( typeid(Toolkit::Button), typeid(Toolkit::Control), 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, SIGNAL_PRESSED , &Button::DoConnectSignal );
+SignalConnectorType signalConnector2( typeRegistration, SIGNAL_RELEASED, &Button::DoConnectSignal );
+SignalConnectorType signalConnector3( typeRegistration, SIGNAL_CLICKED, &Button::DoConnectSignal );
+SignalConnectorType signalConnector4( typeRegistration, SIGNAL_STATE_CHANGED, &Button::DoConnectSignal );
+
+TypeAction action1( typeRegistration, 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 );
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 )
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 );
return OnAnimationTimeRequested();
}
+void Button::SetLabel( const std::string& label )
+{
+ 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( 0 == strcmp( actionName.c_str(), ACTION_BUTTON_CLICK ) )
+ {
+ 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()
+{
+ 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()
{
- return 0.f;
+ OnTouchPointLeave();
}
-Toolkit::Button::ClickedSignalType& Button::ClickedSignal()
+Toolkit::Button::ButtonSignalType& Button::PressedSignal()
+{
+ return mPressedSignal;
+}
+
+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;
}
Dali::BaseHandle handle( object );
bool connected( true );
- Toolkit::Button button = Toolkit::Button::DownCast(handle);
+ Toolkit::Button button = Toolkit::Button::DownCast( handle );
- if( Dali::Toolkit::Button::SIGNAL_CLICKED == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_PRESSED ) )
+ {
+ button.PressedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_RELEASED ) )
+ {
+ button.ReleasedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_CLICKED ) )
{
button.ClickedSignal().Connect( tracker, functor );
}
- else if( Dali::Toolkit::Button::SIGNAL_STATE_CHANGED == signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_STATE_CHANGED ) )
{
button.StateChangedSignal().Connect( tracker, functor );
}
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() );
// Do nothing.
}
+void Button::SetUpTimer( float delay )
+{
+ mAutoRepeatingTimer = Dali::Timer::New( static_cast<unsigned int>( 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<bool>() );
+ switch ( index )
+ {
+ case Toolkit::Button::PROPERTY_DISABLED:
+ {
+ GetImplementation( button ).SetDisabled( value.Get<bool>() );
+ 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
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/timer.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/button.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
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 );
*/
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.
* 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.
* 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.
virtual void OnInitialize();
/**
+ * @copydoc Toolkit::Control::OnActivated()
+ */
+ virtual void OnActivated();
+
+ /**
* @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize )
*/
virtual void OnControlSizeSet( const Vector3& targetSize );
*/
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
// 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
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/signals/connection-tracker.h>
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.
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.
*/
* @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
#include "check-box-button-default-painter-impl.h"
// EXTERNAL INCLUDES
+#include <dali/public-api/actors/image-actor.h>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
+#include <dali/public-api/object/ref-object.h>
// INTERNAL INCLUDES
-#include <dali/public-api/actors/image-actor.h>
-#include <dali/public-api/object/ref-object.h>
#include "check-box-button-impl.h"
namespace Dali
CheckBoxButtonDefaultPainter::CheckBoxButtonDefaultPainter()
: CheckBoxButtonPainter(),
mDisabled( false ),
- mPaintState( UncheckedState ),
+ mPaintState( UnselectedState ),
mButton(NULL),
mAnimationTime( ANIMATION_TIME )
{
}
}
-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<Toolkit::CheckBoxButton&>( button );
SetBackgroundImage( checkBox, backgroundImage );
}
- if( checkedImage )
+ if( selectedImage )
{
- SetCheckedImage( checkBox, checkedImage );
+ SetSelectedImage( checkBox, selectedImage );
}
if( disabledBackgroundImage )
SetDisabledBackgroundImage( checkBox, disabledBackgroundImage );
}
- if( disabledCheckedImage )
+ if( disabledSelectedImage )
{
- SetDisabledCheckedImage( checkBox, disabledCheckedImage );
+ SetDisabledSelectedImage( checkBox, disabledSelectedImage );
}
SetDisabled( button, mDisabled );
{
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 );
}
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<Toolkit::CheckBoxButton&>( button );
switch( mPaintState )
{
- case UncheckedState:
+ case UnselectedState:
{
if( disabled )
{
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 )
{
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 );
StartCheckOutAnimation( checkBox );
StartCheckInAnimation();
- mPaintState = UncheckedDisabledTransition;
+ mPaintState = UnselectedDisabledTransition;
}
break;
}
- case UncheckedDisabledTransition:
+ case UnselectedDisabledTransition:
{
if( !disabled )
{
StartCheckOutAnimation( checkBox );
StartCheckInAnimation();
- mPaintState = DisabledUncheckedTransition;
+ mPaintState = DisabledUnselectedTransition;
}
break;
}
- case DisabledUncheckedTransition:
+ case DisabledUnselectedTransition:
{
if( disabled )
{
StartCheckOutAnimation( checkBox );
StartCheckInAnimation();
- mPaintState = UncheckedDisabledTransition;
+ mPaintState = UnselectedDisabledTransition;
}
break;
}
- case CheckedDisabledTransition:
+ case SelectedDisabledTransition:
{
if( !disabled )
{
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 )
{
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;
}
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<Toolkit::CheckBoxButton&>( 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<Toolkit::CheckBoxButton&>( 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<Toolkit::CheckBoxButton&>( 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<Toolkit::CheckBoxButton&>( 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<Toolkit::CheckBoxButton&>( 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:
}
}
-void CheckBoxButtonDefaultPainter::ApplyCheckedConstraint( Actor& actor, float depth )
+void CheckBoxButtonDefaultPainter::ApplySelectedConstraint( Actor& actor, float depth )
{
if( actor )
{
}
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() )
fadeOutBackgroundImage.GetParent().Remove( fadeOutBackgroundImage );
}
- fadeOutCheckedImage.Reset();
+ fadeOutSelectedImage.Reset();
fadeOutBackgroundImage.Reset();
}
}
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;
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 )
{
{
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:
{
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:
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/images/image.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/animation/animation.h>
-#include <dali-toolkit/public-api/shader-effects/image-region-effect.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/shader-effects/image-region-effect.h>
#include "check-box-button-painter-impl.h"
namespace Dali
*/
~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
*
* @param[inout] checkBox The Dali::Toolkit::CheckBoxButton in which this object is registered.
*/
- void Checked( Toolkit::CheckBoxButton& checkBox );
+ void Selected( Toolkit::Button& checkBox );
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.
};
/**
* @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.
* 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.
* 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.
*/
* @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
#include "check-box-button-impl.h"
// EXTERNAL INCLUDES
-#include <algorithm>
-#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
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<CheckBoxButtonDefaultPainter*>( painter.Get() );
- }
-} // namespace
-
Dali::Toolkit::CheckBoxButton CheckBoxButton::New()
{
// Create the implementation, temporarily owned on stack
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
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
#include "button-impl.h"
*/
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:
/**
// 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
*/
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
/////////////////////////////////////////////////////////////////////////////
// EXTERNAL INCLUDES
#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/object/ref-object.h>
}
}
-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<Toolkit::PushButton&>( 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<Toolkit::PushButton&>( 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 )
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<Toolkit::PushButton&>( 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<Toolkit::PushButton&>( 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<Toolkit::PushButton&>( 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<Toolkit::PushButton&>( 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<Toolkit::PushButton&>( 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<Toolkit::PushButton&>( 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<Toolkit::PushButton&>( 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 )
{
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 )
}
}
-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<Toolkit::PushButton&>( 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 )
{
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 )
}
}
-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<Toolkit::PushButton&>( 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 )
}
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 )
{
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 )
{
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 )
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/images/image.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/animation/animation.h>
+// INTERNAL INCLUDES
#include "push-button-painter-impl.h"
namespace Dali
*/
~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:
#include <algorithm>
#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/scripting/scripting.h>
// INTERNAL INCLUDES
#include "push-button-default-painter-impl.h"
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<PushButtonDefaultPainter*>( painter.Get() );
-}
-
/**
* Find the first image actor in the actor hierarchy
*/
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 )
-{
- // TODO
-}
-
-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.
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<unsigned int>( 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()
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 );
}
}
- ImageActor backgroundImageActor = FindImageActor( mBackgroundImage );
+ ImageActor backgroundImageActor = FindImageActor( GetBackgroundImage() );
if( backgroundImageActor && backgroundImageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH )
{
Vector3 imageSize = RelayoutHelper::GetNaturalSize( backgroundImageActor );
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
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/common/dali-vector.h>
// INTERNAL INCLUDES
*/
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
/**
*/
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.
*/
// 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
*/
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
/////////////////////////////////////////////////////////////////////////////
// EXTERNAL INCLUDES
#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/scripting/scripting.h>
+#include <dali/public-api/images/resource-image.h>
using namespace Dali;
using namespace Dali::Toolkit::Internal;
}
RadioButton::RadioButton()
- : mSelected(false)
{
- mUnselectedImage = Dali::Image::New( UNSELECTED_BUTTON_IMAGE_DIR );
- mSelectedImage = Dali::Image::New( SELECTED_BUTTON_IMAGE_DIR );
+ mUnselectedImage = Dali::ResourceImage::New( UNSELECTED_BUTTON_IMAGE_DIR );
+ mSelectedImage = Dali::ResourceImage::New( SELECTED_BUTTON_IMAGE_DIR );
mRadioIcon = Dali::ImageActor::New( mUnselectedImage );
-}
-RadioButton::~RadioButton()
-{
+// SetTogglableButton(true);
+ mTogglableButton = true; // TODO: Use SetTogglableButton() after refactoring painter
}
-void RadioButton::SetLabel(const std::string& label)
+RadioButton::~RadioButton()
{
- // TODO
-
- RelayoutRequest();
}
-void RadioButton::SetLabel(Actor label)
+void RadioButton::SetLabel( Actor label )
{
if( mLabel != 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 )
{
// 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 );
}
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 )
- {
- radioButtonImpl.SetSelected( value.Get< bool >( ) );
- }
- else if ( propertyIndex == Toolkit::Button::PROPERTY_LABEL_ACTOR )
+ // Don't allow selection on an already selected radio button
+ if( !IsSelected() )
{
- 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;
-}
/**
* 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()
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
/**
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
namespace
{
+// Actions
+
+const char* const ACTION_EXPAND = "expand";
+const char* const ACTION_COLLAPSE = "collapse";
+const char* const ACTION_TRANSFORM = "transform";
+
BaseHandle Create()
{
- Toolkit::ClusterStyleStandard s = Toolkit::ClusterStyleStandard::New(Toolkit::ClusterStyleStandard::ClusterStyle1);
+ Toolkit::ClusterStyleStandard s = Toolkit::ClusterStyleStandard::New( Toolkit::ClusterStyleStandard::ClusterStyle1 );
return Toolkit::Cluster::New( s );
}
-TypeRegistration mType( typeid(Toolkit::Cluster), typeid(Toolkit::Control), Create );
+TypeRegistration mType( typeid( Toolkit::Cluster ), typeid( Toolkit::Control ), Create );
-TypeAction a1(mType, Toolkit::Cluster::ACTION_EXPAND , &Cluster::DoAction);
-TypeAction a2(mType, Toolkit::Cluster::ACTION_COLLAPSE , &Cluster::DoAction);
-TypeAction a3(mType, Toolkit::Cluster::ACTION_TRANSFORM, &Cluster::DoAction);
+TypeAction a1( mType, ACTION_EXPAND, &Cluster::DoAction );
+TypeAction a2( mType, ACTION_COLLAPSE, &Cluster::DoAction );
+TypeAction a3( mType, ACTION_TRANSFORM, &Cluster::DoAction );
}
{
bool ret = false;
- Dali::BaseHandle handle(object);
+ Dali::BaseHandle handle( object );
- Toolkit::Cluster cluster = Toolkit::Cluster::DownCast(handle);
+ Toolkit::Cluster cluster = Toolkit::Cluster::DownCast( handle );
- DALI_ASSERT_ALWAYS(cluster);
+ DALI_ASSERT_ALWAYS( cluster );
- if(Toolkit::Cluster::ACTION_EXPAND == actionName)
+ if( 0 == strcmp( actionName.c_str(), ACTION_EXPAND ) )
{
- GetImpl(cluster).DoExpandAction(attributes);
+ GetImpl( cluster ).DoExpandAction( attributes );
ret = true;
}
- else if(Toolkit::Cluster::ACTION_COLLAPSE == actionName)
+ else if( 0 == strcmp( actionName.c_str(), ACTION_COLLAPSE ) )
{
- GetImpl(cluster).DoCollapseAction(attributes);
+ GetImpl( cluster ).DoCollapseAction( attributes );
ret = true;
}
- else if(Toolkit::Cluster::ACTION_TRANSFORM == actionName)
+ else if( 0 == strcmp( actionName.c_str(), ACTION_TRANSFORM ) )
{
- GetImpl(cluster).DoTransformAction(attributes);
+ GetImpl( cluster ).DoTransformAction( attributes );
ret = true;
}
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/object/ref-object.h>
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/cluster/cluster.h>
#include <dali-toolkit/public-api/controls/cluster/cluster-style.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/cluster/cluster.h>
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/cluster/cluster-style.h>
namespace Dali
#include "effects-view-impl.h"
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
SetupCameras();
- mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::Unused );
+ mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
mActorForChildren.SetImage(mImageForChildren);
- mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::Unused );
+ mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
mActorPostFilter.SetImage(mImagePostFilter);
SetupFilters();
// EXTERNAL INCLUDES
#include <sstream>
#include <iomanip>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
mRenderFullSizeCamera.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale);
// create offscreen buffer of new size to render our child actors to
- mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::Unused );
+ mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
// Set ImageActor for performing a horizontal blur on the texture
mImageActorHorizBlur.SetImage( mRenderTargetForRenderingChildren );
// Create offscreen buffer for vert blur pass
- mRenderTarget1 = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::Unused );
+ mRenderTarget1 = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
// use the completed blur in the first buffer and composite with the original child actors render
mImageActorComposite.SetImage( mRenderTarget1 );
}
// Create offscreen buffer for horiz blur pass
- mRenderTarget2 = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::Unused );
+ mRenderTarget2 = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
// size needs to match render target
mImageActorHorizBlur.SetSize(mDownsampledWidth, mDownsampledHeight);
// EXTERNAL INCLUDES
#include <sstream>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali-toolkit/internal/controls/magnifier/magnifier-impl.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/images/resource-image.h>
using namespace Dali;
{
Actor self(Self());
- Image image = Image::New( DEFAULT_FRAME_IMAGE_PATH );
+ Image image = ResourceImage::New( DEFAULT_FRAME_IMAGE_PATH );
mFrame = ImageActor::New( image );
mFrame.SetDrawMode(DrawMode::OVERLAY);
mFrame.SetStyle( ImageActor::STYLE_NINE_PATCH );
#include <string>
// INTERNAL INCLUDES
+#include <dali/public-api/animation/alpha-functions.h>
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
-#include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
#include <dali-toolkit/public-api/controls/navigation-frame/page.h>
#include <dali-toolkit/public-api/controls/navigation-frame/navigation-bar-style.h>
-
+#include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
namespace Dali
{
namespace // to register type
{
+
+// Actions
+
+const char* const ACTION_PUSH = "push";
+const char* const ACTION_POP = "pop";
+
BaseHandle Create()
{
return Toolkit::NavigationControl::New();
}
-TypeRegistration mType( typeid(Toolkit::NavigationControl), typeid(Toolkit::Control), Create );
+TypeRegistration mType( typeid( Toolkit::NavigationControl ), typeid( Toolkit::Control ), Create );
+
+TypeAction a1( mType, ACTION_PUSH, &NavigationControl::DoAction );
+TypeAction a2( mType, ACTION_POP, &NavigationControl::DoAction );
-TypeAction a1(mType, Toolkit::NavigationControl::ACTION_PUSH, &NavigationControl::DoAction);
-TypeAction a2(mType, Toolkit::NavigationControl::ACTION_POP, &NavigationControl::DoAction);
}
NavigationControl::NavigationControl()
return mItemPoppedSignal;
}
-bool NavigationControl::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
+bool NavigationControl::DoAction( BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes )
{
bool ret = false;
- Dali::BaseHandle handle(object);
- Toolkit::NavigationControl control = Toolkit::NavigationControl::DownCast(handle);
- DALI_ASSERT_ALWAYS(control);
+ Dali::BaseHandle handle( object );
+ Toolkit::NavigationControl control = Toolkit::NavigationControl::DownCast( handle );
+ DALI_ASSERT_ALWAYS( control );
- if (Toolkit::NavigationControl::ACTION_PUSH == actionName)
+ if( 0 == strcmp( actionName.c_str(), ACTION_PUSH ) )
{
- for (PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter)
+ for( PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter )
{
const Property::Value& value = *iter;
- DALI_ASSERT_ALWAYS(value.GetType() == Property::STRING);
- std::string itemName = value.Get<std::string> ();
+ DALI_ASSERT_ALWAYS( value.GetType() == Property::STRING );
+ std::string itemName = value.Get<std::string>();
- for (std::list<Toolkit::Page>::iterator itemsIter = GetImpl(control).mUnpushedItems.begin(); itemsIter != GetImpl(control).mUnpushedItems.end(); ++itemsIter)
+ for( std::list<Toolkit::Page>::iterator itemsIter = GetImpl( control ).mUnpushedItems.begin(); itemsIter != GetImpl( control ).mUnpushedItems.end(); ++itemsIter )
{
Toolkit::Page page = *itemsIter;
- if (page.GetName() == itemName)
+ if( page.GetName() == itemName )
{
- GetImpl(control).PushItem(page);
+ GetImpl( control ).PushItem( page );
ret = true;
break;
}
}
}
}
- else if(Toolkit::NavigationControl::ACTION_POP == actionName)
+ else if( 0 == strcmp( actionName.c_str(), ACTION_POP ) )
{
- GetImpl(control).PopItem();
+ GetImpl( control ).PopItem();
ret = true;
}
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/navigation-frame/navigation-control.h>
#include <dali-toolkit/public-api/controls/navigation-frame/page.h>
-#include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
#include <dali-toolkit/public-api/controls/popup/popup.h>
+#include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
namespace Dali
{
*
*/
+// CLASS HEADER
#include "navigation-title-bar.h"
namespace Dali
*
*/
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/navigation-frame/page.h>
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
#include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
#include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
-#include <dali-toolkit/public-api/controls/navigation-frame/page.h>
namespace Dali
{
*
*/
+// CLASS HEADER
#include "navigation-tool-bar.h"
namespace Dali
*
*/
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
#include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
#include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
*/
// CLASS HEADER
-
#include "page-impl.h"
// EXTERNAL INCLUDES
// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/events/hit-test-algorithm.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
Self().Add( mPageSourceActor[i] );
mPageSourceActor[i].SetSensitive( false );
- mRenderedPage[i] = FrameBufferImage::New( mControlSize.width, mControlSize.height, Pixel::RGB8888, Image::Unused );
+ mRenderedPage[i] = FrameBufferImage::New( mControlSize.width, mControlSize.height, Pixel::RGB8888, Image::UNUSED );
mOffscreenTask[i] = taskList.CreateTask();
mOffscreenTask[i].SetRefreshRate( RenderTask::REFRESH_ONCE );
mOffscreenTask[i].SetCameraActor(mCameraActor);
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/images/resource-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/button.h>
const Vector3 DEFAULT_DIALOG_SIZE = Vector3(POPUP_TITLE_WIDTH/POPUP_WIDTH, 0.5f, 0.0f);
const Vector3 DEFAULT_BOTTOM_SIZE = Vector3(1.0f, 0.2f, 0.0f);
-const char* const PROPERTY_TITLE = "title";
-const char* const PROPERTY_STATE = "state";
+// Signals
+
+const char* const SIGNAL_TOUCHED_OUTSIDE = "touched-outside";
+const char* const SIGNAL_HIDDEN = "hidden";
+
+// Properties
+
+const char* const PROPERTY_TITLE = "title";
+const char* const PROPERTY_STATE = "state";
/**
* The background size should be at least as big as the Dialog.
return Toolkit::Popup::New();
}
-TypeRegistration typeRegistration( typeid(Toolkit::Popup), typeid(Toolkit::Control), Create );
+TypeRegistration typeRegistration( typeid( Toolkit::Popup ), typeid( Toolkit::Control ), Create );
-SignalConnectorType signalConnector1( typeRegistration, Toolkit::Popup::SIGNAL_TOUCHED_OUTSIDE, &Popup::DoConnectSignal );
-SignalConnectorType signalConnector2( typeRegistration, Toolkit::Popup::SIGNAL_HIDDEN, &Popup::DoConnectSignal );
+SignalConnectorType signalConnector1( typeRegistration, SIGNAL_TOUCHED_OUTSIDE, &Popup::DoConnectSignal );
+SignalConnectorType signalConnector2( typeRegistration, SIGNAL_HIDDEN, &Popup::DoConnectSignal );
}
if(image != "")
{
- Image tail = Image::New( image );
+ Image tail = ResourceImage::New( image );
mTailImage = ImageActor::New(tail);
const Vector3 anchorPoint = AnchorPoint::FRONT_BOTTOM_RIGHT - position;
void Popup::SetDefaultBackgroundImage()
{
- Image bg = Image::New( mPopupStyle->backgroundImage );
+ Image bg = ResourceImage::New( mPopupStyle->backgroundImage );
ImageActor bgImage = ImageActor::New( bg );
bgImage.SetStyle( ImageActor::STYLE_NINE_PATCH );
bgImage.SetNinePatchBorder( mPopupStyle->backgroundScale9Border );
- Image buttonBg = Image::New( mPopupStyle->buttonAreaImage );
+ Image buttonBg = ResourceImage::New( mPopupStyle->buttonAreaImage );
ImageActor buttonBgImage = ImageActor::New( buttonBg );
buttonBgImage.SetStyle( ImageActor::STYLE_NINE_PATCH );
buttonBgImage.SetNinePatchBorder( mPopupStyle->buttonArea9PatchBorder );
Dali::BaseHandle handle( object );
bool connected( true );
- Toolkit::Popup popup = Toolkit::Popup::DownCast(handle);
+ Toolkit::Popup popup = Toolkit::Popup::DownCast( handle );
- if( Dali::Toolkit::Popup::SIGNAL_TOUCHED_OUTSIDE == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED_OUTSIDE ) )
{
popup.OutsideTouchedSignal().Connect( tracker, functor );
}
- else if( Dali::Toolkit::Popup::SIGNAL_HIDDEN == signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_HIDDEN ) )
{
popup.HiddenSignal().Connect( tracker, functor );
}
*
*/
+// EXTERNAL INCLUDES
#include <dali-toolkit/internal/controls/popup/popup-style-impl.h>
using namespace Dali;
#include <dali/public-api/math/vector4.h>
#include <dali/public-api/object/ref-object.h>
+#include <string>
+
namespace Dali
{
*
*/
-// FILE HEADER
-
+// CLASS HEADER
#include "relayout-controller-impl.h"
// EXTERNAL INCLUDES
*
*/
-// FILE HEADER
-
+// CLASS HEADER
#include "relayout-controller.h"
-#include "relayout-controller-impl.h"
// EXTERNAL INCLUDES
#include <stack>
// INTERNAL INCLUDES
+#include "relayout-controller-impl.h"
#include "dali-toolkit/public-api/controls/control.h"
#include "dali-toolkit/public-api/controls/control-impl.h"
#include <dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/images/resource-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h>
return Toolkit::ScrollBar::New();
}
-TypeRegistration typeRegistration( typeid(Toolkit::ScrollBar), typeid(Toolkit::ScrollComponent), Create );
+TypeRegistration typeRegistration( typeid( Toolkit::ScrollBar ), typeid( Toolkit::ScrollComponent ), Create );
+
+const char* const SCROLL_POSITION_NOTIFIED_SIGNAL_NAME = "scroll-position-notified";
PropertyRegistration property1( typeRegistration, "indicator-height-policy", Toolkit::ScrollBar::PROPERTY_INDICATOR_HEIGHT_POLICY, Property::STRING, &ScrollBar::SetProperty, &ScrollBar::GetProperty );
PropertyRegistration property2( typeRegistration, "indicator-fixed-height", Toolkit::ScrollBar::PROPERTY_INDICATOR_FIXED_HEIGHT, Property::FLOAT, &ScrollBar::SetProperty, &ScrollBar::GetProperty );
{
Actor self = Self();
- Image indicatorImage = Image::New( DEFAULT_INDICATOR_IMAGE_PATH );
+ Image indicatorImage = ResourceImage::New( DEFAULT_INDICATOR_IMAGE_PATH );
mIndicator = ImageActor::New( indicatorImage );
mIndicator.SetNinePatchBorder( DEFAULT_INDICATOR_NINE_PATCH_BORDER );
mIndicator.SetStyle( ImageActor::STYLE_NINE_PATCH );
}
}
+bool ScrollBar::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ Dali::BaseHandle handle( object );
+
+ bool connected( true );
+ Toolkit::ScrollBar scrollBar = Toolkit::ScrollBar::DownCast( handle );
+
+ if( 0 == strcmp( signalName.c_str(), SCROLL_POSITION_NOTIFIED_SIGNAL_NAME ) )
+ {
+ scrollBar.ScrollPositionNotifiedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
void ScrollBar::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
{
Toolkit::ScrollBar scrollBar = Toolkit::ScrollBar::DownCast( Dali::BaseHandle( object ) );
// EXTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/actors/image-actor.h>
+#include <dali/public-api/animation/active-constraint.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/object/property-notification.h>
return mScrollPositionNotifiedSignal;
}
+ /**
+ * 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
/**
private:
- Constrainable mScrollPositionObject; ///< From mScrollConnector
+ Handle mScrollPositionObject; ///< From mScrollConnector
ImageActor mIndicator; ///< Image of scroll indicator.
Animation mAnimation; ///< Scroll indicator Show/Hide Animation.
#include <dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-input.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/images/resource-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/enums.h>
mAxisMask(vertical ? Vector3::YAXIS : Vector3::XAXIS),
mDragMode(false)
{
- Image sliderImage = Image::New( BAR_TAB_IMAGE_PATH );
+ Image sliderImage = ResourceImage::New( BAR_TAB_IMAGE_PATH );
mSlider = ImageActor::New( sliderImage );
mSlider.SetParentOrigin( ParentOrigin::TOP_LEFT );
*
*/
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scroll-component/scroll-bar-internal.h>
#include <dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.h>
// CLASS HEADER
#include <dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.h>
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
+#include <math.h>
#include <dali/public-api/actors/mesh-actor.h>
-#include <dali/public-api/geometry/animatable-mesh.h>
+#include <dali/public-api/animation/active-constraint.h>
#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/geometry/animatable-mesh.h>
#include <dali/public-api/shader-effects/shader-effect.h>
#include <dali/public-api/math/vector3.h>
-// EXTERNAL INCLUDES
-#include <math.h>
-
namespace Dali
{
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/object/property.h>
// EXTERNAL INCLUDES
#include <algorithm>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/set-wrapper.h>
#include <dali/public-api/common/stage.h>
Actor mOvershootOverlay; ///< The overlay actor for overshoot effect
Dali::Toolkit::ScrollConnector mScrollConnector; ///< Connects ItemView with scrollable components e.g. scroll bars
- Constrainable mScrollPositionObject; ///< From mScrollConnector
+ Handle mScrollPositionObject; ///< From mScrollConnector
bool mAddingItems;
// EXTERNAL INCLUDES
#include <dali/public-api/object/property-index.h>
+#include <dali/public-api/object/type-registry.h>
#include <dali/integration-api/debug.h>
namespace Dali
namespace Internal
{
+namespace
+{
+
+// Signals
+
+const char* const DOMAIN_CHANGED_SIGNAL_NAME = "domain-changed";
+const char* const SCROLL_POSITION_CHANGED_SIGNAL_NAME = "scroll-position-changed";
+
+TypeRegistration typeRegistration( typeid( Toolkit::ScrollConnector ), typeid( Dali::BaseHandle ), NULL );
+
+SignalConnectorType signalConnector1( typeRegistration, DOMAIN_CHANGED_SIGNAL_NAME , &ScrollConnector::DoConnectSignal );
+SignalConnectorType signalConnector2( typeRegistration, SCROLL_POSITION_CHANGED_SIGNAL_NAME , &ScrollConnector::DoConnectSignal );
+
+}
+
const Property::Index ScrollConnector::SCROLL_POSITION = Dali::PROPERTY_CUSTOM_START_INDEX;
const Property::Index ScrollConnector::OVERSHOOT = Dali::PROPERTY_CUSTOM_START_INDEX + 1;
mScrollPositionChangedSignal.Emit( position );
}
+bool ScrollConnector::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ Dali::BaseHandle handle( object );
+
+ bool connected( true );
+ Toolkit::ScrollConnector scrollConnector = Toolkit::ScrollConnector::DownCast( handle );
+
+ if( 0 == strcmp( signalName.c_str(), DOMAIN_CHANGED_SIGNAL_NAME ) )
+ {
+ scrollConnector.DomainChangedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SCROLL_POSITION_CHANGED_SIGNAL_NAME ) )
+ {
+ scrollConnector.ScrollPositionChangedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
ScrollConnector::ScrollConnector()
: mMinLimit( 0.0f ),
mMaxLimit( 0.0f ),
mContentLength( 0.0f )
{
- mScrollPositionObject = Constrainable::New();
+ mScrollPositionObject = Handle::New();
mScrollPositionObject.RegisterProperty( Toolkit::ScrollConnector::SCROLL_POSITION_PROPERTY_NAME, 0.0f );
mScrollPositionObject.RegisterProperty( Toolkit::ScrollConnector::OVERSHOOT_PROPERTY_NAME, 0.0f );
* Retrieve the object which provides the "scroll-position" property.
* @return The scroll-position object.
*/
- Constrainable GetScrollPositionObject() const
+ Handle GetScrollPositionObject() const
{
return mScrollPositionObject;
}
+ /**
+ * 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 );
+
private:
/**
private:
- Constrainable mScrollPositionObject;
+ Handle mScrollPositionObject;
DomainChangedSignalType mDomainChangedSignal;
ScrollPositionChangedSignalType mScrollPositionChangedSignal;
*
*/
+// CLASS HEADER
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h>
using namespace Dali;
mPropertyTime(Property::INVALID_INDEX),
mPropertyPrePosition(Property::INVALID_INDEX),
mPropertyPosition(Property::INVALID_INDEX),
- mPropertyScale(Property::INVALID_INDEX),
mPropertyOvershootX(Property::INVALID_INDEX),
mPropertyOvershootY(Property::INVALID_INDEX),
mPropertyWrap(Property::INVALID_INDEX),
mPropertyOvershootX = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME, 0.0f);
mPropertyOvershootY = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME, 0.0f);
mPropertyFinal = self.RegisterProperty(Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME, Vector3::ZERO);
- mPropertyScale = self.RegisterProperty(Toolkit::ScrollView::SCROLL_SCALE_PROPERTY_NAME, Vector3::ONE);
mPropertyWrap = self.RegisterProperty(Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME, false);
mPropertyPanning = self.RegisterProperty(Toolkit::ScrollView::SCROLL_PANNING_PROPERTY_NAME, false);
mPropertyScrolling = self.RegisterProperty(Toolkit::ScrollView::SCROLL_SCROLLING_PROPERTY_NAME, false);
// EXTERNAL INCLUDES
// TODO - Replace list with dali-vector.h
#include <list>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
// INTERNAL INCLUDES
Property::Index mPropertyTime; ///< Scroll Time (0 to animationDuration while animating, otherwise 0)
Property::Index mPropertyPrePosition; ///< Scroll Position ("scroll-position") [function of scroll-x, scroll-y]
Property::Index mPropertyPosition; ///< Scroll Position ("scroll-position") [function of scroll-pre-position]
- Property::Index mPropertyScale; ///< Scroll Scale ("scroll-scale")
Property::Index mPropertyOvershootX; ///< Scroll Overshoot ("scroll-overshoot-x") [function of scroll-pre-position, scroll-position]
Property::Index mPropertyOvershootY; ///< Scroll Overshoot ("scroll-overshoot-y") [function of scroll-pre-position, scroll-position]
Property::Index mPropertyWrap; ///< Scroll Wrap ("scroll-wrap")
// EXTERNAL INCLUDES
#include <boost/bind.hpp>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-input.h>
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.h>
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-carousel-effect.h>
// EXTERNAL INCLUDES
#include <boost/bind.hpp>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-input.h>
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.h>
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-cube-effect.h>
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-input.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.h>
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-depth-effect.h>
*
*/
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h>
namespace
{
-const int DEFAULT_REFRESH_INTERVAL_MILLISECONDS = 50; ///< Refresh rate TODO: Animation should have an update signal (and see item-view-impl)
+// Signals
+
+const char* const SIGNAL_SNAP_STARTED = "snap-started";
+
const Vector2 DEFAULT_MIN_FLICK_DISTANCE(30.0f, 30.0f); ///< minimum distance for pan before flick allowed
const float DEFAULT_MIN_FLICK_SPEED_THRESHOLD(500.0f); ///< Minimum pan speed required for flick in pixels/s
const float FREE_FLICK_SPEED_THRESHOLD = 200.0f; ///< Free-Flick threshold in pixels/ms
const float AUTOLOCK_AXIS_MINIMUM_DISTANCE2 = 100.0f; ///< Auto-lock axis after minimum distance squared.
const float FLICK_ORTHO_ANGLE_RANGE = 75.0f; ///< degrees. (if >45, then supports diagonal flicking)
-const unsigned int MAXIMUM_NUMBER_OF_VALUES = 5; ///< Number of values to use for weighted pan calculation.
const Vector2 DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION = Vector2(0.17f, 0.1f); ///< The step of horizontal scroll distance in the proportion of stage size for each mouse wheel event received.
const unsigned long MINIMUM_TIME_BETWEEN_DOWN_AND_UP_FOR_RESET( 150u );
const float TOUCH_DOWN_TIMER_INTERVAL = 100.0f;
const float DEFAULT_SCROLL_UPDATE_DISTANCE( 30.0f ); ///< Default distance to travel in pixels for scroll update signal
-// predefined effect values
-const Vector3 ANGLE_CAROUSEL_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f);
-const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.2f, Math::PI * 0.2f, 0.0f); ///< Cube page rotates as if it has ten sides with the camera positioned inside
-const Vector2 ANGLE_CUSTOM_CUBE_SWING(-Math::PI * 0.45f, -Math::PI * 0.45f); ///< outer cube pages swing 90 degrees as they pan offscreen
-const Vector2 ANGLE_SPIRAL_SWING_IN(Math::PI * 0.5f, Math::PI * 0.5f);
-const Vector2 ANGLE_SPIRAL_SWING_OUT(Math::PI * 0.35f, Math::PI * 0.35f);
-const Vector2 ANGLE_OUTER_CUBE_SWING(Math::PI * 0.5f, Math::PI * 0.5f); ///< outer cube pages swing 90 degrees as they pan offscreen
-
// Helpers ////////////////////////////////////////////////////////////////////////////////////////
/**
return Toolkit::ScrollView::New();
}
-TypeRegistration typeRegistration( typeid(Toolkit::ScrollView), typeid(Toolkit::Scrollable), Create );
+TypeRegistration typeRegistration( typeid( Toolkit::ScrollView ), typeid( Toolkit::Scrollable ), Create );
-SignalConnectorType signalConnector1( typeRegistration, Toolkit::ScrollView::SIGNAL_SNAP_STARTED, &ScrollView::DoConnectSignal );
+SignalConnectorType signalConnector1( typeRegistration, SIGNAL_SNAP_STARTED, &ScrollView::DoConnectSignal );
}
mTouchDownTime(0u),
mGestureStackDepth(0),
mScrollStateFlags(0),
- mMinTouchesForPanning(1),
- mMaxTouchesForPanning(1),
mLockAxis(LockPossible),
mScrollUpdateDistance(DEFAULT_SCROLL_UPDATE_DISTANCE),
- mOvershootDelay(1.0f),
mMaxOvershoot(Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT, Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT),
mUserMaxOvershoot(Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT, Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT),
mSnapOvershootDuration(Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION),
EnableGestureDetection( Gesture::Type( Gesture::Pan ) );
- // For pan, default to only 1 touch required, ignoring touches outside this range.
- SetTouchesRequiredForPanning(1, 1, false);
-
// By default we'll allow the user to freely drag the scroll view,
// while disabling the other rulers.
RulerPtr ruler = new DefaultRuler();
mSnapOvershootDuration = duration;
}
-void ScrollView::SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside)
-{
- PanGestureDetector panGesture( GetPanGestureDetector() );
-
- mMinTouchesForPanning = minTouches;
- mMaxTouchesForPanning = maxTouches;
-
- if(endOutside)
- {
- panGesture.SetMinimumTouchesRequired(minTouches);
- panGesture.SetMaximumTouchesRequired(maxTouches);
- }
- else
- {
- panGesture.SetMinimumTouchesRequired(1);
- panGesture.SetMaximumTouchesRequired(UINT_MAX);
- }
-}
-
void ScrollView::SetActorAutoSnap(bool enable)
{
mActorAutoSnapEnabled = enable;
void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunction alpha,
DirectionBias horizontalBias, DirectionBias verticalBias)
{
+ // If this is called while the timer is running, then cancel it
+ StopTouchDownTimer();
+
Actor self( Self() );
// Guard against destruction during signal emission
self.RemovePropertyNotification(mScrollXUpdateNotification);
mScrollXUpdateNotification.Reset();
}
- if( enabled )
+ if( enabled && !mScrollUpdatedSignal.Empty())
{
+ // Only set up the notification when the application has connected to the updated signal
mScrollXUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 0, StepCondition(mScrollUpdateDistance, 0.0f));
mScrollXUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification );
}
self.RemovePropertyNotification(mScrollYUpdateNotification);
mScrollYUpdateNotification.Reset();
}
- if( enabled )
+ if( enabled && !mScrollUpdatedSignal.Empty())
{
+ // Only set up the notification when the application has connected to the updated signal
mScrollYUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 1, StepCondition(mScrollUpdateDistance, 0.0f));
mScrollYUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification );
}
bool connected( true );
Toolkit::ScrollView view = Toolkit::ScrollView::DownCast( handle );
- if( Toolkit::ScrollView::SIGNAL_SNAP_STARTED == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_SNAP_STARTED ) )
{
view.SnapStartedSignal().Connect( tracker, functor );
}
void ScrollView::ClampPosition(Vector3& position) const
{
- ClampState3 clamped;
+ ClampState3D clamped;
ClampPosition(position, clamped);
}
-void ScrollView::ClampPosition(Vector3& position, ClampState3 &clamped) const
+void ScrollView::ClampPosition(Vector3& position, ClampState3D &clamped) const
{
Vector3 size = Self().GetCurrentSize();
void SetSnapOvershootDuration(float duration);
/**
- * @copydoc Toolkit::ScrollView::SetTouchesRequiredForPanning
- */
- void SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside);
-
- /**
* @copydoc Toolkit::ScrollView::SetActorAutoSnap
*/
void SetActorAutoSnap(bool enable);
* @param[in,out] position The position you wish to clamp
* @param[out] clamped The results of the clamping.
*/
- void ClampPosition(Vector3& position, ClampState3 &clamped) const;
+ void ClampPosition(Vector3& position, ClampState3D &clamped) const;
/**
* Wraps position within the domain set up by X/Y Rulers
Vector3 mMinScroll;
Vector3 mMaxScroll;
- unsigned int mMinTouchesForPanning; ///< Minimum number of touches for panning to be used.
- unsigned int mMaxTouchesForPanning; ///< Maximum number of touches for panning to be used.
-
Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
- float mOvershootDelay; ///< Time to wait for input before reducing overshoot back to 0
Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector3::ZERO
// EXTERNAL INCLUDES
#include <boost/bind.hpp>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-input.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-helper-functions.h>
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-carousel-effect.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
// EXTERNAL INCLUDES
#include <boost/bind.hpp>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-input.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-helper-functions.h>
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-cube-effect.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
*
*/
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h>
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/actors/custom-actor.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-wobble-effect.h>
const Vector4 DEFAULT_OVERSHOOT_COLOUR(0.0f, 0.64f, 0.85f, 0.25f);
const float DEFAULT_OVERSHOOT_ANIMATION_SPEED(120.0f); // 120 pixels per second
+// Signals
+
+const char* const SIGNAL_SCROLL_STARTED = "scroll-started";
+const char* const SIGNAL_SCROLL_COMPLETED = "scroll-completed";
+const char* const SIGNAL_SCROLL_UPDATED = "scroll-updated";
+
BaseHandle Create()
{
// empty handle as we cannot create Scrollable (but type registered for scroll signal)
return BaseHandle();
}
-TypeRegistration mType( typeid(Toolkit::Scrollable), typeid(Toolkit::Control), Create );
+TypeRegistration mType( typeid( Toolkit::Scrollable ), typeid( Toolkit::Control ), Create );
-SignalConnectorType s1(mType, Toolkit::Scrollable::SIGNAL_SCROLL_STARTED, &Scrollable::DoConnectSignal);
-SignalConnectorType s2(mType, Toolkit::Scrollable::SIGNAL_SCROLL_COMPLETED, &Scrollable::DoConnectSignal);
-SignalConnectorType s3(mType, Toolkit::Scrollable::SIGNAL_SCROLL_UPDATED, &Scrollable::DoConnectSignal);
-SignalConnectorType s4(mType, Toolkit::Scrollable::SIGNAL_SCROLL_CLAMPED, &Scrollable::DoConnectSignal);
+SignalConnectorType s1( mType, SIGNAL_SCROLL_STARTED, &Scrollable::DoConnectSignal );
+SignalConnectorType s2( mType, SIGNAL_SCROLL_COMPLETED, &Scrollable::DoConnectSignal );
+SignalConnectorType s3( mType, SIGNAL_SCROLL_UPDATED, &Scrollable::DoConnectSignal );
PropertyRegistration property1( mType,
"overshoot-effect-color",
return mScrollCompletedSignal;
}
-Toolkit::Scrollable::ScrollClampedSignalType& Scrollable::ScrollClampedSignal()
-{
- return mScrollClampedSignal;
-}
-
bool Scrollable::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
Dali::BaseHandle handle( object );
bool connected( true );
Toolkit::Scrollable scrollable = Toolkit::Scrollable::DownCast( handle );
- if( Toolkit::Scrollable::SIGNAL_SCROLL_STARTED == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_SCROLL_STARTED ) )
{
scrollable.ScrollStartedSignal().Connect( tracker, functor );
}
- else if( Toolkit::Scrollable::SIGNAL_SCROLL_UPDATED == signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCROLL_UPDATED ) )
{
scrollable.ScrollUpdatedSignal().Connect( tracker, functor );
}
- else if( Toolkit::Scrollable::SIGNAL_SCROLL_COMPLETED == signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCROLL_COMPLETED ) )
{
scrollable.ScrollCompletedSignal().Connect( tracker, functor );
}
- else if( Toolkit::Scrollable::SIGNAL_SCROLL_CLAMPED == signalName )
- {
- scrollable.ScrollClampedSignal().Connect( tracker, functor );
- }
else
{
// signalName does not match any signal
Toolkit::Scrollable::ScrollCompletedSignalType& ScrollCompletedSignal();
/**
- * @copydoc Dali::Toolkit::Scrollable::ScrollClampedSignal()
- */
- Toolkit::Scrollable::ScrollClampedSignalType& ScrollClampedSignal();
-
- /**
* 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.
Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal;
Toolkit::Scrollable::ScrollUpdatedSignalType mScrollUpdatedSignal;
Toolkit::Scrollable::ScrollCompletedSignalType mScrollCompletedSignal;
- Toolkit::Scrollable::ScrollClampedSignalType mScrollClampedSignal;
private:
// EXTERNAL INCLUDES
#include <sstream>
#include <iomanip>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
ConstrainCamera();
- mShadowPlane.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlaneBg, Actor::SIZE ), EqualToConstraint() ) );
+ mShadowPlane.SetSizeMode( SIZE_EQUAL_TO_PARENT );
- mBlurRootActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlane, Actor::SIZE ), EqualToConstraint() ) );
+ mBlurRootActor.SetSizeMode( SIZE_EQUAL_TO_PARENT );
}
void ShadowView::SetPointLight(Actor pointLight)
{
// root actor to parent all user added actors. Used as source actor for shadow render task.
mChildrenRoot.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
- mChildrenRoot.ApplyConstraint(Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ));
+ mChildrenRoot.SetSizeMode( SIZE_EQUAL_TO_PARENT );
Vector2 stageSize = Stage::GetCurrent().GetSize();
mCameraActor = CameraActor::New(stageSize);
#include <dali-toolkit/internal/controls/slider/slider-impl.h>
// EXTERNAL INCLUDES
+#include <sstream>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/images/resource-image.h>
-// EXTERNAL INCLUDES
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <sstream>
-
using namespace Dali;
namespace Dali
const bool DEFAULT_ENABLED = true;
const bool DEFAULT_SNAP_TO_MARKS = false;
+// Signals
+
+const char* const SIGNAL_VALUE_CHANGED = "value-changed";
+const char* const SIGNAL_MARK = "mark";
+
BaseHandle Create()
{
return Dali::Toolkit::Slider::New();
}
-TypeRegistration typeRegistration( typeid(Dali::Toolkit::Slider), typeid(Dali::Toolkit::Control), Create );
+TypeRegistration typeRegistration( typeid( Dali::Toolkit::Slider ), typeid( Dali::Toolkit::Control ), Create );
-SignalConnectorType signalConnector1( typeRegistration, Toolkit::Slider::SIGNAL_VALUE_CHANGED, &Toolkit::Internal::Slider::DoConnectSignal );
-SignalConnectorType signalConnector2( typeRegistration, Toolkit::Slider::SIGNAL_MARK, &Toolkit::Internal::Slider::DoConnectSignal );
+SignalConnectorType signalConnector1( typeRegistration, SIGNAL_VALUE_CHANGED, &Toolkit::Internal::Slider::DoConnectSignal );
+SignalConnectorType signalConnector2( typeRegistration, SIGNAL_MARK, &Toolkit::Internal::Slider::DoConnectSignal );
PropertyRegistration property1( typeRegistration, "lower-bound", Toolkit::Slider::LOWER_BOUND_PROPERTY, Property::FLOAT, &Slider::SetProperty, &Slider::GetProperty );
PropertyRegistration property2( typeRegistration, "upper-bound", Toolkit::Slider::UPPER_BOUND_PROPERTY, Property::FLOAT, &Slider::SetProperty, &Slider::GetProperty );
{
if( mBacking && imageName != String::EMPTY )
{
- Image image = Image::New( imageName );
+ Image image = ResourceImage::New( imageName );
mBacking.SetImage( image );
}
}
{
if( mBacking )
{
- return mBacking.GetImage().GetFilename();
+ return ResourceImage::DownCast( mBacking.GetImage() ).GetUrl();
}
return std::string( "" );
{
if( mProgress && imageName != String::EMPTY )
{
- Image image = Image::New( imageName );
+ Image image = ResourceImage::New( imageName );
mProgress.SetImage( image );
}
}
{
if( mProgress )
{
- return mProgress.GetImage().GetFilename();
+ return ResourceImage::DownCast( mProgress.GetImage()).GetUrl();
}
return std::string( "" );
{
if( mPopup && imageName != String::EMPTY )
{
- Image image = Image::New( imageName );
+ Image image = ResourceImage::New( imageName );
mPopup.SetImage( image );
}
}
{
if( mPopupArrow && imageName != String::EMPTY )
{
- Image image = Image::New( imageName );
+ Image image = ResourceImage::New( imageName );
mPopupArrow.SetImage( image );
}
}
{
if( mHandle && imageName != String::EMPTY )
{
- Image image = Image::New( imageName );
+ Image image = ResourceImage::New( imageName );
mHandle.SetImage( image );
}
}
{
if( mHandle )
{
- return mHandle.GetImage().GetFilename();
+ return ResourceImage::DownCast( mHandle.GetImage() ).GetUrl();
}
return std::string( "" );
return mMarkTolerance;
}
-// static class method to support script connecting signals
-
+// Static class method to support script connecting signals
bool Slider::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
Dali::BaseHandle handle( object );
bool connected = true;
Toolkit::Slider slider = Toolkit::Slider::DownCast( handle );
- if( signalName == Dali::Toolkit::Slider::SIGNAL_VALUE_CHANGED )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_VALUE_CHANGED ) )
{
slider.ValueChangedSignal().Connect( tracker, functor );
}
- else if( signalName == Dali::Toolkit::Slider::SIGNAL_MARK )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_MARK ) )
{
slider.MarkSignal().Connect( tracker, functor );
}
*
*/
+// CLASS HEADER
+#include "super-blur-view-impl.h"
+
// EXTERNAL INCLUDES
#include <cmath>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
-// CLASS HEADER
-#include "super-blur-view-impl.h"
-
namespace //unnamed namespace
{
{
float exponent = static_cast<float>(i+1);
mBlurredImage[i] = FrameBufferImage::New( mTargetSize.width/std::pow(2.f,exponent) , mTargetSize.height/std::pow(2.f,exponent),
- GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT, Dali::Image::Never );
+ GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT, Dali::Image::NEVER );
}
}
}
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
namespace Dali
{
if( item.HasKey( "policy" ) && item.HasKey( "value" ) )
{
- Toolkit::TableView::LayoutPolicy policy = Scripting::GetEnumeration< Toolkit::TableView::LayoutPolicy >( item.GetValue("policy").Get<std::string>(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT );
+ Toolkit::TableView::LayoutPolicy policy = Scripting::GetEnumeration< Toolkit::TableView::LayoutPolicy >( item.GetValue("policy").Get<std::string>().c_str(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT );
if( policy == Toolkit::TableView::Fixed )
{
(tableViewImpl.*funcFixed)( rowIndex, item.GetValue("value").Get<float>() );
#include <dali-toolkit/internal/controls/text-controls/text-field-impl.h>
// EXTERNAL INCLUDES
-#include <dali/public-api/images/image.h>
+#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/integration-api/debug.h>
}
case Toolkit::TextField::PROPERTY_CURSOR_IMAGE:
{
- Image image = Image::New( value.Get< std::string >() );
- //ResourceImage image = ResourceImage::New( value.Get< std::string >() );
+ ResourceImage image = ResourceImage::New( value.Get< std::string >() );
if( impl.mDecorator )
{
{
if( impl.mDecorator )
{
- Image image = impl.mDecorator->GetCursorImage();
- //ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetCursorImage() );
+ ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetCursorImage() );
if( image )
{
- value = image.GetFilename();
- //value = image.GetUrl();
+ value = image.GetUrl();
}
}
break;
namespace // to register type
{
+// Signals
+
+const char* const SIGNAL_ORIENTATION_ANIMATION_START = "orientation-animation-start";
+
BaseHandle Create()
{
return Toolkit::View::New();
}
-TypeRegistration typeRegistration( typeid(Toolkit::View), typeid(Toolkit::Control), Create );
+TypeRegistration typeRegistration( typeid( Toolkit::View ), typeid( Toolkit::Control ), Create );
-SignalConnectorType signalConnector1( typeRegistration, Toolkit::View::SIGNAL_ORIENTATION_ANIMATION_START , &View::DoConnectSignal );
+SignalConnectorType signalConnector1( typeRegistration, SIGNAL_ORIENTATION_ANIMATION_START , &View::DoConnectSignal );
}
bool connected( true );
Toolkit::View view = Toolkit::View::DownCast(handle);
- if( Toolkit::View::SIGNAL_ORIENTATION_ANIMATION_START == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_ORIENTATION_ANIMATION_START ) )
{
view.OrientationAnimationStartedSignal().Connect( tracker, functor );
}
mActorForInput.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) );
// create internal offscreen for result of horizontal pass
- mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::Unused );
+ mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED );
// create an actor to render mImageForHorz for vertical blur pass
mActorForHorz = ImageActor::New( mImageForHorz );
mActorForHorz.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) );
// create internal offscreen for result of the two pass blurred image
- mBlurredImage = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::Unused );
+ mBlurredImage = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED);
// create an actor to blend the blurred image and the input image with the given blur strength
mActorForBlending = ImageActor::New( mBlurredImage );
}
}
-Constrainable BlurTwoPassFilter::GetHandleForAnimateBlurStrength()
+Handle BlurTwoPassFilter::GetHandleForAnimateBlurStrength()
{
return mShaderForBlending;
}
Property::Index GetBlurStrengthPropertyIndex() const {return mBlurStrengthPropertyIndex;}
/**
- * Retrieve the constrainable object to animate or constrain the blur strength property
- * @return the constrainable object which blend the output image according to the blur strength
+ * Retrieve the handle to the object in order to animate or constrain the blur strength property
+ * @return The hadnle to the object which blends the output image according to the blur strength
*/
- Constrainable GetHandleForAnimateBlurStrength();
+ Handle GetHandleForAnimateBlurStrength();
private:
/**
mCameraActor = CameraActor::New();
mCameraActor.SetParentOrigin(ParentOrigin::CENTER);
- mImageForEmboss1 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::Unused );
- mImageForEmboss2 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::Unused );
+ mImageForEmboss1 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED );
+ mImageForEmboss2 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED );
// create actor to render input with applied emboss effect
mActorForInput1 = ImageActor::New( mInputImage );
mActorForInput.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) );
// create internal offscreen for result of horizontal pass
- mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::Unused );
+ mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED );
// create an actor to render mImageForHorz for vertical blur pass
mActorForHorz = ImageActor::New( mImageForHorz );
#include <dali/public-api/adaptor-framework/tts-player.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/events/hit-test-algorithm.h>
+#include <dali/public-api/images/resource-image.h>
+#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali/integration-api/debug.h>
namespace Dali
{
namespace // unnamed namespace
{
+// Signals
+
+const char* const SIGNAL_FOCUS_CHANGED = "focus-changed";
+const char* const SIGNAL_FOCUS_OVERSHOT = "focus-overshot";
+const char* const SIGNAL_FOCUSED_ACTOR_ACTIVATED = "focused-actor-activated";
+
#if defined(DEBUG_ENABLED)
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_FOCUS_MANAGER");
#endif
-const char * const ACTOR_FOCUSABLE("focusable");
-const char * const IS_FOCUS_GROUP("is-focus-group");
+const char* const ACTOR_FOCUSABLE("focusable");
+const char* const IS_FOCUS_GROUP("is-focus-group");
const char* FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "B16-8_TTS_focus.png";
const Vector4 FOCUS_BORDER_IMAGE_BORDER = Vector4(7.0f, 7.0f, 7.0f, 7.0f);
void FocusManager::CreateDefaultFocusIndicatorActor()
{
// Create a focus indicator actor shared by all the focusable actors
- Image borderImage = Image::New(FOCUS_BORDER_IMAGE_PATH);
+ Image borderImage = ResourceImage::New(FOCUS_BORDER_IMAGE_PATH);
ImageActor focusIndicator = ImageActor::New(borderImage);
focusIndicator.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
// Apply size constraint to the focus indicator
- Constraint constraint = Constraint::New<Vector3>(Actor::SIZE,
- ParentSource(Actor::SIZE),
- EqualToConstraint());
- focusIndicator.ApplyConstraint(constraint);
+ focusIndicator.SetSizeMode( SIZE_EQUAL_TO_PARENT );
SetFocusIndicatorActor(focusIndicator);
}
Dali::BaseHandle handle( object );
bool connected( true );
- FocusManager* manager = dynamic_cast<FocusManager*>(object);
+ FocusManager* manager = dynamic_cast<FocusManager*>( object );
- if( Dali::Toolkit::FocusManager::SIGNAL_FOCUS_CHANGED == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_CHANGED ) )
{
manager->FocusChangedSignal().Connect( tracker, functor );
}
- else if( Dali::Toolkit::FocusManager::SIGNAL_FOCUS_OVERSHOT == signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_OVERSHOT ) )
{
manager->FocusOvershotSignal().Connect( tracker, functor );
}
- else if( Dali::Toolkit::FocusManager::SIGNAL_FOCUSED_ACTOR_ACTIVATED== signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ACTIVATED ) )
{
manager->FocusedActorActivatedSignal().Connect( tracker, functor );
}
#include <dali/public-api/common/stage.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/images/resource-image.h>
+#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/focus-manager/focus-manager.h>
#include <dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h>
-#include <dali/integration-api/debug.h>
namespace Dali
{
namespace // unnamed namespace
{
+// Signals
+
+const char* const SIGNAL_PRE_FOCUS_CHANGE = "keyboard-pre-focus-change";
+const char* const SIGNAL_FOCUS_CHANGED = "keyboard-focus-changed";
+const char* const SIGNAL_FOCUS_GROUP_CHANGED = "keyboard-focus-group-changed";
+const char* const SIGNAL_FOCUSED_ACTOR_ACTIVATED = "keyboard-focused-actor-activated";
+
#if defined(DEBUG_ENABLED)
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_KEYBOARD_FOCUS_MANAGER");
#endif
return handle;
}
+
TypeRegistration KEYBOARD_FOCUS_MANAGER_TYPE( typeid(Dali::Toolkit::KeyboardFocusManager), typeid(Dali::BaseHandle), Create, true /* Create instance at startup */ );
+SignalConnectorType signalConnector1( KEYBOARD_FOCUS_MANAGER_TYPE, SIGNAL_PRE_FOCUS_CHANGE , &KeyboardFocusManager::DoConnectSignal );
+SignalConnectorType signalConnector2( KEYBOARD_FOCUS_MANAGER_TYPE, SIGNAL_FOCUS_CHANGED , &KeyboardFocusManager::DoConnectSignal );
+SignalConnectorType signalConnector3( KEYBOARD_FOCUS_MANAGER_TYPE, SIGNAL_FOCUS_GROUP_CHANGED , &KeyboardFocusManager::DoConnectSignal );
+SignalConnectorType signalConnector4( KEYBOARD_FOCUS_MANAGER_TYPE, SIGNAL_FOCUSED_ACTOR_ACTIVATED , &KeyboardFocusManager::DoConnectSignal );
+
} // unnamed namespace
Toolkit::KeyboardFocusManager KeyboardFocusManager::Get()
void KeyboardFocusManager::CreateDefaultFocusIndicatorActor()
{
// Create a focus indicator actor shared by all the keyboard focusable actors
- Image borderImage = Image::New(FOCUS_BORDER_IMAGE_PATH);
+ Image borderImage = ResourceImage::New(FOCUS_BORDER_IMAGE_PATH);
ImageActor focusIndicator = ImageActor::New(borderImage);
focusIndicator.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
// Apply size constraint to the focus indicator
- Constraint constraint = Constraint::New<Vector3>(Actor::SIZE,
- ParentSource(Actor::SIZE),
- EqualToConstraint());
- focusIndicator.ApplyConstraint(constraint);
+ focusIndicator.SetSizeMode( SIZE_EQUAL_TO_PARENT );
SetFocusIndicatorActor(focusIndicator);
}
Dali::BaseHandle handle( object );
bool connected( true );
- KeyboardFocusManager* manager = dynamic_cast<KeyboardFocusManager*>(object);
+ KeyboardFocusManager* manager = dynamic_cast<KeyboardFocusManager*>( object );
- if( Dali::Toolkit::KeyboardFocusManager::SIGNAL_PRE_FOCUS_CHANGE == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_PRE_FOCUS_CHANGE ) )
{
manager->PreFocusChangeSignal().Connect( tracker, functor );
}
- if( Dali::Toolkit::KeyboardFocusManager::SIGNAL_FOCUS_CHANGED == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_CHANGED ) )
{
manager->FocusChangedSignal().Connect( tracker, functor );
}
- if( Dali::Toolkit::KeyboardFocusManager::SIGNAL_FOCUS_GROUP_CHANGED == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_GROUP_CHANGED ) )
{
manager->FocusGroupChangedSignal().Connect( tracker, functor );
}
- else if( Dali::Toolkit::KeyboardFocusManager::SIGNAL_FOCUSED_ACTOR_ACTIVATED== signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ACTIVATED ) )
{
manager->FocusedActorActivatedSignal().Connect( tracker, functor );
}
namespace Internal
{
+namespace
+{
+
+// Signals
+
+const char* const SIGNAL_KEY_INPUT_FOCUS_CHANGED = "key-input-focus-changed";
+const char* const SIGNAL_UNHANDLED_KEY_EVENT = "unhandled-key-event";
+
+}
+
KeyInputFocusManager::KeyInputFocusManager()
: mSlotDelegate( this )
{
Dali::BaseHandle handle( object );
bool connected( true );
- KeyInputFocusManager* manager = dynamic_cast<KeyInputFocusManager*>(object);
+ KeyInputFocusManager* manager = dynamic_cast<KeyInputFocusManager*>( object );
- if( Dali::Toolkit::KeyInputFocusManager::SIGNAL_KEY_INPUT_FOCUS_CHANGED == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_CHANGED ) )
{
manager->KeyInputFocusChangedSignal().Connect( tracker, functor );
}
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_UNHANDLED_KEY_EVENT ) )
+ {
+ manager->UnhandledKeyEventSignal().Connect( tracker, functor );
+ }
else
{
// signalName does not match any signal
// EXTERNAL HEADERS
#include <sstream>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/common/stage.h>
namespace Dali
* limitations under the License.
*
*/
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/constraint.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/shader-effects/page-turn-effect.h>
// EXTERNAL INCLUDES
#include <dali/public-api/common/stage.h>
#include <dali/public-api/images/image-attributes.h>
+#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
namespace Dali
namespace Internal
{
+namespace
+{
+
+// Signals
+
+const char* const SIGNAL_TRANSITION_COMPLETED = "transition-completed";
+
+TypeRegistration typeRegistration( typeid( Toolkit::CubeTransitionEffect ), typeid( Dali::BaseHandle ), NULL );
+
+SignalConnectorType signalConnector1( typeRegistration, SIGNAL_TRANSITION_COMPLETED , &CubeTransitionEffect::DoConnectSignal );
+
+}
+
const Vector4 CubeTransitionEffect::FULL_BRIGHTNESS( 1.0f, 1.0f, 1.0f, 1.0f );
const Vector4 CubeTransitionEffect::HALF_BRIGHTNESS( 0.5f, 0.5f, 0.5f, 1.0f );
void CubeTransitionEffect::SetImage( ImageActor imageActor )
{
mCurrentImage = imageActor;
- mIsImageLoading = true;
Image image = imageActor.GetImage();
+ ResourceImage resourceImage = ResourceImage::DownCast( image );
mBufferIndex = mBufferIndex^1;
//must make sure the image is already loaded before using its attributes
- if( image.GetLoadingState() == ResourceLoadingSucceeded )
+ if( resourceImage && resourceImage.GetLoadingState() != ResourceLoadingSucceeded )
{
- OnImageLoaded( image );
+ mIsImageLoading = true;
+ resourceImage.LoadingFinishedSignal().Connect( this, &CubeTransitionEffect::OnImageLoaded );
}
else
{
- image.LoadingFinishedSignal().Connect( this, &CubeTransitionEffect::OnImageLoaded );
+ mIsImageLoading = false;
+ PrepareTiles( image );
}
}
}
}
-void CubeTransitionEffect::OnImageLoaded(Image image)
+void CubeTransitionEffect::OnImageLoaded(ResourceImage image)
+{
+ mIsImageLoading = false;
+ PrepareTiles( image );
+}
+
+/**
+ * Set sub-image to each tile.
+ * @param[in] image The image content of the imageActor for transition
+ */
+void CubeTransitionEffect::PrepareTiles( Image image )
{
// Fit the image to view area, while keeping the aspect; FitKeepAspectRatio(imageSize, viewAreaSize)
- ImageAttributes attributes( image.GetAttributes() );
- float scale = std::min( mViewAreaSize.width / attributes.GetWidth(), mViewAreaSize.height / attributes.GetHeight() );
- Vector2 imageSize(attributes.GetWidth()*scale, attributes.GetHeight()*scale);
+ float scale = std::min( mViewAreaSize.width / image.GetWidth(), mViewAreaSize.height / image.GetHeight() );
+ Vector2 imageSize(image.GetWidth()*scale, image.GetHeight()*scale);
mFullImageCreator.SetEffectImage(image);
mFullImageCreator.SetRegionSize(mViewAreaSize, imageSize);
mTiles[mContainerIndex][idx].SetPixelArea( pixelArea );
}
}
- mIsImageLoading = false;
}
+
void CubeTransitionEffect::OnTransitionFinished(Animation& source)
{
mRoot.SetVisible(false);
return mTransitionCompletedSignal;
}
+bool CubeTransitionEffect::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ Dali::BaseHandle handle( object );
+
+ bool connected( true );
+ Toolkit::CubeTransitionEffect cubeTransitionEffect = Toolkit::CubeTransitionEffect::DownCast( handle );
+
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_TRANSITION_COMPLETED ) )
+ {
+ cubeTransitionEffect.TransitionCompletedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
} // namespace Internal
} // namespace Toolkit
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/images/resource-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/transition-effects/cube-transition-effect.h>
*/
Toolkit::CubeTransitionEffect::TransitionCompletedSignalType& TransitionCompletedSignal();
+ /**
+ * 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 );
+
protected:
/**
* Set image and pixelArea to tiles
* @param[in] image The image content of the imageActor for transition
*/
- void OnImageLoaded(Image image);
+ void OnImageLoaded(ResourceImage image);
+
+ /**
+ * Set sub-image to each tile.
+ * @param[in] image The image content of the imageActor for transition
+ */
+ void PrepareTiles( Image image );
/**
* Callback function of transition animation finished
// CLASS HEADER
#include <dali-toolkit/public-api/builder/json-parser.h>
+// EXTERNAL INCLUDES
#include <memory.h>
#include <functional>
#include <iostream>
*
*/
+// EXTERNAL INCLUDES
#include <string>
#include <vector>
#include <list>
*
*/
+// EXTERNAL INCLUDES
#include <utility> // pair
#include <iterator>
#include <vector>
*/
// CLASS HEADER
-
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-
-#include <dali/integration-api/debug.h>
#include <dali-toolkit/internal/controls/alignment/alignment-impl.h>
namespace Dali
*
*/
+// CLASS HEADER
#include <dali-toolkit/public-api/controls/bubble-effect/bubble-emitter.h>
-//INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.h>
namespace Toolkit
{
-const char* const Button::SIGNAL_CLICKED = "clicked";
-const char* const Button::SIGNAL_STATE_CHANGED = "state-changed";
-
Button::Button()
{}
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 );
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();
}
* point doesn't leave the boundary of the button.
*
* When the \e disabled property is set to \e true, no signal is emitted.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------|-----------------------------|
+ * | pressed | @ref PressedSignal() |
+ * | released | @ref ReleasedSignal() |
+ * | clicked | @ref ClickedSignal() |
+ * | state-changed | @ref StateChangedSignal() |
+ *
+ * Actions
+ * | %Action Name | %Button method called |
+ * |-------------------|-----------------------------|
+ * | button-click | %DoClickAction() |
*/
class DALI_IMPORT_API Button : public Control
{
public:
- // Signal Names
- static const char* const SIGNAL_CLICKED; ///< name "clicked"
- static const char* const SIGNAL_STATE_CHANGED; ///< name "state-changed"
-
// 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
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.
*/
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
namespace Toolkit
{
-const char* const CheckBoxButton::ACTION_CHECK_BOX_BUTTON_CLICK = "check-box-button-click";
-
CheckBoxButton::CheckBoxButton()
: Button()
{
return Control::DownCast<CheckBoxButton, Internal::CheckBoxButton>(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 );
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 )
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 )
/**
* 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.
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()
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.
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.
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
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()
{
return Control::DownCast<PushButton, Internal::PushButton>(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 );
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
/**
* @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:
* <ul>
* <li>\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.
*
- * <li>\e toggle
+ * <li>\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.
* </ul>
*
* The button's appearance could be modified by setting images or actors with PushButton::SetButtonImage, PushButton::SetBackgroundImage,
{
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().
*
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.
*/
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
/**
{
}
-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 )
{
return *this;
}
-RadioButton::RadioButton(Dali::Internal::CustomActor* internal)
- : Button(internal)
+RadioButton::RadioButton( Dali::Internal::CustomActor* internal )
+ : Button( internal )
{
VerifyCustomActorPointer<Internal::RadioButton>( internal );
}
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<RadioButton, Internal::RadioButton>( 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
*
* 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.
* 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
{
/**
* @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
*
* @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.
*
* @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.
* @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
*
* @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
*
*/
+// CLASS HEADER
#include <dali-toolkit/public-api/controls/cluster/cluster-style.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/cluster/cluster-style-impl.h>
using namespace Dali;
const std::string Cluster::CLUSTER_ACTOR_DEPTH( "cluster-actor-depth" );
-const char* const Cluster::ACTION_EXPAND = "expand";
-const char* const Cluster::ACTION_COLLAPSE = "collapse";
-const char* const Cluster::ACTION_TRANSFORM = "transform";
-
Cluster::Cluster()
{
}
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/time-period.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
class ClusterStyle;
/**
- * Cluster is a container of grouped actors positioned in different cluster styles.
+ * @brief Cluster is a container of grouped actors positioned in different cluster styles.
+ *
+ * Actions
+ * | %Action Name | Method |
+ * |---------------------------|---------------------------|
+ * | expand | DoExpandAction() |
+ * | collapse | DoCollapseAction() |
+ * | transform | DoTransformAction() |
*/
class DALI_IMPORT_API Cluster : public Control
{
static const std::string CLUSTER_ACTOR_DEPTH; ///< Property, name "cluster-actor-depth", type FLOAT
- //Action Names
- static const char* const ACTION_EXPAND;
- static const char* const ACTION_COLLAPSE;
- static const char* const ACTION_TRANSFORM;
-
public:
/**
#include <stack>
#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/actors/mesh-actor.h>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/geometry/mesh.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/relayout-controller.h>
#include <dali-toolkit/internal/controls/relayout-helper.h>
#include <dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h>
namespace
{
+// Signals
+
+const char* const SIGNAL_KEY_EVENT = "key-event";
+const char* const SIGNAL_TAPPED = "tapped";
+const char* const SIGNAL_PANNED = "panned";
+const char* const SIGNAL_PINCHED = "pinched";
+const char* const SIGNAL_LONG_PRESSED = "long-pressed";
+
+// Actions
+
+const char* const ACTION_CONTROL_ACTIVATED = "control-activated";
+
const Scripting::StringEnum< Control::SizePolicy > SIZE_POLICY_STRING_TABLE[] =
{
{ "FIXED", Control::Fixed },
// Property Registration after Internal::Control::Impl definition below
-TypeAction ACTION_TYPE_1( CONTROL_TYPE, Toolkit::Control::ACTION_CONTROL_ACTIVATED, &Internal::Control::DoAction );
+TypeAction ACTION_TYPE_1( CONTROL_TYPE, ACTION_CONTROL_ACTIVATED, &Internal::Control::DoAction );
-SignalConnectorType SIGNAL_CONNECTOR_1( CONTROL_TYPE, Toolkit::Control::SIGNAL_KEY_EVENT, &Internal::Control::DoConnectSignal );
-SignalConnectorType SIGNAL_CONNECTOR_2( CONTROL_TYPE, Toolkit::Control::SIGNAL_TAPPED, &Internal::Control::DoConnectSignal );
-SignalConnectorType SIGNAL_CONNECTOR_3( CONTROL_TYPE, Toolkit::Control::SIGNAL_PANNED, &Internal::Control::DoConnectSignal );
-SignalConnectorType SIGNAL_CONNECTOR_4( CONTROL_TYPE, Toolkit::Control::SIGNAL_PINCHED, &Internal::Control::DoConnectSignal );
-SignalConnectorType SIGNAL_CONNECTOR_5( CONTROL_TYPE, Toolkit::Control::SIGNAL_LONG_PRESSED, &Internal::Control::DoConnectSignal );
+SignalConnectorType SIGNAL_CONNECTOR_1( CONTROL_TYPE, SIGNAL_KEY_EVENT, &Internal::Control::DoConnectSignal );
+SignalConnectorType SIGNAL_CONNECTOR_2( CONTROL_TYPE, SIGNAL_TAPPED, &Internal::Control::DoConnectSignal );
+SignalConnectorType SIGNAL_CONNECTOR_3( CONTROL_TYPE, SIGNAL_PANNED, &Internal::Control::DoConnectSignal );
+SignalConnectorType SIGNAL_CONNECTOR_4( CONTROL_TYPE, SIGNAL_PINCHED, &Internal::Control::DoConnectSignal );
+SignalConnectorType SIGNAL_CONNECTOR_5( CONTROL_TYPE, SIGNAL_LONG_PRESSED, &Internal::Control::DoConnectSignal );
/**
* Structure which holds information about the background of a control
case Toolkit::Control::PROPERTY_WIDTH_POLICY:
{
- controlImpl.mImpl->mWidthPolicy = Scripting::GetEnumeration< Toolkit::Control::SizePolicy >( value.Get< std::string >(), SIZE_POLICY_STRING_TABLE, SIZE_POLICY_STRING_TABLE_COUNT );
+ controlImpl.mImpl->mWidthPolicy = Scripting::GetEnumeration< Toolkit::Control::SizePolicy >( value.Get< std::string >().c_str(), SIZE_POLICY_STRING_TABLE, SIZE_POLICY_STRING_TABLE_COUNT );
break;
}
case Toolkit::Control::PROPERTY_HEIGHT_POLICY:
{
- controlImpl.mImpl->mHeightPolicy = Scripting::GetEnumeration< Toolkit::Control::SizePolicy >( value.Get< std::string >(), SIZE_POLICY_STRING_TABLE, SIZE_POLICY_STRING_TABLE_COUNT );
+ controlImpl.mImpl->mHeightPolicy = Scripting::GetEnumeration< Toolkit::Control::SizePolicy >( value.Get< std::string >().c_str(), SIZE_POLICY_STRING_TABLE, SIZE_POLICY_STRING_TABLE_COUNT );
break;
}
{
bool ret = false;
- if( object && (actionName == Toolkit::Control::ACTION_CONTROL_ACTIVATED) )
+ if( object && ( 0 == strcmp( actionName.c_str(), ACTION_CONTROL_ACTIVATED ) ) )
{
Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
if( control )
Dali::BaseHandle handle( object );
bool connected( false );
- Toolkit::Control control = Toolkit::Control::DownCast(handle);
+ Toolkit::Control control = Toolkit::Control::DownCast( handle );
if ( control )
{
Control& controlImpl( control.GetImplementation() );
connected = true;
- if ( Toolkit::Control::SIGNAL_KEY_EVENT == signalName )
+ if ( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
{
controlImpl.KeyEventSignal().Connect( tracker, functor );
}
- else if( Toolkit::Control::SIGNAL_TAPPED == signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_TAPPED ) )
{
controlImpl.EnableGestureDetection( Gesture::Tap );
controlImpl.GetTapGestureDetector().DetectedSignal().Connect( tracker, functor );
}
- else if( Toolkit::Control::SIGNAL_PANNED == signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_PANNED ) )
{
controlImpl.EnableGestureDetection( Gesture::Pan );
controlImpl.GetPanGestureDetector().DetectedSignal().Connect( tracker, functor );
}
- else if( Toolkit::Control::SIGNAL_PINCHED == signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_PINCHED ) )
{
controlImpl.EnableGestureDetection( Gesture::Pinch );
controlImpl.GetPinchGestureDetector().DetectedSignal().Connect( tracker, functor );
}
- else if( Toolkit::Control::SIGNAL_LONG_PRESSED == signalName )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_LONG_PRESSED ) )
{
controlImpl.EnableGestureDetection( Gesture::LongPress );
controlImpl.GetLongPressGestureDetector().DetectedSignal().Connect( tracker, functor );
virtual void OnInitialize();
/**
- * @brief This method is called when the control is activates.
+ * @brief This method is called when the control is activated.
*
* Derived classes should override this if they wish to be notified when they are activated.
*/
*
*/
+// CLASS HEADER
#include <dali-toolkit/public-api/controls/control.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
namespace Toolkit
{
-const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated";
-
-const char* const Control::SIGNAL_KEY_EVENT = "key-event";
-const char* const Control::SIGNAL_TAPPED = "tapped";
-const char* const Control::SIGNAL_PANNED = "panned";
-const char* const Control::SIGNAL_PINCHED = "pinched";
-const char* const Control::SIGNAL_LONG_PRESSED = "long-pressed";
-
Control Control::New()
{
return Internal::Control::New();
*
* The implementation of the control must be supplied; see Internal::Control for more details.
* @see Internal::Control
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------|-----------------------------------------------------|
+ * | key-event | @ref KeyEventSignal() |
+ * | tapped | @ref GetTapGestureDetector().DetectedSignal() |
+ * | panned | @ref GetPanGestureDetector().DetectedSignal() |
+ * | pinched | @ref GetPinchGestureDetector().DetectedSignal() |
+ * | long-pressed | @ref GetLongPressGestureDetector().DetectedSignal() |
+ *
+ * Actions
+ * | %Action Name | %Control method called |
+ * |-------------------|-----------------------------------------------------|
+ * | control-activated | %OnActivated() |
*/
class DALI_IMPORT_API Control : public CustomActor
{
static const Property::Index PROPERTY_KEY_INPUT_FOCUS; ///< name "key-input-focus", @see SetKeyInputFocus, type BOOLEAN
/** @} */
- /// @name Signals
- /** @{ */
- static const char* const SIGNAL_KEY_EVENT; ///< name "key-event"
- static const char* const SIGNAL_TAPPED; ///< name "tapped"
- static const char* const SIGNAL_PANNED; ///< name "panned"
- static const char* const SIGNAL_PINCHED; ///< name "pinched"
- static const char* const SIGNAL_LONG_PRESSED; ///< name "long-pressed"
- /** @} */
-
- /// @name Actions
- /** @{ */
- static const char* const ACTION_CONTROL_ACTIVATED; ///< name "control-activated"
- /** @} */
-
/**
* @brief Describes how a control could be resized.
*/
*
*/
+// CLASS HEADER
#include "check-button-factory.h"
// EXTERNAL INCLUDES
#include <dali/public-api/actors/image-actor.h>
+#include <dali/public-api/images/resource-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
Alignment CreateAlignedImage( const std::string& imagePath )
{
- Image image = Image::New( imagePath );
+ Image image = ResourceImage::New( imagePath );
return CreateAlignedImage( ImageActor::New( image ) );
}
} // 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();
button.SetBackgroundImage( CreateAlignedImage( backgroundImagePath ) );
}
- if( !checkedImagePath.empty() )
+ if( !selectedImagePath.empty() )
{
- button.SetCheckedImage( CreateAlignedImage( checkedImagePath ) );
+ button.SetSelectedImage( CreateAlignedImage( selectedImagePath ) );
}
if( !disabledBackgroundImagePath.empty() )
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();
button.SetBackgroundImage( CreateAlignedImage( backgroundImageActor ) );
}
- if( checkedImageActor )
+ if( selectedImageActor )
{
- button.SetCheckedImage( CreateAlignedImage( checkedImageActor ) );
+ button.SetSelectedImage( CreateAlignedImage( selectedImageActor ) );
}
if( disabledBackgroundImageActor )
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();
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();
button.SetBackgroundImage( CreateAlignedImage( backgroundImageActor ) );
}
- if( checkedImageActor )
+ if( selectedImageActor )
{
- button.SetCheckedImage( CreateAlignedImage( checkedImageActor ) );
+ button.SetSelectedImage( CreateAlignedImage( selectedImageActor ) );
}
return button;
* @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.
* @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
// EXTERNAL INCLUDES
#include <dali/public-api/actors/image-actor.h>
+#include <dali/public-api/images/resource-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
Alignment CreateAlignedImage( const std::string& imagePath )
{
- Image image = Image::New( imagePath );
+ Image image = ResourceImage::New( imagePath );
return CreateAlignedImage( ImageActor::New( image ) );
}
*/
// EXTERNAL INCLUDES
+#include <dali/public-api/images/bitmap-image.h>
// INTERNAL INCLUDES
-
#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-#include <dali/public-api/images/bitmap-image.h>
+
namespace Dali
{
*
*/
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/math/vector4.h>
#include <dali/public-api/actors/image-actor.h>
*
*/
-// EXTERNAL INCLUDES
-
// CLASS HEADER
#include <dali-toolkit/public-api/controls/effects-view/effects-view.h>
*
*/
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/magnifier/magnifier.h>
#include <dali-toolkit/internal/controls/magnifier/magnifier-impl.h>
namespace Toolkit
{
-const char* const NavigationControl::ACTION_PUSH = "push";
-const char* const NavigationControl::ACTION_POP = "pop";
-
NavigationControl::NavigationControl()
{
}
*/
// INTERNAL INCLUDES
+#include <dali/public-api/animation/alpha-functions.h>
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/controls/navigation-frame/page.h>
#include <dali-toolkit/public-api/controls/navigation-frame/navigation-bar-style.h>
* | +-+ +-----+ +-----+ +-+ |
* | +-+ +-----+ +-----+ +-+ | tool bar
* +----------------------------------------+
+ *
+ * Actions
+ * | %Action Name | %NavigationControl method called |
+ * |-------------------|----------------------------------|
+ * | push | %PushItem() |
+ * | pop | %PopItem() |
*/
-
class DALI_IMPORT_API NavigationControl : public Control
{
public:
- //Action Names
- static const char* const ACTION_PUSH;
- static const char* const ACTION_POP;
-
-public:
/**
* Create a NavigationControl handle; this can be initialize with NavigationControl::New().
*
*/
+// CLASS HEADER
#include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
namespace Dali
*
*/
-//INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
namespace Dali
*
*/
-//INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
namespace Dali
*
*/
+// CLASS HEADER
#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h>
using namespace Dali;
*
*/
+// CLASS HEADER
#include <dali-toolkit/public-api/controls/popup/popup.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/popup/popup-impl.h>
#include <dali-toolkit/public-api/controls/buttons/button.h>
// Popup
///////////////////////////////////////////////////////////////////////////////////////////////////
-const char* const Popup::SIGNAL_TOUCHED_OUTSIDE = "touched-outside";
-const char* const Popup::SIGNAL_HIDDEN = "hidden";
-
Popup::Popup()
{
}
*
* A popup can use various custom transition effects, e.g.
* Alpha fade, Scaling transition, position/rotation, shader effects.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------|------------------------------|
+ * | touched-outside | @ref OutsideTouchedSignal() |
+ * | hidden | @ref HiddenSignal() |
*/
class DALI_IMPORT_API Popup : public Control
{
public:
- //Signal Names
- static const char* const SIGNAL_TOUCHED_OUTSIDE; ///< name "touched-outside"
- static const char* const SIGNAL_HIDDEN; ///< name "hidden"
-
/**
* @brief Current popup state.
*/
*
*/
+// CLASS HEADER
#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h>
namespace Dali
namespace Toolkit
{
-const char* const ScrollBar::SCROLL_POSITION_NOTIFIED_SIGNAL_NAME = "scroll-position-notified";
-
ScrollBar::ScrollBar()
{
}
/**
* ScrollBar is a UI component that can be added to the scrollable controls
* indicating the current scroll position of the scrollable content.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |--------------------------|-------------------------------------|
+ * | scroll-position-notified | @ref ScrollPositionNotifiedSignal() |
*/
class DALI_IMPORT_API ScrollBar : public ScrollComponent
{
public:
// Signals
- static const char* const SCROLL_POSITION_NOTIFIED_SIGNAL_NAME; ///< "scroll-position-notified" signal name
typedef Signal< void ( float ) > ScrollPositionNotifiedSignalType;
// Properties
*/
// INTERNAL INCLUDES
-
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
namespace Dali
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/time-period.h>
return currentLayoutPosition;
}
-void ItemLayout::GetXAxisScrollHint(Vector2& scrollHint) const
-{
- scrollHint = Vector2::ZERO;
- Radian scrollAngle(GetScrollDirection());
- Vector2 scrollDirection(sinf(scrollAngle), cosf(scrollAngle));
- switch(mOrientation)
- {
- case ControlOrientation::Up:
- {
- if(fabsf(scrollDirection.y) < Math::MACHINE_EPSILON_1)
- {
- // we probably want x scrolling
- if(scrollDirection.x > 0.0f)
- {
- // normal positive scrolling
- scrollHint = Vector2::XAXIS;
- }
- else
- {
- scrollHint = -Vector2::XAXIS;
- }
- }
- break;
- }
- case ControlOrientation::Down:
- {
- if(fabsf(scrollDirection.y) < Math::MACHINE_EPSILON_1)
- {
- // we probably want x scrolling
- if(scrollDirection.x > 0.0f)
- {
- // normal positive scrolling
- scrollHint = -Vector2::XAXIS;
- }
- else
- {
- scrollHint = Vector2::XAXIS;
- }
- }
- break;
- }
- case ControlOrientation::Left:
- {
- // we probably want x scrolling
- if(scrollDirection.x > 0.0f)
- {
- // normal positive scrolling
- scrollHint = Vector2::XAXIS;
- }
- else
- {
- scrollHint = -Vector2::XAXIS;
- }
- break;
- }
- case ControlOrientation::Right:
- {
- // we probably want x scrolling
- if(scrollDirection.x > 0.0f)
- {
- // normal positive scrolling
- scrollHint = -Vector2::XAXIS;
- }
- else
- {
- scrollHint = Vector2::XAXIS;
- }
- break;
- }
- }
-}
-
-void ItemLayout::GetYAxisScrollHint(Vector2& scrollHint) const
-{
- scrollHint = Vector2::ZERO;
- Radian scrollAngle(GetScrollDirection());
- Vector2 scrollDirection(sinf(scrollAngle), cosf(scrollAngle));
- switch(mOrientation)
- {
- case ControlOrientation::Up:
- {
- // we probably want x scrolling
- if(scrollDirection.y > 0.0f)
- {
- // normal positive scrolling
- scrollHint = Vector2::YAXIS;
- }
- else
- {
- scrollHint = -Vector2::YAXIS;
- }
- break;
- }
- case ControlOrientation::Down:
- {
- // we probably want x scrolling
- if(scrollDirection.y > 0.0f)
- {
- // normal positive scrolling
- scrollHint = -Vector2::YAXIS;
- }
- else
- {
- scrollHint = Vector2::YAXIS;
- }
- break;
- }
- case ControlOrientation::Left:
- {
- if(fabsf(scrollDirection.x) < Math::MACHINE_EPSILON_1)
- {
- // we probably want x scrolling
- if(scrollDirection.y > 0.0f)
- {
- // normal positive scrolling
- scrollHint = -Vector2::YAXIS;
- }
- else
- {
- scrollHint = Vector2::YAXIS;
- }
- }
- break;
- }
- case ControlOrientation::Right:
- {
- if(fabsf(scrollDirection.x) < Math::MACHINE_EPSILON_1)
- {
- // we probably want x scrolling
- if(scrollDirection.y > 0.0f)
- {
- // normal positive scrolling
- scrollHint = Vector2::YAXIS;
- }
- else
- {
- scrollHint = -Vector2::YAXIS;
- }
- }
- break;
- }
- }
-}
-
int ItemLayout::GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled)
{
switch( direction )
return GetScrollSpeedFactor();
}
-void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Constrainable scrollPositionObject, const Actor& itemViewActor )
+void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Handle scrollPositionObject, const Actor& itemViewActor )
{
// This just implements the default behaviour of constraint application.
// Custom layouts can override this function to apply their custom constraints.
*/
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/common/vector-wrapper.h>
// INTERNAL INCLUDES
virtual Degree GetScrollDirection() const = 0;
/**
- * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction.
- *
- * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a
- * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis.
- * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar
- * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis
- *
- * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all
- * layout implementations should provide their own version of this function to ensure proper functionality of
- * internal toolkit systems.
- *
- * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for x-axis scrolling
- */
- DALI_IMPORT_API virtual void GetXAxisScrollHint(Vector2& scrollHint) const;
-
- /**
- * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction.
- *
- * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a
- * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis.
- * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar
- * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis
- *
- * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all
- * layout implementations should provide their own version of this function to ensure proper functionality of
- * internal toolkit systems.
- *
- * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for y-axis scrolling
- */
- DALI_IMPORT_API virtual void GetYAxisScrollHint(Vector2& scrollHint) const;
-
- /**
* @brief Query the scroll speed factor of the layout while dragging.
*
* This factor is used by the layout to customise its scroll speed while dragging.
* @param[in] scrollPositionObject The object which provides the layout position property.
* @param[in] itemViewActor The item view instance which requests the application of constraints.
*/
- DALI_IMPORT_API virtual void ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Constrainable scrollPositionObject, const Actor& itemViewActor );
+ DALI_IMPORT_API virtual void ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Handle scrollPositionObject, const Actor& itemViewActor );
/**
* @brief Gets the position of a given item
const Property::Index ScrollConnector::SCROLL_POSITION = Internal::ScrollConnector::SCROLL_POSITION;
const Property::Index ScrollConnector::OVERSHOOT = Internal::ScrollConnector::OVERSHOOT;
-const char* const ScrollConnector::DOMAIN_CHANGED_SIGNAL_NAME = "domain-changed";
-const char* const ScrollConnector::SCROLL_POSITION_CHANGED_SIGNAL_NAME = "scroll-position-changed";
-
ScrollConnector ScrollConnector::New()
{
return ScrollConnector( Internal::ScrollConnector::New() );
return GetImpl(*this).GetContentLength();
}
-Constrainable ScrollConnector::GetScrollPositionObject() const
+Handle ScrollConnector::GetScrollPositionObject() const
{
return GetImpl(*this).GetScrollPositionObject();
}
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/object/constrainable.h>
+#include <dali/public-api/object/handle.h>
namespace Dali
{
* The overshoot property is intended for implementing 'end of list' style indicators. This property is expected to be in the range
* -1 to 1, where -1 shows an attempt the scroll beyond the minimum limit, and 1 shows an attempt the scroll beyond the maximum limit.
* Zero indicates normal scrolling i.e. when overshoot indicators should be hidden.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------------|------------------------------------|
+ * | domain-changed | @ref DomainChangedSignal() |
+ * | scroll-position-changed | @ref ScrollPositionChangedSignal() |
*/
class DALI_IMPORT_API ScrollConnector : public BaseHandle
{
static const Property::Index OVERSHOOT; ///< The index of the "overshoot" property
// Signals
- static const char* const DOMAIN_CHANGED_SIGNAL_NAME; ///< "domain-changed" signal name
typedef Signal< void ( float min, float max, float size ) > DomainChangedSignalType;
-
- static const char* const SCROLL_POSITION_CHANGED_SIGNAL_NAME; ///< "scroll-position-changed" signal name
typedef Signal< void ( float position ) > ScrollPositionChangedSignalType;
/**
* @brief Retrieve the object which provides the "scroll-position" property.
* @return The scroll-position object.
*/
- Constrainable GetScrollPositionObject() const;
+ Handle GetScrollPositionObject() const;
public: // Not intended for application developers
// ScrollView
///////////////////////////////////////////////////////////////////////////////////////////////////
-const std::string ScrollView::SCROLL_PAGE_CURRENT( "scroll-page-current" );
const std::string ScrollView::SCROLL_TIME_PROPERTY_NAME( "scroll-time" );
const std::string ScrollView::SCROLL_POSITION_PROPERTY_NAME( "scroll-position" );
const std::string ScrollView::SCROLL_PRE_POSITION_PROPERTY_NAME( "scroll-pre-position" );
const std::string ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME( "scroll-overshoot-x" );
const std::string ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME( "scroll-overshoot-y" );
const std::string ScrollView::SCROLL_FINAL_PROPERTY_NAME( "scroll-final" );
-const std::string ScrollView::SCROLL_SCALE_PROPERTY_NAME( "scroll-scale" );
const std::string ScrollView::SCROLL_WRAP_PROPERTY_NAME( "scroll-wrap" );
const std::string ScrollView::SCROLL_PANNING_PROPERTY_NAME( "scroll-panning" );
const std::string ScrollView::SCROLL_SCROLLING_PROPERTY_NAME( "scroll-scrolling" );
const float ScrollView::DEFAULT_FLICK_SPEED_COEFFICIENT(1.0f);
const float ScrollView::DEFAULT_MAX_FLICK_SPEED(3.0f);
-const char* const ScrollView::SIGNAL_SNAP_STARTED = "snap-started";
-
ScrollView::ScrollView()
{
}
GetImpl(*this).SetSnapOvershootDuration(duration);
}
-void ScrollView::SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside)
-{
- GetImpl(*this).SetTouchesRequiredForPanning(minTouches, maxTouches, endOutside);
-}
-
void ScrollView::SetActorAutoSnap(bool enable)
{
GetImpl(*this).SetActorAutoSnap(enable);
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/alpha-functions.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
}
/**
+ * @brief How axes/rotation or scale are clamped
+ */
+enum ClampState
+{
+ NotClamped, ///< The quantity isn't clamped
+ ClampedToMin, ///< The quantity is clamped to the min value
+ ClampedToMax ///< The quantity is clamped to the max value
+};
+
+/**
+ * @brief A 3 dimensional clamp
+ */
+struct ClampState3D
+{
+ ClampState x; ///< The clamp state of the x axis
+ ClampState y; ///< The clamp state of the y axis
+ ClampState z; ///< The clamp state of the z axis
+};
+
+/**
* @brief The snap type
*/
enum SnapType
/**
* @brief ScrollView contains actors that can be scrolled manually (via touch)
* or automatically.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------|----------------------------|
+ * | snap-started | @ref SnapStartedSignal() |
*/
class DALI_IMPORT_API ScrollView : public Scrollable
{
// Custom properties
- static const std::string SCROLL_PAGE_CURRENT; ///< Property, name "scroll-page-current", type INT
static const std::string SCROLL_TIME_PROPERTY_NAME; ///< Property, name "scroll-time", type FLOAT
static const std::string SCROLL_POSITION_PROPERTY_NAME; ///< Property, name "scroll-position", type VECTOR3
static const std::string SCROLL_PRE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-pre-position", type VECTOR3
static const std::string SCROLL_OVERSHOOT_X_PROPERTY_NAME; ///< Property, name "scroll-overshoot-x", type float
static const std::string SCROLL_OVERSHOOT_Y_PROPERTY_NAME; ///< Property, name "scroll-overshoot-y", type float
static const std::string SCROLL_FINAL_PROPERTY_NAME; ///< Property, name "scroll-final", type VECTOR3
- static const std::string SCROLL_SCALE_PROPERTY_NAME; ///< Property, name "scroll-scale", type VECTOR3
static const std::string SCROLL_WRAP_PROPERTY_NAME; ///< Property, name "scroll-wrap", type BOOLEAN
static const std::string SCROLL_PANNING_PROPERTY_NAME; ///< Property, name "scroll-panning", type BOOLEAN
static const std::string SCROLL_SCROLLING_PROPERTY_NAME; ///< Property, name "scroll-scrolling", type BOOLEAN
static const float DEFAULT_FLICK_SPEED_COEFFICIENT; ///< Default Flick speed coefficient (multiples input touch velocity)
static const float DEFAULT_MAX_FLICK_SPEED; ///< Default Maximum flick speed. (in stage diagonals per second)
- //Signal Names
- static const char* const SIGNAL_SNAP_STARTED; ///< Name "snap-started"
+public:
- /// Direction of transitions
- enum EDirectionFlag
+ /**
+ * @brief Clamp signal event's data
+ */
+ struct ClampEvent
{
- DirectionFlagLeft = 0x01,
- DirectionFlagRight = 0x02,
- DirectionFlagUp = 0x04,
- DirectionFlagDown = 0x08,
- DirectionFlagTransitionOn = 0x10, ///< doesnt mean a page is moving towards centre, it affects whether the current page is using values for moving onto screen or off screen, if the user changes scroll direction we dont want things to flip over when in view
- DirectionFlagTransitionOff = 0x20,
- DirectionFlagMask_Direction = DirectionFlagLeft | DirectionFlagRight | DirectionFlagUp | DirectionFlagDown,
- DirectionFlagMask_Transition = DirectionFlagTransitionOn | DirectionFlagTransitionOff
+ ClampState3D scale; ///< Clamp information for scale axes
+ ClampState3D position; ///< Clamp information for position axes
+ ClampState rotation; ///< Clamp information for rotation
};
-public:
-
/**
* @brief Snap signal event's data.
*/
void SetSnapOvershootDuration(float duration);
/**
- * @brief Sets Touches required for pan gestures.
- *
- * Panning requires number of touches to be within (minTouches) and
- * (maxTouches).
- *
- * If (endOutside) is true, then outside this range of touches,
- * the pan gesture will end and thus will snap.
- *
- * If (endOutside) is false, then outside this range of touches,
- * the pan gesture will pause. but will not end until touches = 0.
- *
- * @param[in] minTouches Minimum touches for panning to occur.
- * @param[out] maxTouches Maxiumum touches for panning to occur.
- * @param[in] endOutside Whether to end the panning gesture outside of touch range
- */
- void SetTouchesRequiredForPanning(unsigned int minTouches = 1, unsigned int maxTouches = 1, bool endOutside = true);
-
- /**
* @brief Enables or Disables Actor Auto-Snap mode.
*
* When Actor Auto-Snap mode has been enabled, ScrollView will automatically
const std::string Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME( "scroll-position-max" );
const std::string Scrollable::SCROLL_DIRECTION_PROPERTY_NAME( "scroll-direction" );
-const char* const Scrollable::SIGNAL_SCROLL_STARTED = "scroll-started";
-const char* const Scrollable::SIGNAL_SCROLL_COMPLETED = "scroll-completed";
-const char* const Scrollable::SIGNAL_SCROLL_UPDATED = "scroll-updated";
-const char* const Scrollable::SIGNAL_SCROLL_CLAMPED = "scroll-clamped";
-
Scrollable::Scrollable()
{
}
return GetImpl(*this).ScrollCompletedSignal();
}
-Scrollable::ScrollClampedSignalType& Scrollable::ScrollClampedSignal()
-{
- return GetImpl(*this).ScrollClampedSignal();
-}
-
bool Scrollable::IsScrollComponentEnabled(Scrollable::ScrollComponentType indicator) const
{
return GetImpl(*this).IsScrollComponentEnabled(indicator);
}
/**
- * @brief How axes/rotation or scale are clamped
- */
-enum ClampState
-{
- NotClamped, ///< The quantity isn't clamped
- ClampedToMin, ///< The quantity is clamped to the min value
- ClampedToMax ///< The quantity is clamped to the max value
-};
-
-/**
- * @brief A 2 dimensional clamp
- */
-struct ClampState2
-{
- ClampState x; ///< The clamp state of the x axis
- ClampState y; ///< The clamp state of the y axis
-};
-
-/**
- * @brief A 3 dimensional clamp
- */
-struct ClampState3
-{
- ClampState x; ///< The clamp state of the x axis
- ClampState y; ///< The clamp state of the y axis
- ClampState z; ///< The clamp state of the z axis
-};
-
-/**
* @brief Base class for derived Scrollables that contains actors that can be scrolled manually
* (via touch) or automatically.
*
* Scrollables such as ScrollView and ItemView can be derived from this class.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------|------------------------------|
+ * | scroll-started | @ref ScrollStartedSignal() |
+ * | scroll-completed | @ref ScrollUpdatedSignal() |
+ * | scroll-updated | @ref ScrollCompletedSignal() |
*/
class DALI_IMPORT_API Scrollable : public Control
{
public:
/**
- * @brief Clamp signal event's data
- */
- struct ClampEvent
- {
- ClampState3 scale; ///< Clamp information for scale axes
- ClampState3 position; ///< Clamp information for position axes
- ClampState rotation; ///< Clamp information for rotation
- };
-
- /**
* @brief Scroll component types
*/
enum ScrollComponentType
static const Property::Index PROPERTY_OVERSHOOT_ANIMATION_SPEED; ///< Property, name "overshoot-animation-speed", @see SetOvershootAnimationSpeed(), type FLOAT
/** @} */
- /// @name Signals
- /** @{ */
- static const char* const SIGNAL_SCROLL_STARTED; ///< "scroll-started";
- static const char* const SIGNAL_SCROLL_COMPLETED; ///< "scroll-completed";
- static const char* const SIGNAL_SCROLL_UPDATED; ///< "scroll-updated";
- static const char* const SIGNAL_SCROLL_CLAMPED; ///< "scroll-clamped";
- /** @} */
-
public:
typedef Signal< void ( const Vector3& ) > ScrollStartedSignalType; ///< ScrollStarted signal type
typedef Signal< void ( const Vector3& ) > ScrollCompletedSignalType; ///< ScrollCompleted signal type
typedef Signal< void ( const Vector3& ) > ScrollUpdatedSignalType; ///< Scroll updated signal type
- typedef Signal< void ( const ClampEvent& ) > ScrollClampedSignalType; ///< Scroll clamped signal type
/**
* @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
*/
ScrollCompletedSignalType& ScrollCompletedSignal();
- /**
- * @brief Signal emitted when the Scrollable is pushing against a domain boundary
- * (in either position, scale, or rotation).
- *
- * @return The signal to connect to
- */
- ScrollClampedSignalType& ScrollClampedSignal();
-
public:
/**
// Slider
///////////////////////////////////////////////////////////////////////////////////////////////////
-// Signals
-const char* const Slider::SIGNAL_VALUE_CHANGED = "value-changed";
-const char* const Slider::SIGNAL_MARK = "mark";
-
Slider::Slider()
{
}
/**
* @brief Slider is a control to enable sliding an indicator between two values
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------|-----------------------------|
+ * | value-changed | @ref ValueChangedSignal() |
+ * | mark | @ref MarkSignal() |
*/
class DALI_IMPORT_API Slider : public Control
{
public:
- //Signal Names
- static const char* const SIGNAL_VALUE_CHANGED;
- static const char* const SIGNAL_MARK;
-
// Properties
static const Property::Index LOWER_BOUND_PROPERTY; ///< Property, name "lower-bound", type FLOAT
static const Property::Index UPPER_BOUND_PROPERTY; ///< Property, name "upper-bound", type FLOAT
namespace Toolkit
{
-const char* const View::SIGNAL_ORIENTATION_ANIMATION_START = "orientation-animation-start";
-
View::View()
{
}
* contentLayer.ApplyConstraint( ParentConstraint::Size::New( ParentSize() ) );
* view.AddContentLayer( contentLayer );
* \endcode
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-----------------------------|------------------------------------------|
+ * | orientation-animation-start | @ref OrientationAnimationStartedSignal() |
+
*/
class DALI_IMPORT_API View : public Control
{
-public:
- //Signal Names
- static const char* const SIGNAL_ORIENTATION_ANIMATION_START;
public:
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
$(public_api_src_dir)/controls/super-blur-view/super-blur-view.cpp \
$(public_api_src_dir)/controls/table-view/table-view.cpp \
$(public_api_src_dir)/controls/text-controls/text-label.cpp \
+ $(public_api_src_dir)/controls/text-controls/text-field.cpp \
$(public_api_src_dir)/controls/tool-bar/tool-bar.cpp \
$(public_api_src_dir)/controls/bloom-view/bloom-view.cpp \
$(public_api_src_dir)/controls/cluster/cluster-style.cpp \
$(public_api_src_dir)/shader-effects/overlay-effect.cpp \
$(public_api_src_dir)/shader-effects/page-turn-book-spine-effect.cpp \
$(public_api_src_dir)/shader-effects/page-turn-effect.cpp \
+ $(public_api_src_dir)/shader-effects/quadratic-bezier.cpp \
$(public_api_src_dir)/shader-effects/ripple-effect.cpp \
$(public_api_src_dir)/shader-effects/ripple2d-effect.cpp \
$(public_api_src_dir)/shader-effects/shear-effect.cpp \
$(public_api_src_dir)/controls/table-view/table-view.h
public_api_text_controls_header_files = \
- $(public_api_src_dir)/controls/text-controls/text-label.h
+ $(public_api_src_dir)/controls/text-controls/text-label.h \
+ $(public_api_src_dir)/controls/text-controls/text-field.h
public_api_text_header_files = \
$(public_api_src_dir)/text/bidirectional-line-info-run.h \
$(public_api_src_dir)/shader-effects/overlay-effect.h \
$(public_api_src_dir)/shader-effects/page-turn-book-spine-effect.h \
$(public_api_src_dir)/shader-effects/page-turn-effect.h \
+ $(public_api_src_dir)/shader-effects/quadratic-bezier.h \
$(public_api_src_dir)/shader-effects/ripple-effect.h \
$(public_api_src_dir)/shader-effects/ripple2d-effect.h \
$(public_api_src_dir)/shader-effects/shear-effect.h \
namespace Toolkit
{
-const char* const FocusManager::SIGNAL_FOCUS_CHANGED = "focus-changed";
-const char* const FocusManager::SIGNAL_FOCUS_OVERSHOT = "focus-overshot";
-const char* const FocusManager::SIGNAL_FOCUSED_ACTOR_ACTIVATED = "focused-actor-activated";
-
FocusManager::FocusManager()
{
}
* It provides functionality of setting the
* focus and moving the focus forward and backward. It also draws a highlight for the
* focused actor and emits a signal when the focus is changed.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------------|------------------------------------|
+ * | focus-changed | @ref FocusChangedSignal() |
+ * | focus-overshot | @ref FocusOvershotSignal() |
+ * | focused-actor-activated | @ref FocusedActorActivatedSignal() |
*/
-
class DALI_IMPORT_API FocusManager : public BaseHandle
{
public:
- // Signal Names
- static const char* const SIGNAL_FOCUS_CHANGED; ///< name "focus-changed"
- static const char* const SIGNAL_FOCUS_OVERSHOT; ///< name "focus-overshot"
- static const char* const SIGNAL_FOCUSED_ACTOR_ACTIVATED; ///< name "focused-actor-activated"
/**
* @brief Accessibility needs four information which will be read by screen-reader.
namespace Toolkit
{
-const char* const KeyboardFocusManager::SIGNAL_PRE_FOCUS_CHANGE = "keyboard-pre-focus-change";
-const char* const KeyboardFocusManager::SIGNAL_FOCUS_CHANGED = "keyboard-focus-changed";
-const char* const KeyboardFocusManager::SIGNAL_FOCUS_GROUP_CHANGED = "keyboard-focus-group-changed";
-const char* const KeyboardFocusManager::SIGNAL_FOCUSED_ACTOR_ACTIVATED = "keyboard-focused-actor-activated";
-
KeyboardFocusManager::KeyboardFocusManager()
{
}
* in four directions (i.e. Left, Right, Up and Down). It also draws a
* highlight for the focused actor and emits a signal when the focus
* is changed.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |----------------------------------|------------------------------------|
+ * | keyboard-pre-focus-change | @ref PreFocusChangeSignal() |
+ * | keyboard-focus-changed | @ref FocusChangedSignal() |
+ * | keyboard-focus-group-changed | @ref FocusGroupChangedSignal() |
+ * | keyboard-focused-actor-activated | @ref FocusedActorActivatedSignal() |
*/
class DALI_IMPORT_API KeyboardFocusManager : public BaseHandle
{
-public:
- //Signal Names
- static const char* const SIGNAL_PRE_FOCUS_CHANGE; ///< name "keyboard-pre-focus-change"
- static const char* const SIGNAL_FOCUS_CHANGED; ///< name "keyboard-focus-changed"
- static const char* const SIGNAL_FOCUS_GROUP_CHANGED; ///< name "keyboard-focus-group-changed"
- static const char* const SIGNAL_FOCUSED_ACTOR_ACTIVATED; ///< name "keyboard-focused-actor-activated"
public:
namespace Toolkit
{
-const char* const KeyInputFocusManager::SIGNAL_KEY_INPUT_FOCUS_CHANGED = "key-input-focus-changed";
-const char* const KeyInputFocusManager::SIGNAL_UNHANDLED_KEY_EVENT = "unhandled-key-event";
-
KeyInputFocusManager::KeyInputFocusManager()
{
}
* all the keyboard events first. And if the conrol doesn't consume the event it is passed to
* the next control in the stack. If none of the controls in the stack consume the key event then
* UnhandledKeyEventSignal() is emitted.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------------|-----------------------------------|
+ * | key-input-focus-changed | @ref KeyInputFocusChangedSignal() |
+ * | unhandled-key-event | @ref UnhandledKeyEventSignal() |
*/
class DALI_IMPORT_API KeyInputFocusManager : public BaseHandle
{
public:
- // Signal Names
- static const char* const SIGNAL_KEY_INPUT_FOCUS_CHANGED;
- static const char* const SIGNAL_UNHANDLED_KEY_EVENT;
// KeyInputFocusChanged
typedef Signal< void (Control, Control) > KeyInputFocusChangedSignalType;
{
}
-BubbleEffect BubbleEffect::New( unsigned int numberOfBubble, const std::string& shapeImagePath)
+BubbleEffect BubbleEffect::New( unsigned int numberOfBubble)
{
std::ostringstream vertexShaderStringStream;
vertexShaderStringStream << "#define NUMBER_OF_BUBBLE "<< numberOfBubble << "\n";
" precision mediump float;\n"
// the gravity applied to the y direction
" uniform float uGravity; \n"
- // Width of the texture in pixels
- " uniform float uShapeWidth; \n"
// xy: the emit position of the bubble; zw: the destinationof the bubble.
// The bubble is moving from (xy) to (zw plus the y drop influenced by gravity).
" uniform vec4 uStartAndEndPos[NUMBER_OF_BUBBLE];\n"
" gl_Position = uMvpMatrix * position;\n"
"\n"
// Add multiple bubble shapes in the effect
- " mediump float texCoordX = floor( mod(startAndEnd.z, uShapeWidth) );\n "
- " mediump float texCoordY = floor( mod(startAndEnd.w, uShapeWidth) );\n "
- " vTexCoord = vec2( (texCoordX + aTexCoord.x)/ uShapeWidth,(texCoordY + aTexCoord.y)/ uShapeWidth );\n"
+ " vTexCoord = aTexCoord;\n"
" vPercentage = percentage;\n"
// Use the emit position color for the bubble
" vEffectTexCoord = startAndEnd.xy * uInvertedMovementArea;\n"
handle.SetUniform( "uMagnification", 1.f );
handle.SetUniform( "uDynamicScale", 1.f );
- //Get pixel width of the shape
- float width = Image::GetImageSize(shapeImagePath).width;
- handle.SetUniform( "uShapeWidth", (width/EACH_WIDTH_PER_SHAPE) );
-
Vector4 zeroVector;
for( unsigned int i=0; i<numberOfBubble; i++ )
{
SetUniform( "uGravity", gravity );
}
-void BubbleEffect::SetShapeImageWidth( float imageWidth )
-{
- SetUniform( "uShapeWidth", (imageWidth/EACH_WIDTH_PER_SHAPE) );
-}
-
void BubbleEffect::SetDynamicScale( float scale )
{
SetUniform( "uDynamicScale", scale );
* Ideally use one group of uniform to control one bubble.
* If the num of patches in the MeshActor is more than groups of uniforms,
* the uniform values will be shared by multiple bubbles. Allow up to 9 times.
- * @param shapeImagePath File path of the image that will be used as a texture for each bubble.
* @return A handle to a newly allocated Dali resource.
*/
- static BubbleEffect New( unsigned int numberOfBubble, const std::string& shapeImagePath);
+ static BubbleEffect New( unsigned int numberOfBubble);
/**
* Set the bubble movement area for the BubbleEffect
*/
void SetGravity( float gravity );
- /*
- * Set the width of shape image
- * If one image has multiple shape, bubble effect will parse one shape from the image randomly.
- * @param[in] imageWidth width of shape image
- */
- void SetShapeImageWidth( float imageWidth );
-
/**
* Set the scale factor applied to the bubbles
* @param[in] scale The scale factor applied on all bubbles.
#include <dali-toolkit/public-api/shader-effects/motion-blur-effect.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
namespace Dali
#include <dali-toolkit/public-api/shader-effects/motion-stretch-effect.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
namespace Dali
#include <dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-input.h>
#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/images/resource-image.h>
namespace Dali
{
GeometryType( GEOMETRY_TYPE_IMAGE ),
ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
- maskEffect.SetEffectImage( Image::New( maskImage ) );
+ maskEffect.SetEffectImage( ResourceImage::New( maskImage ) );
maskEffect.SetUniform( "uImageSize", Vector2(0,0) /*Constrained to actor size*/ );
maskEffect.ApplyConstraint( Constraint::New<Vector2>( maskEffect.GetPropertyIndex("uImageSize"),
void Apply( ImageActor actor, const std::string& maskImage )
{
- Vector2 maskSize = Image::GetImageSize( maskImage );
+ Vector2 maskSize = ResourceImage::GetImageSize( maskImage );
const float leftRight = (maskSize.width - 1.0f) * 0.5f;
const float topBottom = (maskSize.height - 1.0f) * 0.5f;
void Apply( ImageActor actor, const std::string& maskImage, const Vector4& maskBorder )
{
- Vector2 maskSize = Image::GetImageSize( maskImage );
+ Vector2 maskSize = ResourceImage::GetImageSize( maskImage );
DoApply( actor, maskImage, maskSize, maskBorder );
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+//CLASS HEADER
+#include <dali-toolkit/public-api/shader-effects/quadratic-bezier.h>
+
+//EXTERNAL HEADERS
+#include <sstream>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace
+{
+const char* POINT_PROPERTY_NAME( "uPoint" );
+const char* LINEWIDTH_PROPERTY_NAME( "uLineWidth" );
+const char* COLOR_PROPERTY_NAME( "uColor" );
+} // namespace
+
+QuadraticBezier::QuadraticBezier()
+{
+}
+
+//Call the Parent copy constructor to add reference to the implementation for this object
+QuadraticBezier::QuadraticBezier(ShaderEffect handle)
+:ShaderEffect(handle)
+{
+}
+
+QuadraticBezier::~QuadraticBezier()
+{
+}
+
+QuadraticBezier QuadraticBezier::New(unsigned int pointCount, bool filled )
+{
+ std::string vertexShader = DALI_COMPOSE_SHADER
+ (
+ uniform mediump vec3 uPoint[MAX_POINT_COUNT];\n
+ varying highp vec2 vCoefficient;
+ void main()\n
+ {\n
+ int vertexId = int(aNormal.z);\n
+ gl_Position = uMvpMatrix * vec4(uPoint[vertexId], 1.0);\n
+ vCoefficient = aNormal.xy;\n
+ }\n
+ );
+
+ std::string fragmentShader;
+
+ if( filled )
+ {
+ fragmentShader = DALI_COMPOSE_SHADER
+ (
+ varying highp vec2 vCoefficient;\n
+
+ void main()\n
+ {\n
+ highp float C = (vCoefficient.x*vCoefficient.x-vCoefficient.y);\n
+ highp float Cdx = dFdx(C);\n
+ highp float Cdy = dFdy(C);\n
+
+ highp float distance = float(C / sqrt(Cdx*Cdx + Cdy*Cdy));\n
+
+ gl_FragColor = uColor;\n
+ highp float alpha = 0.5 - distance;\n
+ if( alpha < 0.0 )\n
+ discard;\n
+
+ gl_FragColor.w = alpha;\n
+ }\n
+ );
+ }
+ else
+ {
+ fragmentShader = DALI_COMPOSE_SHADER
+ (
+ varying highp vec2 vCoefficient;\n
+ uniform lowp float uLineWidth;\n
+
+ void main()\n
+ {\n
+ highp float C = (vCoefficient.x*vCoefficient.x-vCoefficient.y);\n
+ highp float Cdx = dFdx(C);\n
+ highp float Cdy = dFdy(C);\n
+ highp float distance = abs(float(C / sqrt(Cdx*Cdx + Cdy*Cdy)));\n
+ gl_FragColor = uColor*(uLineWidth-distance);\n
+ }\n
+ );
+ }
+
+ std::ostringstream vertexShaderPrefix;
+ vertexShaderPrefix << "#define MAX_POINT_COUNT "<< pointCount << "\n";
+
+ Dali::ShaderEffect shaderEffectCustom = Dali::ShaderEffect::NewWithPrefix( vertexShaderPrefix.str(),vertexShader,
+ "#extension GL_OES_standard_derivatives:enable\n", fragmentShader,
+ GEOMETRY_TYPE_UNTEXTURED_MESH );
+
+ Dali::Toolkit::QuadraticBezier handle( shaderEffectCustom );
+
+ //Set default uniform values
+ handle.SetUniform( COLOR_PROPERTY_NAME, Vector4(1.0f,1.0f,1.0f,1.0f) );
+ if( !filled )
+ {
+ //Set default line widht to 1 pixel
+ handle.SetUniform( LINEWIDTH_PROPERTY_NAME, 1.0f );
+ }
+
+ return handle;
+}
+
+void QuadraticBezier::SetPoint(unsigned int index, const Vector3& position)
+{
+ SetUniform( GetPointPropertyName(index), position );
+}
+
+void QuadraticBezier::SetLineWidth( float width )
+{
+ SetUniform( LINEWIDTH_PROPERTY_NAME, width );
+}
+
+void QuadraticBezier::SetColor( const Vector4& color )
+{
+ SetUniform( COLOR_PROPERTY_NAME, color );
+}
+
+std::string QuadraticBezier::GetPointPropertyName(unsigned int index) const
+{
+ std::ostringstream propertyName;
+ propertyName<<POINT_PROPERTY_NAME<<"["<<index<<"]";
+ return propertyName.str();
+}
+
+std::string QuadraticBezier::GetLineWidthPropertyName( ) const
+{
+ return LINEWIDTH_PROPERTY_NAME;
+}
+
+std::string QuadraticBezier::GetColorPropertyName( ) const
+{
+ return COLOR_PROPERTY_NAME;
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
--- /dev/null
+#ifndef __DALI_TOOLKIT_QUADRATIC_BEZIER_H__
+#define __DALI_TOOLKIT_QUADRATIC_BEZIER_H__
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/shader-effects/shader-effect.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+/**
+ * @brief QuadraticBezier is a custom shader to render quadratic bezier curves and bounded regions.
+ *
+ * Implementation based on the paper "Resolution Independent Curve Rendering using Programmable Graphics Hardware"
+ * by Charles Loop and Jim Blinn.
+ *
+ * The coordinates of the control points is passed to the shader via uniforms.
+ * aNormal attribute is used to pass the coefficients of each control point (xy coordinates) as well as the vertex ID (z coordinate).
+ * A quadratic curve should have as normal for the first control point (0.0,0.0), (0.5,0.0) for the second and (1.0,1.0) for the third.
+ * Triangles that do not contain curves should have coordinates (0.0,1.0) for each control point in order to be filled properly.
+ */
+
+class DALI_IMPORT_API QuadraticBezier : public ShaderEffect
+{
+public:
+
+ /**
+ * @brief Create an uninitialized QuadraticBezier; this can be initialized with QuadraticBezier::New().
+ *
+ * Calling member functions with an uninitialized Dali::Object is not allowed.
+ */
+ QuadraticBezier();
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~QuadraticBezier();
+
+ /**
+ * @brief Create an initialized QuadraticBezier.
+ *
+ * @param[in] pointCount The maximum number of vertices
+ * @param[in] filled Specify whether the the bounded region should be filled or not
+ * @return A handle to a newly allocated Dali resource.
+ */
+ static QuadraticBezier New(unsigned int pointCount, bool filled );
+
+ /**
+ * @brief Set position coordinates for a point in the curve
+ *
+ * @param[in] index The index of the vertex
+ * @param[in] position The new position
+ */
+ void SetPoint( unsigned int index, const Vector3& position );
+
+ /**
+ * @brief Set the width of the pathThis is only for not filled curves
+ *
+ * @param[in] width Width of the line in pixels
+ */
+ void SetLineWidth( float width );
+
+ /**
+ * @brief Sets the color of the curve
+ *
+ * @param[in] color The new color
+ */
+ void SetColor( const Vector4& color );
+
+ /**
+ * @brief Get the name of a the point property given its index
+ *
+ * @param[in] index Index of the vertex
+ * @return A std::string containing the property name
+ */
+ std::string GetPointPropertyName( unsigned int index ) const;
+
+ /**
+ * @brief Get the name of the line width property
+ *
+ * @return A std::string containing the property name
+ */
+ std::string GetLineWidthPropertyName( ) const;
+
+ /**
+ * @brief Get the name of the color property
+ *
+ * @return A std::string containing the property name
+ */
+ std::string GetColorPropertyName( ) const;
+
+private: // Not intended for application developers
+
+ DALI_INTERNAL QuadraticBezier(ShaderEffect handle);
+
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-input.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/shader-effects/soft-button-effect.h>
+
namespace Dali
{
Vector4 color;
};
- Impl(Internal::Control& parent)
+ Impl(Dali::Toolkit::Internal::Control& parent)
: mParent(parent),
mActiveCursor(ACTIVE_CURSOR_NONE),
mCursorBlinkInterval(0.5f),
delete mImpl;
}
-Decorator::Decorator(Internal::Control& parent)
+Decorator::Decorator(Dali::Toolkit::Internal::Control& parent)
: mImpl( NULL )
{
mImpl = new Decorator::Impl(parent);
* @param[in] parent Decorations will be added to this parent control.
* @return A pointer to a new Decorator.
*/
- static DecoratorPtr New( Internal::Control& parent );
+ static DecoratorPtr New( Dali::Toolkit::Internal::Control& parent );
/**
* @brief The decorator waits until a relayout before creating actors etc.
* @brief Private constructor.
* @param[in] parent Decorations will be added to this parent control.
*/
- Decorator(Internal::Control& parent);
+ Decorator(Dali::Toolkit::Internal::Control& parent);
// Undefined
Decorator( const Decorator& handle );
return;
}
+#ifdef DEBUG_ENABLED
const Length numberOfFontRuns = fonts.Count();
+ const Length numberOfScriptRuns = scripts.Count();
+#endif
DALI_ASSERT_DEBUG( ( 0u != numberOfFontRuns ) &&
( numberOfCharacters == fonts[numberOfFontRuns - 1u].characterRun.characterIndex + fonts[numberOfFontRuns - 1u].characterRun.numberOfCharacters ) &&
"Toolkit::Text::ShapeText. All characters must have a font set." );
- const Length numberOfScriptRuns = scripts.Count();
-
DALI_ASSERT_DEBUG( ( 0u != numberOfScriptRuns ) &&
( numberOfCharacters == scripts[numberOfScriptRuns - 1u].characterRun.characterIndex + scripts[numberOfScriptRuns - 1u].characterRun.numberOfCharacters ) &&
"Toolkit::Text::ShapeText. All characters must have a script set." );
namespace Toolkit
{
-const char* const CubeTransitionEffect::SIGNAL_TRANSITION_COMPLETED = "transition-completed";
-
CubeTransitionEffect::CubeTransitionEffect()
{
}
{
}
+CubeTransitionEffect CubeTransitionEffect::DownCast( BaseHandle handle )
+{
+ return CubeTransitionEffect( dynamic_cast< Dali::Toolkit::Internal::CubeTransitionEffect* >( handle.GetObjectPtr() ) );
+}
+
void CubeTransitionEffect::SetTransitionDuration( float duration )
{
GetImpl(*this).SetTransitionDuration( duration );
* cubeEffect.StartTransition( );
*
* @endcode
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |----------------------|----------------------------------|
+ * | transition-completed | @ref TransitionCompletedSignal() |
*/
class DALI_IMPORT_API CubeTransitionEffect : public BaseHandle
{
~CubeTransitionEffect();
/**
+ * @brief Downcast an Object handle to a CubeTransitionEffect handle.
+ *
+ * If handle points to a CubeTransitionEffect object the downcast produces
+ * a valid handle. If not the returned handle is left uninitialized.
+ *
+ * @param[in] handle A handle to an object
+ * @return A handle to a CubeTransitionEffect object or an uninitialized handle
+ */
+ static CubeTransitionEffect DownCast( BaseHandle handle );
+
+ /**
* Set the duration of transition animation
* @param[in] duration The duration of transition animation
*/
public: //Signal
- //signal name
- static const char* const SIGNAL_TRANSITION_COMPLETED;
-
//Transition animation completed signal
typedef Signal< void ( CubeTransitionEffect, ImageActor ) > TransitionCompletedSignalType;
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
%build
PREFIX="/usr"
CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections "
-LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections "
+LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "
libtoolize --force
cd %{_builddir}/dali-toolkit-%{version}/build/tizen