namespace
{
-static const char* TEST_IMAGE_ONE = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
-
static bool gIsCalledButtonCallback = false;
const int RENDER_FRAME_INTERVAL = 16;
END_TEST;
}
-int UtcDaliButtonSetDisabledP(void)
+int UtcDaliButtonDisabledPropertyP(void)
{
ToolkitTestApplication application;
Button button = PushButton::New();
- button.SetDisabled( true );
- DALI_TEST_CHECK( button.IsDisabled() );
+ button.SetProperty( button.GetPropertyIndex("disabled"), true );
- button.SetDisabled( false );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("disabled")), true, TEST_LOCATION );
- DALI_TEST_CHECK( !button.IsDisabled() );
+ button.SetProperty( button.GetPropertyIndex("disabled"), false );
- button.SetDisabled( true );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("disabled")), false, TEST_LOCATION );
- DALI_TEST_CHECK( button.IsDisabled() );
+ button.SetProperty( button.GetPropertyIndex("disabled"), true );
- button.SetDisabled( false );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("disabled")), true, TEST_LOCATION );
+
+ button.SetProperty( button.GetPropertyIndex("disabled"), false );
+
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("disabled")), false, TEST_LOCATION );
- DALI_TEST_CHECK( !button.IsDisabled() );
END_TEST;
}
END_TEST;
}
-int UtcDaliButtonSetAutoRepeatingP(void)
+int UtcDaliButtonAutoRepeatingPropertyP(void)
{
ToolkitTestApplication application;
Button button = PushButton::New();
- button.SetAutoRepeating( true );
+ button.SetProperty( button.GetPropertyIndex("autoRepeating"), true );
- DALI_TEST_CHECK( button.IsAutoRepeating() );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
- button.SetAutoRepeating( false );
+ button.SetProperty( button.GetPropertyIndex("autoRepeating"), false );
- DALI_TEST_CHECK( !button.IsAutoRepeating() );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("autoRepeating")), false, TEST_LOCATION );
- button.SetAutoRepeating( true );
+ button.SetProperty( button.GetPropertyIndex("autoRepeating"), true );
- DALI_TEST_CHECK( button.IsAutoRepeating() );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
button.SetAutoRepeating( false );
END_TEST;
}
-int UtcDaliButtonSetInitialAutoRepeatingDelayP(void)
+int UtcDaliButtonInitialAutoRepeatingDelayPropertyP(void)
{
ToolkitTestApplication application;
Button button = PushButton::New();
- button.SetInitialAutoRepeatingDelay( 0.5f );
+ button.SetProperty( button.GetPropertyIndex("initialAutoRepeatingDelay"), 0.5f );
- DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS( button.GetProperty<float>( button.GetPropertyIndex("initialAutoRepeatingDelay")), 0.5f, TEST_LOCATION );
- button.SetInitialAutoRepeatingDelay( 0.2f );
+ button.SetProperty( button.GetPropertyIndex("initialAutoRepeatingDelay"), 0.2f );
+
+ DALI_TEST_EQUALS( button.GetProperty<float>( button.GetPropertyIndex("initialAutoRepeatingDelay")), 0.2f, TEST_LOCATION );
- DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
END_TEST;
}
-int UtcDaliButtonSetNextAutoRepeatingDelayP(void)
+int UtcDaliButtonNextAutoRepeatingDelayPropertyP(void)
{
ToolkitTestApplication application;
Button button = PushButton::New();
- button.SetNextAutoRepeatingDelay( 0.5f );
+ button.SetProperty( button.GetPropertyIndex("nextAutoRepeatingDelay"), 0.5f );
- DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS( button.GetProperty<float>( button.GetPropertyIndex("nextAutoRepeatingDelay")), 0.5f, TEST_LOCATION );
- button.SetProperty( Button::Property::NEXT_AUTO_REPEATING_DELAY, 0.2f );
+ button.SetProperty( button.GetPropertyIndex("nextAutoRepeatingDelay"), 0.2f );
- DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
+ DALI_TEST_EQUALS( button.GetProperty<float>( button.GetPropertyIndex("nextAutoRepeatingDelay")), 0.2f, TEST_LOCATION );
END_TEST;
}
-int UtcDaliButtonSetTogglableButtonP(void)
+int UtcDaliButtonTogglableButtonPropertyP(void)
{
ToolkitTestApplication application;
Button button = PushButton::New();
- button.SetTogglableButton( true );
+ button.SetProperty( button.GetPropertyIndex("togglable"), true );
- DALI_TEST_CHECK( button.IsTogglableButton() );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("togglable")), true, TEST_LOCATION );
- button.SetTogglableButton( false );
+ button.SetProperty( button.GetPropertyIndex("togglable"), false );
- DALI_TEST_CHECK( !button.IsTogglableButton() );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("togglable")), false, TEST_LOCATION );
END_TEST;
}
-int UtcDaliButtonSetSelectedP(void)
+int UtcDaliButtonSelectedPropertyP(void)
{
ToolkitTestApplication application;
Button button = PushButton::New();
- button.SetTogglableButton( true );
+ button.SetProperty( button.GetPropertyIndex("togglable"), true );
- button.SetSelected( true );
+ button.SetProperty( button.GetPropertyIndex("selected"), true );
- DALI_TEST_CHECK( button.IsSelected() );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("selected")), true, TEST_LOCATION );
- button.SetSelected( false );
+ button.SetProperty( button.GetPropertyIndex("selected"), false );
- DALI_TEST_CHECK( !button.IsSelected() );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("selected")), false, TEST_LOCATION );
END_TEST;
}
END_TEST;
}
-int UtcDaliButtonSetUnselectedImageP(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliButtonSetUnselectedImageP");
-
- PushButton pushButton = PushButton::New();
- Stage::GetCurrent().Add( pushButton );
-
- application.SendNotification();
- application.Render();
-
- pushButton.SetUnselectedImage( "Image.jpg" );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_CHECK( pushButton );
-
- END_TEST;
-}
-
-int UtcDaliButtonSetSelectedImageP(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliButtonSetButtonImage");
-
- PushButton pushButton = PushButton::New();
- Stage::GetCurrent().Add( pushButton );
-
- application.SendNotification();
- application.Render();
-
- pushButton.SetSelectedImage( "Image.jpg" );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_CHECK( pushButton );
-
- END_TEST;
-}
-
int UtcDaliButtonPressedSignalP(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliButtonStateChangedSignalP");
Button button = PushButton::New();
- button.SetTogglableButton( true );
+
+ button.SetProperty( Button::Property::TOGGLABLE, true);
Stage::GetCurrent().Add( button );
button.ConnectSignal( testTracker, "stateChanged", CallbackFunctor(&stateChangedSignal) );
gIsCalledButtonCallback = false;
- button.SetSelected( true );
+ button.SetProperty( Button::Property::SELECTED, true);
DALI_TEST_CHECK( gIsCalledButtonCallback );
DALI_TEST_CHECK( stateChangedSignal );
gIsCalledButtonCallback = false;
stateChangedSignal = false;
- button.SetSelected( false );
-
+ button.SetProperty( Button::Property::SELECTED, false);
DALI_TEST_CHECK( gIsCalledButtonCallback );
DALI_TEST_CHECK( stateChangedSignal );
END_TEST;
PushButton pushButton = PushButton::New();
pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), false);
- DALI_TEST_CHECK( false == pushButton.IsDisabled() );
-
- pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), true);
- DALI_TEST_CHECK( true == pushButton.IsDisabled() );
-
- END_TEST;
-}
-
-int UtcDaliButtonSize(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliButtonSize");
-
- // First an image is set, then SetSize is called.
- PushButton pushButton = PushButton::New();
- Stage::GetCurrent().Add( pushButton );
-
- pushButton.SetBackgroundImage( "Image.jpg" );
- pushButton.SetSize( 10.f, 10.f );
-
- application.SendNotification();
- application.Render();
-
- Vector3 size = pushButton.GetCurrentSize();
-
- DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliButtonSetSelectedBackgroundImageP(void)
-{
- ToolkitTestApplication application;
-
- PushButton button = PushButton::New();
- Stage::GetCurrent().Add( button );
-
- try
- {
- button.SetSelectedBackgroundImage( "TestImage.jpg");
- DALI_TEST_CHECK( true );
- }
- catch(...)
- {
- DALI_TEST_CHECK( false );
- }
-
- END_TEST;
-}
-
-int UtcDaliButtonSetSelectedBackgroundImageN(void)
-{
- ToolkitTestApplication application;
-
- PushButton button;
-
- try
- {
- button.SetSelectedBackgroundImage( "TestImage.jpg");
- DALI_TEST_CHECK( false );
- }
- catch(...)
- {
- DALI_TEST_CHECK( true );
- }
-
- END_TEST;
-}
-
-int UtcDaliButtonSetDisabledImageP(void)
-{
- ToolkitTestApplication application;
-
- PushButton button = PushButton::New();
- Stage::GetCurrent().Add( button );
-
- try
- {
- button.SetDisabledImage( "TestImage.jpg");
- DALI_TEST_CHECK( true );
- }
- catch(...)
- {
- DALI_TEST_CHECK( false );
- }
-
- END_TEST;
-}
-
-int UtcDaliButtonSetDisabledImageN(void)
-{
- ToolkitTestApplication application;
-
- PushButton button;
-
- try
- {
- button.SetDisabledImage( "TestImage.jpg");
- DALI_TEST_CHECK( false );
- }
- catch(...)
- {
- DALI_TEST_CHECK( true );
- }
-
- END_TEST;
-}
-
-int UtcDaliButtonSetDisabledSelectedImageP(void)
-{
- ToolkitTestApplication application;
-
- PushButton button = PushButton::New();
- Stage::GetCurrent().Add( button );
-
- try
- {
- button.SetDisabledSelectedImage( "TestImage.jpg");
- DALI_TEST_CHECK( true );
- }
- catch(...)
- {
- DALI_TEST_CHECK( false );
- }
-
- END_TEST;
-}
-
-int UtcDaliButtonSetDisabledSelectedImageN(void)
-{
- ToolkitTestApplication application;
-
- PushButton button;
-
- try
- {
- button.SetDisabledSelectedImage( "TestImage.jpg");
- DALI_TEST_CHECK( false );
- }
- catch(...)
- {
- DALI_TEST_CHECK( true );
- }
-
- END_TEST;
-}
-int UtcDaliButtonSetLabeActorlP(void)
-{
- ToolkitTestApplication application;
-
- PushButton button = PushButton::New();
- Stage::GetCurrent().Add( button );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>( pushButton.GetPropertyIndex("disabled")), false, TEST_LOCATION );
- try
- {
- button.SetLabel( TextLabel::New("Hello") );
- DALI_TEST_CHECK( true );
- }
- catch(...)
- {
- DALI_TEST_CHECK( false );
- }
+ pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), true);
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>( pushButton.GetPropertyIndex("disabled")), true, TEST_LOCATION );
END_TEST;
}
-int UtcDaliButtonSetLabelN(void)
-{
- ToolkitTestApplication application;
-
- PushButton button;
-
- try
- {
- button.SetLabel( TextLabel::New("Hello") );
- DALI_TEST_CHECK( false );
- }
- catch(...)
- {
- DALI_TEST_CHECK( true );
- }
+// Deprecated API Tests
- END_TEST;
-}
-
-int UtcDaliButtonSetButtonImageP(void)
+int UtcDaliButtonSetDisabledP(void)
{
ToolkitTestApplication application;
- PushButton button = PushButton::New();
- Stage::GetCurrent().Add( button );
-
- try
- {
- ResourceImage image1 = ResourceImage::New( TEST_IMAGE_ONE );
- button.SetButtonImage( image1 );
-
- Property::Value value = button.GetProperty(Button::Property::UNSELECTED_STATE_IMAGE );
- DALI_TEST_CHECK( value.Get<std::string>() == TEST_IMAGE_ONE );
- }
- catch(...)
- {
- DALI_TEST_CHECK( false );
- }
-
- std::string imageUrl;
-
- Dali::Actor actor = button.GetButtonImage();
+ Button button = PushButton::New();
- Toolkit::ImageView imageView = Toolkit::ImageView ::DownCast( actor );
+ button.SetDisabled( true );
- tet_infoline(" UtcDaliButtonSetButtonImageP Ensure an ImageView is returned\n");
- DALI_TEST_CHECK ( imageView )
+ DALI_TEST_CHECK( button.IsDisabled() );
- END_TEST;
-}
+ button.SetDisabled( false );
-int UtcDaliButtonSetButtonImageN(void)
-{
- ToolkitTestApplication application;
+ DALI_TEST_CHECK( !button.IsDisabled() );
- PushButton button;
+ button.SetDisabled( true );
- try
- {
- ResourceImage image1 = ResourceImage::New( TEST_IMAGE_ONE );
- button.SetButtonImage( image1 );
+ DALI_TEST_CHECK( button.IsDisabled() );
- DALI_TEST_CHECK( false );
- }
- catch(...)
- {
- DALI_TEST_CHECK( true );
- }
+ button.SetDisabled( false );
+ DALI_TEST_CHECK( !button.IsDisabled() );
END_TEST;
}
-int UtcDaliButtonSetSelectedImageWithImageP(void)
+int UtcDaliButtonSetAutoRepeatingP(void)
{
ToolkitTestApplication application;
- PushButton button = PushButton::New();
- Stage::GetCurrent().Add( button );
- ResourceImage image1 = ResourceImage::New( TEST_IMAGE_ONE );
-
- try
- {
- button.SetSelectedImage( image1 );
- Property::Value value = button.GetProperty( Button::Property::SELECTED_STATE_IMAGE );
- DALI_TEST_CHECK( value.Get<std::string>() == TEST_IMAGE_ONE );
- }
- catch(...)
- {
- DALI_TEST_CHECK( false );
- }
-
- std::string imageUrl;
+ Button button = PushButton::New();
- Dali::Actor actor = button.GetSelectedImage();
+ button.SetAutoRepeating( true );
- Toolkit::ImageView imageView = Toolkit::ImageView::DownCast( actor );
+ DALI_TEST_CHECK( button.IsAutoRepeating() );
- tet_infoline(" UtcDaliButtonSetSelectedImageWithImageP Ensure an ImageView is returned\n");
+ button.SetAutoRepeating( false );
- END_TEST;
-}
+ DALI_TEST_CHECK( !button.IsAutoRepeating() );
-int UtcDaliButtonSetSelectedImageWithImageN(void)
-{
- ToolkitTestApplication application;
+ button.SetAutoRepeating( true );
- PushButton button;
+ DALI_TEST_CHECK( button.IsAutoRepeating() );
- try
- {
- button.SetSelectedImage( CreateBufferImage( 10, 10, Color::WHITE ) );
- DALI_TEST_CHECK( false );
- }
- catch(...)
- {
- DALI_TEST_CHECK( true );
- }
+ button.SetAutoRepeating( false );
+ DALI_TEST_CHECK( !button.IsAutoRepeating() );
END_TEST;
}
-int UtcDaliButtonSetSelectedColorP(void)
+int UtcDaliButtonSetInitialAutoRepeatingDelayP(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliButtonSetSelectedColorP");
- PushButton pushButton = PushButton::New();
- Stage::GetCurrent().Add( pushButton );
-
- application.SendNotification();
- application.Render();
-
- const Vector4 SET_COLOR = Color::BLUE;
-
- pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
- pushButton.SetProperty( Button::Property::SELECTED_COLOR, SET_COLOR );
+ Button button = PushButton::New();
- application.SendNotification();
- application.Render();
+ button.SetInitialAutoRepeatingDelay( 0.5f );
- Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
+ DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
- DALI_TEST_EQUALS( color, SET_COLOR, TEST_LOCATION );
+ button.SetInitialAutoRepeatingDelay( 0.2f );
+ DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
END_TEST;
}
-int UtcDaliButtonSetUnSelectedColorP(void)
+int UtcDaliButtonSetNextAutoRepeatingDelayP(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliButtonSetUnSelectedColorP");
-
- PushButton pushButton = PushButton::New();
- Stage::GetCurrent().Add( pushButton );
-
- application.SendNotification();
- application.Render();
- const Vector4 SET_COLOR = Color::BLUE;
-
- pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
- pushButton.SetProperty( Button::Property::UNSELECTED_COLOR, SET_COLOR );
+ Button button = PushButton::New();
- application.SendNotification();
- application.Render();
+ button.SetNextAutoRepeatingDelay( 0.5f );
- Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::UNSELECTED_COLOR );
+ DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
- DALI_TEST_EQUALS( color, SET_COLOR, TEST_LOCATION );
+ button.SetProperty( Button::Property::NEXT_AUTO_REPEATING_DELAY, 0.2f );
+ DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
END_TEST;
}
-int UtcDaliButtonResetSelectedColorP(void)
+int UtcDaliButtonSetTogglableButtonP(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliButtonSetSelectedColorP");
-
- PushButton pushButton = PushButton::New();
- Stage::GetCurrent().Add( pushButton );
-
- application.SendNotification();
- application.Render();
-
- const Vector4 FIRST_COLOR = Color::BLUE;
- const Vector4 SECOND_COLOR = Color::BLUE;
-
- pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
- pushButton.SetProperty( Button::Property::SELECTED_COLOR, FIRST_COLOR );
- application.SendNotification();
- application.Render();
-
- Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
-
- DALI_TEST_EQUALS( color, FIRST_COLOR, TEST_LOCATION );
-
- pushButton.SetProperty( Button::Property::SELECTED_COLOR, SECOND_COLOR );
+ Button button = PushButton::New();
- application.SendNotification();
- application.Render();
+ button.SetTogglableButton( true );
- color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
+ DALI_TEST_CHECK( button.IsTogglableButton() );
- DALI_TEST_EQUALS( color, SECOND_COLOR, TEST_LOCATION );
+ button.SetTogglableButton( false );
+ DALI_TEST_CHECK( !button.IsTogglableButton() );
END_TEST;
}
-int UtcDaliButtonSetImagesWithDeprecatedProperties(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliButtonSetImagesWithDeprecatedProperties");
-
- PushButton pushButton = PushButton::New();
-
- Stage::GetCurrent().Add( pushButton );
-
- Property::Map propertyMap;
- propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
- propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
-
- DALI_TEST_EQUALS( pushButton.GetRendererCount(), 0, TEST_LOCATION );
-
- pushButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, propertyMap );
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( pushButton.GetRendererCount(), 1, TEST_LOCATION );
-
- tet_infoline(" Set state to selected and provide SELECTED visual");
- pushButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, propertyMap );
- pushButton.SetProperty( Toolkit::Button::Property::SELECTED, true );
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( pushButton.GetRendererCount(), 1, TEST_LOCATION );
-
- tet_infoline(" Set state to selected, disabled and provide DISABLED_STATE_IMAGE visual");
- pushButton.SetProperty( Toolkit::Button::Property::SELECTED, false );
- pushButton.SetProperty( Toolkit::Button::Property::DISABLED, true );
- pushButton.SetProperty( Toolkit::Button::Property::DISABLED_STATE_IMAGE, propertyMap );
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( pushButton.GetRendererCount(), 1, TEST_LOCATION );
-
-END_TEST;
-}
-
-int UtcDaliButtonSetGetDepreciatedPropertiesWithURL(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliButtonSetGetDepreciatedPropertiesWithURL");
-
- PushButton button = PushButton::New();
- Stage::GetCurrent().Add( button );
-
- tet_infoline(" Set state to selected, disabled and provide DISABLED_STATE_IMAGE visual");
- button.SetProperty( Toolkit::Button::Property::DISABLED, true );
- button.SetProperty( Toolkit::Button::Property::DISABLED_STATE_IMAGE, TEST_IMAGE_ONE );
-
- Property::Value value = button.GetProperty(Button::Property::DISABLED_STATE_IMAGE );
- DALI_TEST_EQUALS( value.Get<std::string>(), TEST_IMAGE_ONE, TEST_LOCATION );
-
-END_TEST;
-}
-
-int UtcDaliButtonSetLabelTextDeprecatedPropertyP(void)
+int UtcDaliButtonSetSelectedP(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliButtonSetLabelTextDeprecatedPropertyP");
-
- const std::string TEST_LABEL1 = "test label one";
- const std::string TEST_LABEL2 = "test label two";
Button button = PushButton::New();
+ button.SetTogglableButton( true );
- button.SetProperty( Toolkit::Button::Property::LABEL,
- Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
- .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
- );
-
- button.SetProperty( Button::Property::LABEL_TEXT, TEST_LABEL1 );
-
- std::string labelText = button.GetProperty<std::string>( Button::Property::LABEL_TEXT );
-
- DALI_TEST_EQUALS( labelText, TEST_LABEL1, TEST_LOCATION );
-
- Property::Map propertyMap;
- propertyMap.Insert( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT );
- propertyMap.Insert( Toolkit::TextVisual::Property::TEXT, TEST_LABEL2 );
- propertyMap.Insert( Toolkit::TextVisual::Property::TEXT_COLOR, Color::BLUE );
- propertyMap.Insert( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f );
- button.SetProperty( Button::Property::LABEL, propertyMap );
+ button.SetSelected( true );
- labelText = button.GetProperty<std::string>( Button::Property::LABEL_TEXT );
+ DALI_TEST_CHECK( button.IsSelected() );
- DALI_TEST_EQUALS( labelText, TEST_LABEL2, TEST_LOCATION );
+ button.SetSelected( false );
+ DALI_TEST_CHECK( !button.IsSelected() );
END_TEST;
}
static bool gCheckBoxButtonState = false;
bool CheckBoxButtonClicked( Button button )
{
- gCheckBoxButtonState = button.IsSelected();
+ gCheckBoxButtonState = button.GetProperty<bool>(button.GetPropertyIndex("selected")) ;
return true;
}
static const char* TEST_IMAGE_ONE = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
const Vector2 TEST_IMAGE_SIZE = Vector2( 66.0f, 66.0f );
+static std::string GetButtonText( Button button )
+{
+ Property::Value value = button.GetProperty( Toolkit::Button::Property::LABEL );
+
+ Property::Map *labelProperty = value.GetMap();
+
+ std::string textLabel;
+
+ if ( labelProperty )
+ {
+ Property::Value* value = labelProperty->Find( Toolkit::TextVisual::Property::TEXT );
+ value->Get( textLabel );
+ }
+
+ return textLabel;
+}
} // namespace
END_TEST;
}
-int UtcDaliCheckBoxButtonSetGetSelected(void)
+int UtcDaliCheckBoxButtonSelectedPropertyP(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliCheckBoxButtonSetGetSelected");
// global var used to check if CheckBoxButtonClicked is called;
gCheckBoxButtonState = false;
- checkBoxButton.SetSelected( true );
+ checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("selected"), true );
- DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+ DALI_TEST_EQUALS( checkBoxButton.GetProperty<bool>(checkBoxButton.GetPropertyIndex("selected")), true, TEST_LOCATION );
DALI_TEST_CHECK( gCheckBoxButtonState );
- checkBoxButton.SetSelected( false );
+ checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("selected"), false );
- DALI_TEST_CHECK( !checkBoxButton.IsSelected() );
+ DALI_TEST_EQUALS( checkBoxButton.GetProperty<bool>(checkBoxButton.GetPropertyIndex("selected")), false, TEST_LOCATION );
DALI_TEST_CHECK( !gCheckBoxButtonState );
- checkBoxButton.SetSelected( true );
+ checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("selected"), true );
- DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+ DALI_TEST_EQUALS( checkBoxButton.GetProperty<bool>(checkBoxButton.GetPropertyIndex("selected")), true, TEST_LOCATION );
DALI_TEST_CHECK( gCheckBoxButtonState );
END_TEST;
}
checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
- DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION ); // Change to use GerProperty once that code is implemented
+ DALI_TEST_EQUALS( GetButtonText( checkBox ) , "activate", TEST_LOCATION );
END_TEST;
}
-int UtcDaliCheckBoxSetLabelDisabledP(void)
+int UtcDaliCheckBoxSetDisabledPropertyP(void)
{
TestApplication application;
Stage::GetCurrent().Add( checkBox );
checkBox.SetSize( Vector2( 20.0f, 20.0f ) );
- checkBox.SetDisabledBackgroundImage( "Image.jpg" );
+ checkBox.SetProperty(checkBox.GetPropertyIndex("disabledUnselectedBackgroundVisual"), "Image.jpg" );
application.SendNotification();
application.Render();
checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), true);
checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
- DALI_TEST_CHECK( checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
- DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION ); // Change to use GetProperty once that code is implemented
+ DALI_TEST_EQUALS( checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( GetButtonText( checkBox ) , "activate", TEST_LOCATION );
END_TEST;
}
END_TEST;
}
+
+// Deprecated API Tests
+
+int UtcDaliCheckBoxButtonSetGetSelected(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCheckBoxButtonSetGetSelected");
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ checkBoxButton.StateChangedSignal().Connect( &CheckBoxButtonClicked );
+
+ // global var used to check if CheckBoxButtonClicked is called;
+ gCheckBoxButtonState = false;
+
+ checkBoxButton.SetSelected( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+ DALI_TEST_CHECK( gCheckBoxButtonState );
+
+ checkBoxButton.SetSelected( false );
+
+ DALI_TEST_CHECK( !checkBoxButton.IsSelected() );
+ DALI_TEST_CHECK( !gCheckBoxButtonState );
+
+ checkBoxButton.SetSelected( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+ DALI_TEST_CHECK( gCheckBoxButtonState );
+ END_TEST;
+}
+
+int UtcDaliCheckBoxSetLabelDisabledP(void)
+{
+ TestApplication application;
+
+ CheckBoxButton checkBox = CheckBoxButton::New();
+ Stage::GetCurrent().Add( checkBox );
+
+ checkBox.SetSize( Vector2( 20.0f, 20.0f ) );
+ checkBox.SetDisabledBackgroundImage( "Image.jpg" );
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Map propertyMap;
+
+ propertyMap.Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+ .Add( Toolkit::TextVisual::Property::TEXT, "activate" )
+ .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f );
+
+ checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), true);
+ checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
+
+ DALI_TEST_CHECK( checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
+ DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION );
+
+ END_TEST;
+}
\ No newline at end of file
static bool gPushButtonSelectedState = false;
bool PushButtonSelected( Button button )
{
- gPushButtonSelectedState = button.IsSelected();
+ gPushButtonSelectedState = button.GetProperty<bool>(button.GetPropertyIndex("selected") );
return true;
}
}
}
+static std::string GetButtonText( Button button )
+{
+ Property::Value value = button.GetProperty( Toolkit::Button::Property::LABEL );
+
+ Property::Map *labelProperty = value.GetMap();
+
+ std::string textLabel;
+
+ if ( labelProperty )
+ {
+ Property::Value* value = labelProperty->Find( Toolkit::TextVisual::Property::TEXT );
+ value->Get( textLabel );
+ }
+
+ return textLabel;
+}
+
} //namespace
int UtcDaliPushButtonConstructorP(void)
END_TEST;
}
-int UtcDaliPushButtonSetGetAutoRepeating(void)
+int UtcDaliPushButtonAutoRepeatingProperty(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating");
PushButton pushButton = PushButton::New();
- pushButton.SetAutoRepeating( true );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("autoRepeating"), true );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
- DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("autoRepeating"), false );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), false, TEST_LOCATION );
- pushButton.SetAutoRepeating( false );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("autoRepeating"), true );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
- DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
-
- pushButton.SetAutoRepeating( true );
-
- DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
- END_TEST;
+ END_TEST;
}
int UtcDaliPushButtonSetAutoRepeating(void)
END_TEST;
}
-int UtcDaliPushButtonSetGetTogglableButton(void)
+int UtcDaliPushButtonTogglableProperty(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliPushButtonSetGetTogglableButton");
PushButton pushButton = PushButton::New();
- pushButton.SetTogglableButton( true );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), true, TEST_LOCATION );
- DALI_TEST_CHECK( pushButton.IsTogglableButton() );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), false );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), false, TEST_LOCATION );
- pushButton.SetTogglableButton( false );
-
- DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
-
- pushButton.SetTogglableButton( true );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), true, TEST_LOCATION );
- DALI_TEST_CHECK( pushButton.IsTogglableButton() );
END_TEST;
}
-int UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton(void)
+int UtcDaliPushButtonAutoRepeatingPropertyAndTogglableButton(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton");
PushButton pushButton = PushButton::New();
- pushButton.SetAutoRepeating( true );
- pushButton.SetTogglableButton( true );
+ pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
- DALI_TEST_CHECK( pushButton.IsTogglableButton() );
- DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), false, TEST_LOCATION );
- pushButton.SetTogglableButton( true );
- pushButton.SetAutoRepeating( true );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
+ pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
- DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
- DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), false, TEST_LOCATION );
END_TEST;
}
-int UtcDaliPushButtonSetGetSelected01(void)
+int UtcDaliPushButtonSelectedProperty01(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliPushButtonSetGetSelected01");
PushButton pushButton = PushButton::New();
- pushButton.SetTogglableButton( true );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
+
pushButton.StateChangedSignal().Connect( &PushButtonSelected );
gPushButtonSelectedState = false;
- pushButton.SetSelected( true );
+ pushButton.SetProperty( Button::Property::SELECTED, true );
- DALI_TEST_CHECK( pushButton.IsSelected() );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED ), true , TEST_LOCATION );
DALI_TEST_CHECK( gPushButtonSelectedState );
- pushButton.SetSelected( false );
+ pushButton.SetProperty( Button::Property::SELECTED, false );
- DALI_TEST_CHECK( !pushButton.IsSelected() );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED ), false , TEST_LOCATION );
DALI_TEST_CHECK( !gPushButtonSelectedState );
- pushButton.SetSelected( true );
+ pushButton.SetProperty( Button::Property::SELECTED, true );
- DALI_TEST_CHECK( pushButton.IsSelected() );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED ), true , TEST_LOCATION );
DALI_TEST_CHECK( gPushButtonSelectedState );
END_TEST;
}
-int UtcDaliPushButtonSetGetSelected02(void)
+int UtcDaliPushButtonSelectedProperty02(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliPushButtonSetGetSelected02");
PushButton pushButton = PushButton::New();
- pushButton.SetTogglableButton( false );
+ pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), false );
pushButton.StateChangedSignal().Connect( &PushButtonSelected );
gPushButtonSelectedState = false;
- pushButton.SetSelected( true );
+ pushButton.SetProperty( Button::Property::SELECTED, true );
- DALI_TEST_CHECK( !pushButton.IsSelected() );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED ), false , TEST_LOCATION );
DALI_TEST_CHECK( !gPushButtonSelectedState );
- pushButton.SetSelected( false );
+ pushButton.SetProperty( Button::Property::SELECTED, false );
- DALI_TEST_CHECK( !pushButton.IsSelected() );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED ), false , TEST_LOCATION );
DALI_TEST_CHECK( !gPushButtonSelectedState );
- pushButton.SetSelected( true );
+ pushButton.SetProperty( Button::Property::SELECTED, true );
- DALI_TEST_CHECK( !pushButton.IsSelected() );
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED ), false , TEST_LOCATION );
DALI_TEST_CHECK( !gPushButtonSelectedState );
END_TEST;
}
-int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void)
+int UtcDaliPushButtonAutorepeatingDelayPropertyValues01(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01");
PushButton pushButton = PushButton::New();
- pushButton.SetAutoRepeating( true );
+ pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
- pushButton.SetInitialAutoRepeatingDelay( 1.f );
- DALI_TEST_EQUALS( pushButton.GetInitialAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+ pushButton.SetProperty( Button::Property::INITIAL_AUTO_REPEATING_DELAY, 1.f );
+
+ DALI_TEST_EQUALS( pushButton.GetProperty<float>(pushButton.GetPropertyIndex("initialAutoRepeatingDelay") ), 1.f, TEST_LOCATION );
- pushButton.SetNextAutoRepeatingDelay( 1.f );
- DALI_TEST_EQUALS( pushButton.GetNextAutoRepeatingDelay(), 1.f, TEST_LOCATION );
END_TEST;
}
-int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
+int UtcDaliPushButtonAutorepeatingDelayPropertyValues02(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02");
bool assert1( false );
bool assert2( false );
- pushButton.SetAutoRepeating( true );
+ pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
try
{
- pushButton.SetInitialAutoRepeatingDelay( -1.f );
+ pushButton.SetProperty( Button::Property::INITIAL_AUTO_REPEATING_DELAY, -1.f );
}
catch( Dali::DaliException& e )
{
try
{
- pushButton.SetNextAutoRepeatingDelay( -1.f );
+ pushButton.SetProperty( Button::Property::NEXT_AUTO_REPEATING_DELAY, -1.f );
}
catch( Dali::DaliException& e )
{
END_TEST;
}
-int UtcDaliPushButtonSetLabelText(void)
+int UtcDaliPushButtonLabelProperty(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliPushButtonSetLabelText");
PushButton pushButton = PushButton::New();
- pushButton.SetProperty( Toolkit::Button::Property::LABEL,
- Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
- .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
- );
-
application.SendNotification();
application.Render();
- pushButton.SetLabelText( STR );
+ pushButton.SetProperty( Toolkit::Button::Property::LABEL,
+ Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+ .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
+ );
- DALI_TEST_EQUALS( pushButton.GetLabelText(), STR, TEST_LOCATION );
+
+ pushButton.SetProperty( Toolkit::Button::Property::LABEL, STR );
+
+ DALI_TEST_EQUALS( GetButtonText( pushButton ), STR, TEST_LOCATION );
END_TEST;
}
DALI_TEST_CHECK( !gPushButtonSelectedState );
// Set togglable property.
- pushButton.SetTogglableButton( true );
+ pushButton.SetProperty( Button::Property::TOGGLABLE, true );
// Test2. Touch point down and up inside the button twice.
gPushButtonSelectedState = false;
// Test5. Touch point down outside and up inside the button.
// Start in unselected state
pushButton.SetProperty( Button::Property::SELECTED, false );
- DALI_TEST_CHECK( !pushButton.IsSelected());
+
+ DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("selected") ),false , TEST_LOCATION );
gPushButtonSelectedState = false;
event = Dali::Integration::TouchEvent();
DALI_TEST_EQUALS( size, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Check label only padding
- pushButton.SetLabelText( "Label" );
+ pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Label" );
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( size, expectedIconAndPaddingSize, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Now test padding for both label and icon simultaneously.
- pushButton.SetLabelText( "Label" );
+ pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Label" );
+
application.SendNotification();
application.Render();
Stage::GetCurrent().Add( pushButton );
// Add a label and get size of control
- pushButton.SetLabelText( "Label" );
+ pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Label" );
application.SendNotification();
application.Render();
END_TEST;
}
+
+// Deprecated API Tests
+
+int UtcDaliPushButtonSetGetAutoRepeating(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAutoRepeating( true );
+
+ DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+
+ pushButton.SetAutoRepeating( false );
+
+ DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+
+ pushButton.SetAutoRepeating( true );
+
+ DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetTogglableButton(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetTogglableButton");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetTogglableButton( true );
+
+ DALI_TEST_CHECK( pushButton.IsTogglableButton() );
+
+ pushButton.SetTogglableButton( false );
+
+ DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
+
+ pushButton.SetTogglableButton( true );
+
+ DALI_TEST_CHECK( pushButton.IsTogglableButton() );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAutoRepeating( true );
+ pushButton.SetTogglableButton( true );
+
+ DALI_TEST_CHECK( pushButton.IsTogglableButton() );
+ DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+
+ pushButton.SetTogglableButton( true );
+ pushButton.SetAutoRepeating( true );
+
+ DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+ DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetSelected01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetSelected01");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetTogglableButton( true );
+ pushButton.StateChangedSignal().Connect( &PushButtonSelected );
+
+ gPushButtonSelectedState = false;
+ pushButton.SetSelected( true );
+
+ DALI_TEST_CHECK( pushButton.IsSelected() );
+ DALI_TEST_CHECK( gPushButtonSelectedState );
+
+ pushButton.SetSelected( false );
+
+ DALI_TEST_CHECK( !pushButton.IsSelected() );
+ DALI_TEST_CHECK( !gPushButtonSelectedState );
+
+ pushButton.SetSelected( true );
+
+ DALI_TEST_CHECK( pushButton.IsSelected() );
+ DALI_TEST_CHECK( gPushButtonSelectedState );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetSelected02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetSelected02");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetTogglableButton( false );
+ pushButton.StateChangedSignal().Connect( &PushButtonSelected );
+
+ gPushButtonSelectedState = false;
+ pushButton.SetSelected( true );
+
+ DALI_TEST_CHECK( !pushButton.IsSelected() );
+ DALI_TEST_CHECK( !gPushButtonSelectedState );
+
+ pushButton.SetSelected( false );
+
+ DALI_TEST_CHECK( !pushButton.IsSelected() );
+ DALI_TEST_CHECK( !gPushButtonSelectedState );
+
+ pushButton.SetSelected( true );
+
+ DALI_TEST_CHECK( !pushButton.IsSelected() );
+ DALI_TEST_CHECK( !gPushButtonSelectedState );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAutoRepeating( true );
+
+ pushButton.SetInitialAutoRepeatingDelay( 1.f );
+ DALI_TEST_EQUALS( pushButton.GetInitialAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+
+ pushButton.SetNextAutoRepeatingDelay( 1.f );
+ DALI_TEST_EQUALS( pushButton.GetNextAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02");
+
+ PushButton pushButton = PushButton::New();
+
+ bool assert1( false );
+ bool assert2( false );
+
+ pushButton.SetAutoRepeating( true );
+
+ try
+ {
+ pushButton.SetInitialAutoRepeatingDelay( -1.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_EQUALS(e.condition, "initialAutoRepeatingDelay > 0.f", TEST_LOCATION);
+ assert1 = true;
+ }
+
+ try
+ {
+ pushButton.SetNextAutoRepeatingDelay( -1.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_EQUALS(e.condition, "nextAutoRepeatingDelay > 0.f", TEST_LOCATION);
+ assert2 = true;
+ }
+
+ DALI_TEST_CHECK( assert1 && assert2 );
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetLabelText(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetLabelText");
+
+ const std::string STR( "Hola!" );
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetProperty( Toolkit::Button::Property::LABEL,
+ Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+ .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
+ );
+
+ application.SendNotification();
+ application.Render();
+
+ pushButton.SetLabelText( STR );
+
+ DALI_TEST_EQUALS( pushButton.GetLabelText(), STR, TEST_LOCATION );
+
+ END_TEST;
+}
gObjectCreatedCallBackCalled = true;
}
+static std::string GetButtonText( Button button )
+{
+ Property::Value value = button.GetProperty( Toolkit::Button::Property::LABEL );
+
+ Property::Map *labelProperty = value.GetMap();
+
+ std::string textLabel;
+
+ if ( labelProperty )
+ {
+ Property::Value* value = labelProperty->Find( Toolkit::TextVisual::Property::TEXT );
+ value->Get( textLabel );
+ }
+
+ return textLabel;
+}
+
}
int UtcDaliRadioButtonConstructorP(void)
END_TEST;
}
-int UtcDaliRadioButtonLabelActor(void)
+int UtcDaliRadioButtonLabelProperty(void)
{
ToolkitTestApplication application;
- std::string labelText = "test actor 1";
+ const std::string labelText = "test actor 1";
RadioButton radioButton = RadioButton::New();
.Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
);
- radioButton.SetLabelText( labelText );
+ radioButton.SetProperty( Toolkit::Button::Property::LABEL, labelText );
+ DALI_TEST_EQUALS( GetButtonText( radioButton ), labelText, TEST_LOCATION );
- DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText, TEST_LOCATION );
std::string labelText2 = "test actor 2";
- radioButton.SetLabelText( labelText2 );
- DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText2, TEST_LOCATION );
-
- END_TEST;
-}
+ radioButton.SetProperty( Toolkit::Button::Property::LABEL, labelText2 );
-int UtcDaliRadioButtonSelected(void)
-{
- ToolkitTestApplication application;
-
- RadioButton radioButton = RadioButton::New();
-
- // Default selected
- DALI_TEST_CHECK( radioButton.IsSelected() == false );
-
- // False
- radioButton.SetSelected( false );
- DALI_TEST_CHECK( radioButton.IsSelected() == false );
-
- // True
- radioButton.SetSelected( true );
- DALI_TEST_CHECK( radioButton.IsSelected() == true );
-
- // False
- radioButton.SetSelected( false );
- DALI_TEST_CHECK( radioButton.IsSelected() == false );
+ DALI_TEST_EQUALS( GetButtonText( radioButton ), labelText2, TEST_LOCATION );
END_TEST;
}
END_TEST;
}
+
+
+// Deprecated API Tests
+
+int UtcDaliRadioButtonLabelActor(void)
+{
+ ToolkitTestApplication application;
+
+ std::string labelText = "test actor 1";
+
+ RadioButton radioButton = RadioButton::New();
+
+ radioButton.SetProperty( Toolkit::Button::Property::LABEL,
+ Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+ .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
+ );
+
+ radioButton.SetLabelText( labelText );
+
+ DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText, TEST_LOCATION );
+
+ std::string labelText2 = "test actor 2";
+ radioButton.SetLabelText( labelText2 );
+ DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText2, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliRadioButtonSelected(void)
+{
+ ToolkitTestApplication application;
+
+ RadioButton radioButton = RadioButton::New();
+
+ // Default selected
+ DALI_TEST_CHECK( radioButton.IsSelected() == false );
+
+ // False
+ radioButton.SetSelected( false );
+ DALI_TEST_CHECK( radioButton.IsSelected() == false );
+
+ // True
+ radioButton.SetSelected( true );
+ DALI_TEST_CHECK( radioButton.IsSelected() == true );
+
+ // False
+ radioButton.SetSelected( false );
+ DALI_TEST_CHECK( radioButton.IsSelected() == false );
+
+ END_TEST;
+}
+
bool RadioButton::OnToggleReleased()
{
// Radio button overrides toggle release (button up) as doesn't allow un-selection to be performed on it directly.
- bool stateChanged = false;
- if( !IsSelected() )
- {
- Button::SetSelected( true ); // Set button to selected as previously unselected
- stateChanged = true;
- }
- return stateChanged;
+ return false;
}
void RadioButton::OnStateChange( State newState )
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
Toolkit::PushButton option = Toolkit::PushButton::New();
option.SetName( button.name );
- option.SetAnimationTime( 0.0f );
option.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
switch( button.id )
}
// 3. Set the normal option image (blank / Transparent).
- option.SetUnselectedImage( "" );
+ option.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, "" );
// 4. Set the pressed option image.
// The image can be blank, the color can be used regardless.
- option.SetSelectedImage( mPressedImage );
+ option.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, mPressedImage );
option.SetProperty( Toolkit::Button::Property::SELECTED_COLOR, mPressedColor );
option.SetProperty( Toolkit::Control::Property::STYLE_NAME, TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME );
./property-wrapper.rb
./constructor-generator.rb
+# have manual binding for View now, but cannot stop swig generating binding for
+# it as otherwise swig will not generate correct binding for any classes inherited
+# from it, therefore have to delete the automatic binding for View in the end
+ rm -f automatic/csharp/View.cs
+
dist-hook: $(BUILT_SOURCES)
mkdir -p $(distdir)/automatic/cpp
cp ./automatic/cpp/*.cpp $(distdir)/automatic/cpp
namespace MyCSharpExample
{
+ class MyView : View
+ {
+ private string _myOwnName;
+ public int _myCurrentValue;
+
+ public MyView()
+ {
+ _myCurrentValue = 0;
+ }
+
+ public string MyOwnName
+ {
+ get
+ {
+ return _myOwnName;
+ }
+ set
+ {
+ _myOwnName = value;
+ }
+ }
+ }
+
+ class MyButton : PushButton
+ {
+ private string _myOwnName;
+ public int _myCurrentValue;
+
+ public MyButton()
+ {
+ _myCurrentValue = 0;
+ }
+
+ public string MyOwnName
+ {
+ get
+ {
+ return _myOwnName;
+ }
+ set
+ {
+ _myOwnName = value;
+ }
+ }
+ }
+
+ class MySpin : Spin
+ {
+ private string _myOwnName;
+ public int _myCurrentValue;
+
+ public MySpin()
+ {
+ _myCurrentValue = 0;
+ }
+
+ public string MyOwnName
+ {
+ get
+ {
+ return _myOwnName;
+ }
+ set
+ {
+ _myOwnName = value;
+ }
+ }
+ }
+
class Example
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
color.B += 10;
color.A += 10;
Console.WriteLine( " Color r = " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A );
+
+ ViewDownCastTest();
}
public void RectanglePaddingClassTest()
}
}
+ public void ViewDownCastTest()
+ {
+ View container = new View();
+ container.Position = new Position(-800.0f, -800.0f, 0.0f);
+ Stage.GetCurrent().Add(container);
+
+ // Test downcast for native control
+ TextLabel myLabel = new TextLabel();
+ myLabel.Name = "MyLabelName";
+ myLabel.Text = "MyText";
+
+ Console.WriteLine("myLabel.Name = " + myLabel.Name + ", Text = " + myLabel.Text);
+
+ container.Add(myLabel);
+
+ Actor myLabelActor = container.FindChildByName("MyLabelName");
+ if(myLabelActor)
+ {
+ TextLabel newLabel = View.DownCast<TextLabel>(myLabelActor);
+ if(newLabel)
+ {
+ Console.WriteLine("Downcast to TextLabel successful: newLabel Name = " + newLabel.Name + ", Text = " + newLabel.Text);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to TextLabel failed!");
+ }
+ }
+
+ // Test downcast for class directly inherited from View
+ MyView myView = new MyView();
+ myView.Name = "MyViewName";
+ myView.MyOwnName = "MyOwnViewName";
+ myView._myCurrentValue = 5;
+
+ Console.WriteLine("myView.Name = " + myView.Name + ", MyOwnName = " + myView.MyOwnName + ", myCurrentValue = " + myView._myCurrentValue);
+
+ container.Add(myView);
+
+ Actor myViewActor = container.FindChildByName("MyViewName");
+ if(myViewActor)
+ {
+ MyView newView = View.DownCast<MyView>(myViewActor);
+ if(newView)
+ {
+ Console.WriteLine("Downcast to MyView successful: newView Name = " + newView.Name + ", MyOwnName = " + newView.MyOwnName + ", myCurrentValue = " + newView._myCurrentValue);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to MyView failed!");
+ }
+ }
+
+ // Test downcast for class directly inherited from native control
+ MyButton myButton = new MyButton();
+ myButton.Name = "MyButtonName";
+ myButton.MyOwnName = "MyOwnViewName";
+ myButton.LabelText = "MyLabelText";
+ myButton._myCurrentValue = 5;
+
+ Console.WriteLine("myButton.Name = " + myButton.Name + ", MyOwnName = " + myButton.MyOwnName + ", LabelText = " + myButton.LabelText + ", myCurrentValue = " + myButton._myCurrentValue);
+
+ container.Add(myButton);
+
+ Actor myButtonActor = container.FindChildByName("MyButtonName");
+ if(myButtonActor)
+ {
+ MyButton newButton = View.DownCast<MyButton>(myButtonActor);
+ if(newButton)
+ {
+ Console.WriteLine("Downcast to MyButton successful: newButton Name = " + newButton.Name + ", MyOwnName = " + newButton.MyOwnName + ", LabelText = " + myButton.LabelText + ", myCurrentValue = " + newButton._myCurrentValue);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to MyButton failed!");
+ }
+ }
+
+ // Test downcast for a CustomView
+ Spin spin = new Spin();
+ spin.Name = "SpinName";
+ spin.MaxValue = 8888;
+
+ Console.WriteLine("spin.Name = " + spin.Name + ", MaxValue = " + spin.MaxValue);
+
+ container.Add(spin);
+
+ Actor spinActor = container.FindChildByName("SpinName");
+ if(spinActor)
+ {
+ Spin newSpin = View.DownCast<Spin>(spinActor);
+ if(newSpin)
+ {
+ Console.WriteLine("Downcast to Spin successful: newSpin Name = " + newSpin.Name + ", MaxValue = " + newSpin.MaxValue);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to Spin failed!");
+ }
+ }
+
+ // Test downcast for class inherited from a CustomView
+ MySpin mySpin = new MySpin();
+ mySpin.Name = "MySpinName";
+ mySpin.MyOwnName = "MyOwnSpinName";
+ mySpin.MaxValue = 8888;
+ mySpin._myCurrentValue = 5;
+
+ Console.WriteLine("mySpin.Name = " + mySpin.Name + ", MyOwnName = " + mySpin.MyOwnName + ", MaxValue = " + mySpin.MaxValue + ", currentValue = " + mySpin._myCurrentValue);
+
+ container.Add(mySpin);
+
+ Actor mySpinActor = container.FindChildByName("MySpinName");
+ if(mySpinActor)
+ {
+ MySpin newSpin = View.DownCast<MySpin>(mySpinActor);
+ if(newSpin)
+ {
+ Console.WriteLine("Downcast to MySpin successful: newSpin Name = " + newSpin.Name + ", MyOwnName = " + newSpin.MyOwnName + ", MaxValue = " + newSpin.MaxValue + ", currentValue = " + newSpin._myCurrentValue);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to MySpin failed!");
+ }
+ }
+ }
+
public void MainLoop()
{
_application.MainLoop ();
Actor month = actorTree.FindChildByName("Month" );
Actor day = actorTree.FindChildByName("Day");
- // need to get the actual C# View associated with the actor,
- _spinYear = (Spin ) ViewRegistry.GetCustomViewFromActor( year );
- _spinMonth = (Spin ) ViewRegistry.GetCustomViewFromActor( month );
- _spinDay = (Spin ) ViewRegistry.GetCustomViewFromActor( day );
+ // need to get the actual C# Spin object associated with the actor,
+ _spinYear = View.DownCast<Spin>( year );
+ _spinMonth = View.DownCast<Spin>( month );
+ _spinDay = View.DownCast<Spin>( day );
_spinYear.Value = 2099;
_spinMonth.Value = 5;
_spinDay.Value = 23;
-
_spinYear.SetKeyboardFocusable(true);
_spinMonth.SetKeyboardFocusable(true);
_spinDay.SetKeyboardFocusable(true);
-
FocusManager keyboardFocusManager = FocusManager.Instance;
keyboardFocusManager.PreFocusChange += OnKeyboardPreFocusChange;
keyboardFocusManager.FocusedActorEnterKeyPressed += OnFocusedActorEnterKeyPressed;
--- /dev/null
+/** Copyright (c) 2017 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.
+*
+*/
+
+namespace Dali {
+
+ using System;
+ using System.Runtime.InteropServices;
+
+
+public class View : CustomActor {
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+
+ internal View(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.View_SWIGUpcast(cPtr), cMemoryOwn) {
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+
+ // Register this instance of view in the view registry.
+ ViewRegistry.RegisterView(this);
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj) {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ }
+
+ ~View() {
+ DisposeQueue.Instance.Add(this);
+ }
+
+ public override void Dispose() {
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_View(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ base.Dispose();
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via KeyInputFocusGained signal
+ *
+ */
+ public class KeyInputFocusGainedEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that gets Key Input Focus
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via KeyInputFocusLost signal
+ *
+ */
+ public class KeyInputFocusLostEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that loses Key Input Focus
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via Key signal
+ *
+ */
+ public class KeyEventArgs : EventArgs
+ {
+ private View _view;
+ private Key _key;
+
+ /**
+ * @brief View - is the view that recieves the key.
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+
+ /**
+ * @brief Key - is the key sent to the View.
+ *
+ */
+ public Key Key
+ {
+ get
+ {
+ return _key;
+ }
+ set
+ {
+ _key = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via OnRelayout signal
+ *
+ */
+ public class OnRelayoutEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that is being resized upon relayout
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+ }
+
+
+ /**
+ * @brief Event arguments that passed via Touch signal
+ *
+ */
+ public class TouchEventArgs : EventArgs
+ {
+ private View _view;
+ private Touch _touch;
+
+ /**
+ * @brief View - is the view that is being touched
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+
+ /**
+ * @brief Touch - contains the information of touch points
+ *
+ */
+ public Touch Touch
+ {
+ get
+ {
+ return _touch;
+ }
+ set
+ {
+ _touch = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via Hover signal
+ *
+ */
+ public class HoverEventArgs : EventArgs
+ {
+ private View _view;
+ private Hover _hover;
+
+ /**
+ * @brief View - is the view that is being hovered
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+
+ /**
+ * @brief Hover - contains touch points that represent the points
+ * that are currently being hovered or the points where a hover has stopped
+ *
+ */
+ public Hover Hover
+ {
+ get
+ {
+ return _hover;
+ }
+ set
+ {
+ _hover = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via Wheel signal
+ *
+ */
+ public class WheelEventArgs : EventArgs
+ {
+ private View _view;
+ private Wheel _wheel;
+
+ /**
+ * @brief View - is the view that is being wheeled
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+
+ /**
+ * @brief Wheel - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL
+ *
+ */
+ public Wheel Wheel
+ {
+ get
+ {
+ return _wheel;
+ }
+ set
+ {
+ _wheel = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via OnStage signal
+ *
+ */
+ public class OnStageEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that is being connected to the stage
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via OffStage signal
+ *
+ */
+ public class OffStageEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that is being disconnected from the stage
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void KeyInputFocusGainedCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,KeyInputFocusGainedEventArgs> _KeyInputFocusGainedEventHandler;
+ private KeyInputFocusGainedCallbackDelegate _KeyInputFocusGainedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void KeyInputFocusLostCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,KeyInputFocusLostEventArgs> _KeyInputFocusLostEventHandler;
+ private KeyInputFocusLostCallbackDelegate _KeyInputFocusLostCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr key);
+ private DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> _KeyHandler;
+ private KeyCallbackDelegate _KeyCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OnRelayoutEventCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,OnRelayoutEventArgs> _viewOnRelayoutEventHandler;
+ private OnRelayoutEventCallbackDelegate _viewOnRelayoutEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool TouchCallbackDelegate(IntPtr view, IntPtr touch);
+ private DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> _viewTouchHandler;
+ private TouchCallbackDelegate _viewTouchCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool HoverCallbackDelegate(IntPtr view, IntPtr hover);
+ private DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> _viewHoverHandler;
+ private HoverCallbackDelegate _viewHoverCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool WheelCallbackDelegate(IntPtr view, IntPtr wheel);
+ private DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> _viewWheelHandler;
+ private WheelCallbackDelegate _viewWheelCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OnStageEventCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,OnStageEventArgs> _viewOnStageEventHandler;
+ private OnStageEventCallbackDelegate _viewOnStageEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OffStageEventCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,OffStageEventArgs> _viewOffStageEventHandler;
+ private OffStageEventCallbackDelegate _viewOffStageEventCallbackDelegate;
+
+ /**
+ * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyInputFocusGainedEventHandler-DaliEventHandler<object,KeyInputFocusGainedEventArgs>)
+ * provided by the user. KeyInputFocusGained signal is emitted when the control gets Key Input Focus.
+ */
+ public event DaliEventHandler<object,KeyInputFocusGainedEventArgs> KeyInputFocusGained
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_KeyInputFocusGainedEventHandler == null)
+ {
+ _KeyInputFocusGainedEventHandler += value;
+ Console.WriteLine("View Key EVENT Locked....");
+ _KeyInputFocusGainedCallbackDelegate = new KeyInputFocusGainedCallbackDelegate(OnKeyInputFocusGained);
+ this.KeyInputFocusGainedSignal().Connect(_KeyInputFocusGainedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_KeyInputFocusGainedEventHandler != null)
+ {
+ this.KeyInputFocusGainedSignal().Disconnect(_KeyInputFocusGainedCallbackDelegate);
+ }
+
+ _KeyInputFocusGainedEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnKeyInputFocusGained(IntPtr view)
+ {
+ KeyInputFocusGainedEventArgs e = new KeyInputFocusGainedEventArgs();
+ Console.WriteLine("View Key ....");
+ // Populate all members of "e" (KeyInputFocusGainedEventArgs) with real data
+ e.View = Dali.View.GetViewFromPtr(view);
+
+ if (_KeyInputFocusGainedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _KeyInputFocusGainedEventHandler(this, e);
+ }
+
+ }
+
+ /**
+ * @brief Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyInputFocusLostEventHandler-DaliEventHandler<object,KeyInputFocusLostEventArgs>)
+ * provided by the user. KeyInputFocusLost signal is emitted when the control loses Key Input Focus.
+ */
+ public event DaliEventHandler<object,KeyInputFocusLostEventArgs> KeyInputFocusLost
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_KeyInputFocusLostEventHandler == null)
+ {
+ _KeyInputFocusLostEventHandler += value;
+
+ _KeyInputFocusLostCallbackDelegate = new KeyInputFocusLostCallbackDelegate(OnKeyInputFocusLost);
+ this.KeyInputFocusLostSignal().Connect(_KeyInputFocusLostCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_KeyInputFocusLostEventHandler != null)
+ {
+ this.KeyInputFocusLostSignal().Disconnect(_KeyInputFocusLostCallbackDelegate);
+ }
+
+ _KeyInputFocusLostEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnKeyInputFocusLost(IntPtr view)
+ {
+ KeyInputFocusLostEventArgs e = new KeyInputFocusLostEventArgs();
+
+ // Populate all members of "e" (KeyInputFocusLostEventArgs) with real data
+ e.View = Dali.View.GetViewFromPtr(view);
+
+ if (_KeyInputFocusLostEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _KeyInputFocusLostEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyHandler-DaliEventHandlerWithReturnType<object,KeyEventArgs,bool>)
+ * provided by the user. KeyPressed signal is emitted when key event is received.
+ */
+ public event DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> KeyPressed
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_KeyHandler == null)
+ {
+ _KeyHandler += value;
+
+ _KeyCallbackDelegate = new KeyCallbackDelegate(OnKey);
+ this.KeyEventSignal().Connect(_KeyCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_KeyHandler != null)
+ {
+ this.KeyEventSignal().Disconnect(_KeyCallbackDelegate);
+ }
+
+ _KeyHandler -= value;
+ }
+ }
+ }
+
+ private bool OnKey(IntPtr view, IntPtr key)
+ {
+ KeyEventArgs e = new KeyEventArgs();
+
+ // Populate all members of "e" (KeyEventArgs) with real data
+ e.View = Dali.View.GetViewFromPtr(view);
+ e.Key = Dali.Key.GetKeyFromPtr(key);
+
+ if (_KeyHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _KeyHandler(this, e);
+ }
+ return false;
+
+ }
+
+ /**
+ * @brief Event for OnRelayout signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of OnRelayoutEventHandler) provided by the user.
+ * OnRelayout signal is emitted after the size has been set on the view during relayout.
+ */
+ public event DaliEventHandler<object,OnRelayoutEventArgs> OnRelayoutEvent
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewOnRelayoutEventHandler == null)
+ {
+ _viewOnRelayoutEventHandler += value;
+ Console.WriteLine("View OnRelayoutEventArgs Locked....");
+ _viewOnRelayoutEventCallbackDelegate = new OnRelayoutEventCallbackDelegate(OnRelayout);
+ this.OnRelayoutSignal().Connect(_viewOnRelayoutEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_viewOnRelayoutEventHandler != null)
+ {
+ this.OnRelayoutSignal().Disconnect(_viewOnRelayoutEventCallbackDelegate);
+ }
+
+ _viewOnRelayoutEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for View OnRelayout signal
+ private void OnRelayout(IntPtr data)
+ {
+ OnRelayoutEventArgs e = new OnRelayoutEventArgs();
+ Console.WriteLine("View OnRelayoutEventArgs....");
+ // Populate all members of "e" (OnRelayoutEventArgs) with real data
+ e.View = View.GetViewFromPtr(data);
+
+ if (_viewOnRelayoutEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _viewOnRelayoutEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of TouchHandler-DaliEventHandlerWithReturnType<object,TouchEventArgs,bool>)
+ * provided by the user. Touched signal is emitted when touch input is received.
+ */
+ public event DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> Touched
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewTouchHandler == null)
+ {
+ _viewTouchHandler += value;
+ Console.WriteLine("View Touch EVENT LOCKED....");
+ _viewTouchCallbackDelegate = new TouchCallbackDelegate(OnTouch);
+ this.TouchSignal().Connect(_viewTouchCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_viewTouchHandler != null)
+ {
+ this.TouchSignal().Disconnect(_viewTouchCallbackDelegate);
+ }
+
+ _viewTouchHandler -= value;
+ }
+ }
+ }
+
+ // Callback for View TouchSignal
+ private bool OnTouch(IntPtr view, IntPtr touch)
+ {
+ TouchEventArgs e = new TouchEventArgs();
+ Console.WriteLine("View Touch EVENT....");
+ // Populate all members of "e" (TouchEventArgs) with real data
+ e.View = View.GetViewFromPtr(view);
+ e.Touch = Dali.Touch.GetTouchFromPtr(touch);
+
+ if (_viewTouchHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _viewTouchHandler(this, e);
+ }
+
+ return false;
+ }
+
+ /**
+ * @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of HoverHandler-DaliEventHandlerWithReturnType<object,HoverEventArgs,bool>)
+ * provided by the user. Hovered signal is emitted when hover input is received.
+ */
+ public event DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> Hovered
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewHoverHandler == null)
+ {
+ _viewHoverHandler += value;
+
+ _viewHoverCallbackDelegate = new HoverCallbackDelegate(OnHover);
+ this.HoveredSignal().Connect(_viewHoverCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_viewHoverHandler != null)
+ {
+ this.HoveredSignal().Disconnect(_viewHoverCallbackDelegate);
+ }
+
+ _viewHoverHandler -= value;
+ }
+ }
+ }
+
+ // Callback for View Hover signal
+ private bool OnHover(IntPtr view, IntPtr hover)
+ {
+ HoverEventArgs e = new HoverEventArgs();
+
+ // Populate all members of "e" (HoverEventArgs) with real data
+ e.View = View.GetViewFromPtr(view);
+ e.Hover = Dali.Hover.GetHoverFromPtr(hover);
+
+ if (_viewHoverHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _viewHoverHandler(this, e);
+ }
+
+ return false;
+ }
+
+ /**
+ * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of WheelHandler-DaliEventHandlerWithReturnType<object,WheelEventArgs,bool>)
+ * provided by the user. WheelMoved signal is emitted when wheel event is received.
+ */
+ public event DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> WheelMoved
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewWheelHandler == null)
+ {
+ _viewWheelHandler += value;
+ Console.WriteLine("View Wheel EVENT LOCKED....");
+ _viewWheelCallbackDelegate = new WheelCallbackDelegate(OnWheel);
+ this.WheelEventSignal().Connect(_viewWheelCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_viewWheelHandler != null)
+ {
+ this.WheelEventSignal().Disconnect(_viewWheelCallbackDelegate);
+ }
+
+ _viewWheelHandler -= value;
+ }
+ }
+ }
+
+ // Callback for View Wheel signal
+ private bool OnWheel(IntPtr view, IntPtr wheel)
+ {
+ WheelEventArgs e = new WheelEventArgs();
+ Console.WriteLine("View Wheel EVENT ....");
+ // Populate all members of "e" (WheelEventArgs) with real data
+ e.View = View.GetViewFromPtr(view);
+ e.Wheel = Dali.Wheel.GetWheelFromPtr(wheel);
+
+ if (_viewWheelHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _viewWheelHandler(this, e);
+ }
+
+ return false;
+ }
+
+ /**
+ * @brief Event for OnStage signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of OnStageEventHandler) provided by the user.
+ * OnStage signal is emitted after the view has been connected to the stage.
+ */
+ public event DaliEventHandler<object,OnStageEventArgs> OnStageEvent
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewOnStageEventHandler == null)
+ {
+ _viewOnStageEventHandler += value;
+
+ _viewOnStageEventCallbackDelegate = new OnStageEventCallbackDelegate(OnStage);
+ this.OnStageSignal().Connect(_viewOnStageEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_viewOnStageEventHandler != null)
+ {
+ this.OnStageSignal().Disconnect(_viewOnStageEventCallbackDelegate);
+ }
+
+ _viewOnStageEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for View OnStage signal
+ private void OnStage(IntPtr data)
+ {
+ OnStageEventArgs e = new OnStageEventArgs();
+
+ // Populate all members of "e" (OnStageEventArgs) with real data
+ e.View = View.GetViewFromPtr(data);
+
+ //Console.WriteLine("############# OnStage()! e.View.Name=" + e.View.Name);
+
+ if (_viewOnStageEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _viewOnStageEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for OffStage signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of OffStageEventHandler) provided by the user.
+ * OffStage signal is emitted after the view has been disconnected from the stage.
+ */
+ public event DaliEventHandler<object,OffStageEventArgs> OffStageEvent
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewOffStageEventHandler == null)
+ {
+ _viewOffStageEventHandler += value;
+
+ _viewOffStageEventCallbackDelegate = new OffStageEventCallbackDelegate(OffStage);
+ this.OnStageSignal().Connect(_viewOffStageEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_viewOffStageEventHandler != null)
+ {
+ this.OnStageSignal().Disconnect(_viewOffStageEventCallbackDelegate);
+ }
+
+ _viewOffStageEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for View OffStage signal
+ private void OffStage(IntPtr data)
+ {
+ OffStageEventArgs e = new OffStageEventArgs();
+
+ // Populate all members of "e" (OffStageEventArgs) with real data
+ e.View = View.GetViewFromPtr(data);
+
+ if (_viewOffStageEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _viewOffStageEventHandler(this, e);
+ }
+ }
+
+ public static View GetViewFromPtr(global::System.IntPtr cPtr) {
+ View ret = new View(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public class Property : global::System.IDisposable {
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ protected bool swigCMemOwn;
+
+ internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ }
+
+ ~Property() {
+ Dispose();
+ }
+
+ public virtual void Dispose() {
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_View_Property(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+
+ public static readonly int TOOLTIP = NDalicManualPINVOKE.View_Property_TOOLTIP_get();
+ public static readonly int STATE = NDalicManualPINVOKE.View_Property_STATE_get();
+ public static readonly int SUB_STATE = NDalicManualPINVOKE.View_Property_SUB_STATE_get();
+
+ public Property() : this(NDalicPINVOKE.new_View_Property(), true) {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public static readonly int STYLE_NAME = NDalicPINVOKE.View_Property_STYLE_NAME_get();
+ public static readonly int BACKGROUND_COLOR = NDalicPINVOKE.View_Property_BACKGROUND_COLOR_get();
+ public static readonly int BACKGROUND_IMAGE = NDalicPINVOKE.View_Property_BACKGROUND_IMAGE_get();
+ public static readonly int KEY_INPUT_FOCUS = NDalicPINVOKE.View_Property_KEY_INPUT_FOCUS_get();
+ public static readonly int BACKGROUND = NDalicPINVOKE.View_Property_BACKGROUND_get();
+
+ }
+
+ public class KeyboardFocus : global::System.IDisposable {
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ protected bool swigCMemOwn;
+
+ internal KeyboardFocus(global::System.IntPtr cPtr, bool cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyboardFocus obj) {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ }
+
+ ~KeyboardFocus() {
+ Dispose();
+ }
+
+ public virtual void Dispose() {
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_View_KeyboardFocus(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+
+ public KeyboardFocus() : this(NDalicPINVOKE.new_View_KeyboardFocus(), true) {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public enum Direction {
+ LEFT,
+ RIGHT,
+ UP,
+ DOWN,
+ PAGE_UP,
+ PAGE_DOWN
+ }
+ }
+
+ public View () : this (NDalicPINVOKE.View_New(), true) {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ }
+ public View(View uiControl) : this(NDalicPINVOKE.new_View__SWIG_1(View.getCPtr(uiControl)), true) {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public View Assign(View handle) {
+ View ret = new View(NDalicPINVOKE.View_Assign(swigCPtr, View.getCPtr(handle)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private new static View DownCast(BaseHandle handle) {
+ View ret = new View(NDalicPINVOKE.View_DownCast(BaseHandle.getCPtr(handle)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public static T DownCast<T>(Actor actor) where T : View
+ {
+ return (T)( ViewRegistry.GetViewFromActor( actor ) );
+ }
+
+ public void SetKeyInputFocus() {
+ NDalicPINVOKE.View_SetKeyInputFocus(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public bool HasKeyInputFocus() {
+ bool ret = NDalicPINVOKE.View_HasKeyInputFocus(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public void ClearKeyInputFocus() {
+ NDalicPINVOKE.View_ClearKeyInputFocus(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public PinchGestureDetector GetPinchGestureDetector() {
+ PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.View_GetPinchGestureDetector(swigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public PanGestureDetector GetPanGestureDetector() {
+ PanGestureDetector ret = new PanGestureDetector(NDalicPINVOKE.View_GetPanGestureDetector(swigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public TapGestureDetector GetTapGestureDetector() {
+ TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.View_GetTapGestureDetector(swigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public LongPressGestureDetector GetLongPressGestureDetector() {
+ LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.View_GetLongPressGestureDetector(swigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public void SetStyleName(string styleName) {
+ NDalicPINVOKE.View_SetStyleName(swigCPtr, styleName);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public string GetStyleName() {
+ string ret = NDalicPINVOKE.View_GetStyleName(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public void SetBackgroundColor(Vector4 color) {
+ NDalicPINVOKE.View_SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public Vector4 GetBackgroundColor() {
+ Vector4 ret = new Vector4(NDalicPINVOKE.View_GetBackgroundColor(swigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public void SetBackgroundImage(Image image) {
+ NDalicPINVOKE.View_SetBackgroundImage(swigCPtr, Image.getCPtr(image));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public void ClearBackground() {
+ NDalicPINVOKE.View_ClearBackground(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public ControlKeySignal KeyEventSignal() {
+ ControlKeySignal ret = new ControlKeySignal(NDalicPINVOKE.View_KeyEventSignal(swigCPtr), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public KeyInputFocusSignal KeyInputFocusGainedSignal() {
+ KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.View_KeyInputFocusGainedSignal(swigCPtr), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public KeyInputFocusSignal KeyInputFocusLostSignal() {
+ KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.View_KeyInputFocusLostSignal(swigCPtr), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public View(ViewImpl implementation) : this(NDalicPINVOKE.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true) {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ public enum PropertyRange {
+ PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
+ CONTROL_PROPERTY_START_INDEX = PROPERTY_START_INDEX,
+ CONTROL_PROPERTY_END_INDEX = CONTROL_PROPERTY_START_INDEX+1000
+ }
+
+ public string StyleName
+ {
+ get
+ {
+ string temp;
+ GetProperty( View.Property.STYLE_NAME).Get( out temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.STYLE_NAME, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Vector4 BackgroundColor
+ {
+ get
+ {
+ Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
+ GetProperty( View.Property.BACKGROUND_COLOR).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.BACKGROUND_COLOR, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map BackgroundImage
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( View.Property.BACKGROUND_IMAGE).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.BACKGROUND_IMAGE, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public bool KeyInputFocus
+ {
+ get
+ {
+ bool temp = false;
+ GetProperty( View.Property.KEY_INPUT_FOCUS).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.KEY_INPUT_FOCUS, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map Background
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( View.Property.BACKGROUND).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.BACKGROUND, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public string State
+ {
+ get
+ {
+ string temp;
+ GetProperty( View.Property.STATE).Get( out temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.STATE, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public string SubState
+ {
+ get
+ {
+ string temp;
+ GetProperty( View.Property.SUB_STATE).Get( out temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.SUB_STATE, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map Tooltip
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( View.Property.TOOLTIP).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.TOOLTIP, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public string TooltipText
+ {
+ set
+ {
+ SetProperty( View.Property.TOOLTIP, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public float Flex
+ {
+ get
+ {
+ float temp = 0.0f;
+ GetProperty( FlexContainer.ChildProperty.FLEX).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( FlexContainer.ChildProperty.FLEX, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public int AlignSelf
+ {
+ get
+ {
+ int temp = 0;
+ GetProperty( FlexContainer.ChildProperty.ALIGN_SELF).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( FlexContainer.ChildProperty.ALIGN_SELF, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Vector4 FlexMargin
+ {
+ get
+ {
+ Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
+ GetProperty( FlexContainer.ChildProperty.FLEX_MARGIN).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( FlexContainer.ChildProperty.FLEX_MARGIN, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Vector2 CellIndex
+ {
+ get
+ {
+ Vector2 temp = new Vector2(0.0f,0.0f);
+ GetProperty( TableView.ChildProperty.CELL_INDEX).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( TableView.ChildProperty.CELL_INDEX, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public float RowSpan
+ {
+ get
+ {
+ float temp = 0.0f;
+ GetProperty( TableView.ChildProperty.ROW_SPAN).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( TableView.ChildProperty.ROW_SPAN, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public float ColumnSpan
+ {
+ get
+ {
+ float temp = 0.0f;
+ GetProperty( TableView.ChildProperty.COLUMN_SPAN).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( TableView.ChildProperty.COLUMN_SPAN, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public string CellHorizontalAlignment
+ {
+ get
+ {
+ string temp;
+ GetProperty( TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT).Get( out temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public string CellVerticalAlignment
+ {
+ get
+ {
+ string temp;
+ GetProperty( TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT).Get( out temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT, new Dali.Property.Value( value ) );
+ }
+ }
+}
+
+}
/// in MyControl.h
/// class MyControl : public Control
/// {
- /// struct Property
+ /// struct Property
+ /// {
+ /// enum
/// {
- /// enum
- /// {
- /// HOURS = Control::CONTROL_PROPERTY_END_INDEX + 1
- /// }
- /// }
- ///
+ /// HOURS = Control::CONTROL_PROPERTY_END_INDEX + 1
+ /// }
+ /// }
+ /// }
///
/// in MyControl-impl.cpp
///
private PropertyRangeManager _propertyRangeManager;
/// <summary>
- /// Given a C++ custom control the dictionary allows us to find what CustomView it belongs to
+ /// Given a C++ control the dictionary allows us to find which C# control (View) it belongs to
/// </summary>
- private Dictionary<IntPtr, Dali.CustomView> _controlMap;
+ private Dictionary<IntPtr, Dali.View> _controlMap;
///<summary>
// Maps the name of a custom view to a create instance function
_getPropertyCallback = new GetPropertyDelegate (GetProperty);
_setPropertyCallback = new SetPropertyDelegate (SetProperty);
- _controlMap = new Dictionary<IntPtr, CustomView>();
+ _controlMap = new Dictionary<IntPtr, View>();
_constructorMap = new Dictionary<string, Func<CustomView>>();
_propertyRangeManager = new PropertyRangeManager();
}
/// <summary>
- /// Called directly from DALi C++ type registry to create a control (View) uses no marshalling.
+ /// Called directly from DALi C++ type registry to create a control (View) using no marshalling.
/// </summary>
/// <returns>Pointer to the Control (Views) handle </returns>
/// <param name="cPtrControlName"> C pointer to the Control (View) name</param>
{
// Create the control
CustomView newControl = controlConstructor ();
-
- // Store the mapping between this instance of the custom control and native part
- // We store a pointer to the RefObject for the control
- IntPtr cPtr = newControl.GetPtrfromActor();
- RefObject refObj = newControl.GetObjectPtr ();
- IntPtr refCptr = (IntPtr) RefObject.getCPtr(refObj);
-
- //Console.WriteLine ("________Storing ref object cptr in control map Hex: {0:X}", refCptr);
- Instance._controlMap.Add (refCptr , newControl );
-
- return cPtr; // return pointer to handle
+ return newControl.GetPtrfromActor(); // return pointer to handle
}
else
{
}
}
+ /// <summary>
+ /// Store the mapping between this instance of control (View) and native part.
+ /// </summary>
+ /// <param name="view"> The instance of control (View)</param>
+ public static void RegisterView( View view )
+ {
+ // We store a pointer to the RefObject for the control
+ RefObject refObj = view.GetObjectPtr();
+ IntPtr refCptr = (IntPtr) RefObject.getCPtr(refObj);
+
+ //Console.WriteLine ("________Storing ref object cptr in control map Hex: {0:X}", refCptr);
+ if ( !Instance._controlMap.ContainsKey(refCptr) )
+ {
+ Instance._controlMap.Add(refCptr, view );
+ }
+
+ return;
+ }
+
private static IntPtr GetProperty( IntPtr controlPtr, IntPtr propertyName )
{
string name = System.Runtime.InteropServices.Marshal.PtrToStringAnsi (propertyName);
}
}
- public static CustomView GetCustomViewFromActor( Actor actor )
+ public static View GetViewFromActor( Actor actor )
{
// we store a dictionary of ref-obects (C++ land) to custom views (C# land)
- Dali.CustomView view;
+ Dali.View view;
RefObject refObj = actor.GetObjectPtr ();
IntPtr refObjectPtr = (IntPtr) RefObject.getCPtr(refObj);
if ( Instance._controlMap.TryGetValue ( refObjectPtr, out view) )
{
-
- // call the get property function
-
return view;
}
else
private IntPtr GetPropertyValue ( IntPtr controlPtr, string propertyName)
{
// Get the C# control that maps to the C++ control
- Dali.CustomView view;
+ Dali.View view;
BaseHandle baseHandle = new BaseHandle (controlPtr, false);
if ( _controlMap.TryGetValue ( refObjectPtr, out view) )
{
-
// call the get property function
System.Object val = view.GetType ().GetProperty (propertyName).GetAccessors () [0].Invoke (view, null);
private void SetPropertyValue ( IntPtr controlPtr, string propertyName, IntPtr propertyValuePtr)
{
// Get the C# control that maps to the C++ control
- Dali.CustomView view;
+ Dali.View view;
//Console.WriteLine ("SetPropertyValue refObjectPtr = {0:X}", controlPtr);