From: Adeel Kazmi Date: Mon, 9 Jan 2017 10:05:45 +0000 (-0800) Subject: Merge "Fix the warning log in Control causing the wrong position" into devel/master X-Git-Tag: dali_1.2.22~5 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=84d36f3df81b55d0c7ae20db8005a28742fa4060;hp=380cdb40c8cb0aaefb60134268744e0331c35385 Merge "Fix the warning log in Control causing the wrong position" into devel/master --- diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index 20d76c0..fc24948 100644 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -21,6 +21,7 @@ SET(TC_SOURCES utc-Dali-Text-Markup.cpp utc-Dali-Text-Typesetter.cpp utc-Dali-Text-ViewModel.cpp + utc-Dali-DebugRendering.cpp ) # Append list of test harness files (Won't get parsed for test cases) @@ -65,6 +66,8 @@ PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror") +ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" ) + FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS}) SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}") ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS}) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-DebugRendering.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp similarity index 59% rename from automated-tests/src/dali-toolkit/utc-Dali-DebugRendering.cpp rename to automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp index 096bf4d..7348859 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-DebugRendering.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp @@ -14,9 +14,13 @@ * limitations under the License. * */ +#include #include #include +#include +#include +#include #include #include @@ -32,18 +36,25 @@ namespace { const char* TEST_IMAGE_FILE_NAME = "image_01.jpg"; const char* TEST_NPATCH_FILE_NAME = "image_01.9.jpg"; +const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg"; +const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif"; -bool IsDebugVisual( Visual::Base& visual ) +const std::string DEFAULT_FONT_DIR( "/resources/fonts" ); + +void TestDebugVisual( Visual::Base& visual, Visual::Type actualType, Vector2 expectedNaturalSize ) { - bool isDebugVisualType = false; - bool isGeometryLineType = false; + DALI_TEST_CHECK( &typeid( Toolkit::Internal::WireframeVisual ) == &typeid( GetImplementation(visual) ) ); + + Vector2 naturalSize; + visual.GetNaturalSize( naturalSize ); + DALI_TEST_EQUALS( naturalSize, expectedNaturalSize, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); Property::Map propertyMap; visual.CreatePropertyMap( propertyMap ); Property::Value* typeValue = propertyMap.Find( Visual::Property::TYPE, Property::INTEGER ); if ( typeValue ) { - isDebugVisualType = ( typeValue->Get() == Visual::WIREFRAME ); // Debug Rendering uses the WireframeVisual + DALI_TEST_CHECK( typeValue->Get() == actualType ); } DummyControl actor = DummyControl::New(); @@ -55,10 +66,8 @@ bool IsDebugVisual( Visual::Base& visual ) if( actor.GetRendererCount() > 0 ) { Geometry geometry = actor.GetRendererAt( 0 ).GetGeometry(); - isGeometryLineType = ( geometry.GetType() == Geometry::LINES ); + DALI_TEST_CHECK( geometry.GetType() == Geometry::LINES ); } - - return isDebugVisualType && isGeometryLineType; } } @@ -87,7 +96,7 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap1.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE); Visual::Base colorVisual = factory.CreateVisual(propertyMap1); DALI_TEST_CHECK( colorVisual ); - DALI_TEST_CHECK( IsDebugVisual( colorVisual ) ); + TestDebugVisual( colorVisual, Visual::COLOR, Vector2::ZERO ); // Test that border visual is replaced with debug visual Property::Map propertyMap2; @@ -96,7 +105,7 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap2.Insert(BorderVisual::Property::SIZE, 2.f); Visual::Base borderVisual = factory.CreateVisual(propertyMap2); DALI_TEST_CHECK( borderVisual ); - DALI_TEST_CHECK( IsDebugVisual( borderVisual ) ); + TestDebugVisual( borderVisual, Visual::BORDER, Vector2::ZERO ); // Test that gradient visual is replaced with debug visual Property::Map propertyMap3; @@ -116,23 +125,68 @@ int UtcDaliDebugRenderingGetVisual1(void) propertyMap3.Insert(GradientVisual::Property::STOP_COLOR, stopColors); Visual::Base gradientVisual = factory.CreateVisual(propertyMap3); DALI_TEST_CHECK( gradientVisual ); - DALI_TEST_CHECK( IsDebugVisual( gradientVisual ) ); + TestDebugVisual( gradientVisual, Visual::GRADIENT, Vector2::ZERO ); // Test that image visual is replaced with debug visual Property::Map propertyMap4; propertyMap4.Insert( Visual::Property::TYPE, Visual::IMAGE ); propertyMap4.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ); + propertyMap4.Insert( ImageVisual::Property::DESIRED_WIDTH, 50.f ); + propertyMap4.Insert( ImageVisual::Property::DESIRED_HEIGHT, 100.f ); Visual::Base imageVisual = factory.CreateVisual( propertyMap4 ); DALI_TEST_CHECK( imageVisual ); - DALI_TEST_CHECK( IsDebugVisual( imageVisual ) ); + TestDebugVisual( imageVisual, Visual::IMAGE, Vector2( 50.f, 100.f ) ); - // Test that n patch visual is replaced with debug visual + // Test that SVG visual is replaced with debug visual + // TEST_SVG_FILE: + // + // + // Property::Map propertyMap5; propertyMap5.Insert( Visual::Property::TYPE, Visual::IMAGE ); - propertyMap5.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME ); - Visual::Base nPatchVisual = factory.CreateVisual( propertyMap4 ); - DALI_TEST_CHECK( nPatchVisual ); - DALI_TEST_CHECK( IsDebugVisual( nPatchVisual ) ); + propertyMap5.Insert( ImageVisual::Property::URL, TEST_SVG_FILE_NAME ); + Visual::Base svgVisual = factory.CreateVisual( propertyMap5 ); + DALI_TEST_CHECK( svgVisual ); + TestDebugVisual( svgVisual, Visual::IMAGE, Vector2(100.f, 100.f) ); + + // Test that AnimatedImageVisual is replaced with debug visual + // TEST_GIF_FILE: anim.gif + // resolution: 50*50, frame count: 4, frame delay: 0.2 second for each frame + Property::Map propertyMap6; + propertyMap6.Insert( Visual::Property::TYPE, Visual::IMAGE ); + propertyMap6.Insert( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ); + Visual::Base animatedImageVisual = factory.CreateVisual( propertyMap6 ); + DALI_TEST_CHECK( animatedImageVisual ); + TestDebugVisual( animatedImageVisual, Visual::IMAGE, Vector2(50.f, 50.f) ); + + // Test that text visual is replaced with debug visual + + // Load some fonts to get the same metrics on different platforms. + TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get(); + fontClient.SetDpi( 96u, 96u ); + + char* pathNamePtr = get_current_dir_name(); + const std::string pathName( pathNamePtr ); + free( pathNamePtr ); + + fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" ); + + Property::Map propertyMap7; + propertyMap7.Insert( Visual::Property::TYPE, DevelVisual::TEXT ); + propertyMap7.Insert( TextVisual::Property::ENABLE_MARKUP, true ); + propertyMap7.Insert( TextVisual::Property::TEXT, "Hello world" ); + propertyMap7.Insert( TextVisual::Property::MULTI_LINE, true ); + + Visual::Base textVisual = factory.CreateVisual( propertyMap7 ); + DALI_TEST_CHECK( textVisual ); + DALI_TEST_CHECK( &typeid( Toolkit::Internal::WireframeVisual ) == &typeid( GetImplementation(textVisual) ) ); + + Vector2 naturalSize; + textVisual.GetNaturalSize( naturalSize ); + DALI_TEST_EQUALS( naturalSize, Vector2( 80.f, 20.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + const float height = textVisual.GetHeightForWidth( 40.f ); + DALI_TEST_EQUALS( height, 40.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); EnvironmentVariable::SetTestingEnvironmentVariable(false); END_TEST; @@ -154,7 +208,7 @@ int UtcDaliDebugRenderingGetVisual2(void) Visual::Base colorVisual = factory.CreateVisual( map); DALI_TEST_CHECK( colorVisual ); - DALI_TEST_CHECK( IsDebugVisual( colorVisual ) ); + TestDebugVisual( colorVisual, Visual::COLOR, Vector2::ZERO ); // Test that border visual is replaced with debug visual map.Clear(); @@ -163,18 +217,18 @@ int UtcDaliDebugRenderingGetVisual2(void) map[ BorderVisual::Property::SIZE ] = 2.f; Visual::Base borderVisual = factory.CreateVisual( map ); DALI_TEST_CHECK( borderVisual ); - DALI_TEST_CHECK( IsDebugVisual( borderVisual ) ); + TestDebugVisual( borderVisual, Visual::BORDER, Vector2::ZERO ); // Test that image visual is replaced with debug visual Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME); Visual::Base imageVisual = factory.CreateVisual( image ); DALI_TEST_CHECK( imageVisual ); - DALI_TEST_CHECK( IsDebugVisual( imageVisual ) ); + TestDebugVisual( imageVisual, Visual::IMAGE, Vector2::ZERO); // Test that n patch visual is replaced with debug visual Visual::Base nPatchVisual = factory.CreateVisual( TEST_NPATCH_FILE_NAME, ImageDimensions() ); DALI_TEST_CHECK( nPatchVisual ); - DALI_TEST_CHECK( IsDebugVisual( nPatchVisual ) ); + TestDebugVisual( nPatchVisual, Visual::IMAGE, Vector2::ZERO ); EnvironmentVariable::SetTestingEnvironmentVariable(false); END_TEST; diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index 4e59f15..1297575 100644 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -54,7 +54,6 @@ SET(TC_SOURCES utc-Dali-Model3dView.cpp utc-Dali-Visual.cpp utc-Dali-VisualFactory.cpp - utc-Dali-DebugRendering.cpp utc-Dali-ImageAtlas.cpp utc-Dali-VideoView.cpp utc-Dali-AsyncImageLoader.cpp diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp index e8c266d..ed4d02c 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -207,12 +207,12 @@ void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; } void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; } void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; } -void DummyControlImplOverride::OnStageConnection( int depth ) { Control::OnStageConnection( depth ); stageConnectionCalled = true; } +void DummyControlImplOverride::OnStageConnection( int depth ) { stageConnectionCalled = true; Control::OnStageConnection( depth ); } void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; Control::OnStageDisconnection(); } -void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; } -void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; } -void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; } -void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; } +void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; Control::OnChildAdd( child ); } +void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; Control::OnChildRemove( child ); } +void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; Control::OnSizeSet( targetSize ); } +void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; Control::OnSizeAnimation( animation, targetSize ); } bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; } bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; } bool DummyControlImplOverride::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp index 81a5781..93ee34e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -607,3 +607,117 @@ int UtcDaliControlImplGetControlExtensionP(void) END_TEST; } + +int UtcDaliControlAutoClipping(void) +{ + ToolkitTestApplication application; + Control control = Control::New(); + + tet_infoline( "Test to see if a renderer gets added when we are clipping children" ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliControlAutoClippingN(void) +{ + ToolkitTestApplication application; + Control control = Control::New(); + control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Visual::Property::TYPE, Visual::COLOR ) + .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) ); + + tet_infoline( "Test to ensure that a renderer does NOT get added when we are clipping children and already have renderers/visuals" ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Only 1, not 2 + + // Ensure the background color is still RED rather than what's set by the automatic clipping + Property::Value value = control.GetProperty( Control::Property::BACKGROUND ); + Property::Map* map = value.GetMap(); + DALI_TEST_CHECK( map ); + Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR ); + DALI_TEST_CHECK( colorValue ); + DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliControlAutoClippingWhenAlreadyOnStage(void) +{ + ToolkitTestApplication application; + Control control = Control::New(); + + tet_infoline( "Test to see if a renderer gets added when we are clipping children and when already on stage" ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliControlAutoClippingWhenAlreadyOnStageN(void) +{ + ToolkitTestApplication application; + Control control = Control::New(); + control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Visual::Property::TYPE, Visual::COLOR ) + .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) ); + + tet_infoline( "Test to ensure that a renderer does NOT get added when we are clipping children and already have renderers/visuals and when already on stage" ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Still should be 1 + + // Ensure the background color is still RED rather than what's set by the automatic clipping + Property::Value value = control.GetProperty( Control::Property::BACKGROUND ); + Property::Map* map = value.GetMap(); + DALI_TEST_CHECK( map ); + Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR ); + DALI_TEST_CHECK( colorValue ); + DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp index 4a29efc..77c2436 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * 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. @@ -1351,3 +1351,69 @@ int UtcDaliControlImplRegisterTwoVisualsAndEnableOnlyOne(void) END_TEST; } +int UtcDaliControlImplAutoClippingWithVisuals(void) +{ + ToolkitTestApplication application; + + tet_infoline( "Test to ensure a renderer does NOT get added when we've already registered a visual which we haven't enabled" ); + + DummyControl control = DummyControl::New(); + DummyControlImpl& controlImpl = static_cast( control.GetImplementation() ); + + Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get(); + Toolkit::Visual::Base visual; + Property::Map map; + map[Visual::Property::TYPE] = Visual::COLOR; + map[ColorVisual::Property::MIX_COLOR] = Color::RED; + visual = visualFactory.CreateVisual( map ); + DALI_TEST_CHECK(visual); + controlImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual, false ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliControlImplAutoClippingWithVisualsAlreadyOnStage(void) +{ + ToolkitTestApplication application; + + tet_infoline( "Test to ensure a renderer does NOT get added when we've already registered a visual which we haven't enabled and we're already on the stage" ); + + DummyControl control = DummyControl::New(); + DummyControlImpl& controlImpl = static_cast( control.GetImplementation() ); + + Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get(); + Toolkit::Visual::Base visual; + Property::Map map; + map[Visual::Property::TYPE] = Visual::COLOR; + map[ColorVisual::Property::MIX_COLOR] = Color::RED; + visual = visualFactory.CreateVisual( map ); + DALI_TEST_CHECK(visual); + controlImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual, false ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp index 7beeb96..590614e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp @@ -915,3 +915,127 @@ int UtcDaliTableViewKeyboardFocus(void) END_TEST; } + +int UtcDaliTableViewKeyboardFocusInNestedTableView(void) +{ + ToolkitTestApplication application; + + TableView tableView = TableView::New(3, 3); + tableView.SetKeyboardFocusable( true ); + tableView.SetName( "TableView"); + + for ( int row = 0; row < 3; ++row ) + { + for ( int col = 0; col < 3; ++col ) + { + std::ostringstream str; + str << row << "-" << col; + + if (row == 1 && col ==1) + { + // Add a nested 2x2 table view in the middle cell of the parent table view + TableView childTableView = TableView::New(2, 2); + childTableView.SetName( str.str() ); + + for(int childRow = 0; childRow < 2; childRow++) + { + for(int childCol = 0; childCol < 2; childCol++) + { + Control control = Control::New(); + std::ostringstream nameStr; + nameStr << row << "-" << col << "-" << childRow << "-" << childCol; + control.SetName( nameStr.str() ); + control.SetKeyboardFocusable( true ); + childTableView.AddChild( control, TableView::CellPosition( childRow, childCol ) ); + } + } + tableView.AddChild( childTableView, TableView::CellPosition( row, col ) ); + } + else + { + Control control = Control::New(); + control.SetName( str.str() ); + control.SetKeyboardFocusable( true ); + tableView.AddChild( control, TableView::CellPosition( row, col ) ); + } + } + } + + Stage::GetCurrent().Add( tableView ); + + application.SendNotification(); + application.Render(); + + Actor firstFocusActor = Toolkit::Internal::GetImplementation( tableView ).GetNextKeyboardFocusableActor( Actor(), Control::KeyboardFocus::RIGHT, true ); + DALI_TEST_CHECK( firstFocusActor ); + DALI_TEST_CHECK( firstFocusActor.GetName() == "0-0" ); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + manager.SetFocusGroupLoop( false ); + manager.SetCurrentFocusActor( firstFocusActor ); + + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "0-0" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "0-1" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "0-2" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-0" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-0-0" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-0-1" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-1-0" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-1-1" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-2" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "2-0" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "2-1" ); + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "2-2" ); + + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "2-1" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "2-0" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-2" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-1-1" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-1-0" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-0-1" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-0-0" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-0" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "0-2" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "0-1" ); + manager.MoveFocus( Control::KeyboardFocus::LEFT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "0-0" ); + + manager.MoveFocus( Control::KeyboardFocus::RIGHT ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "0-1" ); + manager.MoveFocus( Control::KeyboardFocus::DOWN ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-0-0" ); + manager.MoveFocus( Control::KeyboardFocus::DOWN ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-1-0" ); + manager.MoveFocus( Control::KeyboardFocus::DOWN ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "2-1" ); + + manager.MoveFocus( Control::KeyboardFocus::UP ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-1-1" ); + manager.MoveFocus( Control::KeyboardFocus::UP ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "1-1-0-1" ); + manager.MoveFocus( Control::KeyboardFocus::UP ); + DALI_TEST_CHECK( manager.GetCurrentFocusActor().GetName() == "0-1" ); + + END_TEST; +} diff --git a/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp b/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp index 9bfb68c..085772e 100644 --- a/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp +++ b/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -277,8 +277,6 @@ void BloomView::OnInitialize() void BloomView::OnSizeSet(const Vector3& targetSize) { - Control::OnSizeSet( targetSize ); - mTargetSize = Vector2(targetSize); mChildrenRoot.SetSize(targetSize); mCompositeImageView.SetSize(targetSize); @@ -300,16 +298,18 @@ void BloomView::OnSizeSet(const Vector3& targetSize) Deactivate(); Activate(); } + + Control::OnSizeSet( targetSize ); } void BloomView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - if( child != mChildrenRoot && child != mInternalRoot) { mChildrenRoot.Add( child ); } + + Control::OnChildAdd( child ); } void BloomView::OnChildRemove( Actor& child ) diff --git a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp index 44bc39b..08cfc16 100644 --- a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp +++ b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -289,8 +289,6 @@ void EffectsView::OnInitialize() void EffectsView::OnSizeSet(const Vector3& targetSize) { - Control::OnSizeSet( targetSize ); - mTargetSize = Vector2(targetSize); // if we are already on stage, need to update render target sizes now to reflect the new size of this actor @@ -304,13 +302,15 @@ void EffectsView::OnSizeSet(const Vector3& targetSize) } mChildrenRoot.SetSize( targetSize ); + + Control::OnSizeSet( targetSize ); } void EffectsView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - Enable(); + + Control::OnStageConnection( depth ); } void EffectsView::OnStageDisconnection() @@ -328,12 +328,12 @@ void EffectsView::OnStageDisconnection() void EffectsView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - if( child != mChildrenRoot && child != mCameraForChildren ) { mChildrenRoot.Add( child ); } + + Control::OnChildAdd( child ); } void EffectsView::OnChildRemove( Actor& child ) diff --git a/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp b/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp index 94a92a7..03d4583 100644 --- a/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp +++ b/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -465,8 +465,6 @@ Property::Value FlexContainer::GetProperty( BaseObject* object, Property::Index void FlexContainer::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - // Anchor actor to top left of the container child.SetAnchorPoint( AnchorPoint::TOP_LEFT ); child.SetParentOrigin( ParentOrigin::TOP_LEFT ); @@ -478,6 +476,8 @@ void FlexContainer::OnChildAdd( Actor& child ) childNode.node->get_child = GetChildNodeAtIndex; childNode.node->is_dirty = IsNodeDirty; mChildrenNodes.push_back(childNode); + + Control::OnChildAdd( child ); } void FlexContainer::OnChildRemove( Actor& child ) @@ -562,11 +562,8 @@ void FlexContainer::OnSizeSet( const Vector3& size ) RelayoutRequest(); } -} -void FlexContainer::OnSizeAnimation( Animation& animation, const Vector3& targetSize ) -{ - // @todo Animate the children to their target size and position + Control::OnSizeSet( size ); } void FlexContainer::ComputeLayout() diff --git a/dali-toolkit/internal/controls/flex-container/flex-container-impl.h b/dali-toolkit/internal/controls/flex-container/flex-container-impl.h index f89c1f4..ce09e23 100644 --- a/dali-toolkit/internal/controls/flex-container/flex-container-impl.h +++ b/dali-toolkit/internal/controls/flex-container/flex-container-impl.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_INTERNAL_FLEX_CONTAINER_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -205,11 +205,6 @@ private: // From Control */ virtual void OnSizeSet( const Vector3& size ); - /** - * @copydoc CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&) - */ - virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize); - private: // Implementation /** diff --git a/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp b/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp index a202236..2dddad7 100644 --- a/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp +++ b/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -330,8 +330,6 @@ void GaussianBlurView::OnInitialize() void GaussianBlurView::OnSizeSet(const Vector3& targetSize) { - Control::OnSizeSet( targetSize ); - mTargetSize = Vector2(targetSize); mChildrenRoot.SetSize(targetSize); @@ -356,16 +354,18 @@ void GaussianBlurView::OnSizeSet(const Vector3& targetSize) Deactivate(); Activate(); } + + Control::OnSizeSet( targetSize ); } void GaussianBlurView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - if( child != mChildrenRoot && child != mInternalRoot) { mChildrenRoot.Add( child ); } + + Control::OnChildAdd( child ); } void GaussianBlurView::OnChildRemove( Actor& child ) diff --git a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp index 12205a6..bb48404 100644 --- a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp +++ b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -288,8 +288,6 @@ void Magnifier::SetFrameVisibility(bool visible) void Magnifier::OnSizeSet(const Vector3& targetSize) { - Control::OnSizeSet( targetSize ); - // TODO: Once Camera/CameraActor properties function as proper animatable properties // this code can disappear. // whenever the size of the magnifier changes, the field of view needs to change @@ -297,6 +295,8 @@ void Magnifier::OnSizeSet(const Vector3& targetSize) // a constraint yet as Camera/CameraActor properties are not animatable/constrainable. mActorSize = targetSize; Update(); + + Control::OnSizeSet( targetSize ); } float Magnifier::GetMagnificationFactor() const diff --git a/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp b/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp index dd90747..9c22982 100644 --- a/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp +++ b/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -428,8 +428,6 @@ Property::Value Model3dView::GetProperty( BaseObject* object, Property::Index in void Model3dView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - CustomActor self = Self(); self.AddRenderer( mRenderer ); @@ -449,6 +447,8 @@ void Model3dView::OnStageConnection( int depth ) constraint.AddSource( Source( self, Toolkit::Model3dView::Property::LIGHT_POSITION ) ); constraint.Apply(); } + + Control::OnStageConnection( depth ); } /////////////////////////////////////////////////////////// diff --git a/dali-toolkit/internal/controls/navigation-view/navigation-view-impl.cpp b/dali-toolkit/internal/controls/navigation-view/navigation-view-impl.cpp index 1d15650..5ddf48c 100644 --- a/dali-toolkit/internal/controls/navigation-view/navigation-view-impl.cpp +++ b/dali-toolkit/internal/controls/navigation-view/navigation-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -74,6 +74,8 @@ Toolkit::NavigationView NavigationView::New() void NavigationView::OnStageConnection( int depth ) { Self().SetSensitive(true); + + Control::OnStageConnection( depth ); } void NavigationView::Push( Actor& actor ) diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index dc60e63..a66813a 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -473,9 +473,9 @@ void PageTurnView::SetupShadowView() void PageTurnView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - SetupShadowView(); + + Control::OnStageConnection( depth ); } void PageTurnView::OnStageDisconnection() diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index d12e273..9794921 100644 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -1574,16 +1574,14 @@ bool Popup::OnDialogTouched( Actor actor, const TouchData& touch ) void Popup::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - mLayoutDirty = true; RelayoutRequest(); + + Control::OnStageConnection( depth ); } void Popup::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - // Re-parent any children added by user to the body layer. if( mAlterAddedChild ) { @@ -1594,6 +1592,8 @@ void Popup::OnChildAdd( Actor& child ) mLayoutDirty = true; RelayoutRequest(); } + + Control::OnChildAdd( child ); } void Popup::LayoutContext( const Vector2& size ) diff --git a/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp b/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp index b8d9f59..ff3ed25 100755 --- a/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp +++ b/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp @@ -59,7 +59,6 @@ const char* SKINNED_PROGRESS_VISUAL = DALI_IMAGE_DIR "slider-skin-progress.9.png float DEFAULT_VALUE = 0.0f; float DEFAULT_LOWER_BOUND = 0.0f; float DEFAULT_UPPER_BOUND = 1.0f; -float DEFAULT_PADDING = 24.0f; } // Unnamed namespace @@ -111,13 +110,10 @@ void ProgressBar::OnInitialize() void ProgressBar::OnRelayout( const Vector2& size, RelayoutContainer& container ) { - Vector2 trackSize( size ); - trackSize.width = std::max( 0.0f, size.width - DEFAULT_PADDING ); // Ensure we don't go negative - // Track if( mTrack ) { - container.Add( mTrack, trackSize ); + container.Add( mTrack, size ); // mValueTextLabel will have its relayout method called automatically as it's a child of mTrack, // which is added to the container @@ -126,13 +122,13 @@ void ProgressBar::OnRelayout( const Vector2& size, RelayoutContainer& container // Progress bar if( mProgress ) { - mDomain = CalcDomain( trackSize ); + mDomain = CalcDomain( size ); - Vector2 progressSize( trackSize ); + Vector2 progressSize( size ); // If no progress, then we do not want a n-patch image shown incorrectly progressSize.width = std::max( mProgressVisualSize.width, mDomain.from.x + mValue * ( mDomain.to.x - mDomain.from.x ) ); - progressSize.width = std::min( progressSize.width, trackSize.width ); // We should not exceed given size + progressSize.width = std::min( progressSize.width, size.width ); // We should not exceed given size container.Add( mProgress, progressSize ); } diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp index 2192d5e..6e301cb 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -496,6 +496,8 @@ void ScrollBar::OnSizeSet( const Vector3& size ) { mIndicator.SetSize(size.width, mIndicatorFixedHeight); } + + Control::OnSizeSet( size ); } void ScrollBar::SetScrollDirection( Toolkit::ScrollBar::Direction direction ) diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index 7770147..a5741ab 100755 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -997,6 +997,8 @@ void ItemView::OnChildAdd(Actor& child) Toolkit::ItemView::Property::SCROLL_CONTENT_SIZE); } } + + Scrollable::OnChildAdd( child ); } bool ItemView::OnWheelEvent(const WheelEvent& event) diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 0d8becc..0da1660 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * 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. @@ -701,8 +701,6 @@ void ScrollView::OnInitialize() void ScrollView::OnStageConnection( int depth ) { - ScrollBase::OnStageConnection( depth ); - DALI_LOG_SCROLL_STATE("[0x%X]", this); if ( mSensitive ) @@ -710,11 +708,14 @@ void ScrollView::OnStageConnection( int depth ) SetScrollSensitive( false ); SetScrollSensitive( true ); } + if(IsOvershootEnabled()) { // try and make sure property notifications are set EnableScrollOvershoot(true); } + + ScrollBase::OnStageConnection( depth ); } void ScrollView::OnStageDisconnection() @@ -1941,6 +1942,8 @@ void ScrollView::OnSizeSet( const Vector3& size ) { mOvershootIndicator->Reset(); } + + ScrollBase::OnSizeSet( size ); } void ScrollView::OnChildAdd(Actor& child) diff --git a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp index b486fbb..c8605c1 100644 --- a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp +++ b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -297,12 +297,12 @@ void ShadowView::OnInitialize() void ShadowView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - if( child != mChildrenRoot && child != mBlurRootActor) { mChildrenRoot.Add( child ); } + + Control::OnChildAdd( child ); } void ShadowView::OnChildRemove( Actor& child ) diff --git a/dali-toolkit/internal/controls/slider/slider-impl.cpp b/dali-toolkit/internal/controls/slider/slider-impl.cpp index 1d2e001..f322618 100755 --- a/dali-toolkit/internal/controls/slider/slider-impl.cpp +++ b/dali-toolkit/internal/controls/slider/slider-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -205,10 +205,6 @@ void Slider::OnInitialize() self.TouchSignal().Connect( this, &Slider::OnTouch ); } -void Slider::OnSizeSet( const Vector3& size ) -{ -} - void Slider::OnRelayout( const Vector2& size, RelayoutContainer& container ) { SetHitRegion( Vector2( size.x, GetHitRegion().y ) ); diff --git a/dali-toolkit/internal/controls/slider/slider-impl.h b/dali-toolkit/internal/controls/slider/slider-impl.h index 7879f37..cbb23b0 100755 --- a/dali-toolkit/internal/controls/slider/slider-impl.h +++ b/dali-toolkit/internal/controls/slider/slider-impl.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_INTERNAL_SLIDER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -282,11 +282,6 @@ protected: virtual ~Slider(); /** - * @copydoc CustomActorImpl::OnSizeSet( const Vector3& size ) - */ - virtual void OnSizeSet( const Vector3& size ); - - /** * @copydoc CustomActorImpl::OnRelayout */ virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); diff --git a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp index 4e74276..a93257d 100644 --- a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp +++ b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -292,6 +292,8 @@ void SuperBlurView::OnSizeSet( const Vector3& targetSize ) SetImage( mInputImage ); } } + + Control::OnSizeSet( targetSize ); } void SuperBlurView::OnStageConnection( int depth ) @@ -301,7 +303,7 @@ void SuperBlurView::OnStageConnection( int depth ) return; } - // Chaining up first ensures visuals have SetOnStage called to create their renderers + // Exception to the rule, chaining up first ensures visuals have SetOnStage called to create their renderers Control::OnStageConnection( depth ); Actor self = Self(); @@ -310,6 +312,7 @@ void SuperBlurView::OnStageConnection( int depth ) // Note that the renderer indices are depending on the order they been added to the actor // which might be different from the blur level of its texture. // We can check the depth index of the renderer to know which blurred image it renders. + // All visuals WILL have renderers at this point as we are simply creating visuals with an Image handle. Renderer renderer = self.GetRendererAt( i ); int depthIndex = renderer.GetProperty(Renderer::Property::DEPTH_INDEX); if( depthIndex > 0 ) @@ -322,11 +325,6 @@ void SuperBlurView::OnStageConnection( int depth ) } } -void SuperBlurView::OnStageDisconnection( ) -{ - Control::OnStageDisconnection(); -} - Vector3 SuperBlurView::GetNaturalSize() { if( mInputImage ) diff --git a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h index 4380a6e..0c782c9 100644 --- a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h +++ b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_INTERNAL_SUPER_BLUR_VIEW_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -132,11 +132,6 @@ private: // from Control virtual void OnStageConnection( int depth ); /** - * @copydoc CustomActorImpl::OnStageDisconnection() - */ - virtual void OnStageDisconnection(); - - /** * @copydoc CustomActorImpl::GetNaturalSize() */ virtual Vector3 GetNaturalSize(); diff --git a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp index dea576c..a674abb 100644 --- a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp +++ b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -795,6 +795,8 @@ void TableView::OnSizeSet( const Vector3& size ) // rows and columns must be recalculated or the new size will not take effect. mRowDirty = mColumnDirty = true; RelayoutRequest(); + + Control::OnSizeSet( size ); } void TableView::OnRelayout( const Vector2& size, RelayoutContainer& container ) @@ -961,98 +963,101 @@ Property::Value TableView::GetProperty( BaseObject* object, Property::Index inde void TableView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - - if( mLayoutingChild ) + if( ! mLayoutingChild ) { - // we're in the middle of laying out children so no point doing anything here - return; - } + // Ensure we're not in the middle of laying out children - // Check child properties on actor to decide its position inside the table - HorizontalAlignment::Type horizontalAlignment = HorizontalAlignment::LEFT; - VerticalAlignment::Type verticalAlignment = VerticalAlignment::TOP; + // Check child properties on actor to decide its position inside the table + HorizontalAlignment::Type horizontalAlignment = HorizontalAlignment::LEFT; + VerticalAlignment::Type verticalAlignment = VerticalAlignment::TOP; - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ) != Property::NONE ) - { - std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ).Get(); - Scripting::GetEnumeration< HorizontalAlignment::Type >( value.c_str(), - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT, - horizontalAlignment ); - } + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ) != Property::NONE ) + { + std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ).Get(); + Scripting::GetEnumeration< HorizontalAlignment::Type >( value.c_str(), + HORIZONTAL_ALIGNMENT_STRING_TABLE, + HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT, + horizontalAlignment ); + } - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ) != Property::NONE ) - { - std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ).Get(); - Scripting::GetEnumeration< VerticalAlignment::Type >( value.c_str(), - VERTICAL_ALIGNMENT_STRING_TABLE, - VERTICAL_ALIGNMENT_STRING_TABLE_COUNT, - verticalAlignment ); - } + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ) != Property::NONE ) + { + std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ).Get(); + Scripting::GetEnumeration< VerticalAlignment::Type >( value.c_str(), + VERTICAL_ALIGNMENT_STRING_TABLE, + VERTICAL_ALIGNMENT_STRING_TABLE_COUNT, + verticalAlignment ); + } - Toolkit::TableView::CellPosition cellPosition; - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::ROW_SPAN ) != Property::NONE ) - { - cellPosition.rowSpan = static_cast( child.GetProperty( Toolkit::TableView::ChildProperty::ROW_SPAN ).Get() ); - } + Toolkit::TableView::CellPosition cellPosition; + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::ROW_SPAN ) != Property::NONE ) + { + cellPosition.rowSpan = static_cast( child.GetProperty( Toolkit::TableView::ChildProperty::ROW_SPAN ).Get() ); + } - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::COLUMN_SPAN ) != Property::NONE ) - { - cellPosition.columnSpan = static_cast( child.GetProperty( Toolkit::TableView::ChildProperty::COLUMN_SPAN ).Get() ); - } + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::COLUMN_SPAN ) != Property::NONE ) + { + cellPosition.columnSpan = static_cast( child.GetProperty( Toolkit::TableView::ChildProperty::COLUMN_SPAN ).Get() ); + } - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_INDEX ) != Property::NONE ) - { - Vector2 indices = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_INDEX ).Get(); - cellPosition.rowIndex = static_cast( indices.x ); - cellPosition.columnIndex = static_cast( indices.y ); + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_INDEX ) != Property::NONE ) + { + Vector2 indices = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_INDEX ).Get(); + cellPosition.rowIndex = static_cast( indices.x ); + cellPosition.columnIndex = static_cast( indices.y ); - AddChild( child, cellPosition ); - SetCellAlignment(cellPosition, horizontalAlignment, verticalAlignment); + AddChild( child, cellPosition ); + SetCellAlignment(cellPosition, horizontalAlignment, verticalAlignment); + } + else + { + bool availableCellFound = false; - // Do not continue - return; - } + // Find the first available cell to store the actor in + const unsigned int rowCount = mCellData.GetRows(); + const unsigned int columnCount = mCellData.GetColumns(); + for( unsigned int row = 0; row < rowCount && !availableCellFound; ++row ) + { + for( unsigned int column = 0; column < columnCount && !availableCellFound; ++column ) + { + if( !(mCellData[ row ][ column ].actor) ) + { + // Put the actor in the cell + CellData data; + data.actor = child; + data.position.columnIndex = column; + data.position.rowIndex = row; + data.horizontalAlignment = horizontalAlignment; + data.verticalAlignment = verticalAlignment; + mCellData[ row ][ column ] = data; + + availableCellFound = true; + break; + } + } + } - // Find the first available cell to store the actor in - const unsigned int rowCount = mCellData.GetRows(); - const unsigned int columnCount = mCellData.GetColumns(); - for( unsigned int row = 0; row < rowCount; ++row ) - { - for( unsigned int column = 0; column < columnCount; ++column ) - { - if( !(mCellData[ row ][ column ].actor) ) + if( ! availableCellFound ) { - // Put the actor in the cell + // No empty cells, so increase size of the table + unsigned int newColumnCount = ( columnCount > 0 ) ? columnCount : 1; + ResizeContainers( rowCount + 1, newColumnCount ); + + // Put the actor in the first cell of the new row CellData data; data.actor = child; - data.position.columnIndex = column; - data.position.rowIndex = row; + data.position.rowIndex = rowCount; + data.position.columnIndex = 0; data.horizontalAlignment = horizontalAlignment; data.verticalAlignment = verticalAlignment; - mCellData[ row ][ column ] = data; - - // Don't continue - RelayoutRequest(); - return; + mCellData[ rowCount ][ 0 ] = data; } + + RelayoutRequest(); } } - // No empty cells, so increase size of the table - unsigned int newColumnCount = ( columnCount > 0 ) ? columnCount : 1; - ResizeContainers( rowCount + 1, newColumnCount ); - - // Put the actor in the first cell of the new row - CellData data; - data.actor = child; - data.position.rowIndex = rowCount; - data.position.columnIndex = 0; - data.horizontalAlignment = horizontalAlignment; - data.verticalAlignment = verticalAlignment; - mCellData[ rowCount ][ 0 ] = data; - RelayoutRequest(); + Control::OnChildAdd( child ); } void TableView::OnChildRemove( Actor& child ) @@ -1077,6 +1082,8 @@ TableView::TableView( unsigned int initialRows, unsigned int initialColumns ) mRowDirty( true ), // Force recalculation first time mColumnDirty( true ) { + mCurrentColumn = 0; + mCurrentRow = 0; SetKeyboardNavigationSupport( true ); ResizeContainers( initialRows, initialColumns ); } @@ -1398,13 +1405,42 @@ Actor TableView::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolki // Move the focus if we haven't lost it. if(!focusLost) { + // Save the new focus cell positions of TableView. + mCurrentColumn = currentColumn; + mCurrentRow = currentRow; + nextFocusableActor = GetChildAt(Toolkit::TableView::CellPosition(currentRow, currentColumn)); } } else { - // The current focused actor is not within table view, so the child in the first cell should be focused. - nextFocusableActor = GetChildAt(Toolkit::TableView::CellPosition(0, 0)); + // The current focused actor is not within TableView. + // This means that the TableView has gained the Focus again. + + unsigned int numberOfColumns = GetColumns(); + unsigned int numberOfRows = GetRows(); + + if( (mCurrentRow != 0 && mCurrentColumn != 0) && // Last saved cell was not the first cell + (mCurrentRow != numberOfRows - 1 && mCurrentColumn != numberOfColumns - 1) ) // Last saved cell was not the last cell + { + // This condition handles the cases when parent TableView gained the focus again after the child layout + // container (i.e. TableView) has no more items (i.e. actors) to be focused on in a given direction. + + // Move the focus to next cell towards the given direction in a TableView if the last saved cell was not the first or last cell. + nextFocusableActor = GetNextKeyboardFocusableActor(GetChildAt(Toolkit::TableView::CellPosition(mCurrentRow, mCurrentColumn)), direction, loopEnabled); + } + else + { + // Otherwise, move the focus to either the first or the last cell according to the given direction. + if(direction == Toolkit::Control::KeyboardFocus::LEFT || direction == Toolkit::Control::KeyboardFocus::UP) + { + nextFocusableActor = GetChildAt(Toolkit::TableView::CellPosition(numberOfRows - 1, numberOfColumns - 1)); + } + else + { + nextFocusableActor = GetChildAt(Toolkit::TableView::CellPosition(0, 0)); + } + } } } diff --git a/dali-toolkit/internal/controls/table-view/table-view-impl.h b/dali-toolkit/internal/controls/table-view/table-view-impl.h index d6e62b6..be1f702 100644 --- a/dali-toolkit/internal/controls/table-view/table-view-impl.h +++ b/dali-toolkit/internal/controls/table-view/table-view-impl.h @@ -497,6 +497,8 @@ private: // Data Size mFixedTotals; ///< Accumulated totals for fixed width and height Size mPadding; ///< Padding to apply to each cell + unsigned int mCurrentRow; ///< Last / current focused row + unsigned int mCurrentColumn; ///< Last / current focused column bool mLayoutingChild; ///< Can't be a bitfield due to Relayouting lock bool mRowDirty : 1; ///< Flag to indicate the row data is dirty bool mColumnDirty : 1; ///< Flag to indicate the column data is dirty diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index fec052a..aab4f95 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -1374,13 +1374,13 @@ void TextEditor::KeyboardStatusChanged(bool keyboardShown) void TextEditor::OnStageConnection( int depth ) { - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - // Sets the depth to the visuals inside the text's decorator. mDecorator->SetTextDepth( depth ); // The depth of the text renderer is set in the RenderText() called from OnRelayout(). + + // Call the Control::OnStageConnection() to set the depth of the background. + Control::OnStageConnection( depth ); } bool TextEditor::OnTouched( Actor actor, const TouchData& touch ) diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 44dc851..63568e6 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -1572,13 +1572,13 @@ void TextField::KeyboardStatusChanged(bool keyboardShown) void TextField::OnStageConnection( int depth ) { - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - // Sets the depth to the visuals inside the text's decorator. mDecorator->SetTextDepth( depth ); // The depth of the text renderer is set in the RenderText() called from OnRelayout(). + + // Call the Control::OnStageConnection() to set the depth of the background. + Control::OnStageConnection( depth ); } bool TextField::OnTouched( Actor actor, const TouchData& touch ) diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index e4a8b53..9f7863f 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -790,14 +790,6 @@ void TextLabel::OnStageConnect( Dali::Actor actor ) } } -void TextLabel::OnStageConnection( int depth ) -{ - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - - // The depth of the text renderer is set in the RenderText() called from OnRelayout(). -} - void TextLabel::ScrollingFinished() { // Pure Virtual from TextScroller Interface diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.h b/dali-toolkit/internal/controls/text-controls/text-label-impl.h index c928763..bc2459f 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -95,11 +95,6 @@ private: // From Control */ virtual float GetHeightForWidth( float width ); - /** - * @copydoc Control::OnStageConnection() - */ - virtual void OnStageConnection( int depth ); - // From ControlInterface /** diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index c91f71d..459e534 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -394,15 +394,6 @@ void TextSelectionPopup::OnInitialize() self.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); } -void TextSelectionPopup::OnStageConnection( int depth ) -{ - DALI_LOG_INFO( gLogFilter, Debug::General, "TextSelectionPopup::OnStageConnection\n" ); - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - - // TextSelectionToolbar::OnStageConnection() will set the depths of all the popup's components. -} - void TextSelectionPopup::HideAnimationFinished( Animation& animation ) { Actor self = Self(); diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h index e2a9497..419720f 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * 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. @@ -142,11 +142,6 @@ private: // From Control */ virtual void OnInitialize(); - /** - * @copydoc Control::OnStageConnection() - */ - virtual void OnStageConnection( int depth ); - private: // Implementation void HideAnimationFinished( Animation& animation ); diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp index 00c74f4..cdd2226 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -151,15 +151,6 @@ void TextSelectionToolbar::OnRelayout( const Vector2& size, RelayoutContainer& c mScrollView.SetRulerX( mRulerX ); } -void TextSelectionToolbar::OnStageConnection( int depth ) -{ - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - - // Texts are controls, they have their own OnStageConnection() implementation. - // Icons are inside a TableView. It has it's own OnStageConnection() implementation. -} - void TextSelectionToolbar::SetPopupMaxSize( const Size& maxSize ) { mMaxSize = maxSize; diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h index 46e633b..d44daf0 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -97,11 +97,6 @@ private: // From Control virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); /** - * @copydoc Control::OnStageConnection() - */ - virtual void OnStageConnection( int depth ); - - /** * @brief Set max size of Popup * @param[in] maxSize Size (Vector2) */ diff --git a/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp b/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp index 851945d..441b640 100644 --- a/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp +++ b/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -317,8 +317,6 @@ void ToolBar::OnInitialize() void ToolBar::OnChildAdd(Actor& child) { - Control::OnChildAdd( child ); - if( !mInitializing ) { // An actor is being added through the Actor's API. @@ -335,6 +333,8 @@ void ToolBar::OnChildAdd(Actor& child) // No OnChildRemove method required because Actors are added to the mLayout table view, so if an // actor is removed using the Actor::RemoveChild method it will not remove anything because the // actor is in mLayout not in Self(). + + Control::OnChildAdd( child ); } } // namespace Internal diff --git a/dali-toolkit/internal/controls/video-view/video-view-impl.cpp b/dali-toolkit/internal/controls/video-view/video-view-impl.cpp index 51bf9a2..2ec07ef 100644 --- a/dali-toolkit/internal/controls/video-view/video-view-impl.cpp +++ b/dali-toolkit/internal/controls/video-view/video-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -439,13 +439,13 @@ void VideoView::SetDepthIndex( int depthIndex ) void VideoView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - if( mVisual ) { CustomActor self = Self(); Toolkit::GetImplementation(mVisual).SetOnStage( self ); } + + Control::OnStageConnection( depth ); } void VideoView::OnStageDisconnection() diff --git a/dali-toolkit/internal/filters/blur-two-pass-filter.cpp b/dali-toolkit/internal/filters/blur-two-pass-filter.cpp index 3a258f1..307a3a1 100644 --- a/dali-toolkit/internal/filters/blur-two-pass-filter.cpp +++ b/dali-toolkit/internal/filters/blur-two-pass-filter.cpp @@ -187,7 +187,10 @@ void BlurTwoPassFilter::Enable() // Add effect texture to blend-two-image custom shader TextureSet textureSet = mActorForBlending.GetRendererAt(0).GetTextures(); - TextureSetImage( textureSet, 1u, mInputImage ); + if( textureSet ) + { + TextureSetImage( textureSet, 1u, mInputImage ); + } SetupCamera(); CreateRenderTasks(); diff --git a/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp index ffa43e0..460ea31 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -246,8 +246,6 @@ void CubeTransitionEffect::Initialize() void CubeTransitionEffect::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - Geometry geometry = VisualFactoryCache::CreateQuadGeometry(); Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); @@ -262,6 +260,8 @@ void CubeTransitionEffect::OnStageConnection( int depth ) mCurrentRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, depth ); Self().AddRenderer( mCurrentRenderer ); + + Control::OnStageConnection( depth ); } void CubeTransitionEffect::OnStageDisconnection() diff --git a/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp b/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp index e949728..4fb6e82 100644 --- a/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp +++ b/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp @@ -392,6 +392,11 @@ void PrimitiveVisual::DoSetProperties( const Property::Map& propertyMap ) void PrimitiveVisual::GetNaturalSize( Vector2& naturalSize ) { + if( !mGeometry ) + { + CreateGeometry(); + } + naturalSize.x = mObjectDimensions.x; naturalSize.y = mObjectDimensions.y; } diff --git a/dali-toolkit/internal/visuals/visual-base-impl.h b/dali-toolkit/internal/visuals/visual-base-impl.h index f496467..f740909 100644 --- a/dali-toolkit/internal/visuals/visual-base-impl.h +++ b/dali-toolkit/internal/visuals/visual-base-impl.h @@ -178,6 +178,7 @@ protected: virtual ~Base(); protected: + /** * @brief Called by CreatePropertyMap() allowing sub classes to respond to the CreatePropertyMap event * @@ -198,8 +199,6 @@ protected: */ virtual void OnSetTransform() = 0; -protected: - /** * @brief Called by SetOnStage() allowing sub classes to respond to the SetOnStage event * diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index e829889..2410f0a 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -89,106 +89,98 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property Visual::BasePtr visualPtr; - if( mDebugEnabled ) + Property::Value* typeValue = propertyMap.Find( Toolkit::DevelVisual::Property::TYPE, VISUAL_TYPE ); + Toolkit::DevelVisual::Type visualType = Toolkit::DevelVisual::IMAGE; // Default to IMAGE type. + if( typeValue ) { - //Create a WireframeVisual if we have debug enabled - visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ) ); + Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, visualType ); } - else + + switch( visualType ) { - Property::Value* typeValue = propertyMap.Find( Toolkit::DevelVisual::Property::TYPE, VISUAL_TYPE ); - Toolkit::DevelVisual::Type visualType = Toolkit::DevelVisual::IMAGE; // Default to IMAGE type. - if( typeValue ) + case Toolkit::Visual::BORDER: { - Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, visualType ); + visualPtr = BorderVisual::New( *( mFactoryCache.Get() ), propertyMap ); + break; } - switch( visualType ) + case Toolkit::Visual::COLOR: { - case Toolkit::Visual::BORDER: - { - visualPtr = BorderVisual::New( *( mFactoryCache.Get() ), propertyMap ); - break; - } - - case Toolkit::Visual::COLOR: - { - visualPtr = ColorVisual::New( *( mFactoryCache.Get() ), propertyMap ); - break; - } + visualPtr = ColorVisual::New( *( mFactoryCache.Get() ), propertyMap ); + break; + } - case Toolkit::Visual::GRADIENT: - { - visualPtr = GradientVisual::New( *( mFactoryCache.Get() ), propertyMap ); - break; - } + case Toolkit::Visual::GRADIENT: + { + visualPtr = GradientVisual::New( *( mFactoryCache.Get() ), propertyMap ); + break; + } - case Toolkit::Visual::IMAGE: + case Toolkit::Visual::IMAGE: + { + Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME ); + std::string imageUrl; + if( imageURLValue && imageURLValue->Get( imageUrl ) ) { - Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME ); - std::string imageUrl; - if( imageURLValue && imageURLValue->Get( imageUrl ) ) + // first resolve url type to know which visual to create + UrlType::Type type = ResolveUrlType( imageUrl ); + if( UrlType::N_PATCH == type ) { - // first resolve url type to know which visual to create - UrlType::Type type = ResolveUrlType( imageUrl ); - if( UrlType::N_PATCH == type ) - { - visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); - } - else if( UrlType::SVG == type ) + visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); + } + else if( UrlType::SVG == type ) + { + visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); + } + else if( UrlType::GIF == type ) + { + visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); + } + else // Regular image + { + bool batchingEnabled( false ); + Property::Value* batchingEnabledValue = propertyMap.Find( Toolkit::ImageVisual::Property::BATCHING_ENABLED, BATCHING_ENABLED ); + if( batchingEnabledValue ) { - visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); + batchingEnabledValue->Get( batchingEnabled ); } - else if( UrlType::GIF == type ) + + if( batchingEnabled ) { - visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); + visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); } - else // Regular image + else { - bool batchingEnabled( false ); - Property::Value* batchingEnabledValue = propertyMap.Find( Toolkit::ImageVisual::Property::BATCHING_ENABLED, BATCHING_ENABLED ); - if( batchingEnabledValue ) - { - batchingEnabledValue->Get( batchingEnabled ); - } - - if( batchingEnabled ) - { - visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); - } - else - { - visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); - } + visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); } } - - break; } - case Toolkit::Visual::MESH: - { - visualPtr = MeshVisual::New( *( mFactoryCache.Get() ), propertyMap ); - break; - } + break; + } - case Toolkit::Visual::PRIMITIVE: - { - visualPtr = PrimitiveVisual::New( *( mFactoryCache.Get() ), propertyMap ); - break; - } + case Toolkit::Visual::MESH: + { + visualPtr = MeshVisual::New( *( mFactoryCache.Get() ), propertyMap ); + break; + } - case Toolkit::Visual::WIREFRAME: - { - visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ) ); - break; - } + case Toolkit::Visual::PRIMITIVE: + { + visualPtr = PrimitiveVisual::New( *( mFactoryCache.Get() ), propertyMap ); + break; + } - case Toolkit::DevelVisual::TEXT: - { - visualPtr = TextVisual::New( *( mFactoryCache.Get() ), propertyMap ); - break; - } + case Toolkit::Visual::WIREFRAME: + { + visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ), propertyMap ); + break; + } + + case Toolkit::DevelVisual::TEXT: + { + visualPtr = TextVisual::New( *( mFactoryCache.Get() ), propertyMap ); + break; } } @@ -197,6 +189,12 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property DALI_LOG_ERROR( "Renderer type unknown\n" ); } + if( mDebugEnabled && visualType != Toolkit::DevelVisual::WIREFRAME ) + { + //Create a WireframeVisual if we have debug enabled + visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ), visualPtr, propertyMap ); + } + return Toolkit::Visual::Base( visualPtr.Get() ); } @@ -207,11 +205,6 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Image& image ) mFactoryCache = new VisualFactoryCache(); } - if( mDebugEnabled ) - { - return Toolkit::Visual::Base( WireframeVisual::New( *( mFactoryCache.Get() ) ).Get() ); - } - Visual::BasePtr visualPtr; NinePatchImage npatchImage = NinePatchImage::DownCast( image ); @@ -224,6 +217,12 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Image& image ) visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), image ); } + if( mDebugEnabled ) + { + //Create a WireframeVisual if we have debug enabled + visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ), visualPtr ); + } + return Toolkit::Visual::Base( visualPtr.Get() ); } @@ -234,11 +233,6 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, Image mFactoryCache = new VisualFactoryCache(); } - if( mDebugEnabled ) - { - return Toolkit::Visual::Base( WireframeVisual::New( *( mFactoryCache.Get() ) ).Get() ); - } - Visual::BasePtr visualPtr; // first resolve url type to know which visual to create @@ -260,6 +254,12 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, Image visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), url, size ); } + if( mDebugEnabled ) + { + //Create a WireframeVisual if we have debug enabled + visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ), visualPtr ); + } + return Toolkit::Visual::Base( visualPtr.Get() ); } diff --git a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp index 52a7710..5fd3160 100644 --- a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp +++ b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp @@ -77,13 +77,36 @@ void main()\n } -WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache ) +WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties ) { - return new WireframeVisual( factoryCache ); + Visual::BasePtr emtptyVisual; + + return New(factoryCache, emtptyVisual, properties); } -WireframeVisual::WireframeVisual( VisualFactoryCache& factoryCache ) -: Visual::Base( factoryCache ) +WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual ) +{ + return new WireframeVisual( factoryCache, actualVisual ); +} + +WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual, const Property::Map& properties ) +{ + WireframeVisualPtr wireframeVisual( new WireframeVisual( factoryCache, actualVisual ) ); + + // Instead of calling SetProperties, looking for the only valid property 'transform' + Property::Value* transformValue = properties.Find( DevelVisual::Property::TRANSFORM, TRANSFORM ); + Property::Map transformMap; + if( transformValue && transformValue->Get( transformMap ) ) + { + wireframeVisual->SetTransformAndSize( transformMap, Vector2::ZERO ); + } + + return wireframeVisual; +} + +WireframeVisual::WireframeVisual( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual ) +: Visual::Base( factoryCache ), + mActualVisual( actualVisual ) { } @@ -91,6 +114,43 @@ WireframeVisual::~WireframeVisual() { } +float WireframeVisual::GetHeightForWidth( float width ) +{ + if( mActualVisual ) + { + return mActualVisual->GetHeightForWidth( width ); + } + else + { + return Visual::Base::GetHeightForWidth( width ); + } +} + +void WireframeVisual::GetNaturalSize( Vector2& naturalSize ) +{ + if( mActualVisual ) + { + mActualVisual->GetNaturalSize( naturalSize ); + } + else + { + Visual::Base::GetNaturalSize( naturalSize ); + } +} + +void WireframeVisual::DoCreatePropertyMap( Property::Map& map ) const +{ + if( mActualVisual ) + { + mActualVisual->CreatePropertyMap( map ); + } + else + { + map.Clear(); + map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::WIREFRAME ); + } +} + void WireframeVisual::DoSetProperties( const Property::Map& propertyMap ) { // no properties supported at the moment @@ -103,12 +163,6 @@ void WireframeVisual::DoSetOnStage( Actor& actor ) actor.AddRenderer( mImpl->mRenderer ); } -void WireframeVisual::DoCreatePropertyMap( Property::Map& map ) const -{ - map.Clear(); - map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::WIREFRAME ); -} - void WireframeVisual::InitializeRenderer() { Shader shader = mFactoryCache.GetShader( VisualFactoryCache::WIREFRAME_SHADER ); diff --git a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h index d35beb3..f446806 100644 --- a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h +++ b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h @@ -47,9 +47,34 @@ public: * @brief Create a new wireframe visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static WireframeVisualPtr New( VisualFactoryCache& factoryCache ); + static WireframeVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties ); + + /** + * @brief Create a new wireframe visual with an encapsulated actual visual. + * + * For debugging purpose, the rendering of the encapsulated visual is replaced with wireframe + * + * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] actualVisual The encapsulated actual visual. + * @return A smart-pointer to the newly allocated visual. + */ + static WireframeVisualPtr New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual ); + + /** + * @brief Create a new wireframe visual with an encapsulated actual visual. + * + * For debugging purpose, the rendering of the encapsulated visual is replaced with wireframe + * + * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] actualVisual The encapsulated actual visual. + * @param[in] properties A Property::Map containing settings for this visual + * @return A smart-pointer to the newly allocated visual. + */ + static WireframeVisualPtr New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual, const Property::Map& properties ); + protected: @@ -57,30 +82,43 @@ protected: * @brief Constructor. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] actualVisual The encapsulated actual visual. */ - WireframeVisual( VisualFactoryCache& factoryCache ); + WireframeVisual( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual ); /** * @brief A reference counted object may only be deleted by calling Unreference(). */ virtual ~WireframeVisual(); +protected: // from Visual::Base + /** - * @copydoc Visual::Base::DoSetProperties() + * @copydoc Visual::Base::GetHeightForWidth() */ - virtual void DoSetProperties( const Property::Map& propertyMap ); + virtual float GetHeightForWidth( float width ); /** - * @copydoc Visual::Base::DoSetOnStage + * @copydoc Visual::Base::GetNaturalSize() */ - virtual void DoSetOnStage( Actor& actor ); + virtual void GetNaturalSize( Vector2& naturalSize ); /** - * @copydoc Visual::Base::CreatePropertyMap + * @copydoc Visual::Base::CreatePropertyMap() */ virtual void DoCreatePropertyMap( Property::Map& map ) const; /** + * @copydoc Visual::Base::DoSetProperties() + */ + virtual void DoSetProperties( const Property::Map& propertyMap ); + + /** + * @copydoc Visual::Base::DoSetOnStage + */ + virtual void DoSetOnStage( Actor& actor ); + + /** * @copydoc Visual::Base::OnSetTransform */ virtual void OnSetTransform(); @@ -97,14 +135,16 @@ private: */ void InitializeRenderer(); -private: - // Undefined WireframeVisual( const WireframeVisual& visual); // Undefined WireframeVisual& operator=( const WireframeVisual& visual ); +private: + + Visual::BasePtr mActualVisual; + }; } // namespace Internal diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index 5103060..c62684f 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,11 @@ namespace Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_CONTROL_VISUALS"); #endif +DALI_ENUM_TO_STRING_TABLE_BEGIN( CLIPPING_MODE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, DISABLED ) +DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, CLIP_CHILDREN ) +DALI_ENUM_TO_STRING_TABLE_END( CLIPPING_MODE ) + /** * Struct used to store Visual within the control, index is a unique key for each visual. */ @@ -1149,16 +1155,33 @@ void Control::OnStageConnection( int depth ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageConnection number of registered visuals(%d)\n", mImpl->mVisuals.Size() ); + Actor self( Self() ); + for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++) { // Check whether the visual is empty and enabled if( (*iter)->visual && (*iter)->enabled ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageConnection Setting visual(%d) on stage\n", (*iter)->index ); - Actor self( Self() ); Toolkit::GetImplementation((*iter)->visual).SetOnStage( self ); } } + + if( mImpl->mVisuals.Empty() && ! self.GetRendererCount() ) + { + Property::Value clippingValue = self.GetProperty( Actor::Property::CLIPPING_MODE ); + int clippingMode = ClippingMode::DISABLED; + if( clippingValue.Get( clippingMode ) ) + { + // Add a transparent background if we do not have any renderers or visuals so we clip our children + + if( clippingMode == ClippingMode::CLIP_CHILDREN ) + { + // Create a transparent background visual which will also get staged. + SetBackgroundColor( Color::TRANSPARENT ); + } + } + } } void Control::OnStageDisconnection() @@ -1197,6 +1220,29 @@ void Control::OnChildRemove(Actor& child) OnControlChildRemove( child ); } +void Control::OnPropertySet( Property::Index index, Property::Value propertyValue ) +{ + Actor self( Self() ); + if( index == Actor::Property::CLIPPING_MODE ) + { + // Only set the background if we're already on the stage and have no renderers or visuals + + if( mImpl->mVisuals.Empty() && ! self.GetRendererCount() && self.OnStage() ) + { + ClippingMode::Type clippingMode = ClippingMode::DISABLED; + if( Scripting::GetEnumerationProperty< ClippingMode::Type >( propertyValue, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, clippingMode ) ) + { + // Add a transparent background if we do not have one so we clip children + + if( clippingMode == ClippingMode::CLIP_CHILDREN ) + { + SetBackgroundColor( Color::TRANSPARENT ); + } + } + } + } +} + void Control::OnSizeSet(const Vector3& targetSize) { Toolkit::Visual::Base visual = GetVisual( Toolkit::Control::Property::BACKGROUND ); diff --git a/dali-toolkit/public-api/controls/control-impl.h b/dali-toolkit/public-api/controls/control-impl.h index 541d489..d850eb4 100644 --- a/dali-toolkit/public-api/controls/control-impl.h +++ b/dali-toolkit/public-api/controls/control-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_CONTROL_IMPL_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -393,7 +393,7 @@ protected: // From CustomActorImpl, not to be used by application developers /** * @copydoc CustomActorImpl::OnStageConnection() - * @note If overridden, then an up-call to Control::OnStageConnection MUST be made at the start. + * @note If overridden, then an up-call to Control::OnStageConnection MUST be made at the end. */ virtual void OnStageConnection( int depth ); @@ -405,7 +405,7 @@ protected: // From CustomActorImpl, not to be used by application developers /** * @copydoc CustomActorImpl::OnChildAdd() - * @note If overridden, then an up-call to Control::OnChildAdd MUST be made at the start. + * @note If overridden, then an up-call to Control::OnChildAdd MUST be made at the end. */ virtual void OnChildAdd( Actor& child ); @@ -416,14 +416,20 @@ protected: // From CustomActorImpl, not to be used by application developers virtual void OnChildRemove( Actor& child ); /** + * @copydoc CustomActorImpl::OnPropertySet() + * @note If overridden, then an up-call to Control::OnChildRemove MUST be made at the end. + */ + virtual void OnPropertySet( Property::Index index, Property::Value propertyValue ); + + /** * @copydoc CustomActorImpl::OnSizeSet() - * @note If overridden, then an up-call to Control::OnSizeSet MUST be made at the start. + * @note If overridden, then an up-call to Control::OnSizeSet MUST be made at the end. */ virtual void OnSizeSet( const Vector3& targetSize ); /** * @copydoc CustomActorImpl::OnSizeAnimation() - * @note If overridden, then an up-call to Control::OnSizeAnimation MUST be made at the start. + * @note If overridden, then an up-call to Control::OnSizeAnimation MUST be made at the end. */ virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize ); diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 403229c..4d7751b 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 2; -const unsigned int TOOLKIT_MICRO_VERSION = 19; +const unsigned int TOOLKIT_MICRO_VERSION = 21; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json b/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json index 8c5661b..1809436 100644 --- a/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * This file is part of Dali Toolkit * @@ -184,11 +184,11 @@ { "progressValue": 0, "trackVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin.9.png", "size":[24,24] }, "progressVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin-progress.9.png", "size":[24,24] } }, diff --git a/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json b/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json index b188dab..0684889 100644 --- a/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json @@ -231,11 +231,11 @@ { "progressValue": 0, "trackVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin.9.png", "size":[24,24] }, "progressVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin-progress.9.png", "size":[24,24] } }, diff --git a/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json b/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json index 2f24933..69abfe1 100644 --- a/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * This file is part of Dali Toolkit * @@ -205,11 +205,11 @@ { "progressValue": 0, "trackVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin.9.png", "size":[24,24] }, "progressVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin-progress.9.png", "size":[24,24] } }, diff --git a/dali-toolkit/styles/images-common/progress-skin-progress.9.png b/dali-toolkit/styles/images-common/progress-skin-progress.9.png new file mode 100644 index 0000000..f02cd0d Binary files /dev/null and b/dali-toolkit/styles/images-common/progress-skin-progress.9.png differ diff --git a/dali-toolkit/styles/images-common/progress-skin.9.png b/dali-toolkit/styles/images-common/progress-skin.9.png new file mode 100644 index 0000000..e1c2ca0 Binary files /dev/null and b/dali-toolkit/styles/images-common/progress-skin.9.png differ diff --git a/docs/content/shared-javascript-and-cpp-documentation/creating-custom-controls.md b/docs/content/shared-javascript-and-cpp-documentation/creating-custom-controls.md index a1451ee..54a0220 100644 --- a/docs/content/shared-javascript-and-cpp-documentation/creating-custom-controls.md +++ b/docs/content/shared-javascript-and-cpp-documentation/creating-custom-controls.md @@ -341,10 +341,10 @@ An up call to the Control class is necessary if these methods are overridden. // C++ void MyUIControlImpl::OnChildAdd( Actor& child ); { - // Up call to Control first - Control::OnChildAdd( child ); - // Do any other operations required upon child addition + + // Up call to Control at the end + Control::OnChildAdd( child ); } ~~~ ~~~{.cpp} @@ -371,10 +371,10 @@ An up call to the Control class is necessary if these methods are overridden. // C++ void MyUIControlImpl::OnStageConnection( int depth ) { - // Up call to Control first - Control::OnStageConnection( depth ); - // Do any other operations required upon stage connection + + // Up call to Control at the end + Control::OnStageConnection( depth ); } ~~~ ~~~{.cpp} @@ -449,6 +449,18 @@ More information on size negotiation can be found [here](@ref size-negotiation-c ___________________________________________________________________________________________________ +### Clipping Support {#creating-controls-clipping} + +When an Actor is set to clip its children, the renderers have to be added manually in order to specify what its children need to clip to. +The Control base class automates the creation of the renderers/visuals when it is set to clip its children. + +This is only done if the application or custom control writer has not added any renderers to the Control or registered any visuals +(regardless of whether these visuals are enabled or not). + +If custom control writers want to define the clipping visuals themselves, then they should register all required visuals before the control is staged. + +___________________________________________________________________________________________________ + ### Other Features {#creating-controls-other} + [Background](@ref background) diff --git a/packaging/dali-addon.spec b/packaging/dali-addon.spec index a6f153e..66af4d1 100644 --- a/packaging/dali-addon.spec +++ b/packaging/dali-addon.spec @@ -1,6 +1,6 @@ Name: dali-addon Summary: DALi module for Node.JS -Version: 1.2.19 +Version: 1.2.21 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 93e837a..35d0ed9 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.2.19 +Version: 1.2.21 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-2-Clause and MIT diff --git a/plugins/dali-swig/Makefile.am b/plugins/dali-swig/Makefile.am index 1e437ce..991c0ee 100755 --- a/plugins/dali-swig/Makefile.am +++ b/plugins/dali-swig/Makefile.am @@ -48,6 +48,7 @@ check-local: examples/dali-test.exe \ examples/spin-control.exe \ examples/control-dashboard.exe \ examples/user-alphafunction.exe \ + examples/image-view.exe \ examples/libNDalic.so examples/NDali.dll examples/%.exe: examples/%.cs diff --git a/plugins/dali-swig/SWIG/alphafunction.i b/plugins/dali-swig/SWIG/alphafunction.i index 154641c..c9173f6 100755 --- a/plugins/dali-swig/SWIG/alphafunction.i +++ b/plugins/dali-swig/SWIG/alphafunction.i @@ -16,11 +16,6 @@ */ %typemap(cscode) Dali::AlphaFunction %{ - public AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction function) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_1((int)function), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - public AlphaFunction(System.Delegate func) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_2(SWIGTYPE_p_f_float__float.getCPtr(new SWIGTYPE_p_f_float__float(System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func), true))), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); diff --git a/plugins/dali-swig/SWIG/dali-core.i b/plugins/dali-swig/SWIG/dali-core.i index 1eb729a..5535ee9 100755 --- a/plugins/dali-swig/SWIG/dali-core.i +++ b/plugins/dali-swig/SWIG/dali-core.i @@ -147,7 +147,21 @@ %rename(BlendingEquationType) Dali::BlendingEquation::Type; %rename(CameraType) Dali::Camera::Type; %rename(LayerBehavior) Dali::Layer::Behavior; -%rename(DaliEndAction) Dali::Animation::EndAction; +%rename(X) Dali::Vector2::x; +%rename(Y) Dali::Vector2::y; +%rename(Width) Dali::Vector2::width; +%rename(Height) Dali::Vector2::height; +%rename(X) Dali::Vector3::x; +%rename(Y) Dali::Vector3::y; +%rename(Z) Dali::Vector3::z; +%rename(Width) Dali::Vector3::width; +%rename(Height) Dali::Vector3::height; +%rename(Depth) Dali::Vector3::depth; +%rename(X) Dali::Vector4::x; +%rename(Y) Dali::Vector4::y; +%rename(Z) Dali::Vector4::z; +%rename(W) Dali::Vector4::w; + typedef std::pair StringValuePair; typedef std::vector TouchPointContainer; diff --git a/plugins/dali-swig/SWIG/dali.i b/plugins/dali-swig/SWIG/dali.i index ee70716..1f5149b 100755 --- a/plugins/dali-swig/SWIG/dali.i +++ b/plugins/dali-swig/SWIG/dali.i @@ -218,6 +218,7 @@ using namespace Dali::Toolkit; %include events/videoview-event.i %include alphafunction.i +%include name-changed.i %include dali-operator.i %include dali-core.i diff --git a/plugins/dali-swig/SWIG/events/animation-event.i b/plugins/dali-swig/SWIG/events/animation-event.i index 2bbc118..41e816a 100755 --- a/plugins/dali-swig/SWIG/events/animation-event.i +++ b/plugins/dali-swig/SWIG/events/animation-event.i @@ -109,11 +109,11 @@ using System.Runtime.InteropServices; } } - public Dali.Constants.Animation.State Status + public Animation.State Status { get { - return (Dali.Constants.Animation.State)GetState(); + return GetState(); } } @@ -143,74 +143,36 @@ using System.Runtime.InteropServices; } } - public Dali.Constants.Animation.EndAction EndAction + public Animation.EndActions EndAction { set { - switch(value) - { - case Dali.Constants.Animation.EndAction.Cancel : - SetEndAction(Dali.Animation.DaliEndAction.Bake); - break; - case Dali.Constants.Animation.EndAction.Discard : - SetEndAction(Dali.Animation.DaliEndAction.Discard); - break; - case Dali.Constants.Animation.EndAction.Stop : - SetEndAction(Dali.Animation.DaliEndAction.BakeFinal); - break; - default : - SetEndAction(Dali.Animation.DaliEndAction.Bake); - break; - } + SetEndAction(value); } get { - Dali.Animation.DaliEndAction temp = GetEndAction(); - switch(temp) - { - case Dali.Animation.DaliEndAction.Bake : - return Dali.Constants.Animation.EndAction.Cancel; - case Dali.Animation.DaliEndAction.Discard : - return Dali.Constants.Animation.EndAction.Discard; - case Dali.Animation.DaliEndAction.BakeFinal : - return Dali.Constants.Animation.EndAction.Stop; - default : - return Dali.Constants.Animation.EndAction.Cancel; - } + return GetEndAction(); } } - public void Stop(Dali.Constants.Animation.EndAction action) { - switch( action ) - { - case Dali.Constants.Animation.EndAction.Cancel : - SetEndAction(Dali.Animation.DaliEndAction.Bake); - break; - case Dali.Constants.Animation.EndAction.Discard : - SetEndAction(Dali.Animation.DaliEndAction.Discard); - break; - case Dali.Constants.Animation.EndAction.Stop : - SetEndAction(Dali.Animation.DaliEndAction.BakeFinal); - break; - default : - SetEndAction(Dali.Animation.DaliEndAction.Bake); - break; - } + public void Stop(Animation.EndActions action) + { + SetEndAction(action); NDalicPINVOKE.Animation_Stop(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } public int StartTime { set; get; } public int EndTime { set; get; } - public string TargetPoperty { set; get; } + public string TargetProperty { set; get; } public object Destination { set; get; } public Dali.AlphaFunction AlphaFunction { set; get; } public void AnimateBy(Actor target) { - string _str1 = TargetPoperty.Substring(0, 1); - string _str2 = TargetPoperty.Substring(1); + string _str1 = TargetProperty.Substring(0, 1); + string _str2 = TargetProperty.Substring(1); string _str = _str1.ToLower() + _str2; dynamic obj = (object)Destination; @@ -223,7 +185,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); } } @@ -235,7 +197,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateBy(new Property(target, _str), new Property.Value(obj), time ); } } @@ -257,7 +219,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); } } @@ -269,7 +231,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateBy(new Property(target, _str), new Property.Value(obj), time ); } } @@ -291,7 +253,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); } } @@ -303,7 +265,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateBy(new Property(target, _str), new Property.Value(obj), time ); } } @@ -311,8 +273,8 @@ using System.Runtime.InteropServices; public void AnimateTo(Actor target) { - string _str1 = TargetPoperty.Substring(0, 1); - string _str2 = TargetPoperty.Substring(1); + string _str1 = TargetProperty.Substring(0, 1); + string _str2 = TargetProperty.Substring(1); string _str = _str1.ToLower() + _str2; dynamic obj = (object)Destination; @@ -325,7 +287,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); } } @@ -337,7 +299,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateTo(new Property(target, _str), new Property.Value(obj), time ); } } @@ -359,7 +321,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); } } @@ -371,7 +333,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateTo(new Property(target, _str), new Property.Value(obj), time ); } } @@ -393,7 +355,7 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); } } @@ -405,12 +367,79 @@ using System.Runtime.InteropServices; } else { - Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); AnimateTo(new Property(target, _str), new Property.Value(obj), time ); } } } + public void AnimateBetween(Actor target, KeyFrames keyFrames) + { + string _str1 = TargetProperty.Substring(0, 1); + string _str2 = TargetProperty.Substring(1); + string _str = _str1.ToLower() + _str2; + + + if( this.AlphaFunction != null ) + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBetween(new Property(target, _str), keyFrames, this.AlphaFunction); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); + AnimateBetween(new Property(target, _str), keyFrames, this.AlphaFunction, time); + } + } + else + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBetween(new Property(target, _str), keyFrames); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); + AnimateBetween(new Property(target, _str), keyFrames, time); + } + } + } + + public void AnimateBetween(Actor target, KeyFrames keyFrames, Animation.Interpolation interpolation) + { + string _str1 = TargetProperty.Substring(0, 1); + string _str2 = TargetProperty.Substring(1); + string _str = _str1.ToLower() + _str2; + + + if( this.AlphaFunction != null ) + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBetween(new Property(target, _str), keyFrames, this.AlphaFunction, interpolation); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); + AnimateBetween(new Property(target, _str), keyFrames, this.AlphaFunction, time, interpolation); + } + } + else + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBetween(new Property(target, _str), keyFrames, interpolation); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime - this.StartTime ) ); + AnimateBetween(new Property(target, _str), keyFrames, time, interpolation); + } + } + } + + /** * @brief Create an initialized Animation. * @@ -443,4 +472,21 @@ using System.Runtime.InteropServices; namespace Dali { DALI_animation_EVENTHANDLER_PARAM( Dali, Animation); + +%typemap(cscode) Dali::KeyFrames %{ + + public void Add(float progress, object value) + { + dynamic obj = value; + Add(progress, new Property.Value(obj)); + } + + public void Add(float progress, object value, AlphaFunction alpha) + { + dynamic obj = value; + Add(progress, new Property.Value(obj), alpha); + } + +%} + } diff --git a/plugins/dali-swig/SWIG/events/application-event.i b/plugins/dali-swig/SWIG/events/application-event.i index b6acb9d..bc81dec 100644 --- a/plugins/dali-swig/SWIG/events/application-event.i +++ b/plugins/dali-swig/SWIG/events/application-event.i @@ -21,10 +21,10 @@ using System.Runtime.InteropServices; /** - * @brief Event arguments that passed via AUIApplicationInit signal + * @brief Event arguments that passed via NUIApplicationInit signal * */ - public class AUIApplicationInitEventArgs : EventArgs + public class NUIApplicationInitEventArgs : EventArgs { private Application _application; @@ -46,10 +46,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationTerminate signal + * @brief Event arguments that passed via NUIApplicationTerminate signal * */ - public class AUIApplicationTerminateEventArgs : EventArgs + public class NUIApplicationTerminateEventArgs : EventArgs { private Application _application; /** @@ -70,10 +70,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationPause signal + * @brief Event arguments that passed via NUIApplicationPause signal * */ - public class AUIApplicationPauseEventArgs : EventArgs + public class NUIApplicationPauseEventArgs : EventArgs { private Application _application; /** @@ -94,10 +94,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationResume signal + * @brief Event arguments that passed via NUIApplicationResume signal * */ - public class AUIApplicationResumeEventArgs : EventArgs + public class NUIApplicationResumeEventArgs : EventArgs { private Application _application; /** @@ -118,10 +118,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationReset signal + * @brief Event arguments that passed via NUIApplicationReset signal * */ - public class AUIApplicationResetEventArgs : EventArgs + public class NUIApplicationResetEventArgs : EventArgs { private Application _application; /** @@ -142,10 +142,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationResize signal + * @brief Event arguments that passed via NUIApplicationResize signal * */ - public class AUIApplicationResizeEventArgs : EventArgs + public class NUIApplicationResizeEventArgs : EventArgs { private Application _application; /** @@ -166,10 +166,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationLanguageChanged signal + * @brief Event arguments that passed via NUIApplicationLanguageChanged signal * */ - public class AUIApplicationLanguageChangedEventArgs : EventArgs + public class NUIApplicationLanguageChangedEventArgs : EventArgs { private Application _application; /** @@ -190,10 +190,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationRegionChanged signal + * @brief Event arguments that passed via NUIApplicationRegionChanged signal * */ - public class AUIApplicationRegionChangedEventArgs : EventArgs + public class NUIApplicationRegionChangedEventArgs : EventArgs { private Application _application; /** @@ -214,10 +214,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationBatteryLow signal + * @brief Event arguments that passed via NUIApplicationBatteryLow signal * */ - public class AUIApplicationBatteryLowEventArgs : EventArgs + public class NUIApplicationBatteryLowEventArgs : EventArgs { private Application _application; /** @@ -238,10 +238,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationMemoryLow signal + * @brief Event arguments that passed via NUIApplicationMemoryLow signal * */ - public class AUIApplicationMemoryLowEventArgs : EventArgs + public class NUIApplicationMemoryLowEventArgs : EventArgs { private Application _application; /** @@ -262,10 +262,10 @@ } /** - * @brief Event arguments that passed via AUIApplicationAppControl signal + * @brief Event arguments that passed via NUIApplicationAppControl signal * */ - public class AUIApplicationAppControlEventArgs : EventArgs + public class NUIApplicationAppControlEventArgs : EventArgs { private Application _application; private IntPtr _voidp; @@ -308,69 +308,69 @@ %define APPLICATION_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName) %typemap(cscode) NameSpace::ClassName %{ [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationInitEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationInitEventHandler; - private AUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate; + private delegate void NUIApplicationInitEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationInitEventHandler; + private NUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationTerminateEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationTerminateEventHandler; - private AUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate; + private delegate void NUIApplicationTerminateEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationTerminateEventHandler; + private NUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationPauseEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationPauseEventHandler; - private AUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate; + private delegate void NUIApplicationPauseEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationPauseEventHandler; + private NUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationResumeEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationResumeEventHandler; - private AUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate; + private delegate void NUIApplicationResumeEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationResumeEventHandler; + private NUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationResetEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationResetEventHandler; - private AUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate; + private delegate void NUIApplicationResetEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationResetEventHandler; + private NUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationResizeEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationResizeEventHandler; - private AUIApplicationResizeEventCallbackDelegate _applicationResizeEventCallbackDelegate; + private delegate void NUIApplicationResizeEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationResizeEventHandler; + private NUIApplicationResizeEventCallbackDelegate _applicationResizeEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationLanguageChangedEventHandler; - private AUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate; + private delegate void NUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationLanguageChangedEventHandler; + private NUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationRegionChangedEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationRegionChangedEventHandler; - private AUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate; + private delegate void NUIApplicationRegionChangedEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationRegionChangedEventHandler; + private NUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationBatteryLowEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationBatteryLowEventHandler; - private AUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate; + private delegate void NUIApplicationBatteryLowEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationBatteryLowEventHandler; + private NUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationMemoryLowEventCallbackDelegate(IntPtr application); - private DaliEventHandler _applicationMemoryLowEventHandler; - private AUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate; + private delegate void NUIApplicationMemoryLowEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationMemoryLowEventHandler; + private NUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void AUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp); - private DaliEventHandler _applicationAppControlEventHandler; - private AUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate; + private delegate void NUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp); + private DaliEventHandler _applicationAppControlEventHandler; + private NUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate; /** * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationInitEventHandler - DaliEventHandler) + * (in the type of NUIApplicationInitEventHandler - DaliEventHandler) * provided by the user. Initialized signal is emitted when application is initialised */ - public event DaliEventHandler Initialized + public event DaliEventHandler Initialized { add { @@ -381,7 +381,7 @@ { _applicationInitEventHandler += value; - _applicationInitEventCallbackDelegate = new AUIApplicationInitEventCallbackDelegate(OnApplicationInit); + _applicationInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationInit); this.InitSignal().Connect(_applicationInitEventCallbackDelegate); } } @@ -404,9 +404,9 @@ // Callback for Application InitSignal private void OnApplicationInit(IntPtr data) { - AUIApplicationInitEventArgs e = new AUIApplicationInitEventArgs(); + NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs(); - // Populate all members of "e" (AUIApplicationInitEventArgs) with real data + // Populate all members of "e" (NUIApplicationInitEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationInitEventHandler != null) @@ -418,10 +418,10 @@ /** * @brief Event for Terminated signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationTerminateEventHandler-DaliEventHandler) + * (in the type of NUIApplicationTerminateEventHandler-DaliEventHandler) * provided by the user. Terminated signal is emitted when application is terminated */ - public event DaliEventHandler Terminated + public event DaliEventHandler Terminated { add { @@ -432,7 +432,7 @@ { _applicationTerminateEventHandler += value; - _applicationTerminateEventCallbackDelegate = new AUIApplicationTerminateEventCallbackDelegate(OnAUIApplicationTerminate); + _applicationTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTerminate); this.TerminateSignal().Connect(_applicationTerminateEventCallbackDelegate); } } @@ -453,11 +453,11 @@ } // Callback for Application TerminateSignal - private void OnAUIApplicationTerminate(IntPtr data) + private void OnNUIApplicationTerminate(IntPtr data) { - AUIApplicationTerminateEventArgs e = new AUIApplicationTerminateEventArgs(); + NUIApplicationTerminateEventArgs e = new NUIApplicationTerminateEventArgs(); - // Populate all members of "e" (AUIApplicationTerminateEventArgs) with real data + // Populate all members of "e" (NUIApplicationTerminateEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationTerminateEventHandler != null) @@ -469,10 +469,10 @@ /** * @brief Event for Paused signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationPauseEventHandler-DaliEventHandler) + * (in the type of NUIApplicationPauseEventHandler-DaliEventHandler) * provided by the user. Paused signal is emitted when application is paused */ - public event DaliEventHandler Paused + public event DaliEventHandler Paused { add { @@ -483,7 +483,7 @@ { _applicationPauseEventHandler += value; - _applicationPauseEventCallbackDelegate = new AUIApplicationPauseEventCallbackDelegate(OnAUIApplicationPause); + _applicationPauseEventCallbackDelegate = new NUIApplicationPauseEventCallbackDelegate(OnNUIApplicationPause); this.PauseSignal().Connect(_applicationPauseEventCallbackDelegate); } } @@ -504,11 +504,11 @@ } // Callback for Application PauseSignal - private void OnAUIApplicationPause(IntPtr data) + private void OnNUIApplicationPause(IntPtr data) { - AUIApplicationPauseEventArgs e = new AUIApplicationPauseEventArgs(); + NUIApplicationPauseEventArgs e = new NUIApplicationPauseEventArgs(); - // Populate all members of "e" (AUIApplicationPauseEventArgs) with real data + // Populate all members of "e" (NUIApplicationPauseEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationPauseEventHandler != null) @@ -520,10 +520,10 @@ /** * @brief Event for Resumed signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationResumeEventHandler-DaliEventHandler) + * (in the type of NUIApplicationResumeEventHandler-DaliEventHandler) * provided by the user. Resumed signal is emitted when application is resumed */ - public event DaliEventHandler Resumed + public event DaliEventHandler Resumed { add { @@ -534,7 +534,7 @@ { _applicationResumeEventHandler += value; - _applicationResumeEventCallbackDelegate = new AUIApplicationResumeEventCallbackDelegate(OnAUIApplicationResume); + _applicationResumeEventCallbackDelegate = new NUIApplicationResumeEventCallbackDelegate(OnNUIApplicationResume); this.ResumeSignal().Connect(_applicationResumeEventCallbackDelegate); } } @@ -555,11 +555,11 @@ } // Callback for Application ResumeSignal - private void OnAUIApplicationResume(IntPtr data) + private void OnNUIApplicationResume(IntPtr data) { - AUIApplicationResumeEventArgs e = new AUIApplicationResumeEventArgs(); + NUIApplicationResumeEventArgs e = new NUIApplicationResumeEventArgs(); - // Populate all members of "e" (AUIApplicationResumeEventArgs) with real data + // Populate all members of "e" (NUIApplicationResumeEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationResumeEventHandler != null) @@ -571,10 +571,10 @@ /** * @brief Event for Reset signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationResetEventHandler-DaliEventHandler) + * (in the type of NUIApplicationResetEventHandler-DaliEventHandler) * provided by the user. Reset signal is emitted when application is reset */ - public event DaliEventHandler Reset + public event DaliEventHandler Reset { add { @@ -585,7 +585,7 @@ { _applicationResetEventHandler += value; - _applicationResetEventCallbackDelegate = new AUIApplicationResetEventCallbackDelegate(OnAUIApplicationReset); + _applicationResetEventCallbackDelegate = new NUIApplicationResetEventCallbackDelegate(OnNUIApplicationReset); this.ResetSignal().Connect(_applicationResetEventCallbackDelegate); } } @@ -606,11 +606,11 @@ } // Callback for Application ResetSignal - private void OnAUIApplicationReset(IntPtr data) + private void OnNUIApplicationReset(IntPtr data) { - AUIApplicationResetEventArgs e = new AUIApplicationResetEventArgs(); + NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs(); - // Populate all members of "e" (AUIApplicationResetEventArgs) with real data + // Populate all members of "e" (NUIApplicationResetEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationResetEventHandler != null) @@ -622,10 +622,10 @@ /** * @brief Event for Resized signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationResizeEventHandler-DaliEventHandler) + * (in the type of NUIApplicationResizeEventHandler-DaliEventHandler) * provided by the user. Resized signal is emitted when application is resized */ - public event DaliEventHandler Resized + public event DaliEventHandler Resized { add { @@ -636,7 +636,7 @@ { _applicationResizeEventHandler += value; - _applicationResizeEventCallbackDelegate = new AUIApplicationResizeEventCallbackDelegate(OnAUIApplicationResize); + _applicationResizeEventCallbackDelegate = new NUIApplicationResizeEventCallbackDelegate(OnNUIApplicationResize); this.ResizeSignal().Connect(_applicationResizeEventCallbackDelegate); } } @@ -657,11 +657,11 @@ } // Callback for Application ResizeSignal - private void OnAUIApplicationResize(IntPtr data) + private void OnNUIApplicationResize(IntPtr data) { - AUIApplicationResizeEventArgs e = new AUIApplicationResizeEventArgs(); + NUIApplicationResizeEventArgs e = new NUIApplicationResizeEventArgs(); - // Populate all members of "e" (AUIApplicationResizeEventArgs) with real data + // Populate all members of "e" (NUIApplicationResizeEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationResizeEventHandler != null) @@ -673,10 +673,10 @@ /** * @brief Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationLanguageChangedEventHandler-DaliEventHandler) + * (in the type of NUIApplicationLanguageChangedEventHandler-DaliEventHandler) * provided by the user. LanguageChanged signal is emitted when the region of the device is changed. */ - public event DaliEventHandler LanguageChanged + public event DaliEventHandler LanguageChanged { add { @@ -687,7 +687,7 @@ { _applicationLanguageChangedEventHandler += value; - _applicationLanguageChangedEventCallbackDelegate = new AUIApplicationLanguageChangedEventCallbackDelegate(OnAUIApplicationLanguageChanged); + _applicationLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationLanguageChanged); this.LanguageChangedSignal().Connect(_applicationLanguageChangedEventCallbackDelegate); } } @@ -708,11 +708,11 @@ } // Callback for Application LanguageChangedSignal - private void OnAUIApplicationLanguageChanged(IntPtr data) + private void OnNUIApplicationLanguageChanged(IntPtr data) { - AUIApplicationLanguageChangedEventArgs e = new AUIApplicationLanguageChangedEventArgs(); + NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs(); - // Populate all members of "e" (AUIApplicationLanguageChangedEventArgs) with real data + // Populate all members of "e" (NUIApplicationLanguageChangedEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationLanguageChangedEventHandler != null) @@ -724,10 +724,10 @@ /** * @brief Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationRegionChangedEventHandler-DaliEventHandler) + * (in the type of NUIApplicationRegionChangedEventHandler-DaliEventHandler) * provided by the user. RegionChanged signal is emitted when the region of the device is changed. */ - public event DaliEventHandler RegionChanged + public event DaliEventHandler RegionChanged { add { @@ -738,7 +738,7 @@ { _applicationRegionChangedEventHandler += value; - _applicationRegionChangedEventCallbackDelegate = new AUIApplicationRegionChangedEventCallbackDelegate(OnAUIApplicationRegionChanged); + _applicationRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationRegionChanged); this.RegionChangedSignal().Connect(_applicationRegionChangedEventCallbackDelegate); } } @@ -759,11 +759,11 @@ } // Callback for Application RegionChangedSignal - private void OnAUIApplicationRegionChanged(IntPtr data) + private void OnNUIApplicationRegionChanged(IntPtr data) { - AUIApplicationRegionChangedEventArgs e = new AUIApplicationRegionChangedEventArgs(); + NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs(); - // Populate all members of "e" (AUIApplicationRegionChangedEventArgs) with real data + // Populate all members of "e" (NUIApplicationRegionChangedEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationRegionChangedEventHandler != null) @@ -775,10 +775,10 @@ /** * @brief Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationBatteryLowEventHandler-DaliEventHandler) + * (in the type of NUIApplicationBatteryLowEventHandler-DaliEventHandler) * provided by the user. BatteryLow signal is emitted when the battery level of the device is low. */ - public event DaliEventHandler BatteryLow + public event DaliEventHandler BatteryLow { add { @@ -789,7 +789,7 @@ { _applicationBatteryLowEventHandler += value; - _applicationBatteryLowEventCallbackDelegate = new AUIApplicationBatteryLowEventCallbackDelegate(OnAUIApplicationBatteryLow); + _applicationBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationBatteryLow); this.BatteryLowSignal().Connect(_applicationBatteryLowEventCallbackDelegate); } } @@ -810,11 +810,11 @@ } // Callback for Application BatteryLowSignal - private void OnAUIApplicationBatteryLow(IntPtr data) + private void OnNUIApplicationBatteryLow(IntPtr data) { - AUIApplicationBatteryLowEventArgs e = new AUIApplicationBatteryLowEventArgs(); + NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs(); - // Populate all members of "e" (AUIApplicationBatteryLowEventArgs) with real data + // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationBatteryLowEventHandler != null) @@ -826,10 +826,10 @@ /** * @brief Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationMemoryLowEventHandler-DaliEventHandler) + * (in the type of NUIApplicationMemoryLowEventHandler-DaliEventHandler) * provided by the user. MemoryLow signal is emitted when the memory level of the device is low. */ - public event DaliEventHandler MemoryLow + public event DaliEventHandler MemoryLow { add { @@ -840,7 +840,7 @@ { _applicationMemoryLowEventHandler += value; - _applicationMemoryLowEventCallbackDelegate = new AUIApplicationMemoryLowEventCallbackDelegate(OnAUIApplicationMemoryLow); + _applicationMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationMemoryLow); this.MemoryLowSignal().Connect(_applicationMemoryLowEventCallbackDelegate); } } @@ -861,11 +861,11 @@ } // Callback for Application MemoryLowSignal - private void OnAUIApplicationMemoryLow(IntPtr data) + private void OnNUIApplicationMemoryLow(IntPtr data) { - AUIApplicationMemoryLowEventArgs e = new AUIApplicationMemoryLowEventArgs(); + NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs(); - // Populate all members of "e" (AUIApplicationMemoryLowEventArgs) with real data + // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); if (_applicationMemoryLowEventHandler != null) @@ -877,10 +877,10 @@ /** * @brief Event for AppControl signal which can be used to subscribe/unsubscribe the event handler - * (in the type of AUIApplicationAppControlEventHandler-DaliEventHandler) + * (in the type of NUIApplicationAppControlEventHandler-DaliEventHandler) * provided by the user. AppControl signal is emitted when another application sends a launch request to the application. */ - public event DaliEventHandler AppControl + public event DaliEventHandler AppControl { add { @@ -891,7 +891,7 @@ { _applicationAppControlEventHandler += value; - _applicationAppControlEventCallbackDelegate = new AUIApplicationAppControlEventCallbackDelegate(OnAUIApplicationAppControl); + _applicationAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationAppControl); this.AppControlSignal().Connect(_applicationAppControlEventCallbackDelegate); } } @@ -912,11 +912,11 @@ } // Callback for Application AppControlSignal - private void OnAUIApplicationAppControl(IntPtr application, IntPtr voidp) + private void OnNUIApplicationAppControl(IntPtr application, IntPtr voidp) { - AUIApplicationAppControlEventArgs e = new AUIApplicationAppControlEventArgs(); + NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs(); - // Populate all members of "e" (AUIApplicationAppControlEventArgs) with real data + // Populate all members of "e" (NUIApplicationAppControlEventArgs) with real data e.Application = Application.GetApplicationFromPtr(application); e.VoidP = voidp; diff --git a/plugins/dali-swig/SWIG/events/stage-event.i b/plugins/dali-swig/SWIG/events/stage-event.i index ed2dabc..6b2329b 100755 --- a/plugins/dali-swig/SWIG/events/stage-event.i +++ b/plugins/dali-swig/SWIG/events/stage-event.i @@ -442,6 +442,32 @@ using System.Runtime.InteropServices; } } + private static readonly Stage instance = Stage.GetCurrent(); + + public static Stage Instance + { + get + { + return instance; + } + } + + public Layer GetDefaultLayer() + { + return this.GetRootLayer(); + } + + public void AddLayer(Layer layer) + { + this.Add( (Actor)layer ); + } + + public void RemoveLayer(Layer layer) + { + this.Remove( (Actor)layer ); + } + + %} %enddef diff --git a/plugins/dali-swig/SWIG/name-changed.i b/plugins/dali-swig/SWIG/name-changed.i new file mode 100644 index 0000000..c8dbb94 --- /dev/null +++ b/plugins/dali-swig/SWIG/name-changed.i @@ -0,0 +1,26 @@ +%rename( EndActions ) Dali::Animation::EndAction; +%rename( Cancel ) Dali::Animation::Bake; +%rename( StopFinal ) Dali::Animation::BakeFinal; +%rename( Stopped ) Dali::Animation::STOPPED; +%rename( Playing ) Dali::Animation::PLAYING; +%rename( Paused ) Dali::Animation::PAUSED; + +%rename( Default ) Dali::AlphaFunction::DEFAULT; +%rename( Linear ) Dali::AlphaFunction::LINEAR; +%rename( Reverse ) Dali::AlphaFunction::REVERSE; +%rename( EaseInSquare ) Dali::AlphaFunction::EASE_IN_SQUARE; +%rename( EaseOutSquare ) Dali::AlphaFunction::EASE_OUT_SQUARE; +%rename( EaseIn ) Dali::AlphaFunction::EASE_IN; +%rename( EaseOut ) Dali::AlphaFunction::EASE_OUT; +%rename( EaseInOut ) Dali::AlphaFunction::EASE_IN_OUT; +%rename( EaseInSine ) Dali::AlphaFunction::EASE_IN_SINE; +%rename( EaseOutSine) Dali::AlphaFunction::EASE_OUT_SINE; +%rename( EaseInOutSine ) Dali::AlphaFunction::EASE_IN_OUT_SINE; +%rename( Bounce ) Dali::AlphaFunction::BOUNCE; +%rename( Sin ) Dali::AlphaFunction::SIN; +%rename( EaseOutBack) Dali::AlphaFunction::EASE_OUT_BACK; +%rename( Count) Dali::AlphaFunction::COUNT; +%rename( BuiltinFunction ) Dali::AlphaFunction::BUILTIN_FUNCTION; +%rename( CustomFunction ) Dali::AlphaFunction::CUSTOM_FUNCTION; +%rename( Bezier ) Dali::AlphaFunction::BEZIER; + diff --git a/plugins/dali-swig/examples/control-dashboard.cs b/plugins/dali-swig/examples/control-dashboard.cs index bdd3d5d..8fe3c70 100755 --- a/plugins/dali-swig/examples/control-dashboard.cs +++ b/plugins/dali-swig/examples/control-dashboard.cs @@ -58,7 +58,7 @@ namespace MyCSharpExample _application.Initialized += OnInitialize; } - public void OnInitialize(object source, AUIApplicationInitEventArgs e) + public void OnInitialize(object source, NUIApplicationInitEventArgs e) { Console.WriteLine("Customized Application Initialize event handler"); _stage = Stage.GetCurrent(); @@ -122,7 +122,7 @@ namespace MyCSharpExample { // Make label for item TextLabel itemLabel = new TextLabel(" " + item.name); - itemLabel.Size = new Vector3(_stage.GetSize().width * 0.2f, _stage.GetSize().height * 0.05f, 0.0f); + itemLabel.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.05f, 0.0f); itemLabel.HorizontalAlignment = "BEGIN"; itemLabel.VerticalAlignment = "BOTTOM"; itemLabel.PointSize = 18.0f; @@ -270,7 +270,7 @@ namespace MyCSharpExample else { ImageView notSupportView = new ImageView("images/not_yet_sign.png"); - notSupportView.Size = new Vector3(_stage.GetSize().width * 0.2f, _stage.GetSize().height * 0.25f, 0.0f); + notSupportView.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.25f, 0.0f); notSupportView.SetKeyboardFocusable(true); _contentContainer.AddChild(notSupportView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); } diff --git a/plugins/dali-swig/examples/custom-control.cs b/plugins/dali-swig/examples/custom-control.cs index 92b0610..adf3a42 100644 --- a/plugins/dali-swig/examples/custom-control.cs +++ b/plugins/dali-swig/examples/custom-control.cs @@ -83,8 +83,8 @@ namespace MyCSharpExample case Gesture.State.Continuing: { // Calculate the rating according to pan desture displacement - _gestureDisplacement.x += gesture.displacement.x; - int delta = (int)Math.Ceiling(_gestureDisplacement.x / 40.0f); + _gestureDisplacement.X += gesture.displacement.X; + int delta = (int)Math.Ceiling(_gestureDisplacement.X / 40.0f); _currentValue = _myRating + delta; // Clamp the rating @@ -163,7 +163,7 @@ namespace MyCSharpExample _application.Initialized += Initialize; } - public void Initialize(object source, AUIApplicationInitEventArgs e) + public void Initialize(object source, NUIApplicationInitEventArgs e) { Stage stage = Stage.GetCurrent(); stage.BackgroundColor = Color.White; diff --git a/plugins/dali-swig/examples/dali-test.cs b/plugins/dali-swig/examples/dali-test.cs index b6396f7..9c02eee 100644 --- a/plugins/dali-swig/examples/dali-test.cs +++ b/plugins/dali-swig/examples/dali-test.cs @@ -37,7 +37,7 @@ namespace MyCSharpExample Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() ); } - public void Initialize(object source, AUIApplicationInitEventArgs e) + public void Initialize(object source, NUIApplicationInitEventArgs e) { OperatorTests(); @@ -58,7 +58,7 @@ namespace MyCSharpExample actor.Name = "MyActor"; actor.Color = new Color(1.0f, 0.0f, 1.0f, 0.8f); Console.WriteLine("Actor id: {0}", actor.GetId()); - Console.WriteLine("Actor size: " + actor.Size.x + ", " + actor.Size.y); + Console.WriteLine("Actor size: " + actor.Size.X + ", " + actor.Size.Y); Console.WriteLine("Actor name: " + actor.Name); Stage stage = Stage.GetCurrent(); diff --git a/plugins/dali-swig/examples/hello-world.cs b/plugins/dali-swig/examples/hello-world.cs index 8437e3a..324d5dd 100755 --- a/plugins/dali-swig/examples/hello-world.cs +++ b/plugins/dali-swig/examples/hello-world.cs @@ -34,15 +34,12 @@ namespace MyCSharpExample _application.Initialized += Initialize; } - public void Initialize(object source, AUIApplicationInitEventArgs e) + public void Initialize(object source, NUIApplicationInitEventArgs e) { Console.WriteLine("Customized Application Initialize event handler"); - Stage stage = Stage.GetCurrent(); - stage.BackgroundColor = Color.Cyan; + Stage stage = Stage.Instance; + stage.BackgroundColor = Color.White; stage.TouchEvent += OnStageTouched; - stage.WheelEvent += OnStageWheelMoved; - stage.KeyEvent += OnStageKeyPressed; - stage.EventProcessingFinished += OnStageEventProcessingFinished; // Add a _text label to the stage _text = new TextLabel("Hello Mono World"); @@ -57,13 +54,7 @@ namespace MyCSharpExample // Callback for _animation finished signal handling public void AnimationFinished(object sender, EventArgs e) { - Console.WriteLine("AnimationFinished()!"); - } - - // Callback for _animation finished signal handling - public void AnimationFinished2(object sender, EventArgs e) - { - Console.WriteLine("AnimationFinished2()!"); + Console.WriteLine("AnimationFinished()!"); if(_animation) { Console.WriteLine("Duration= " + _animation.Duration); @@ -71,29 +62,6 @@ namespace MyCSharpExample } } - public void OnStageEventProcessingFinished(object sender, EventArgs e) - { - Console.WriteLine("OnStageEventProcessingFinished()!"); - if( e != null) - { - Console.WriteLine("e != null !"); - } - } - - public void OnStageKeyPressed(object sender, Stage.KeyEventArgs e) - { - Console.WriteLine("OnStageKeyEventOccured()!"); - Console.WriteLine("keyPressedName=" + e.KeyEvent.keyPressedName); - Console.WriteLine("state=" + e.KeyEvent.state); - } - - public void OnStageWheelMoved(object sender, Stage.WheelEventArgs e) - { - Console.WriteLine("OnStageWheelEventOccured()!"); - Console.WriteLine("direction=" + e.WheelEvent.direction); - Console.WriteLine("type=" + e.WheelEvent.type); - } - // Callback for stage touched signal handling public void OnStageTouched(object sender, Stage.TouchEventArgs e) { @@ -112,34 +80,33 @@ namespace MyCSharpExample Duration = 2000, StartTime = 0, EndTime = 500, - TargetPoperty = "Orientation", + TargetProperty = "Orientation", Destination = new Quaternion( new Radian( new Degree( 180.0f ) ), Vect3.Xaxis) }; _animation.AnimateTo(_text); _animation.StartTime = 500; _animation.EndTime = 1000; - _animation.TargetPoperty = "Orientation"; + _animation.TargetProperty = "Orientation"; _animation.Destination = new Quaternion( new Radian( new Degree( 0.0f ) ), Vect3.Xaxis ); _animation.AnimateTo(_text); _animation.StartTime = 1000; _animation.EndTime = 1500; - _animation.TargetPoperty = "ScaleX"; + _animation.TargetProperty = "ScaleX"; _animation.Destination = 3.0f; _animation.AnimateBy(_text); _animation.StartTime = 1500; _animation.EndTime = 2000; - _animation.TargetPoperty = "ScaleY"; + _animation.TargetProperty = "ScaleY"; _animation.Destination = 4.0f; _animation.AnimateBy(_text); - _animation.EndAction = Dali.Constants.Animation.EndAction.Discard; + _animation.EndAction = Animation.EndActions.Discard; // Connect the signal callback for animaiton finished signal _animation.Finished += AnimationFinished; - _animation.Finished += AnimationFinished2; // Play the _animation _animation.Play(); diff --git a/plugins/dali-swig/examples/image-view.cs b/plugins/dali-swig/examples/image-view.cs new file mode 100755 index 0000000..43656a2 --- /dev/null +++ b/plugins/dali-swig/examples/image-view.cs @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2016 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. +* +*/ + +using System; +using System.Runtime.InteropServices; +using Dali; +using Dali.Constants; + +namespace ImageViewExample +{ + + class Example + { + public static void Log(string str) + { + Console.WriteLine("[DALI C# SAMPLE] " + str); + } + + private Dali.Application _application; + private Animation _animation; + private ImageView _imageView; + private bool _isAniFinised = true; + private Layer layer, _layer1, _layer2; + private PushButton _pushButton1, _pushButton2; + private Stage stage; + + public Example(Dali.Application application) + { + _application = application; + _application.Initialized += Initialize; + } + + public void Initialize(object source, NUIApplicationInitEventArgs e) + { + Log("Customized Application Initialize event handler"); + stage = Stage.Instance; + stage.BackgroundColor = Color.Cyan; + stage.TouchEvent += OnStageTouched; + stage.WheelEvent += OnStageWheelMoved; + stage.KeyEvent += OnStageKeyPressed; + //stage.EventProcessingFinished += OnStageEventProcessingFinished; + + layer = stage.GetDefaultLayer(); + _layer1 = new Layer(); + _layer2 = new Layer(); + stage.AddLayer(_layer1); + stage.AddLayer(_layer2); + Log("_layer1.Behavior =" + _layer1.Behavior ); + if( _layer1.Behavior == Layer.LayerBehavior.LAYER_UI ) + { + _layer1.Behavior = Layer.LayerBehavior.LAYER_2D; + Log("again _layer1.Behavior =" + _layer1.Behavior ); + } + // Add a ImageView to the stage + _imageView = new ImageView(); + _imageView.ResourceUrl = "./images/gallery-3.jpg"; + _imageView.ParentOrigin = ParentOrigin.Center; + _imageView.AnchorPoint = AnchorPoint.Center; + _imageView.PixelArea = new Vector4(0.0f, 0.0f, 0.5f, 0.5f); + //_imageView.SetResizePolicy(ResizePolicyType.USE_NATURAL_SIZE, DimensionType.ALL_DIMENSIONS); + layer.Add(_imageView); + + _pushButton1 = new PushButton(); + _pushButton1.ParentOrigin = ParentOrigin.BottomLeft; + _pushButton1.AnchorPoint = AnchorPoint.BottomLeft; + _pushButton1.LabelText = "start animation"; + _pushButton1.Position = new Vector3(0.0f, stage.Size.Height * 0.1f, 0.0f); + _pushButton1.Clicked += OnPushButtonClicked1; + _layer1.Add(_pushButton1); + + _pushButton2 = new PushButton(); + _pushButton2.ParentOrigin = ParentOrigin.BottomLeft; + _pushButton2.AnchorPoint = AnchorPoint.BottomLeft; + _pushButton2.LabelText = "reload image with same URL"; + _pushButton2.Position = new Vector3(0.0f, stage.Size.Height * 0.2f, 0.0f); + _pushButton2.Clicked += OnPushButtonClicked2; + _layer2.Add(_pushButton2); + + } + + public bool OnPushButtonClicked2(object sender, Button.ClickedEventArgs e) + { + if( _imageView ) + { + Log("OnPushButtonClicked2()!"); + layer.Remove(_imageView); + _imageView = new ImageView(); + _imageView.ResourceUrl = "./images/gallery-3.jpg"; + _imageView.ParentOrigin = ParentOrigin.Center; + _imageView.AnchorPoint = AnchorPoint.Center; + _imageView.PixelArea = new Vector4(0.0f, 0.0f, 0.5f, 0.5f); + //_imageView.SetResizePolicy(ResizePolicyType.USE_NATURAL_SIZE, DimensionType.ALL_DIMENSIONS); + layer.Add(_imageView); + } + + return true; + } + + + public bool OnPushButtonClicked1(object sender, Button.ClickedEventArgs e) + { + if( _isAniFinised == true ) + { + _isAniFinised = false; + Log("OnPushButtonClicked1()!"); + + // Create a new _animation + if( _animation ) + { + //_animation.Stop(Dali.Constants.Animation.EndAction.Stop); + _animation.Reset(); + } + + _animation = new Animation(); + _animation.StartTime = 0; + _animation.EndTime = 1000; + _animation.TargetProperty = "PixelArea"; + _animation.Destination = new Vector4(0.5f, 0.0f, 0.5f, 0.5f); + _animation.AnimateTo(_imageView); + + _animation.StartTime = 1000; + _animation.EndTime = 2000; + _animation.TargetProperty = "PixelArea"; + _animation.Destination = new Vector4(0.5f, 0.5f, 0.5f, 0.5f); + _animation.AnimateTo(_imageView); + + _animation.StartTime = 2000; + _animation.EndTime = 3000; + _animation.TargetProperty = "PixelArea"; + _animation.Destination = new Vector4(0.0f, 0.0f, 1.0f, 1.0f); + _animation.AnimateTo(_imageView); + + _animation.StartTime = 3000; + _animation.EndTime = 4000; + _animation.TargetProperty = "PixelArea"; + _animation.Destination = new Vector4(0.5f, 0.5f, 0.5f, 0.5f); + _animation.AnimateTo(_imageView); + + _animation.StartTime = 4000; + _animation.EndTime = 6000; + _animation.TargetProperty = "Size"; + KeyFrames _keyFrames = new KeyFrames(); + _keyFrames.Add(0.0f, new Size3D(0.0f, 0.0f, 0.0f) ); + _keyFrames.Add(0.3f, new Size3D( (stage.Size * 0.7f) ) ); + _keyFrames.Add(1.0f, new Size3D( stage.Size ) ); + _animation.AnimateBetween(_imageView, _keyFrames, Animation.Interpolation.Linear); + + _animation.EndAction = Animation.EndActions.Discard; + + // Connect the signal callback for animaiton finished signal + _animation.Finished += AnimationFinished; + _animation.Finished += AnimationFinished2; + + // Play the _animation + _animation.Play(); + } + + return true; + } + + // Callback for _animation finished signal handling + public void AnimationFinished(object sender, EventArgs e) + { + Log("AnimationFinished()!"); + } + + // Callback for second _animation finished signal handling + public void AnimationFinished2(object sender, EventArgs e) + { + Log("AnimationFinished2()!"); + if(_animation) + { + Log("Duration= " + _animation.Duration); + Log("EndAction= " + _animation.EndAction); + _isAniFinised = true; + } + } + + public void OnStageEventProcessingFinished(object sender, EventArgs e) + { + Log("OnStageEventProcessingFinished()!"); + if( e != null) + { + Log("e != null !"); + } + } + + public void OnStageKeyPressed(object sender, Stage.KeyEventArgs e) + { + Log("OnStageKeyEventOccured()!"); + Log("keyPressedName=" + e.KeyEvent.keyPressedName); + Log("state=" + e.KeyEvent.state); + } + + public void OnStageWheelMoved(object sender, Stage.WheelEventArgs e) + { + Log("OnStageWheelEventOccured()!"); + Log("direction=" + e.WheelEvent.direction); + Log("type=" + e.WheelEvent.type); + } + + // Callback for stage touched signal handling + public void OnStageTouched(object sender, Stage.TouchEventArgs e) + { + Log("OnStageTouched()! e.TouchData.GetState(0)=" + e.TouchData.GetState(0) ); + } + + public void MainLoop() + { + _application.MainLoop (); + } + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { + Log("Main() called!"); + + Example example = new Example(Application.NewApplication()); + example.MainLoop (); + } + } +} diff --git a/plugins/dali-swig/examples/scroll-view.cs b/plugins/dali-swig/examples/scroll-view.cs index e922f1f..71e7ff0 100755 --- a/plugins/dali-swig/examples/scroll-view.cs +++ b/plugins/dali-swig/examples/scroll-view.cs @@ -42,7 +42,7 @@ namespace MyCSharpExample } - public void Initialize(object source, AUIApplicationInitEventArgs e) + public void Initialize(object source, NUIApplicationInitEventArgs e) { CreateScrollView(); } @@ -165,8 +165,8 @@ namespace MyCSharpExample _animation = new Animation(1.0f); // 1 second of duration - _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, 0.5f)); - _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.5f, 0.5f)); + _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.0f, 0.5f)); + _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f)); // Connect the signal callback for animaiton finished signal _animation.Finished += AnimationFinished; diff --git a/plugins/dali-swig/examples/spin-control.cs b/plugins/dali-swig/examples/spin-control.cs index 8e5826b..f385852 100755 --- a/plugins/dali-swig/examples/spin-control.cs +++ b/plugins/dali-swig/examples/spin-control.cs @@ -302,7 +302,7 @@ namespace MyCSharpExample _application.Initialized += Initialize; } - public void Initialize(object source, AUIApplicationInitEventArgs e) + public void Initialize(object source, NUIApplicationInitEventArgs e) { Stage stage = Stage.GetCurrent(); stage.BackgroundColor = Color.White; diff --git a/plugins/dali-swig/examples/user-alphafunction.cs b/plugins/dali-swig/examples/user-alphafunction.cs index 0605706..cd11e87 100755 --- a/plugins/dali-swig/examples/user-alphafunction.cs +++ b/plugins/dali-swig/examples/user-alphafunction.cs @@ -46,7 +46,7 @@ namespace MyCSharpExample [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate float UserAlphaFunctionDelegate(float progress); - public void Initialize(object source, AUIApplicationInitEventArgs e) + public void Initialize(object source, NUIApplicationInitEventArgs e) { Log("Initialize() is called!"); Stage stage = Stage.GetCurrent(); @@ -127,13 +127,13 @@ namespace MyCSharpExample _animation = new Animation(10000); // 10000 milli-second of duration _animation.StartTime = 5000; _animation.EndTime = 10000; - _animation.TargetPoperty = "Position"; + _animation.TargetProperty = "Position"; _animation.AlphaFunction = new AlphaFunction(_user_alpha_func); _animation.Destination = new Vector3(150.0f, 150.0f, 0.0f); _animation.AnimateTo(_view2); // Connect the signal callback for animaiton finished signal _animation.Finished += AnimationFinished; - _animation.EndAction = Dali.Constants.Animation.EndAction.Discard; + _animation.EndAction = Animation.EndActions.Discard; // Play the _animation _animation.Play(); } diff --git a/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs b/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs index 71b0ddb..375445d 100755 --- a/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs +++ b/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs @@ -19,47 +19,6 @@ namespace Dali { namespace Constants { - namespace AlphaFunction - { - public enum BuiltinFunction - { - Default = Dali.AlphaFunction.BuiltinFunction.DEFAULT, - Linear = Dali.AlphaFunction.BuiltinFunction.LINEAR, - Reverse = Dali.AlphaFunction.BuiltinFunction.REVERSE, - EaseInSquare = Dali.AlphaFunction.BuiltinFunction.EASE_IN_SQUARE, - EaseOutSquare = Dali.AlphaFunction.BuiltinFunction.EASE_OUT_SQUARE, - EaseIn = Dali.AlphaFunction.BuiltinFunction.EASE_IN, - EaseOut = Dali.AlphaFunction.BuiltinFunction.EASE_OUT, - EaseInOut = Dali.AlphaFunction.BuiltinFunction.EASE_IN_OUT, - EaseInSine = Dali.AlphaFunction.BuiltinFunction.EASE_IN_SINE, - EaseOutSine = Dali.AlphaFunction.BuiltinFunction.EASE_OUT_SINE, - EaseInOutSine = Dali.AlphaFunction.BuiltinFunction.EASE_IN_OUT_SINE, - Bounce = Dali.AlphaFunction.BuiltinFunction.BOUNCE, - Sin = Dali.AlphaFunction.BuiltinFunction.SIN, - EaseOutBack = Dali.AlphaFunction.BuiltinFunction.EASE_OUT_BACK, - Count = Dali.AlphaFunction.BuiltinFunction.COUNT - } - public enum Mode - { - BuiltinFunction = Dali.AlphaFunction.Mode.BUILTIN_FUNCTION, - CustomFunction = Dali.AlphaFunction.Mode.CUSTOM_FUNCTION, - Bezier = Dali.AlphaFunction.Mode.BEZIER - } - } // namespace AlphaFunction - - namespace FrameBuffer - { - namespace Attachment - { - public enum Mask - { - None = Dali.FrameBuffer.Attachment.Mask.NONE, ///< No attachments are created initially @SINCE_1_1.45 - Depth = Dali.FrameBuffer.Attachment.Mask.DEPTH, ///< Depth buffer bit-mask value @SINCE_1_1.45 - Stencil = Dali.FrameBuffer.Attachment.Mask.STENCIL , ///< Stencil buffer bit-mask value @SINCE_1_1.45 - DepthStencil = Dali.FrameBuffer.Attachment.Mask.DEPTH_STENCIL ///< The Framebuffer will be created with depth and stencil buffer @SINCE_1_1.45 - } - } //namespace Attachment - } // namespace FrameBuffer public enum TextureType { @@ -88,27 +47,6 @@ namespace Dali OrthographicProjection = Dali.ProjectionMode.ORTHOGRAPHIC_PROJECTION ///< Relative distance from the camera does not affect the size of objects @SINCE_1_0.0 } - namespace Animation - { - public enum EndAction - { - Cancel = Dali.Animation.DaliEndAction.Bake, - Discard = Dali.Animation.DaliEndAction.Discard, - Stop = Dali.Animation.DaliEndAction.BakeFinal - } - public enum Interpolation - { - Linear = Dali.Animation.Interpolation.Linear, - Cubic = Dali.Animation.Interpolation.Cubic - } - public enum State - { - Stopped = Dali.Animation.State.STOPPED, - Playing = Dali.Animation.State.PLAYING, - Paused = Dali.Animation.State.PAUSED - } - } //namespace Animation - public struct ParentOrigin { public static readonly float Top = NDalic.ParentOriginTop; @@ -157,5 +95,55 @@ namespace Dali public static readonly Dali.Vector3 Zero = Dali.Vector3.ZERO; } + public struct Visual + { + public static readonly int PropertyType = NDalic.VISUAL_PROPERTY_TYPE; + public static readonly int PropertyShader = NDalic.VISUAL_PROPERTY_SHADER; + + public static readonly int VertexShader = NDalic.VERTEX_SHADER; + public static readonly int FragmentShader = NDalic.FRAGMENT_SHADER; + public static readonly int SubdivideGridX = NDalic.SUBDIVIDE_GRID_X; + public static readonly int SubdivideGridY = NDalic.SUBDIVIDE_GRID_Y; + public static readonly int Hints = NDalic.HINTS; + + public static readonly int Color = NDalic.COLOR; + public static readonly int Size = NDalic.SIZE; + public static readonly int AntiAliasing = NDalic.ANTI_ALIASING; + + public static readonly int MixColor = NDalic.MIX_COLOR; + + public static readonly int StartPosition = NDalic.START_POSITION; + public static readonly int EndPosition = NDalic.END_POSITION; + public static readonly int Center = NDalic.CENTER; + public static readonly int Radius = NDalic.RADIUS; + public static readonly int StopOffset = NDalic.STOP_OFFSET; + public static readonly int StopColor = NDalic.STOP_COLOR; + public static readonly int Units = NDalic.UNITS; + public static readonly int SpreadMethod = NDalic.SPREAD_METHOD; + + public static readonly int ImageVisualURL = NDalic.IMAGE_VISUAL_URL; + public static readonly int ImageVisualFittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE; + public static readonly int ImageVisualSamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE; + public static readonly int ImageVisualDesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH; + public static readonly int ImageVisualDesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT; + public static readonly int ImageVisualSynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING; + public static readonly int ImageVisualBorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY; + public static readonly int ImageVisualBatchingEnabled = NDalic.IMAGE_VISUAL_BATCHING_ENABLED; + public static readonly int ImageVisualPixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA; + public static readonly int ImageVisualWrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U; + public static readonly int ImageVisualWrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V; + + public enum Type + { + Border = Dali.VisualType.BORDER, + Color = Dali.VisualType.COLOR, + Gradient = Dali.VisualType.GRADIENT, + Image = Dali.VisualType.IMAGE, + Mesh = Dali.VisualType.MESH, + Primitive = Dali.VisualType.PRIMITIVE, + WireFrame = Dali.VisualType.WIREFRAME + } + } + } // namespace Constants } // namesapce Dali diff --git a/plugins/dali-swig/manual/csharp/DaliEventHandler.cs b/plugins/dali-swig/manual/csharp/DaliEventHandler.cs index 53e8321..f35c1de 100755 --- a/plugins/dali-swig/manual/csharp/DaliEventHandler.cs +++ b/plugins/dali-swig/manual/csharp/DaliEventHandler.cs @@ -23,13 +23,13 @@ namespace Dali { public delegate R DaliEventHandlerWithReturnType(T source, U e); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate void EventCallbackDelegateType0(); + internal delegate void EventCallbackDelegateType0(); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate void EventCallbackDelegateType1(T arg1); + internal delegate void EventCallbackDelegateType1(T arg1); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate void EventCallbackDelegateType2(T arg1, U arg2); + internal delegate void EventCallbackDelegateType2(T arg1, U arg2); //this should be removed with EventHandler from .NET diff --git a/plugins/dali-swig/manual/csharp/FocusManager.cs b/plugins/dali-swig/manual/csharp/FocusManager.cs index 17e7685..cb7ae8f 100755 --- a/plugins/dali-swig/manual/csharp/FocusManager.cs +++ b/plugins/dali-swig/manual/csharp/FocusManager.cs @@ -23,7 +23,7 @@ using System.Runtime.InteropServices; public class FocusManager : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; - internal FocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.KeyboardFocusManager_SWIGUpcast(cPtr), cMemoryOwn) { + internal FocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.FocusManager_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } @@ -45,7 +45,7 @@ public class FocusManager : BaseHandle { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; - NDalicManualPINVOKE.delete_KeyboardFocusManager(swigCPtr); + NDalicManualPINVOKE.delete_FocusManager(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } @@ -237,23 +237,23 @@ public class PreFocusChangeEventArgs : EventArgs [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate IntPtr PreFocusChangeEventCallbackDelegate(IntPtr current, IntPtr proposed, View.KeyboardFocus.Direction direction); - private PreFocusChangeEventHandler _keyboardFocusManagerPreFocusChangeEventHandler; - private PreFocusChangeEventCallbackDelegate _keyboardFocusManagerPreFocusChangeEventCallbackDelegate; + private PreFocusChangeEventHandler _FocusManagerPreFocusChangeEventHandler; + private PreFocusChangeEventCallbackDelegate _FocusManagerPreFocusChangeEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void FocusChangedEventCallbackDelegate(IntPtr actorCurrent, IntPtr actorNext); - private FocusChangedEventHandler _keyboardFocusManagerFocusChangedEventHandler; - private FocusChangedEventCallbackDelegate _keyboardFocusManagerFocusChangedEventCallbackDelegate; + private FocusChangedEventHandler _FocusManagerFocusChangedEventHandler; + private FocusChangedEventCallbackDelegate _FocusManagerFocusChangedEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void FocusGroupChangedEventCallbackDelegate(IntPtr currentFocusedActor, bool forwardDirection); - private FocusGroupChangedEventHandler _keyboardFocusManagerFocusGroupChangedEventHandler; - private FocusGroupChangedEventCallbackDelegate _keyboardFocusManagerFocusGroupChangedEventCallbackDelegate; + private FocusGroupChangedEventHandler _FocusManagerFocusGroupChangedEventHandler; + private FocusGroupChangedEventCallbackDelegate _FocusManagerFocusGroupChangedEventCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void FocusedActorEnterKeyEventCallbackDelegate(IntPtr actor); - private FocusedActorEnterKeyEventHandler _keyboardFocusManagerFocusedActorEnterKeyEventHandler; - private FocusedActorEnterKeyEventCallbackDelegate _keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate; + private FocusedActorEnterKeyEventHandler _FocusManagerFocusedActorEnterKeyEventHandler; + private FocusedActorEnterKeyEventCallbackDelegate _FocusManagerFocusedActorEnterKeyEventCallbackDelegate; public event PreFocusChangeEventHandler PreFocusChange { @@ -262,12 +262,12 @@ public class PreFocusChangeEventArgs : EventArgs lock(this) { // Restricted to only one listener - if (_keyboardFocusManagerPreFocusChangeEventHandler == null) + if (_FocusManagerPreFocusChangeEventHandler == null) { - _keyboardFocusManagerPreFocusChangeEventHandler += value; + _FocusManagerPreFocusChangeEventHandler += value; - _keyboardFocusManagerPreFocusChangeEventCallbackDelegate = new PreFocusChangeEventCallbackDelegate(OnPreFocusChange); - this.PreFocusChangeSignal().Connect(_keyboardFocusManagerPreFocusChangeEventCallbackDelegate); + _FocusManagerPreFocusChangeEventCallbackDelegate = new PreFocusChangeEventCallbackDelegate(OnPreFocusChange); + this.PreFocusChangeSignal().Connect(_FocusManagerPreFocusChangeEventCallbackDelegate); } } } @@ -276,17 +276,17 @@ public class PreFocusChangeEventArgs : EventArgs { lock(this) { - if (_keyboardFocusManagerPreFocusChangeEventHandler != null) + if (_FocusManagerPreFocusChangeEventHandler != null) { - this.PreFocusChangeSignal().Disconnect(_keyboardFocusManagerPreFocusChangeEventCallbackDelegate); + this.PreFocusChangeSignal().Disconnect(_FocusManagerPreFocusChangeEventCallbackDelegate); } - _keyboardFocusManagerPreFocusChangeEventHandler -= value; + _FocusManagerPreFocusChangeEventHandler -= value; } } } - // Callback for KeyboardFocusManager PreFocusChangeSignal + // Callback for FocusManager PreFocusChangeSignal private IntPtr OnPreFocusChange(IntPtr current, IntPtr proposed, View.KeyboardFocus.Direction direction) { Actor actor = null; @@ -297,10 +297,10 @@ public class PreFocusChangeEventArgs : EventArgs e.Proposed = Actor.GetActorFromPtr(proposed); e.Direction = direction; - if (_keyboardFocusManagerPreFocusChangeEventHandler != null) + if (_FocusManagerPreFocusChangeEventHandler != null) { //here we send all data to user event handlers - actor = _keyboardFocusManagerPreFocusChangeEventHandler(this, e); + actor = _FocusManagerPreFocusChangeEventHandler(this, e); } return actor.GetPtrfromActor(); @@ -318,12 +318,12 @@ public class PreFocusChangeEventArgs : EventArgs lock(this) { // Restricted to only one listener - if (_keyboardFocusManagerFocusChangedEventHandler == null) + if (_FocusManagerFocusChangedEventHandler == null) { - _keyboardFocusManagerFocusChangedEventHandler += value; + _FocusManagerFocusChangedEventHandler += value; - _keyboardFocusManagerFocusChangedEventCallbackDelegate = new FocusChangedEventCallbackDelegate(OnFocusChanged); - this.FocusChangedSignal().Connect(_keyboardFocusManagerFocusChangedEventCallbackDelegate); + _FocusManagerFocusChangedEventCallbackDelegate = new FocusChangedEventCallbackDelegate(OnFocusChanged); + this.FocusChangedSignal().Connect(_FocusManagerFocusChangedEventCallbackDelegate); } } } @@ -332,17 +332,17 @@ public class PreFocusChangeEventArgs : EventArgs { lock(this) { - if (_keyboardFocusManagerFocusChangedEventHandler != null) + if (_FocusManagerFocusChangedEventHandler != null) { - this.FocusChangedSignal().Disconnect(_keyboardFocusManagerFocusChangedEventCallbackDelegate); + this.FocusChangedSignal().Disconnect(_FocusManagerFocusChangedEventCallbackDelegate); } - _keyboardFocusManagerFocusChangedEventHandler -= value; + _FocusManagerFocusChangedEventHandler -= value; } } } - // Callback for KeyboardFocusManager FocusChangedSignal + // Callback for FocusManager FocusChangedSignal private void OnFocusChanged(IntPtr actorCurrent, IntPtr actorNext) { FocusChangedEventArgs e = new FocusChangedEventArgs(); @@ -351,10 +351,10 @@ public class PreFocusChangeEventArgs : EventArgs e.ActorCurrent = Actor.GetActorFromPtr(actorCurrent); e.ActorNext = Actor.GetActorFromPtr(actorNext); - if (_keyboardFocusManagerFocusChangedEventHandler != null) + if (_FocusManagerFocusChangedEventHandler != null) { //here we send all data to user event handlers - _keyboardFocusManagerFocusChangedEventHandler(this, e); + _FocusManagerFocusChangedEventHandler(this, e); } } @@ -370,12 +370,12 @@ public class PreFocusChangeEventArgs : EventArgs lock(this) { // Restricted to only one listener - if (_keyboardFocusManagerFocusGroupChangedEventHandler == null) + if (_FocusManagerFocusGroupChangedEventHandler == null) { - _keyboardFocusManagerFocusGroupChangedEventHandler += value; + _FocusManagerFocusGroupChangedEventHandler += value; - _keyboardFocusManagerFocusGroupChangedEventCallbackDelegate = new FocusGroupChangedEventCallbackDelegate(OnFocusGroupChanged); - this.FocusGroupChangedSignal().Connect(_keyboardFocusManagerFocusGroupChangedEventCallbackDelegate); + _FocusManagerFocusGroupChangedEventCallbackDelegate = new FocusGroupChangedEventCallbackDelegate(OnFocusGroupChanged); + this.FocusGroupChangedSignal().Connect(_FocusManagerFocusGroupChangedEventCallbackDelegate); } } } @@ -384,17 +384,17 @@ public class PreFocusChangeEventArgs : EventArgs { lock(this) { - if (_keyboardFocusManagerFocusGroupChangedEventHandler != null) + if (_FocusManagerFocusGroupChangedEventHandler != null) { - this.FocusGroupChangedSignal().Disconnect(_keyboardFocusManagerFocusGroupChangedEventCallbackDelegate); + this.FocusGroupChangedSignal().Disconnect(_FocusManagerFocusGroupChangedEventCallbackDelegate); } - _keyboardFocusManagerFocusGroupChangedEventHandler -= value; + _FocusManagerFocusGroupChangedEventHandler -= value; } } } - // Callback for KeyboardFocusManager FocusGroupChangedSignal + // Callback for FocusManager FocusGroupChangedSignal private void OnFocusGroupChanged(IntPtr currentFocusedActor, bool forwardDirection) { FocusGroupChangedEventArgs e = new FocusGroupChangedEventArgs(); @@ -403,10 +403,10 @@ public class PreFocusChangeEventArgs : EventArgs e.CurrentFocusedActor = Actor.GetActorFromPtr(currentFocusedActor); e.ForwardDirection = forwardDirection; - if (_keyboardFocusManagerFocusGroupChangedEventHandler != null) + if (_FocusManagerFocusGroupChangedEventHandler != null) { //here we send all data to user event handlers - _keyboardFocusManagerFocusGroupChangedEventHandler(this, e); + _FocusManagerFocusGroupChangedEventHandler(this, e); } } @@ -422,12 +422,12 @@ public class PreFocusChangeEventArgs : EventArgs lock(this) { // Restricted to only one listener - if (_keyboardFocusManagerFocusedActorEnterKeyEventHandler == null) + if (_FocusManagerFocusedActorEnterKeyEventHandler == null) { - _keyboardFocusManagerFocusedActorEnterKeyEventHandler += value; + _FocusManagerFocusedActorEnterKeyEventHandler += value; - _keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate = new FocusedActorEnterKeyEventCallbackDelegate(OnFocusedActorEnterKey); - this.FocusedActorEnterKeySignal().Connect(_keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate); + _FocusManagerFocusedActorEnterKeyEventCallbackDelegate = new FocusedActorEnterKeyEventCallbackDelegate(OnFocusedActorEnterKey); + this.FocusedActorEnterKeySignal().Connect(_FocusManagerFocusedActorEnterKeyEventCallbackDelegate); } } } @@ -436,17 +436,17 @@ public class PreFocusChangeEventArgs : EventArgs { lock(this) { - if (_keyboardFocusManagerFocusedActorEnterKeyEventHandler != null) + if (_FocusManagerFocusedActorEnterKeyEventHandler != null) { - this.FocusedActorEnterKeySignal().Disconnect(_keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate); + this.FocusedActorEnterKeySignal().Disconnect(_FocusManagerFocusedActorEnterKeyEventCallbackDelegate); } - _keyboardFocusManagerFocusedActorEnterKeyEventHandler -= value; + _FocusManagerFocusedActorEnterKeyEventHandler -= value; } } } - // Callback for KeyboardFocusManager FocusedActorEnterKeySignal + // Callback for FocusManager FocusedActorEnterKeySignal private void OnFocusedActorEnterKey(IntPtr actor) { FocusedActorEnterKeyEventArgs e = new FocusedActorEnterKeyEventArgs(); @@ -454,105 +454,105 @@ public class PreFocusChangeEventArgs : EventArgs // Populate all members of "e" (FocusedActorEnterKeyEventArgs) with real data e.Actor = Actor.GetActorFromPtr(actor); - if (_keyboardFocusManagerFocusedActorEnterKeyEventHandler != null) + if (_FocusManagerFocusedActorEnterKeyEventHandler != null) { //here we send all data to user event handlers - _keyboardFocusManagerFocusedActorEnterKeyEventHandler(this, e); + _FocusManagerFocusedActorEnterKeyEventHandler(this, e); } } - public FocusManager() : this(NDalicManualPINVOKE.new_KeyboardFocusManager(), true) { + public FocusManager() : this(NDalicManualPINVOKE.new_FocusManager(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } public static FocusManager Get() { - FocusManager ret = new FocusManager(NDalicManualPINVOKE.KeyboardFocusManager_Get(), true); + FocusManager ret = new FocusManager(NDalicManualPINVOKE.FocusManager_Get(), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public bool SetCurrentFocusActor(Actor actor) { - bool ret = NDalicManualPINVOKE.KeyboardFocusManager_SetCurrentFocusActor(swigCPtr, Actor.getCPtr(actor)); + bool ret = NDalicManualPINVOKE.FocusManager_SetCurrentFocusActor(swigCPtr, Actor.getCPtr(actor)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public Actor GetCurrentFocusActor() { - Actor ret = new Actor(NDalicManualPINVOKE.KeyboardFocusManager_GetCurrentFocusActor(swigCPtr), true); + Actor ret = new Actor(NDalicManualPINVOKE.FocusManager_GetCurrentFocusActor(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public bool MoveFocus(View.KeyboardFocus.Direction direction) { - bool ret = NDalicManualPINVOKE.KeyboardFocusManager_MoveFocus(swigCPtr, (int)direction); + bool ret = NDalicManualPINVOKE.FocusManager_MoveFocus(swigCPtr, (int)direction); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public void ClearFocus() { - NDalicManualPINVOKE.KeyboardFocusManager_ClearFocus(swigCPtr); + NDalicManualPINVOKE.FocusManager_ClearFocus(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } public void SetFocusGroupLoop(bool enabled) { - NDalicManualPINVOKE.KeyboardFocusManager_SetFocusGroupLoop(swigCPtr, enabled); + NDalicManualPINVOKE.FocusManager_SetFocusGroupLoop(swigCPtr, enabled); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } public bool GetFocusGroupLoop() { - bool ret = NDalicManualPINVOKE.KeyboardFocusManager_GetFocusGroupLoop(swigCPtr); + bool ret = NDalicManualPINVOKE.FocusManager_GetFocusGroupLoop(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public void SetAsFocusGroup(Actor actor, bool isFocusGroup) { - NDalicManualPINVOKE.KeyboardFocusManager_SetAsFocusGroup(swigCPtr, Actor.getCPtr(actor), isFocusGroup); + NDalicManualPINVOKE.FocusManager_SetAsFocusGroup(swigCPtr, Actor.getCPtr(actor), isFocusGroup); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } public bool IsFocusGroup(Actor actor) { - bool ret = NDalicManualPINVOKE.KeyboardFocusManager_IsFocusGroup(swigCPtr, Actor.getCPtr(actor)); + bool ret = NDalicManualPINVOKE.FocusManager_IsFocusGroup(swigCPtr, Actor.getCPtr(actor)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public Actor GetFocusGroup(Actor actor) { - Actor ret = new Actor(NDalicManualPINVOKE.KeyboardFocusManager_GetFocusGroup(swigCPtr, Actor.getCPtr(actor)), true); + Actor ret = new Actor(NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, Actor.getCPtr(actor)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public void SetFocusIndicatorActor(Actor indicator) { - NDalicManualPINVOKE.KeyboardFocusManager_SetFocusIndicatorActor(swigCPtr, Actor.getCPtr(indicator)); + NDalicManualPINVOKE.FocusManager_SetFocusIndicatorActor(swigCPtr, Actor.getCPtr(indicator)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } public Actor GetFocusIndicatorActor() { - Actor ret = new Actor(NDalicManualPINVOKE.KeyboardFocusManager_GetFocusIndicatorActor(swigCPtr), true); + Actor ret = new Actor(NDalicManualPINVOKE.FocusManager_GetFocusIndicatorActor(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - public KeyboardPreFocusChangeSignal PreFocusChangeSignal() { - KeyboardPreFocusChangeSignal ret = new KeyboardPreFocusChangeSignal(NDalicManualPINVOKE.KeyboardFocusManager_PreFocusChangeSignal(swigCPtr), false); + public PreFocusChangeSignal PreFocusChangeSignal() { + PreFocusChangeSignal ret = new PreFocusChangeSignal(NDalicManualPINVOKE.FocusManager_PreFocusChangeSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public FocusChangedSignal FocusChangedSignal() { - FocusChangedSignal ret = new FocusChangedSignal(NDalicManualPINVOKE.KeyboardFocusManager_FocusChangedSignal(swigCPtr), false); + FocusChangedSignal ret = new FocusChangedSignal(NDalicManualPINVOKE.FocusManager_FocusChangedSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public FocusGroupChangedSignal FocusGroupChangedSignal() { - FocusGroupChangedSignal ret = new FocusGroupChangedSignal(NDalicManualPINVOKE.KeyboardFocusManager_FocusGroupChangedSignal(swigCPtr), false); + FocusGroupChangedSignal ret = new FocusGroupChangedSignal(NDalicManualPINVOKE.FocusManager_FocusGroupChangedSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public ActorSignal FocusedActorEnterKeySignal() { - ActorSignal ret = new ActorSignal(NDalicManualPINVOKE.KeyboardFocusManager_FocusedActorEnterKeySignal(swigCPtr), false); + ActorSignal ret = new ActorSignal(NDalicManualPINVOKE.FocusManager_FocusedActorEnterKeySignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } diff --git a/plugins/dali-swig/manual/csharp/KeyboardPreFocusChangeSignal.cs b/plugins/dali-swig/manual/csharp/KeyboardPreFocusChangeSignal.cs index bd49666..69484ef 100755 --- a/plugins/dali-swig/manual/csharp/KeyboardPreFocusChangeSignal.cs +++ b/plugins/dali-swig/manual/csharp/KeyboardPreFocusChangeSignal.cs @@ -19,22 +19,22 @@ using System; namespace Dali { -public delegate IntPtr SwigDelegateKeyboardPreFocusChangeSignal(IntPtr current, IntPtr proposed, View.KeyboardFocus.Direction direction); +public delegate IntPtr SwigDelegatePreFocusChangeSignal(IntPtr current, IntPtr proposed, View.KeyboardFocus.Direction direction); -public class KeyboardPreFocusChangeSignal : global::System.IDisposable { +public class PreFocusChangeSignal : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; - internal KeyboardPreFocusChangeSignal(global::System.IntPtr cPtr, bool cMemoryOwn) { + internal PreFocusChangeSignal(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(KeyboardPreFocusChangeSignal obj) { + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PreFocusChangeSignal obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - ~KeyboardPreFocusChangeSignal() { + ~PreFocusChangeSignal() { DisposeQueue.Instance.Add(this); } @@ -48,7 +48,7 @@ public class KeyboardPreFocusChangeSignal : global::System.IDisposable { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; - NDalicManualPINVOKE.delete_KeyboardPreFocusChangeSignal(swigCPtr); + NDalicManualPINVOKE.delete_PreFocusChangeSignal(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } @@ -57,37 +57,37 @@ public class KeyboardPreFocusChangeSignal : global::System.IDisposable { } public bool Empty() { - bool ret = NDalicManualPINVOKE.KeyboardPreFocusChangeSignal_Empty(swigCPtr); + bool ret = NDalicManualPINVOKE.PreFocusChangeSignal_Empty(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public uint GetConnectionCount() { - uint ret = NDalicManualPINVOKE.KeyboardPreFocusChangeSignal_GetConnectionCount(swigCPtr); + uint ret = NDalicManualPINVOKE.PreFocusChangeSignal_GetConnectionCount(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public void Connect(FocusManager.PreFocusChangeEventCallbackDelegate func) { - NDalicManualPINVOKE.KeyboardPreFocusChangeSignal_Connect(swigCPtr, func); + NDalicManualPINVOKE.PreFocusChangeSignal_Connect(swigCPtr, func); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } public void Disconnect(System.Delegate func) { System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); { - NDalicManualPINVOKE.KeyboardPreFocusChangeSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + NDalicManualPINVOKE.PreFocusChangeSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } public Actor Emit(Actor arg1, Actor arg2, View.KeyboardFocus.Direction arg3) { - Actor ret = new Actor(NDalicManualPINVOKE.KeyboardPreFocusChangeSignal_Emit(swigCPtr, Actor.getCPtr(arg1), Actor.getCPtr(arg2), (int)arg3), true); + Actor ret = new Actor(NDalicManualPINVOKE.PreFocusChangeSignal_Emit(swigCPtr, Actor.getCPtr(arg1), Actor.getCPtr(arg2), (int)arg3), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - public KeyboardPreFocusChangeSignal() : this(NDalicManualPINVOKE.new_KeyboardPreFocusChangeSignal(), true) { + public PreFocusChangeSignal() : this(NDalicManualPINVOKE.new_PreFocusChangeSignal(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } diff --git a/plugins/dali-swig/manual/csharp/ManualPINVOKE.cs b/plugins/dali-swig/manual/csharp/ManualPINVOKE.cs index 77937dc..9a88a14 100755 --- a/plugins/dali-swig/manual/csharp/ManualPINVOKE.cs +++ b/plugins/dali-swig/manual/csharp/ManualPINVOKE.cs @@ -20,82 +20,82 @@ namespace Dali class NDalicManualPINVOKE { [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_new_KeyboardFocusManager")] - public static extern global::System.IntPtr new_KeyboardFocusManager(); + public static extern global::System.IntPtr new_FocusManager(); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_delete_KeyboardFocusManager")] - public static extern void delete_KeyboardFocusManager(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern void delete_FocusManager(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_Get")] - public static extern global::System.IntPtr KeyboardFocusManager_Get(); + public static extern global::System.IntPtr FocusManager_Get(); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_SetCurrentFocusActor")] - public static extern bool KeyboardFocusManager_SetCurrentFocusActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + public static extern bool FocusManager_SetCurrentFocusActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_GetCurrentFocusActor")] - public static extern global::System.IntPtr KeyboardFocusManager_GetCurrentFocusActor(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern global::System.IntPtr FocusManager_GetCurrentFocusActor(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_MoveFocus")] - public static extern bool KeyboardFocusManager_MoveFocus(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + public static extern bool FocusManager_MoveFocus(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_ClearFocus")] - public static extern void KeyboardFocusManager_ClearFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern void FocusManager_ClearFocus(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_SetFocusGroupLoop")] - public static extern void KeyboardFocusManager_SetFocusGroupLoop(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + public static extern void FocusManager_SetFocusGroupLoop(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_GetFocusGroupLoop")] - public static extern bool KeyboardFocusManager_GetFocusGroupLoop(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern bool FocusManager_GetFocusGroupLoop(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_SetAsFocusGroup")] - public static extern void KeyboardFocusManager_SetAsFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, bool jarg3); + public static extern void FocusManager_SetAsFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, bool jarg3); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_IsFocusGroup")] - public static extern bool KeyboardFocusManager_IsFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + public static extern bool FocusManager_IsFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_GetFocusGroup")] - public static extern global::System.IntPtr KeyboardFocusManager_GetFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + public static extern global::System.IntPtr FocusManager_GetFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_SetFocusIndicatorActor")] - public static extern void KeyboardFocusManager_SetFocusIndicatorActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + public static extern void FocusManager_SetFocusIndicatorActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_GetFocusIndicatorActor")] - public static extern global::System.IntPtr KeyboardFocusManager_GetFocusIndicatorActor(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern global::System.IntPtr FocusManager_GetFocusIndicatorActor(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_PreFocusChangeSignal")] - public static extern global::System.IntPtr KeyboardFocusManager_PreFocusChangeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern global::System.IntPtr FocusManager_PreFocusChangeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_FocusChangedSignal")] - public static extern global::System.IntPtr KeyboardFocusManager_FocusChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern global::System.IntPtr FocusManager_FocusChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_FocusGroupChangedSignal")] - public static extern global::System.IntPtr KeyboardFocusManager_FocusGroupChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern global::System.IntPtr FocusManager_FocusGroupChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_FocusedActorEnterKeySignal")] - public static extern global::System.IntPtr KeyboardFocusManager_FocusedActorEnterKeySignal(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern global::System.IntPtr FocusManager_FocusedActorEnterKeySignal(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Empty")] - public static extern bool KeyboardPreFocusChangeSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern bool PreFocusChangeSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_GetConnectionCount")] - public static extern uint KeyboardPreFocusChangeSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern uint PreFocusChangeSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Connect")] - public static extern void KeyboardPreFocusChangeSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, FocusManager.PreFocusChangeEventCallbackDelegate delegate1); + public static extern void PreFocusChangeSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, FocusManager.PreFocusChangeEventCallbackDelegate delegate1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Disconnect")] - public static extern void KeyboardPreFocusChangeSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + public static extern void PreFocusChangeSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Emit")] - public static extern global::System.IntPtr KeyboardPreFocusChangeSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); + public static extern global::System.IntPtr PreFocusChangeSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_new_KeyboardPreFocusChangeSignal")] - public static extern global::System.IntPtr new_KeyboardPreFocusChangeSignal(); + public static extern global::System.IntPtr new_PreFocusChangeSignal(); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_delete_KeyboardPreFocusChangeSignal")] - public static extern void delete_KeyboardPreFocusChangeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + public static extern void delete_PreFocusChangeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardFocusManager_SWIGUpcast")] - public static extern global::System.IntPtr KeyboardFocusManager_SWIGUpcast(global::System.IntPtr jarg1); + public static extern global::System.IntPtr FocusManager_SWIGUpcast(global::System.IntPtr jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_ViewWrapperImpl_CONTROL_BEHAVIOUR_FLAG_COUNT_get")] public static extern int ViewWrapperImpl_CONTROL_BEHAVIOUR_FLAG_COUNT_get(); diff --git a/plugins/dali-swig/manual/csharp/Position.cs b/plugins/dali-swig/manual/csharp/Position.cs index 2e58ab4..e7c72a9 100644 --- a/plugins/dali-swig/manual/csharp/Position.cs +++ b/plugins/dali-swig/manual/csharp/Position.cs @@ -44,9 +44,9 @@ namespace Dali */ public Position(Vector3 o) { - x = o.x; - y = o.y; - z = o.z; + x = o.X; + y = o.Y; + z = o.Z; } ///< name "X", type float (Position X value) @@ -182,7 +182,7 @@ namespace Dali public static implicit operator Position(Vector3 vec) { - return new Position(vec.x, vec.y, vec.z); + return new Position(vec.X, vec.Y, vec.Z); } } } diff --git a/plugins/dali-swig/manual/csharp/Size.cs b/plugins/dali-swig/manual/csharp/Size.cs index f89172a..d238d36 100644 --- a/plugins/dali-swig/manual/csharp/Size.cs +++ b/plugins/dali-swig/manual/csharp/Size.cs @@ -38,8 +38,8 @@ namespace Dali */ public Size(Vector2 o) { - width = o.x; - height = o.y; + width = o.X; + height = o.Y; } /** @@ -70,6 +70,18 @@ namespace Dali set { height = value; } } + public float Width + { + get { return width; } + set { width = value; } + } + + public float Height + { + get { return height; } + set { height = value; } + } + /** * @brief operator+ * @@ -171,7 +183,7 @@ namespace Dali return copy; } - // User-defined conversion from Position to Vector3 + // User-defined conversion from Position to Vector2 public static implicit operator Vector2(Size size) { return new Vector2(size.width, size.height); @@ -179,7 +191,116 @@ namespace Dali public static implicit operator Size(Vector2 vec) { - return new Size(vec.x, vec.y); + return new Size(vec.X, vec.Y); } } + + public class Size3D + { + private float width; + private float height; + private float depth; + + public Size3D(float a, float b, float c) + { + width = a; + height = b; + depth = c; + } + + public Size3D() + { + width = 0.0f; + height = 0.0f; + depth = 0.0f; + } + + public Size3D(Vector3 o) + { + width = o.X; + height = o.Y; + depth = o.Z; + } + + public Size3D(Vector2 o) + { + width = o.X; + height = o.Y; + depth = 0.0f; + } + + public Size3D(Size3D a) + { + width = a.width; + height = a.height; + depth = a.depth; + } + + public float W + { + get { return width; } + set { width = value; } + } + + public float H + { + get { return height; } + set { height = value; } + } + + public float D + { + get { return depth; } + set { depth = value; } + } + + public float Width + { + get { return width; } + set { width = value; } + } + + public float Height + { + get { return height; } + set { height = value; } + } + + public float Depth + { + get { return depth; } + set { depth = value; } + } + + public float X + { + get { return width; } + set { width = value; } + } + + public float Y + { + get { return height; } + set { height = value; } + } + + public float Z + { + get { return depth; } + set { depth = value; } + } + + // User-defined conversion from Position to Vector3 + public static implicit operator Vector3(Size3D size) + { + return new Vector3(size.width, size.height, size.depth); + } + + public static implicit operator Size3D(Vector3 vec) + { + return new Size3D(vec.X, vec.Y, vec.Z); + } + + } + } diff --git a/plugins/dali-swig/property-wrapper.rb b/plugins/dali-swig/property-wrapper.rb index 37a8cf9..fe2e91c 100755 --- a/plugins/dali-swig/property-wrapper.rb +++ b/plugins/dali-swig/property-wrapper.rb @@ -312,6 +312,13 @@ def writeCSharpData next end + #exception case <<< + #Tooltip gives swig build error + if( property.name == "Tooltip" ) + next + end + #exception case >>> + $totalProperties+=1 # keep track of total propertyType = propertyInfo[1] # e.g. bool or int @@ -328,9 +335,9 @@ def writeCSharpData hasChildProperties = true end - property.csharpGetter =" public #{propertyType} #{property.name} \n"\ - " { \n"\ - " get \n" \ + property.csharpGetter =" public #{propertyType} #{property.name}\n"\ + " {\n"\ + " get\n" \ " {\n"\ " #{tempDeclaration}\n"\ " GetProperty( #{propertyName}).Get( #{propertyArg} temp );\n"\ @@ -339,14 +346,31 @@ def writeCSharpData if property.writable #text.SetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT, new Property.Value("CENTER")); - property.csharpSetter = " set \n" \ - " { \n"\ + property.csharpSetter = " set\n" \ + " {\n"\ " SetProperty( #{propertyName}, new Dali.Property.Value( value ) );\n" \ " }\n"\ " }\n" else property.csharpSetter = "}" # close the opening property declaration end + + #exception case <<< + if( property.name == "Behavior" ) + property.csharpGetter =" public Layer.LayerBehavior #{property.name} \n"\ + " { \n"\ + " get \n" \ + " {\n"\ + " return GetBehavior();\n"\ + " }\n" + + property.csharpSetter = " set \n" \ + " { \n"\ + " SetBehavior( value );\n" \ + " }\n"\ + " }\n" + end + #exception case >>> end # write normal properties to the class's own csharp file writePropertiesToCSharpFile( daliClass )