From: dongsug song Date: Tue, 25 Oct 2016 13:38:21 +0000 (-0700) Subject: Merge "Move Event Handlers to View class" into devel/master X-Git-Tag: dali_1.2.12~9 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=2c223add632be0638418928056d5ac1421c47eb6;hp=4d81316f7df2eefaaf7c15b322ba6ef1f5b655f4 Merge "Move Event Handlers to View class" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp index 7f3d8aa..71851de 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp @@ -53,6 +53,38 @@ Property::Map CreateMap() return map; } +void CHECK_ARRAY_EQUALS( Property::Array test, Property::Value result ) +{ + if( result.GetType() == Property::ARRAY ) + { + // Compare arrays + Property::Array *resultArray = result.GetArray(); + DALI_TEST_EQUALS( test.Count(), resultArray->Count(), TEST_LOCATION ); + for( size_t i=0; i < std::min(test.Count(), resultArray->Count()); ++i ) + { + Property::Value a = test.GetElementAt(i); + Property::Value b = resultArray->GetElementAt(i); + DALI_TEST_EQUALS( a.GetType(), b.GetType(), TEST_LOCATION ); + DALI_TEST_EQUALS( a, b, 0.001, TEST_LOCATION ); + } + } + else if( result.GetType() == Property::VECTOR4 ) + { + Vector4 value = result.Get(); + DALI_TEST_CHECK( test.Count() >= 4 ); + for( size_t i=0; i < 4; ++i ) + { + Property::Value a = test.GetElementAt(i); + DALI_TEST_EQUALS( a.GetType(), Property::FLOAT, TEST_LOCATION ); + DALI_TEST_EQUALS( a.Get(), value[i], 0.001, TEST_LOCATION ); + } + } + else + { + DALI_TEST_CHECK( 0 ); + } +} + void CHECK_MAP_EQUALS( Property::Map test, Property::Map result ) { DALI_TEST_EQUALS(test.Count(), result.Count(), TEST_LOCATION); @@ -74,22 +106,25 @@ void CHECK_MAP_EQUALS( Property::Map test, Property::Map result ) DALI_TEST_CHECK( value != NULL ); if( value != NULL ) { - DALI_TEST_EQUALS( keyValue.second.GetType(), value->GetType(), TEST_LOCATION ); if( keyValue.second.GetType() == Property::MAP ) { + DALI_TEST_EQUALS( keyValue.second.GetType(), value->GetType(), TEST_LOCATION ); CHECK_MAP_EQUALS( *(keyValue.second.GetMap()), *(value->GetMap()) ); } else if( keyValue.second.GetType() == Property::ARRAY ) { + CHECK_ARRAY_EQUALS( *(keyValue.second.GetArray()), *value ); } else if( keyValue.second.GetType() == Property::STRING ) { + DALI_TEST_EQUALS( keyValue.second.GetType(), value->GetType(), TEST_LOCATION ); std::string str; value->Get(str); DALI_TEST_EQUALS( keyValue.second, str.c_str(), TEST_LOCATION ); } else { + DALI_TEST_EQUALS( keyValue.second.GetType(), value->GetType(), TEST_LOCATION ); DALI_TEST_EQUALS( keyValue.second, *value, 0.001f, TEST_LOCATION ); } } @@ -303,7 +338,7 @@ int UtcDaliTransitionDataMap2P(void) } -int UtcDaliTransitionDataMapP3(void) +int UtcDaliTransitionDataMap3P(void) { TestApplication application; @@ -361,6 +396,62 @@ int UtcDaliTransitionDataMapP3(void) END_TEST; } + +int UtcDaliTransitionDataMap4P(void) +{ + TestApplication application; + + tet_printf("Testing animation of a visual's placement actor property using bezier curve\n"); + + Property::Map map; + map["target"] = "Actor1"; + map["property"] = "position"; + map["initialValue"] = Vector3(0, 0, 0); + map["targetValue"] = Vector3(100, 100, 0); + map["animator"] = Property::Map() + .Add("alphaFunction", Vector4(0.71, -0.57, 0.42, 1.38) ) + .Add("timePeriod", Property::Map() + .Add("delay", 0.0f) + .Add("duration", 1.0f)); + + Dali::Toolkit::TransitionData transition = TransitionData::New( map ); + + DummyControl actor = DummyControl::New(); + actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + actor.SetName("Actor1"); + Stage::GetCurrent().Add(actor); + + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + Animation anim = dummyImpl.CreateTransition( transition ); + DALI_TEST_CHECK( anim ); + + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0,0,0), 0.001f, TEST_LOCATION); + + anim.Play(); + + application.SendNotification(); + application.Render(0); + + application.Render(250); // 25% + application.SendNotification(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(-10,-10,0), 1.0, TEST_LOCATION); // High epsilon as we don't have exact figure for bezier curve at 50% + + application.Render(250); // Halfway thru map1 anim + application.SendNotification(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(24,24,0), 1.0, TEST_LOCATION); // High epsilon as we don't have exact figure for bezier curve at 50% + + application.Render(250); // End of map1 anim + application.SendNotification(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(100,100,0), 1.0, TEST_LOCATION); // High epsilon as we don't have exact figure for bezier curve + + application.Render(250); // End of map1 anim + application.SendNotification(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(100,100,0), TEST_LOCATION ); + END_TEST; +} + int UtcDaliTransitionDataMap1N(void) { TestApplication application; @@ -434,6 +525,161 @@ int UtcDaliTransitionDataMapN3(void) END_TEST; } + +int UtcDaliTransitionDataMapN4(void) +{ + TestApplication application; + + tet_printf("Testing visual doesn't animate with duff bezier data \n"); + + Property::Map map; + map["target"] = "visual1"; + map["property"] = "mixColor"; + map["initialValue"] = Color::MAGENTA; + map["targetValue"] = Color::RED; + map["animator"] = Property::Map() + .Add("alphaFunction", Vector3(.1f,1.0f,0.5f)) + .Add("timePeriod", Property::Map() + .Add("delay", 0.5f) + .Add("duration", 1.0f)); + + Dali::Toolkit::TransitionData transition = TransitionData::New( map ); + + DummyControl actor = DummyControl::New(); + actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + actor.SetName("Actor1"); + actor.SetColor(Color::CYAN); + Stage::GetCurrent().Add(actor); + + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + Property::Map visualMap; + visualMap[Visual::Property::TYPE] = Visual::COLOR; + visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA; + Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap ); + visual.SetName( "visual1" ); + + Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1; + dummyImpl.RegisterVisual( visualIndex, actor, visual ); + + Animation anim = dummyImpl.CreateTransition( transition ); + DALI_TEST_CHECK( !anim ); + + application.SendNotification(); + application.Render(0); + application.SendNotification(); + + Renderer renderer = actor.GetRendererAt(0); + Property::Index mixColorIdx = renderer.GetPropertyIndex(ColorVisual::Property::MIX_COLOR); + + tet_printf( "Test that the property has been set to target value\n"); + DALI_TEST_EQUALS(renderer.GetProperty(mixColorIdx), Color::RED, 0.001, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliTransitionDataMapN5(void) +{ + TestApplication application; + + tet_printf("Testing visual doesn't animate with duff bezier data \n"); + + Property::Map map; + map["target"] = "visual1"; + map["property"] = "mixColor"; + map["initialValue"] = Color::MAGENTA; + map["targetValue"] = Color::RED; + map["animator"] = Property::Map() + .Add("alphaFunction", Property::Array().Add(.1f).Add(1.0f).Add(0.5f)) + .Add("timePeriod", Property::Map() + .Add("delay", 0.5f) + .Add("duration", 1.0f)); + + Dali::Toolkit::TransitionData transition = TransitionData::New( map ); + + DummyControl actor = DummyControl::New(); + actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + actor.SetName("Actor1"); + actor.SetColor(Color::CYAN); + Stage::GetCurrent().Add(actor); + + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + Property::Map visualMap; + visualMap[Visual::Property::TYPE] = Visual::COLOR; + visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA; + Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap ); + visual.SetName( "visual1" ); + + Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1; + dummyImpl.RegisterVisual( visualIndex, actor, visual ); + + Animation anim = dummyImpl.CreateTransition( transition ); + DALI_TEST_CHECK( !anim ); + + application.SendNotification(); + application.Render(0); + application.SendNotification(); + + Renderer renderer = actor.GetRendererAt(0); + Property::Index mixColorIdx = renderer.GetPropertyIndex(ColorVisual::Property::MIX_COLOR); + + tet_printf( "Test that the property has been set to target value\n"); + DALI_TEST_EQUALS(renderer.GetProperty(mixColorIdx), Color::RED, 0.001, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliTransitionDataMapN6(void) +{ + TestApplication application; + + tet_printf("Testing visual doesn't animate with duff bezier data \n"); + + Property::Map map; + map["target"] = "visual1"; + map["property"] = "mixColor"; + map["initialValue"] = Color::MAGENTA; + map["targetValue"] = Color::RED; + map["animator"] = Property::Map() + .Add("alphaFunction", Property::Array().Add("1").Add("Two").Add("3").Add("4")) + .Add("timePeriod", Property::Map() + .Add("delay", 0.5f) + .Add("duration", 1.0f)); + + Dali::Toolkit::TransitionData transition = TransitionData::New( map ); + + DummyControl actor = DummyControl::New(); + actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + actor.SetName("Actor1"); + actor.SetColor(Color::CYAN); + Stage::GetCurrent().Add(actor); + + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + Property::Map visualMap; + visualMap[Visual::Property::TYPE] = Visual::COLOR; + visualMap[ColorVisual::Property::MIX_COLOR] = Color::MAGENTA; + Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap ); + visual.SetName( "visual1" ); + + Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1; + dummyImpl.RegisterVisual( visualIndex, actor, visual ); + + Animation anim = dummyImpl.CreateTransition( transition ); + DALI_TEST_CHECK( !anim ); + + application.SendNotification(); + application.Render(0); + application.SendNotification(); + + Renderer renderer = actor.GetRendererAt(0); + Property::Index mixColorIdx = renderer.GetPropertyIndex(ColorVisual::Property::MIX_COLOR); + + tet_printf( "Test that the property has been set to target value\n"); + DALI_TEST_EQUALS(renderer.GetProperty(mixColorIdx), Color::RED, 0.001, TEST_LOCATION); + + END_TEST; +} + + int UtcDaliTransitionDataArrayP(void) { TestApplication application; @@ -613,9 +859,31 @@ int UtcDaliTransitionDataGetAnimatorP(void) .Add("duration", 1.0f)); Property::Map map10; - map10["target"] = "Actor1"; - map10["property"] = "orientation"; - map10["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS ); + map10["target"] = "Actor2"; + map10["property"] = "scale"; + map10["initialValue"] = Vector3(0,0,0); + map10["targetValue"] = Vector3(1,1,1); + map10["animator"] = Property::Map() + .Add("alphaFunction", Vector4(.23,.4,.8,1.2)) + .Add("timePeriod", Property::Map() + .Add("delay", 0.0f) + .Add("duration", 1.0f)); + + Property::Map map11; + map11["target"] = "Actor2"; + map11["property"] = "scale"; + map11["initialValue"] = Vector3(0,0,0); + map11["targetValue"] = Vector3(1,1,1); + map11["animator"] = Property::Map() + .Add("alphaFunction", Property::Array().Add(.23f).Add(.4f).Add(.8f).Add(.2f)) + .Add("timePeriod", Property::Map() + .Add("delay", 0.0f) + .Add("duration", 1.0f)); + + Property::Map map12; + map12["target"] = "Actor1"; + map12["property"] = "orientation"; + map12["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS ); Property::Array array; array.PushBack(map1); @@ -628,6 +896,8 @@ int UtcDaliTransitionDataGetAnimatorP(void) array.PushBack(map8); array.PushBack(map9); array.PushBack(map10); + array.PushBack(map11); + array.PushBack(map12); Dali::Toolkit::TransitionData transition = TransitionData::New( array ); diff --git a/dali-toolkit/internal/visuals/transition-data-impl.cpp b/dali-toolkit/internal/visuals/transition-data-impl.cpp index 30c0dee..8ccb354 100644 --- a/dali-toolkit/internal/visuals/transition-data-impl.cpp +++ b/dali-toolkit/internal/visuals/transition-data-impl.cpp @@ -169,68 +169,119 @@ TransitionData::Animator* TransitionData::ConvertMap( const Property::Map& map) if( key == TOKEN_ALPHA_FUNCTION ) { - std::string alphaFunctionValue = value.Get< std::string >(); + if( value.GetType() == Property::ARRAY ) + { + bool valid = true; + Vector4 controlPoints; + Property::Array *array = value.GetArray(); + if( array->Count() >= 4 ) + { + for( size_t vecIdx = 0; vecIdx < 4; ++vecIdx ) + { + Property::Value& v = array->GetElementAt(vecIdx); + if( v.GetType() == Property::FLOAT ) + { + controlPoints[vecIdx] = v.Get(); + } + else + { + valid = false; + break; + } + } + } + else + { + valid = false; + } - if( alphaFunctionValue == "LINEAR" ) + if( valid ) + { + Vector2 controlPoint1( controlPoints.x, controlPoints.y ); + Vector2 controlPoint2( controlPoints.z, controlPoints.w ); + animator->alphaFunction = AlphaFunction( controlPoint1, controlPoint2 ); + } + else + { + animator->animate = false; + } + } + else if( value.GetType() == Property::VECTOR4 ) { - animator->alphaFunction = AlphaFunction::LINEAR; + Vector4 controlPoints = value.Get(); + Vector2 controlPoint1( controlPoints.x, controlPoints.y ); + Vector2 controlPoint2( controlPoints.z, controlPoints.w ); + animator->alphaFunction = AlphaFunction( controlPoint1, controlPoint2 ); } - else if( ! alphaFunctionValue.compare(0, 5, "EASE_" ) ) + else if( value.GetType() == Property::STRING ) { - if( alphaFunctionValue == "EASE_IN" ) - { - animator->alphaFunction = AlphaFunction::EASE_IN; - } - else if( alphaFunctionValue == "EASE_OUT" ) + std::string alphaFunctionValue = value.Get< std::string >(); + + if( alphaFunctionValue == "LINEAR" ) { - animator->alphaFunction = AlphaFunction::EASE_OUT; + animator->alphaFunction = AlphaFunction(AlphaFunction::LINEAR); } - else if( ! alphaFunctionValue.compare( 5, 3, "IN_" ) ) + else if( ! alphaFunctionValue.compare(0, 5, "EASE_" ) ) { - if( ! alphaFunctionValue.compare(8, -1, "SQUARE" )) + if( alphaFunctionValue == "EASE_IN" ) { - animator->alphaFunction = AlphaFunction::EASE_IN_SQUARE; + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN); } - else if( ! alphaFunctionValue.compare(8, -1, "OUT" )) + else if( alphaFunctionValue == "EASE_OUT" ) { - animator->alphaFunction = AlphaFunction::EASE_IN_OUT; + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_OUT); } - else if( ! alphaFunctionValue.compare(8, -1, "OUT_SINE" )) + else if( ! alphaFunctionValue.compare( 5, 3, "IN_" ) ) { - animator->alphaFunction = AlphaFunction::EASE_IN_OUT_SINE; + if( ! alphaFunctionValue.compare(8, -1, "SQUARE" )) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN_SQUARE); + } + else if( ! alphaFunctionValue.compare(8, -1, "OUT" )) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN_OUT); + } + else if( ! alphaFunctionValue.compare(8, -1, "OUT_SINE" )) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN_OUT_SINE); + } + else if( ! alphaFunctionValue.compare(8, -1, "SINE" )) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN_SINE); + } } - else if( ! alphaFunctionValue.compare(8, -1, "SINE" )) + else if( ! alphaFunctionValue.compare( 5, 4, "OUT_" ) ) { - animator->alphaFunction = AlphaFunction::EASE_IN_SINE; + if( ! alphaFunctionValue.compare(9, -1, "SQUARE" ) ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_OUT_SQUARE); + } + else if( ! alphaFunctionValue.compare(9, -1, "SINE" ) ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_OUT_SINE); + } + else if( ! alphaFunctionValue.compare(9, -1, "BACK" ) ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_OUT_BACK); + } } } - else if( ! alphaFunctionValue.compare( 5, 4, "OUT_" ) ) + else if( alphaFunctionValue == "REVERSE" ) { - if( ! alphaFunctionValue.compare(9, -1, "SQUARE" ) ) - { - animator->alphaFunction = AlphaFunction::EASE_OUT_SQUARE; - } - else if( ! alphaFunctionValue.compare(9, -1, "SINE" ) ) - { - animator->alphaFunction = AlphaFunction::EASE_OUT_SINE; - } - else if( ! alphaFunctionValue.compare(9, -1, "BACK" ) ) - { - animator->alphaFunction = AlphaFunction::EASE_OUT_BACK; - } + animator->alphaFunction = AlphaFunction(AlphaFunction::REVERSE); + } + else if( alphaFunctionValue == "BOUNCE" ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::BOUNCE); + } + else if( alphaFunctionValue == "SIN" ) + { + animator->alphaFunction = AlphaFunction(AlphaFunction::SIN); } } - else if( alphaFunctionValue == "REVERSE" ) - { - animator->alphaFunction = AlphaFunction::REVERSE; - } - else if( alphaFunctionValue == "BOUNCE" ) - { - animator->alphaFunction = AlphaFunction::BOUNCE; - } - else if( alphaFunctionValue == "SIN" ) + else { - animator->alphaFunction = AlphaFunction::SIN; + animator->animate = false; } } else if( key == TOKEN_TIME_PERIOD ) @@ -306,13 +357,24 @@ Property::Map TransitionData::GetAnimatorAt( size_t index ) } if( animator->animate ) { - map[TOKEN_ANIMATOR] = Property::Map() - .Add(TOKEN_ALPHA_FUNCTION, GetEnumerationName( animator->alphaFunction, - ALPHA_FUNCTION_BUILTIN_TABLE, - ALPHA_FUNCTION_BUILTIN_TABLE_COUNT )) - .Add(TOKEN_TIME_PERIOD, Property::Map() - .Add( TOKEN_DELAY, animator->timePeriodDelay ) - .Add( TOKEN_DURATION, animator->timePeriodDuration )); + Property::Map animateMap; + + if( animator->alphaFunction.GetMode() == AlphaFunction::BUILTIN_FUNCTION ) + { + animateMap.Add(TOKEN_ALPHA_FUNCTION, GetEnumerationName( animator->alphaFunction.GetBuiltinFunction(), + ALPHA_FUNCTION_BUILTIN_TABLE, + ALPHA_FUNCTION_BUILTIN_TABLE_COUNT )); + } + else if( animator->alphaFunction.GetMode() == AlphaFunction::BEZIER ) + { + Vector4 controlPoints = animator->alphaFunction.GetBezierControlPoints(); + animateMap.Add( TOKEN_ALPHA_FUNCTION, controlPoints ); + } + animateMap.Add(TOKEN_TIME_PERIOD, Property::Map() + .Add( TOKEN_DELAY, animator->timePeriodDelay ) + .Add( TOKEN_DURATION, animator->timePeriodDuration )); + + map[TOKEN_ANIMATOR] = animateMap; } return map; diff --git a/dali-toolkit/internal/visuals/transition-data-impl.h b/dali-toolkit/internal/visuals/transition-data-impl.h index 9622951..9ca8193 100644 --- a/dali-toolkit/internal/visuals/transition-data-impl.h +++ b/dali-toolkit/internal/visuals/transition-data-impl.h @@ -61,7 +61,7 @@ public: Property::Key propertyKey; ///< A property key of the property owner Property::Value initialValue; ///< The value to set at the start of the transition Property::Value targetValue; ///< The value to set or animate to - Dali::AlphaFunction::BuiltinFunction alphaFunction; + Dali::AlphaFunction alphaFunction; float timePeriodDelay; float timePeriodDuration; bool animate; diff --git a/plugins/dali-swig/SWIG/dali-operator.i b/plugins/dali-swig/SWIG/dali-operator.i index f6bbe4d..894b34f 100644 --- a/plugins/dali-swig/SWIG/dali-operator.i +++ b/plugins/dali-swig/SWIG/dali-operator.i @@ -252,7 +252,13 @@ * This is because from C# we can't wrap the operator BooleanType() function */ %extend Dali::BaseHandle { - bool IsHandleEmpty() const { + bool HasBody() const { + + // C++ code. DALi uses Handle <-> Body design pattern. + // This function checks the Handle to see if it has a body attached ( possible to have empty handles). + // Handles in DALi can be converted into a boolean type + // to check if the handle has a valid body attached to it. + // Internally checking *$self will checks IntrusivePtr mObjectHandle in BaseHandle; if( *$self ) { return true; @@ -262,6 +268,21 @@ return false; } } + + // Check if two handles point to the same body / ref-object. + bool IsEqual( const BaseHandle& rhs ) const { + + // C++ code. Check if two handles reference the same implemtion + if( *$self == rhs) + { + return true; + } + else + { + return false; + } + } + }; /** @@ -274,21 +295,114 @@ */ %typemap(cscode) Dali::BaseHandle %{ - public static bool operator true(BaseHandle handle) - { - if( handle!= null ) - { - return handle.IsHandleEmpty(); - } - else - { - return false; - } - } - public static bool operator false(BaseHandle handle) - { - return handle.IsHandleEmpty(); - } -%} + // Returns the bool value true to indicate that an operand is true and returns false otherwise. + public static bool operator true(BaseHandle handle) + { + // if the C# object is null, return false + if( BaseHandle.ReferenceEquals( handle, null ) ) + { + return false; + } + // returns true if the handle has a body, false otherwise + return handle.HasBody(); + } + + // Returns the bool false to indicate that an operand is false and returns true otherwise. + public static bool operator false(BaseHandle handle) + { + // if the C# object is null, return true + if( BaseHandle.ReferenceEquals( handle, null ) ) + { + return true; + } + return !handle.HasBody(); + } + + // Explicit conversion from Handle to bool. + public static explicit operator bool(BaseHandle handle) + { + // if the C# object is null, return false + if( BaseHandle.ReferenceEquals( handle, null ) ) + { + return false; + } + // returns true if the handle has a body, false otherwise + return handle.HasBody(); + } + // Equality operator + public static bool operator == (BaseHandle x, BaseHandle y) + { + // if the C# objects are the same return true + if( BaseHandle.ReferenceEquals( x, y ) ) + { + return true; + } + if ( !BaseHandle.ReferenceEquals( x, null ) && !BaseHandle.ReferenceEquals( y, null ) ) + { + // drop into native code to see if both handles point to the same body + return x.IsEqual( y) ; + } + return false; + + } + + // Inequality operator. Returns Null if either operand is Null + public static bool operator !=(BaseHandle x, BaseHandle y) + { + return !(x==y); + } + + // Logical AND operator for && + // It's possible when doing a && this function (opBitwiseAnd) is never called due + // to short circuiting. E.g. + // If you perform x && y What actually is called is + // BaseHandle.op_False( x ) ? BaseHandle.op_True( x ) : BaseHandle.opTrue( BaseHandle.opBitwiseAnd(x,y) ) + // + public static BaseHandle operator &(BaseHandle x, BaseHandle y) + { + if( x == y ) + { + return x; + } + return null; + } + + // Logical OR operator for || + // It's possible when doing a || this function (opBitwiseOr) is never called due + // to short circuiting. E.g. + // If you perform x || y What actually is called is + // BaseHandle.op_True( x ) ? BaseHandle.op_True( x ) : BaseHandle.opTrue( BaseHandle.opBitwiseOr(x,y) ) + public static BaseHandle operator |(BaseHandle x, BaseHandle y) + { + if ( !BaseHandle.ReferenceEquals( x, null ) || !BaseHandle.ReferenceEquals( y, null ) ) + { + if( x.HasBody() ) + { + return x; + } + if( y.HasBody() ) + { + return y; + } + return null; + } + return null; + } + + // Logical ! operator + public static bool operator !(BaseHandle x) + { + // if the C# object is null, return true + if( BaseHandle.ReferenceEquals( x, null ) ) + { + return true; + } + if( x.HasBody() ) + { + return false; + } + return true; + } +%} \ No newline at end of file diff --git a/plugins/dali-swig/SWIG/dali.i b/plugins/dali-swig/SWIG/dali.i index e76ba22..e7d633f 100755 --- a/plugins/dali-swig/SWIG/dali.i +++ b/plugins/dali-swig/SWIG/dali.i @@ -200,6 +200,7 @@ using namespace Dali::Toolkit; %include events/pangesture-event.i %include events/propertynotification-event.i %include events/longpressgesture-event.i +%include events/rectinteger.i %include events/resourceimage-event.i %include events/scrollable-event.i %include events/scrollbar-event.i diff --git a/plugins/dali-swig/SWIG/events/actor-event.i b/plugins/dali-swig/SWIG/events/actor-event.i index 72430cc..c1f7095 100644 --- a/plugins/dali-swig/SWIG/events/actor-event.i +++ b/plugins/dali-swig/SWIG/events/actor-event.i @@ -61,16 +61,12 @@ { SetOpacity(value); } - } - - public float CurrentOpacity - { get { float ret = GetCurrentOpacity(); return ret; } - } + } public bool StateFocusEnable { diff --git a/plugins/dali-swig/SWIG/events/animation-event.i b/plugins/dali-swig/SWIG/events/animation-event.i index e921f76..4690317 100644 --- a/plugins/dali-swig/SWIG/events/animation-event.i +++ b/plugins/dali-swig/SWIG/events/animation-event.i @@ -26,6 +26,63 @@ using System.Runtime.InteropServices; %define Animation_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName) %typemap(cscode) NameSpace::ClassName %{ + public static readonly int PARENT_ORIGIN = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_get(); + public static readonly int PARENT_ORIGIN_X = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_X_get(); + public static readonly int PARENT_ORIGIN_Y = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Y_get(); + public static readonly int PARENT_ORIGIN_Z = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Z_get(); + public static readonly int ANCHOR_POINT = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_get(); + public static readonly int ANCHOR_POINT_X = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_X_get(); + public static readonly int ANCHOR_POINT_Y = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Y_get(); + public static readonly int ANCHOR_POINT_Z = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Z_get(); + public static readonly int SIZE = NDalicPINVOKE.Actor_Property_SIZE_get(); + public static readonly int SIZE_WIDTH = NDalicPINVOKE.Actor_Property_SIZE_WIDTH_get(); + public static readonly int SIZE_HEIGHT = NDalicPINVOKE.Actor_Property_SIZE_HEIGHT_get(); + public static readonly int SIZE_DEPTH = NDalicPINVOKE.Actor_Property_SIZE_DEPTH_get(); + public static readonly int POSITION = NDalicPINVOKE.Actor_Property_POSITION_get(); + public static readonly int POSITION_X = NDalicPINVOKE.Actor_Property_POSITION_X_get(); + public static readonly int POSITION_Y = NDalicPINVOKE.Actor_Property_POSITION_Y_get(); + public static readonly int POSITION_Z = NDalicPINVOKE.Actor_Property_POSITION_Z_get(); + public static readonly int WORLD_POSITION = NDalicPINVOKE.Actor_Property_WORLD_POSITION_get(); + public static readonly int WORLD_POSITION_X = NDalicPINVOKE.Actor_Property_WORLD_POSITION_X_get(); + public static readonly int WORLD_POSITION_Y = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Y_get(); + public static readonly int WORLD_POSITION_Z = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Z_get(); + public static readonly int ORIENTATION = NDalicPINVOKE.Actor_Property_ORIENTATION_get(); + public static readonly int WORLD_ORIENTATION = NDalicPINVOKE.Actor_Property_WORLD_ORIENTATION_get(); + public static readonly int SCALE = NDalicPINVOKE.Actor_Property_SCALE_get(); + public static readonly int SCALE_X = NDalicPINVOKE.Actor_Property_SCALE_X_get(); + public static readonly int SCALE_Y = NDalicPINVOKE.Actor_Property_SCALE_Y_get(); + public static readonly int SCALE_Z = NDalicPINVOKE.Actor_Property_SCALE_Z_get(); + public static readonly int WORLD_SCALE = NDalicPINVOKE.Actor_Property_WORLD_SCALE_get(); + public static readonly int VISIBLE = NDalicPINVOKE.Actor_Property_VISIBLE_get(); + public static readonly int COLOR = NDalicPINVOKE.Actor_Property_COLOR_get(); + public static readonly int COLOR_RED = NDalicPINVOKE.Actor_Property_COLOR_RED_get(); + public static readonly int COLOR_GREEN = NDalicPINVOKE.Actor_Property_COLOR_GREEN_get(); + public static readonly int COLOR_BLUE = NDalicPINVOKE.Actor_Property_COLOR_BLUE_get(); + public static readonly int COLOR_ALPHA = NDalicPINVOKE.Actor_Property_COLOR_ALPHA_get(); + public static readonly int WORLD_COLOR = NDalicPINVOKE.Actor_Property_WORLD_COLOR_get(); + public static readonly int WORLD_MATRIX = NDalicPINVOKE.Actor_Property_WORLD_MATRIX_get(); + public static readonly int NAME = NDalicPINVOKE.Actor_Property_NAME_get(); + public static readonly int SENSITIVE = NDalicPINVOKE.Actor_Property_SENSITIVE_get(); + public static readonly int LEAVE_REQUIRED = NDalicPINVOKE.Actor_Property_LEAVE_REQUIRED_get(); + public static readonly int INHERIT_ORIENTATION = NDalicPINVOKE.Actor_Property_INHERIT_ORIENTATION_get(); + public static readonly int INHERIT_SCALE = NDalicPINVOKE.Actor_Property_INHERIT_SCALE_get(); + public static readonly int COLOR_MODE = NDalicPINVOKE.Actor_Property_COLOR_MODE_get(); + public static readonly int POSITION_INHERITANCE = NDalicPINVOKE.Actor_Property_POSITION_INHERITANCE_get(); + public static readonly int DRAW_MODE = NDalicPINVOKE.Actor_Property_DRAW_MODE_get(); + public static readonly int SIZE_MODE_FACTOR = NDalicPINVOKE.Actor_Property_SIZE_MODE_FACTOR_get(); + public static readonly int WIDTH_RESIZE_POLICY = NDalicPINVOKE.Actor_Property_WIDTH_RESIZE_POLICY_get(); + public static readonly int HEIGHT_RESIZE_POLICY = NDalicPINVOKE.Actor_Property_HEIGHT_RESIZE_POLICY_get(); + public static readonly int SIZE_SCALE_POLICY = NDalicPINVOKE.Actor_Property_SIZE_SCALE_POLICY_get(); + public static readonly int WIDTH_FOR_HEIGHT = NDalicPINVOKE.Actor_Property_WIDTH_FOR_HEIGHT_get(); + public static readonly int HEIGHT_FOR_WIDTH = NDalicPINVOKE.Actor_Property_HEIGHT_FOR_WIDTH_get(); + public static readonly int PADDING = NDalicPINVOKE.Actor_Property_PADDING_get(); + public static readonly int MINIMUM_SIZE = NDalicPINVOKE.Actor_Property_MINIMUM_SIZE_get(); + public static readonly int MAXIMUM_SIZE = NDalicPINVOKE.Actor_Property_MAXIMUM_SIZE_get(); + public static readonly int INHERIT_POSITION = NDalicPINVOKE.Actor_Property_INHERIT_POSITION_get(); + public static readonly int CLIPPING_MODE = NDalicPINVOKE.Actor_Property_CLIPPING_MODE_get(); + public static readonly int BATCH_PARENT = NDalicPINVOKE.Actor_Property_BATCH_PARENT_get(); + + /** * @brief Event arguments that passed via Finished signal * @@ -150,6 +207,123 @@ using System.Runtime.InteropServices; } } + public int LoopCount + { + set + { + SetLoopCount(value); + } + get + { + int ret = GetLoopCount(); + return ret; + } + } + + public void AnimateBy(Actor target, T propertyIndex, U relativeValue) + { + dynamic var = (object)(propertyIndex); + dynamic obj = (object)(relativeValue); + AnimateBy(new Property(target, var), new Property.Value(obj)); + } + + public void AnimateBy(Actor target, T propertyIndex, U relativeValue, AlphaFunction alpha) + { + dynamic var = (object)(propertyIndex); + dynamic obj = (object)(relativeValue); + AnimateBy(new Property(target, var), new Property.Value(obj), alpha); + } + + public void AnimateBy(Actor target, T propertyIndex, U relativeValue, TimePeriod period) + { + dynamic var = (object)(propertyIndex); + dynamic obj = (object)(relativeValue); + AnimateBy(new Property(target, var), new Property.Value(obj), period); + } + + public void AnimateBy(Actor target, T propertyIndex, U relativeValue, AlphaFunction alpha, TimePeriod period) + { + dynamic var = (object)(propertyIndex); + dynamic obj = (object)(relativeValue); + AnimateBy(new Property(target, var), new Property.Value(obj), alpha, period); + } + + public void AnimateTo(Actor target, T propertyIndex, U destinationValue) + { + dynamic var = (object)(propertyIndex); + dynamic obj = (object)(destinationValue); + AnimateTo(new Property(target, var), new Property.Value(obj)); + } + + public void AnimateTo(Actor target, T propertyIndex, U destinationValue, AlphaFunction alpha) + { + dynamic var = (object)(propertyIndex); + dynamic obj = (object)(destinationValue); + AnimateTo(new Property(target, var), new Property.Value(obj), alpha); + } + + public void AnimateTo(Actor target, T propertyIndex, U destinationValue, TimePeriod period) + { + dynamic var = (object)(propertyIndex); + dynamic obj = (object)(destinationValue); + AnimateTo(new Property(target, var), new Property.Value(obj), period); + } + + public void AnimateTo(Actor target, T propertyIndex, U destinationValue, AlphaFunction alpha, TimePeriod period) + { + dynamic var = (object)(propertyIndex); + dynamic obj = (object)(destinationValue); + AnimateTo(new Property(target, var), new Property.Value(obj), alpha, period); + } + + public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames) + { + dynamic var = (object)(propertyIndex); + AnimateBetween(new Property(target, var), keyFrames); + } + + public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, Animation.Interpolation interpolation) + { + dynamic var = (object)(propertyIndex); + AnimateBetween(new Property(target, var), keyFrames, interpolation); + } + + public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha) + { + dynamic var = (object)(propertyIndex); + AnimateBetween(new Property(target, var), keyFrames, alpha); + } + + public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation) + { + dynamic var = (object)(propertyIndex); + AnimateBetween(new Property(target, var), keyFrames, alpha, interpolation); + } + + public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, TimePeriod period) + { + dynamic var = (object)(propertyIndex); + AnimateBetween(new Property(target, var), keyFrames, period); + } + + public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation) + { + dynamic var = (object)(propertyIndex); + AnimateBetween(new Property(target, var), keyFrames, period, interpolation); + } + + public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period) + { + dynamic var = (object)(propertyIndex); + AnimateBetween(new Property(target, var), keyFrames, alpha, period); + } + + public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation) + { + dynamic var = (object)(propertyIndex); + AnimateBetween(new Property(target, var), keyFrames, alpha, period, interpolation); + } + %} %enddef diff --git a/plugins/dali-swig/SWIG/events/rectinteger.i b/plugins/dali-swig/SWIG/events/rectinteger.i new file mode 100644 index 0000000..b89d1f5 --- /dev/null +++ b/plugins/dali-swig/SWIG/events/rectinteger.i @@ -0,0 +1,76 @@ +/* + * 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. + * + */ + +%define DALI_RECTINTEGER_PROPERTY_PARAM(NameSpace,ClassName) + %typemap(cscode) NameSpace::ClassName %{ + + public int X { + set { + NDalicPINVOKE.RectInteger_x_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + int ret = NDalicPINVOKE.RectInteger_x_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public int Y { + set { + NDalicPINVOKE.RectInteger_y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + int ret = NDalicPINVOKE.RectInteger_y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public int W { + set { + NDalicPINVOKE.RectInteger_width_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + int ret = NDalicPINVOKE.RectInteger_width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public int H { + set { + NDalicPINVOKE.RectInteger_height_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + int ret = NDalicPINVOKE.RectInteger_height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + +%} + +%enddef + +namespace Dali +{ + DALI_RECTINTEGER_PROPERTY_PARAM( Dali, Rect); +} diff --git a/plugins/dali-swig/examples/dali-test.cs b/plugins/dali-swig/examples/dali-test.cs index ac4bc85..491bd95 100644 --- a/plugins/dali-swig/examples/dali-test.cs +++ b/plugins/dali-swig/examples/dali-test.cs @@ -39,6 +39,9 @@ namespace MyCSharpExample public void Initialize(object source, AUIApplicationInitEventArgs e) { + + OperatorTests(); + Handle handle = new Handle(); int myPropertyIndex = handle.RegisterProperty("myProperty", new Property.Value(10.0f), Property.AccessMode.READ_WRITE); float myProperty = 0.0f; @@ -162,6 +165,181 @@ namespace MyCSharpExample Console.WriteLine( " Vector4 r = " + vector4.r + ", g = " + vector4.g + ", b = " + vector4.b + ", a = " + vector4.a ); } + + public void OperatorTests() + { + Actor actor = new Actor(); + Actor differentActor = new Actor(); + Actor actorSame = actor; + Actor nullActor = null; + + // test the true operator + if ( actor ) + { + Console.WriteLine ("BaseHandle Operator true (actor) : test passed "); + } + else + { + Console.WriteLine ("BaseHandle Operator true (actor): test failed "); + } + + Actor parent = actor.GetParent (); + + if ( parent ) + { + Console.WriteLine ("Handle with Empty body :failed "); + } + else + { + Console.WriteLine ("Valid with Empty body :passed "); + } + + actor.Add( differentActor ); + // here we test two different C# objects, which on the native side have the same body/ ref-object + if ( actor == differentActor.GetParent() ) + { + Console.WriteLine ("actor == differentActor.GetParent() :passed "); + } + else + { + Console.WriteLine ("actor == differentActor.GetParent() :failed "); + } + + if ( differentActor == differentActor.GetParent() ) + { + Console.WriteLine ("differentActor == differentActor.GetParent() :failed "); + } + else + { + Console.WriteLine ("differentActor == differentActor.GetParent() :passed "); + } + + + if ( nullActor ) + { + Console.WriteLine ("BaseHandle Operator true (nullActor) : test failed "); + } + else + { + Console.WriteLine ("BaseHandle Operator true (nullActor): test passed "); + } + + // ! operator + if ( !actor ) + { + Console.WriteLine ("BaseHandle Operator !(actor) : test failed "); + } + else + { + Console.WriteLine ("BaseHandle Operator !(actor): test passed "); + } + + if ( !nullActor ) + { + Console.WriteLine ("BaseHandle Operator !(nullActor) : test passed "); + } + else + { + Console.WriteLine ("BaseHandle Operator !(nullActor): test failed "); + } + + // Note: operator false only used inside & operator + // test equality operator == + if ( actor == actorSame ) + { + Console.WriteLine ("BaseHandle Operator (actor == actorSame) : test passed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (actor == actorSame) : test failed"); + } + + if ( actor == differentActor ) + { + Console.WriteLine ("BaseHandle Operator (actor == differentActor) : test failed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (actor == differentActor) : test passed"); + } + + if ( actor == nullActor ) + { + Console.WriteLine ("BaseHandle Operator (actor == nullActor) : test failed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (actor == nullActor) : test passed"); + } + + if ( nullActor == nullActor ) + { + Console.WriteLine ("BaseHandle Operator (nullActor == nullActor) : test passed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (nullActor == nullActor) : test failed"); + } + + // test || operator + if ( actor || actorSame ) + { + Console.WriteLine ("BaseHandle Operator (actor || actorSame) : test passed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (actor || actorSame) : test failed"); + } + + if ( actor || nullActor ) + { + Console.WriteLine ("BaseHandle Operator (actor || nullActor) : test passed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (actor || nullActor) : test failed"); + } + + if ( nullActor || nullActor ) + { + Console.WriteLine ("BaseHandle Operator (nullActor || nullActor) : test failed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (nullActor || nullActor) : test passed"); + } + + + // test && operator + if ( actor && actorSame ) + { + Console.WriteLine ("BaseHandle Operator (actor && actorSame) : test passed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (actor && actorSame) : test failed"); + } + + if ( actor && nullActor ) + { + Console.WriteLine ("BaseHandle Operator (actor && nullActor) : test failed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (actor && nullActor) : test passed"); + } + + if ( nullActor && nullActor ) + { + Console.WriteLine ("BaseHandle Operator (nullActor && nullActor) : test failed"); + } + else + { + Console.WriteLine ("BaseHandle Operator (nullActor && nullActor) : test passed"); + } + + } + public void MainLoop() { _application.MainLoop (); diff --git a/plugins/dali-swig/examples/firstscreen/App.cs b/plugins/dali-swig/examples/firstscreen/App.cs index e96d98d..5f5819f 100644 --- a/plugins/dali-swig/examples/firstscreen/App.cs +++ b/plugins/dali-swig/examples/firstscreen/App.cs @@ -24,7 +24,7 @@ namespace FirstScreen private View _topContainer; private View _bottomContainer; - private EdenEffect _edenEffect; + private FocusEffect _focusEffect; private string _imagePath; private ImageView _keyboardFocusIndicator; @@ -116,7 +116,7 @@ namespace FirstScreen HideBottomContainer(); // Also apply Focus animation on Focused item on Poster ScrollContainer - _postersContainer[_currentPostersContainerID].FocusAnimation(_edenEffect, EdenEffectDirection.BottomToTop); + _postersContainer[_currentPostersContainerID].FocusAnimation(_focusEffect, FocusEffectDirection.BottomToTop); } } else if (e.Direction == View.KeyboardFocus.Direction.DOWN) @@ -130,7 +130,7 @@ namespace FirstScreen _menuContainer.SetFocused(true); // Also apply Focus animation on Focused item on Menu ScrollContainer - _menuContainer.FocusAnimation(_edenEffect, EdenEffectDirection.TopToBottom); + _menuContainer.FocusAnimation(_focusEffect, FocusEffectDirection.TopToBottom); } } else if (e.Direction == View.KeyboardFocus.Direction.LEFT) @@ -337,7 +337,7 @@ namespace FirstScreen } // Add a shadow seperator image between last Launcher icon and Menu ScrollContainer - _launcherSeparator = new ImageView(_imagePath + "/eden_launcher_shadow_n.png"); + _launcherSeparator = new ImageView(_imagePath + "/focus_launcher_shadow_n.png"); _launcherSeparator.Name = "launcherSeparator"; _launcherSeparator.WidthResizePolicy = "USE_NATURAL_SIZE"; _launcherSeparator.HeightResizePolicy = "FILL_TO_PARENT"; @@ -357,7 +357,7 @@ namespace FirstScreen _menuContainer.OffsetX = Constants.LauncherWidth; _menuContainer.Width = _stageSize.width - Constants.LauncherWidth; _menuContainer.Height = _stageSize.height * Constants.MenuContainerHeightFactor; - _menuContainer.ShadowBorder = new ImageView(_imagePath + "/eden_launcher_shadow.9.png"); + _menuContainer.ShadowBorder = new ImageView(_imagePath + "/focus_launcher_shadow.9.png"); _menuContainer.ShadowBorder.Name = "_menuContainer.ShadowBorder"; _menuContainer.ShadowBorder.Size = new Vector3(_menuContainer.ItemSize.width + 40.0f, _menuContainer.ItemSize.height + 50.0f, 0.0f); _menuContainer.ShadowBorder.Position = new Vector3(0.0f, 5.0f, 0.0f); @@ -381,7 +381,7 @@ namespace FirstScreen keyboardFocusManager.SetFocusIndicatorActor(_keyboardFocusIndicator); - _edenEffect = new EdenEffect(); + _focusEffect = new FocusEffect(); // Move Fcous to Bottom Container (Menu ScrollContainer) ShowBottomContainer(); diff --git a/plugins/dali-swig/examples/firstscreen/EdenData.cs b/plugins/dali-swig/examples/firstscreen/FocusData.cs similarity index 83% rename from plugins/dali-swig/examples/firstscreen/EdenData.cs rename to plugins/dali-swig/examples/firstscreen/FocusData.cs index 63e9dfd..b1ee188 100644 --- a/plugins/dali-swig/examples/firstscreen/EdenData.cs +++ b/plugins/dali-swig/examples/firstscreen/FocusData.cs @@ -3,9 +3,9 @@ using System; namespace FirstScreen { - public class EdenData + public class FocusData { - private string _name; // Name used for EdenData object (mainly to differentiate key frame animation ) + private string _name; // Name used for FocusData object (mainly to differentiate key frame animation ) private string _imageName; // Image File Name (to be loaded from disk) used for ImageView used in key frame animation private Vector3 _parentOrigin; // ParentOrigin applied to ImageView private Vector3 _initSize; // InitSize used for key frame animation @@ -15,8 +15,8 @@ namespace FirstScreen private Direction _direction; // Direction used for key frame animation private ImageView _imageFocus; // ImageView used in key frame animation - // Initialize EdenData used for key frame animation - public EdenData(string name, string imageName, Direction direction, Vector3 parentOrigin, Vector3 initSize, + // Initialize FocusData used for key frame animation + public FocusData(string name, string imageName, Direction direction, Vector3 parentOrigin, Vector3 initSize, Vector3 targetSize, float keyFrameStart, float keyFrameEnd) { _name = name; @@ -28,8 +28,8 @@ namespace FirstScreen _keyFrameEnd = keyFrameEnd; _direction = direction; - _imageFocus = new ImageView("./images/edeneffect/" + _imageName); // Desktop -// _imageFocus = new ImageView("/home/owner/apps_rw/org.tizen.firstscreen/res/images/edeneffect/" + _imageName); // Target + _imageFocus = new ImageView("./images/focuseffect/" + _imageName); // Desktop +// _imageFocus = new ImageView("/home/owner/apps_rw/org.tizen.firstscreen/res/images/focuseffect/" + _imageName); // Target _imageFocus.ParentOrigin = _parentOrigin; _imageFocus.AnchorPoint = NDalic.AnchorPointCenter; @@ -42,7 +42,7 @@ namespace FirstScreen Vertical }; - public Direction EdenDirection + public Direction FocusDirection { get {return _direction;} set {_direction = value;} diff --git a/plugins/dali-swig/examples/firstscreen/EdenEffect.cs b/plugins/dali-swig/examples/firstscreen/FocusEffect.cs similarity index 50% rename from plugins/dali-swig/examples/firstscreen/EdenEffect.cs rename to plugins/dali-swig/examples/firstscreen/FocusEffect.cs index 6a84a09..d02e483 100644 --- a/plugins/dali-swig/examples/firstscreen/EdenEffect.cs +++ b/plugins/dali-swig/examples/firstscreen/FocusEffect.cs @@ -5,51 +5,51 @@ using System.Collections.Specialized; namespace FirstScreen { - public class EdenEffect : IEdenEffect + public class FocusEffect : IFocusEffect { private float _frameThickness; - private EdenData[] _edenFocusData; // Each EdenData is used for one key frame animation (total 6 key frame animations needed for EddenEffect) + private FocusData[] _focusData; // Each FocusData is used for one key frame animation (total 6 key frame animations needed for EddenEffect) private Animation _animation; // Animation used to apply all six key frame animations - public EdenEffect() + public FocusEffect() { _frameThickness = 10.0f; float _bottomFrameTime = 0.6f; // complete the halo/bottom animation 60% of the way through float _sideFrameTime = 0.8f; // Start the side frame animation after the bottom animation and complete at 80% of the way through float _topFrameTime = 1.0f; // start the top frame animation after the side frame animation and complete at 100% way through - // Six key frame animations (EdenData objects) needed for EddenEffect + // Six key frame animations (FocusData objects) needed for EddenEffect // Two key frame animations for top horizontal effect // Two key frame animations for bottom horizontal effect // Two key frame animations for vertical horizontal effect - _edenFocusData = new EdenData[6]; + _focusData = new FocusData[6]; - EdenData edenData = new EdenData("halo", "halo.png", EdenData.Direction.Horizontal, NDalic.ParentOriginTopCenter, + FocusData focusData = new FocusData("halo", "halo.png", FocusData.Direction.Horizontal, NDalic.ParentOriginTopCenter, new Vector3(50,20,0), new Vector3(0.0f, 100.0f , 0.0f), 0.0f, _bottomFrameTime); - _edenFocusData[0] = edenData; + _focusData[0] = focusData; - edenData = new EdenData("bottom", "horizontalFrame.png", EdenData.Direction.Horizontal, NDalic.ParentOriginTopCenter, + focusData = new FocusData("bottom", "horizontalFrame.png", FocusData.Direction.Horizontal, NDalic.ParentOriginTopCenter, new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, _frameThickness, 0.0f), 0.0f, _bottomFrameTime); - _edenFocusData[1] = edenData; + _focusData[1] = focusData; - edenData = new EdenData("left", "verticalFrame.png", EdenData.Direction.Vertical, NDalic.ParentOriginBottomLeft, + focusData = new FocusData("left", "verticalFrame.png", FocusData.Direction.Vertical, NDalic.ParentOriginBottomLeft, new Vector3(0.0f, 0.0f, 0.0f), new Vector3(_frameThickness, 0.0f, 0.0f), _bottomFrameTime, _sideFrameTime); - _edenFocusData[2] = edenData; + _focusData[2] = focusData; - edenData = new EdenData("right", "verticalFrame.png", EdenData.Direction.Vertical, NDalic.ParentOriginBottomRight, + focusData = new FocusData("right", "verticalFrame.png", FocusData.Direction.Vertical, NDalic.ParentOriginBottomRight, new Vector3(0.0f, 0.0f, 0.0f), new Vector3(_frameThickness, 0.0f, 0.0f), _bottomFrameTime, _sideFrameTime); - _edenFocusData[3] = edenData; + _focusData[3] = focusData; - edenData = new EdenData("top-left", "horizontalFrame.png", EdenData.Direction.Horizontal, NDalic.ParentOriginBottomLeft, + focusData = new FocusData("top-left", "horizontalFrame.png", FocusData.Direction.Horizontal, NDalic.ParentOriginBottomLeft, new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f ,_frameThickness, 0.0f), _sideFrameTime, _topFrameTime); - _edenFocusData[4] = edenData; + _focusData[4] = focusData; - edenData = new EdenData("top-right", "horizontalFrame.png", EdenData.Direction.Horizontal, NDalic.ParentOriginBottomRight, + focusData = new FocusData("top-right", "horizontalFrame.png", FocusData.Direction.Horizontal, NDalic.ParentOriginBottomRight, new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, _frameThickness, 0.0f), _sideFrameTime, _topFrameTime); - _edenFocusData[5] = edenData; + _focusData[5] = focusData; } - public void FocusAnimation(View parentItem, Vector3 itemSize, float duration, EdenEffectDirection direction) + public void FocusAnimation(View parentItem, Vector3 itemSize, float duration, FocusEffectDirection direction) { var itemWidth = itemSize.x + _frameThickness / 2; var itemHeight = itemSize.y + _frameThickness / 3; @@ -61,42 +61,42 @@ namespace FirstScreen } _animation = new Animation(duration); - if (direction == EdenEffectDirection.BottomToTop) + if (direction == FocusEffectDirection.BottomToTop) { - _edenFocusData[0].ParentOrigin = NDalic.ParentOriginBottomCenter; - _edenFocusData[1].ParentOrigin = NDalic.ParentOriginBottomCenter; - _edenFocusData[2].ParentOrigin = NDalic.ParentOriginBottomLeft; - _edenFocusData[3].ParentOrigin = NDalic.ParentOriginBottomRight; - _edenFocusData[4].ParentOrigin = NDalic.ParentOriginTopLeft; - _edenFocusData[5].ParentOrigin = NDalic.ParentOriginTopRight; + _focusData[0].ParentOrigin = NDalic.ParentOriginBottomCenter; + _focusData[1].ParentOrigin = NDalic.ParentOriginBottomCenter; + _focusData[2].ParentOrigin = NDalic.ParentOriginBottomLeft; + _focusData[3].ParentOrigin = NDalic.ParentOriginBottomRight; + _focusData[4].ParentOrigin = NDalic.ParentOriginTopLeft; + _focusData[5].ParentOrigin = NDalic.ParentOriginTopRight; } else { - _edenFocusData[0].ParentOrigin = NDalic.ParentOriginTopCenter; - _edenFocusData[1].ParentOrigin = NDalic.ParentOriginTopCenter; - _edenFocusData[2].ParentOrigin = NDalic.ParentOriginBottomLeft; - _edenFocusData[3].ParentOrigin = NDalic.ParentOriginBottomRight; - _edenFocusData[4].ParentOrigin = NDalic.ParentOriginBottomLeft; - _edenFocusData[5].ParentOrigin = NDalic.ParentOriginBottomRight; + _focusData[0].ParentOrigin = NDalic.ParentOriginTopCenter; + _focusData[1].ParentOrigin = NDalic.ParentOriginTopCenter; + _focusData[2].ParentOrigin = NDalic.ParentOriginBottomLeft; + _focusData[3].ParentOrigin = NDalic.ParentOriginBottomRight; + _focusData[4].ParentOrigin = NDalic.ParentOriginBottomLeft; + _focusData[5].ParentOrigin = NDalic.ParentOriginBottomRight; } - foreach (EdenData edenData in _edenFocusData) + foreach (FocusData focusData in _focusData) { - var currentParent = edenData.ImageItem.GetParent(); + var currentParent = focusData.ImageItem.GetParent(); // first parent the controls if (parentItem != currentParent) { - parentItem.Add(edenData.ImageItem); + parentItem.Add(focusData.ImageItem); } - edenData.ImageItem.Size = new Vector3(100.0f,100.0f, 0.0f); - parentItem.Add(edenData.ImageItem); + focusData.ImageItem.Size = new Vector3(100.0f,100.0f, 0.0f); + parentItem.Add(focusData.ImageItem); - Vector3 targetSize = edenData.TargetSize; - Vector3 initSize = edenData.InitSize; + Vector3 targetSize = focusData.TargetSize; + Vector3 initSize = focusData.InitSize; - if (edenData.EdenDirection == EdenData.Direction.Horizontal) + if (focusData.FocusDirection == FocusData.Direction.Horizontal) { // adjust the width to match the parent targetSize.x = itemWidth; @@ -108,7 +108,7 @@ namespace FirstScreen } // half the size for the top frame as we come out from both left / right sides - if (edenData.Name == "top-right" || edenData.Name == "top-left") + if (focusData.Name == "top-right" || focusData.Name == "top-left") { targetSize.x = itemWidth - _frameThickness; } @@ -116,67 +116,67 @@ namespace FirstScreen KeyFrames keyFrames = new KeyFrames(); keyFrames.Add(0.0f, new Property.Value(initSize)); - keyFrames.Add(edenData.KeyFrameStart, new Property.Value(initSize)); - keyFrames.Add(edenData.KeyFrameEnd, new Property.Value(targetSize)); + keyFrames.Add(focusData.KeyFrameStart, new Property.Value(initSize)); + keyFrames.Add(focusData.KeyFrameEnd, new Property.Value(targetSize)); // for halo add an extra keyframe to shrink it ( in 20% of time after it has finished) - if (edenData.Name =="halo") + if (focusData.Name =="halo") { - keyFrames.Add(edenData.KeyFrameEnd + 0.2f, new Property.Value(initSize)); + keyFrames.Add(focusData.KeyFrameEnd + 0.2f, new Property.Value(initSize)); } - _animation.AnimateBetween(new Property(edenData.ImageItem, Actor.Property.SIZE), keyFrames, + _animation.AnimateBetween(new Property(focusData.ImageItem, Actor.Property.SIZE), keyFrames, new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE)); // Simulate the vertical frame growing from the top. // Vertical items are anchored to the bottom of the parent... so when they grow // we need to move them to the middle of the parent ( otherwise they stick out the bottom) - if (edenData.EdenDirection == EdenData.Direction.Vertical) + if (focusData.FocusDirection == FocusData.Direction.Vertical) { //animate position as well so it looks like animation is coming from bottom KeyFrames keyFramesV = new KeyFrames(); - if (direction == EdenEffectDirection.BottomToTop) + if (direction == FocusEffectDirection.BottomToTop) { keyFramesV.Add(0.0f, new Property.Value(0.0f)); - keyFramesV.Add(edenData.KeyFrameStart, new Property.Value(0.0f)); + keyFramesV.Add(focusData.KeyFrameStart, new Property.Value(0.0f)); } else { keyFramesV.Add(0.0f, new Property.Value(-itemHeight)); - keyFramesV.Add(edenData.KeyFrameStart, new Property.Value(-itemHeight)); + keyFramesV.Add(focusData.KeyFrameStart, new Property.Value(-itemHeight)); } - keyFramesV.Add(edenData.KeyFrameEnd, new Property.Value(-itemHeight / 2)); // animate to halfway up the control + keyFramesV.Add(focusData.KeyFrameEnd, new Property.Value(-itemHeight / 2)); // animate to halfway up the control - _animation.AnimateBetween(new Property(edenData.ImageItem, Actor.Property.POSITION_Y), keyFramesV, + _animation.AnimateBetween(new Property(focusData.ImageItem, Actor.Property.POSITION_Y), keyFramesV, new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE)); } // Simulate the top frame growing from the sides. - if (edenData.Name == "top-left") + if (focusData.Name == "top-left") { KeyFrames keyFramesTL = new KeyFrames(); keyFramesTL.Add(0.0f, new Property.Value(0.0f)); - keyFramesTL.Add(edenData.KeyFrameStart, new Property.Value(0.0f)); - keyFramesTL.Add(edenData.KeyFrameEnd, new Property.Value(itemWidth / 2)); // animate to halfway up the control + keyFramesTL.Add(focusData.KeyFrameStart, new Property.Value(0.0f)); + keyFramesTL.Add(focusData.KeyFrameEnd, new Property.Value(itemWidth / 2)); // animate to halfway up the control // grow these from the left or right - _animation.AnimateBetween(new Property(edenData.ImageItem, Actor.Property.POSITION_X), keyFramesTL, + _animation.AnimateBetween(new Property(focusData.ImageItem, Actor.Property.POSITION_X), keyFramesTL, new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE)); } - if (edenData.Name == "top-right") + if (focusData.Name == "top-right") { KeyFrames keyFramesTR = new KeyFrames(); keyFramesTR.Add(0.0f, new Property.Value(0.0f)); - keyFramesTR.Add(edenData.KeyFrameStart, new Property.Value(0.0f)); - keyFramesTR.Add(edenData.KeyFrameEnd, new Property.Value(-itemWidth / 2)); // animate to halfway up the control + keyFramesTR.Add(focusData.KeyFrameStart, new Property.Value(0.0f)); + keyFramesTR.Add(focusData.KeyFrameEnd, new Property.Value(-itemWidth / 2)); // animate to halfway up the control // grow these from the left or right - _animation.AnimateBetween(new Property(edenData.ImageItem, Actor.Property.POSITION_X), keyFramesTR, + _animation.AnimateBetween(new Property(focusData.ImageItem, Actor.Property.POSITION_X), keyFramesTR, new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE)); } @@ -188,13 +188,13 @@ namespace FirstScreen private void OnAnimationFinished(object source, Animation.FinishedEventArgs e) { - foreach (EdenData edenData in _edenFocusData) + foreach (FocusData focusData in _focusData) { - var currentParent = edenData.ImageItem.GetParent(); + var currentParent = focusData.ImageItem.GetParent(); if (currentParent) { - currentParent.Remove(edenData.ImageItem); + currentParent.Remove(focusData.ImageItem); } } } diff --git a/plugins/dali-swig/examples/firstscreen/IEdenEffect.cs b/plugins/dali-swig/examples/firstscreen/IFocusEffect.cs similarity index 61% rename from plugins/dali-swig/examples/firstscreen/IEdenEffect.cs rename to plugins/dali-swig/examples/firstscreen/IFocusEffect.cs index 88ca3b8..222c2ed 100644 --- a/plugins/dali-swig/examples/firstscreen/IEdenEffect.cs +++ b/plugins/dali-swig/examples/firstscreen/IFocusEffect.cs @@ -3,15 +3,15 @@ using System; namespace FirstScreen { - public enum EdenEffectDirection + public enum FocusEffectDirection { TopToBottom, BottomToTop }; - public interface IEdenEffect + public interface IFocusEffect { - void FocusAnimation(View parentItem, Vector3 itemSize, float duration, EdenEffectDirection direction); + void FocusAnimation(View parentItem, Vector3 itemSize, float duration, FocusEffectDirection direction); } } diff --git a/plugins/dali-swig/examples/firstscreen/ScrollContainer.cs b/plugins/dali-swig/examples/firstscreen/ScrollContainer.cs index c22c712..633af05 100644 --- a/plugins/dali-swig/examples/firstscreen/ScrollContainer.cs +++ b/plugins/dali-swig/examples/firstscreen/ScrollContainer.cs @@ -428,9 +428,9 @@ namespace FirstScreen } // Perform EddenEffect animation on Focused Item specified - public void FocusAnimation(EdenEffect edenEffect, EdenEffectDirection direction) + public void FocusAnimation(FocusEffect focusEffect, FocusEffectDirection direction) { - edenEffect.FocusAnimation(_itemList[_focusedItem], _itemSize, 1.0f, direction); + focusEffect.FocusAnimation(_itemList[_focusedItem], _itemSize, 1.0f, direction); } public void SetFocused(bool focused) diff --git a/plugins/dali-swig/examples/firstscreen/images/eden_launcher_shadow.9.png b/plugins/dali-swig/examples/firstscreen/images/focus_launcher_shadow.9.png similarity index 100% rename from plugins/dali-swig/examples/firstscreen/images/eden_launcher_shadow.9.png rename to plugins/dali-swig/examples/firstscreen/images/focus_launcher_shadow.9.png diff --git a/plugins/dali-swig/examples/firstscreen/images/eden_launcher_shadow_n.png b/plugins/dali-swig/examples/firstscreen/images/focus_launcher_shadow_n.png similarity index 100% rename from plugins/dali-swig/examples/firstscreen/images/eden_launcher_shadow_n.png rename to plugins/dali-swig/examples/firstscreen/images/focus_launcher_shadow_n.png diff --git a/plugins/dali-swig/examples/firstscreen/images/edeneffect/halo.png b/plugins/dali-swig/examples/firstscreen/images/focuseffect/halo.png similarity index 100% rename from plugins/dali-swig/examples/firstscreen/images/edeneffect/halo.png rename to plugins/dali-swig/examples/firstscreen/images/focuseffect/halo.png diff --git a/plugins/dali-swig/examples/firstscreen/images/edeneffect/horizontalFrame.png b/plugins/dali-swig/examples/firstscreen/images/focuseffect/horizontalFrame.png similarity index 100% rename from plugins/dali-swig/examples/firstscreen/images/edeneffect/horizontalFrame.png rename to plugins/dali-swig/examples/firstscreen/images/focuseffect/horizontalFrame.png diff --git a/plugins/dali-swig/examples/firstscreen/images/edeneffect/verticalFrame.png b/plugins/dali-swig/examples/firstscreen/images/focuseffect/verticalFrame.png similarity index 100% rename from plugins/dali-swig/examples/firstscreen/images/edeneffect/verticalFrame.png rename to plugins/dali-swig/examples/firstscreen/images/focuseffect/verticalFrame.png diff --git a/plugins/dali-swig/examples/hello-test.cs b/plugins/dali-swig/examples/hello-test.cs old mode 100755 new mode 100644 index 61726aa..1f7962d --- a/plugins/dali-swig/examples/hello-test.cs +++ b/plugins/dali-swig/examples/hello-test.cs @@ -52,6 +52,14 @@ namespace MyCSharpExample { } + public Example(string stylesheet):base(stylesheet) + { + } + + public Example(string stylesheet, Dali.Application.WINDOW_MODE windowMode):base(stylesheet, windowMode) + { + } + private void Initialize() { // Connect the signal callback for stage touched signal @@ -111,7 +119,9 @@ namespace MyCSharpExample static void Main(string[] args) { Console.WriteLine("Hello mono world."); - Example example = new Example(); + //Example example = new Example(); + //Example example = new Example("stylesheet"); + Example example = new Example("stylesheet", Dali.Application.WINDOW_MODE.TRANSPARENT); example.Run(args); } } diff --git a/plugins/dali-swig/examples/hello-world.cs b/plugins/dali-swig/examples/hello-world.cs index 28fd1dd..1d35bc1 100755 --- a/plugins/dali-swig/examples/hello-world.cs +++ b/plugins/dali-swig/examples/hello-world.cs @@ -85,8 +85,9 @@ 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(_text, Animation.ORIENTATION, new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS ), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, 0.5f)); + + _animation.AnimateTo(_text, Animation.ORIENTATION, 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/manual/csharp/Tizen.Applications/DaliApplication.cs b/plugins/dali-swig/manual/csharp/Tizen.Applications/DaliApplication.cs old mode 100755 new mode 100644 index 06d7756..6791355 --- a/plugins/dali-swig/manual/csharp/Tizen.Applications/DaliApplication.cs +++ b/plugins/dali-swig/manual/csharp/Tizen.Applications/DaliApplication.cs @@ -28,13 +28,61 @@ namespace Tizen.Applications /// This application is created before OnCreate() or created event. And the DaliApplication will be terminated when this application is closed. /// protected Dali.Application application; + + /// + /// The instance of the Dali Application extension. + /// protected Dali.ApplicationExtensions applicationExt; /// + /// Store the stylesheet value. + /// + protected string m_stylesheet; + + /// + /// Store the window mode value. + /// + protected Dali.Application.WINDOW_MODE m_windowMode; + + /// + /// Store the app mode value. + /// + protected APP_MODE appMode; + + /// /// The instance of the Dali Stage. /// public Stage stage { get; private set; } + /// + /// The default constructor. + /// + public DaliApplication():base() + { + appMode = APP_MODE.DEFAULT; + } + + /// + /// The constructor with stylesheet. + /// + public DaliApplication(string stylesheet):base() + { + //handle the stylesheet + appMode = APP_MODE.STYLESHEETONLY; + m_stylesheet = stylesheet; + } + + /// + /// The constructor with stylesheet and window mode. + /// + public DaliApplication(string stylesheet, Dali.Application.WINDOW_MODE windowMode) + : base() + { + //handle the stylesheet and windowMode + appMode = APP_MODE.STYLESHEETWITHWINDOWMODE; + m_stylesheet = stylesheet; + m_windowMode = windowMode; + } /// /// Overrides this method if want to handle behavior before calling OnCreate(). @@ -42,8 +90,22 @@ namespace Tizen.Applications /// protected override void OnPreCreate() { - application = Dali.Application.NewApplication(); - applicationExt = new Dali::ApplicationExtensions(application); + switch(appMode) + { + case APP_MODE.DEFAULT: + application = Dali.Application.NewApplication(); + break; + case APP_MODE.STYLESHEETONLY: + application = Dali.Application.NewApplication(m_stylesheet); + break; + case APP_MODE.STYLESHEETWITHWINDOWMODE: + application = Dali.Application.NewApplication(m_stylesheet, m_windowMode); + break; + default: + break; + } + + applicationExt = new Dali.ApplicationExtensions(application); applicationExt.Init(); stage = Stage.GetCurrent(); @@ -85,5 +147,15 @@ namespace Tizen.Applications base.OnLocaleChanged(e); applicationExt.LanguageChange(); } + + /// + /// The mode of creating Dali application. + /// + protected enum APP_MODE + { + DEFAULT = 0, + STYLESHEETONLY = 1, + STYLESHEETWITHWINDOWMODE = 2 + } } }