+++ /dev/null
-T.O.C.
-======
-
- 1. GBS Builds
- 1.1. NON-SMACK Targets
- 1.2. SMACK enabled Targets
- 1.3. DEBUG Builds
- 1.4. MOBILE Profile
- 2. Building for Ubuntu desktop
- 2.1. Minimum Requirements
- 2.2. Building the Repository
- 2.3. Building and executing test cases
-
-
-1. GBS Builds
-=============
-
-1.1. NON-SMACK Targets
-----------------------
-
- gbs build -A [TARGET_ARCH]
-
-1.2. SMACK enabled Targets
---------------------------
-
- gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
-
-1.3. DEBUG Builds
------------------
-
- gbs build -A [TARGET_ARCH] --define "%enable_debug 1"
-
-2. Building for Ubuntu desktop
-==============================
-
-2.1. Minimum Requirements
-------------------------
-
- - Ubuntu 14.04
- - Environment created using dali_env script in dali-core repository
-
-2.2. Building the Repository
-----------------------------
-
-To build the repository enter the 'build/tizen' folder:
-
- cd dali-toolkit/build/tizen
-
-Then run the following commands:
-
- autoreconf --install
- ./configure --prefix=$DESKTOP_PREFIX
- make install -j8
-
-2.3. Building and executing test cases
---------------------------------------
-
-See the README.md in dali-toolkit/automated-tests.
--- /dev/null
+<img src="https://dalihub.github.io/images/DaliLogo320x200.png">
+
+# Table of Contents
+
+ * [Build Instructions](#build-instructions)
+ * [1. Building for Ubuntu desktop](#1-building-for-ubuntu-desktop)
+ * [Minimum Requirements](#minimum-requirements)
+ * [Building the Repository](#building-the-repository)
+ * [Building and executing test cases](#building-and-executing-test-cases)
+ * [2. GBS Builds](#2-gbs-builds)
+ * [NON-SMACK Targets](#non-smack-targets)
+ * [SMACK enabled Targets](#smack-enabled-targets)
+ * [DEBUG Builds](#debug-builds)
+
+# Build Instructions
+
+## 1. Building for Ubuntu desktop
+
+### Minimum Requirements
+
+ - Ubuntu 14.04 or later
+ - Environment created using dali_env script in dali-core repository
+
+### Building the Repository
+
+To build the repository enter the 'build/tizen' folder:
+
+ $ cd dali-toolkit/build/tizen
+
+Then run the following commands:
+
+ $ autoreconf --install
+ $ ./configure --prefix=$DESKTOP_PREFIX
+ $ make install -j8
+
+### Building and executing test cases
+
+See the README.md in dali-toolkit/automated-tests.
+
+## 2. GBS Builds
+
+### NON-SMACK Targets
+
+ $ gbs build -A [TARGET_ARCH]
+
+### SMACK enabled Targets
+
+ $ gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
+
+### DEBUG Builds
+
+ $ gbs build -A [TARGET_ARCH] --define "%enable_debug 1"
utc-Dali-TextLabel.cpp
utc-Dali-TextSelectionPopup.cpp
utc-Dali-ToolBar.cpp
+ utc-Dali-TransitionData.cpp
utc-Dali-Button.cpp
utc-Dali-Control.cpp
utc-Dali-ControlImpl.cpp
{
}
-
DummyControlImpl::~DummyControlImpl()
{
}
return Control::GetPlacementActor( index );
}
+Animation DummyControlImpl::CreateTransition( const Toolkit::TransitionData& transition )
+{
+ return Control::CreateTransition( transition );
+}
+
DummyControl DummyControlImplOverride::New()
{
IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
Toolkit::Visual::Base GetVisual( Property::Index index );
Actor GetPlacementActor( Property::Index index );
+ Animation CreateTransition( const Toolkit::TransitionData& transition );
// Used to test signal connections
void CustomSlot1( Actor actor );
--- /dev/null
+/*
+ * 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.
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include "dummy-control.h"
+
+using namespace Dali;
+using namespace Toolkit;
+
+
+void utc_dali_toolkit_transition_data_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_transition_data_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+Property::Map CreateMap()
+{
+ Property::Map map;
+
+ map["target"] = "Actor1";
+ map["property"] = "color";
+ map["initialValue"] = Color::MAGENTA;
+ map["targetValue"] = Color::RED;
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_IN_OUT_BACK")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.5f)
+ .Add("duration", 1.0f));
+ 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<Vector4>();
+ 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<float>(), 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);
+
+ for( unsigned int i=0; i< test.Count(); ++i )
+ {
+ KeyValuePair keyValue = test.GetKeyValue(i);
+ Property::Value* value;
+
+ if( keyValue.first.type == Property::Key::STRING )
+ {
+ value = result.Find(keyValue.first.stringKey);
+ }
+ else
+ {
+ value = result.Find(keyValue.first.indexKey);
+ }
+
+ DALI_TEST_CHECK( value != NULL );
+ if( value != NULL )
+ {
+ 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 );
+ }
+ }
+ }
+}
+
+
+int UtcDaliTransitionDataNew(void)
+{
+ TestApplication application;
+
+ Property::Map map = CreateMap();
+ Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+ DALI_TEST_CHECK( transition );
+
+ END_TEST;
+}
+
+int UtcDaliTransitionDataDownCast(void)
+{
+ TestApplication application;
+
+ Property::Map map = CreateMap();
+
+ BaseHandle handle = TransitionData::New( map );
+ DALI_TEST_CHECK( handle );
+
+ TransitionData transitionData = TransitionData::DownCast( handle );
+ DALI_TEST_CHECK( transitionData );
+ END_TEST;
+}
+
+int UtcDaliTransitionDataCopyConstructor(void)
+{
+ TestApplication application;
+
+ Property::Map map = CreateMap();
+
+ TransitionData transitionData = TransitionData::New( map );
+ DALI_TEST_CHECK( transitionData );
+
+ TransitionData td2( transitionData );
+ DALI_TEST_CHECK( td2 );
+ DALI_TEST_EQUALS( td2.Count(), 1, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTransitionDataAssignmentOperator(void)
+{
+ TestApplication application;
+
+ Property::Map map = CreateMap();
+
+ TransitionData transitionData = TransitionData::New( map );
+ DALI_TEST_CHECK( transitionData );
+
+ TransitionData td2;
+ DALI_TEST_CHECK( !td2 );
+
+ td2 = transitionData;
+ DALI_TEST_CHECK( td2 );
+
+ DALI_TEST_EQUALS( td2.Count(), 1, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliTransitionDataCount(void)
+{
+ TestApplication application;
+
+ Property::Map map = CreateMap();
+ TransitionData transitionData = TransitionData::New( map );
+ DALI_TEST_CHECK( transitionData );
+ DALI_TEST_EQUALS( transitionData.Count(), 1, TEST_LOCATION );
+
+ Property::Array array;
+ array.PushBack( map );
+ array.PushBack( map );
+ array.PushBack( map );
+
+ TransitionData transitionData2 = TransitionData::New( array );
+ DALI_TEST_CHECK( transitionData2 );
+ DALI_TEST_EQUALS( transitionData2.Count(), 3, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTransitionDataMap1P(void)
+{
+ TestApplication application;
+
+ tet_printf("Testing animation of a visual property using stylesheet equivalent maps\n");
+
+ Property::Map map;
+ map["target"] = "visual1";
+ map["property"] = "mixColor";
+ map["initialValue"] = Color::MAGENTA;
+ map["targetValue"] = Color::RED;
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_IN_OUT")
+ .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<DummyControlImpl&>(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 );
+
+ Renderer renderer = actor.GetRendererAt(0);
+ Property::Index mixColorIndex = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
+ application.SendNotification();
+ application.Render(0);
+
+ DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), Color::MAGENTA, TEST_LOCATION);
+
+ anim.Play();
+
+ application.SendNotification();
+ application.Render(0);
+ application.Render(500); // Start animation
+ application.Render(500); // Halfway thru anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
+
+ application.Render(500); // End of anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), Color::RED, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTransitionDataMap2P(void)
+{
+ TestApplication application;
+
+ tet_printf("Testing animation of a visual property using programmatic maps\n");
+
+ Property::Map map;
+ map["target"] = "visual1";
+ //Control::CONTROL_PROPERTY_END_INDEX + 1
+ map["property"] = ColorVisual::Property::MIX_COLOR;
+ map["initialValue"] = Color::MAGENTA;
+ map["targetValue"] = Color::RED;
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "LINEAR")
+ .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<DummyControlImpl&>(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 );
+
+ Renderer renderer = actor.GetRendererAt(0);
+ Property::Index mixColorIndex = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
+ application.SendNotification();
+ application.Render(0);
+
+ DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), Color::MAGENTA, TEST_LOCATION);
+
+ anim.Play();
+
+ application.SendNotification();
+ application.Render(0);
+ application.Render(500); // Start animation
+ application.Render(500); // Halfway thru anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
+
+ application.Render(500); // End of anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(mixColorIndex), Color::RED, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
+int UtcDaliTransitionDataMap3P(void)
+{
+ TestApplication application;
+
+ tet_printf("Testing animation of a visual's placement actor property\n");
+
+ Property::Map map;
+ map["target"] = "visual1";
+ map["property"] = "color";
+ map["initialValue"] = Color::MAGENTA;
+ map["targetValue"] = Color::RED;
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_IN_OUT")
+ .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<DummyControlImpl&>(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);
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::MAGENTA, TEST_LOCATION);
+
+ anim.Play();
+
+ application.SendNotification();
+ application.Render(0);
+ application.Render(500);
+ application.Render(500); // Halfway thru map1 anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
+
+ application.Render(500); // End of map1 anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::RED, TEST_LOCATION );
+ 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<DummyControlImpl&>(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;
+
+ Property::Map map;
+ map["target"] = "Actor1";
+ map["property"] = "randomProperty";
+ map["initialValue"] = Color::MAGENTA;
+ map["targetValue"] = Color::RED;
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_OUT")
+ .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<DummyControlImpl&>(actor.GetImplementation());
+ Animation anim = dummyImpl.CreateTransition( transition );
+ DALI_TEST_CHECK( ! anim );
+
+ CHECK_MAP_EQUALS( map, transition.GetAnimatorAt(0) );
+ END_TEST;
+}
+
+
+int UtcDaliTransitionDataMapN3(void)
+{
+ TestApplication application;
+
+ tet_printf("Testing visual lookup with no renderers\n");
+
+ Property::Map map;
+ map["target"] = "visual1";
+ map["property"] = "mixColor";
+ map["initialValue"] = Color::MAGENTA;
+ map["targetValue"] = Color::RED;
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_OUT_BACK")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.5f)
+ .Add("duration", 1.0f));
+
+ Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+ CHECK_MAP_EQUALS( map, transition.GetAnimatorAt(0) );
+
+ DummyControl actor = DummyControl::New();
+ actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+ actor.SetName("Actor1");
+ actor.SetColor(Color::CYAN);
+ // Don't stage actor
+
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(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 );
+ 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<DummyControlImpl&>(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<Vector4>(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<DummyControlImpl&>(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<Vector4>(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<DummyControlImpl&>(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<Vector4>(mixColorIdx), Color::RED, 0.001, TEST_LOCATION);
+
+ END_TEST;
+}
+
+
+int UtcDaliTransitionDataArrayP(void)
+{
+ TestApplication application;
+
+ Property::Map map1;
+ map1["target"] = "Actor1";
+ map1["property"] = "color";
+ map1["initialValue"] = Color::MAGENTA;
+ map1["targetValue"] = Color::RED;
+ map1["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_IN_OUT")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.5f)
+ .Add("duration", 1.0f));
+
+ Property::Map map2;
+ map2["target"] = "Actor1";
+ map2["property"] = "position";
+ map2["initialValue"] = Vector3(100,0,0);
+ map2["targetValue"] = Vector3(0,100,0);
+ map2["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_IN_OUT")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.0f)
+ .Add("duration", 1.0f));
+
+ Property::Map map3;
+ map3["target"] = "Actor1";
+ map3["property"] = "orientation";
+ map3["targetValue"] = Quaternion( Radian(Math::PI_2), Vector3::ZAXIS );
+
+ Property::Array array;
+ array.PushBack(map1);
+ array.PushBack(map2);
+ array.PushBack(map3);
+
+ Dali::Toolkit::TransitionData transition = TransitionData::New( array );
+
+ DummyControl actor = DummyControl::New();
+ actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+ actor.SetName("Actor1");
+ actor.SetColor(Color::CYAN);
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0), Vector3::ZAXIS), TEST_LOCATION);
+
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+ Animation anim = dummyImpl.CreateTransition( transition );
+ DALI_TEST_CHECK( anim );
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::MAGENTA, TEST_LOCATION);
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(Math::PI_2), Vector3::ZAXIS), TEST_LOCATION);
+ anim.Play();
+
+ application.SendNotification();
+ application.Render(0); // start map2 anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(100,0,0), TEST_LOCATION);
+
+ application.Render(500); // Start map1 animation, halfway thru map2 anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(50,50,0), TEST_LOCATION);
+
+ application.Render(500); // Halfway thru map1 anim, end of map2 anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0,100,0), TEST_LOCATION);
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), (Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
+
+ application.Render(500); // End of map1 anim
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::RED, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
+int UtcDaliTransitionDataGetAnimatorP(void)
+{
+ TestApplication application;
+
+ Property::Map map1;
+ map1["target"] = "Actor1";
+ map1["property"] = "color";
+ map1["initialValue"] = Color::MAGENTA;
+ map1["targetValue"] = Color::RED;
+ map1["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_IN_SQUARE")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.5f)
+ .Add("duration", 0.5f));
+
+ Property::Map map2;
+ map2["target"] = "Actor1";
+ map2["property"] = "position";
+ map2["initialValue"] = Vector3(100,0,0);
+ map2["targetValue"] = Vector3(0,100,0);
+ map2["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_OUT_SQUARE")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.2f)
+ .Add("duration", 2.0f));
+
+ Property::Map map3;
+ map3["target"] = "Actor1";
+ map3["property"] = "size";
+ map3["initialValue"] = Vector2(10,10);
+ map3["targetValue"] = Vector2(100,100);
+ map3["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_OUT_SINE")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.4f)
+ .Add("duration", 3.0f));
+
+ Property::Map map4;
+ map4["target"] = "Actor2";
+ map4["property"] = "color";
+ map4["initialValue"] = Color::BLACK;
+ map4["targetValue"] = Color::GREEN;
+ map4["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_IN_OUT_SINE")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.5f)
+ .Add("duration", 0.5f));
+
+ Property::Map map5;
+ map5["target"] = "Actor2";
+ map5["property"] = "position";
+ map5["initialValue"] = Vector3(100,0,0);
+ map5["targetValue"] = Vector3(0,100,0);
+ map5["animator"] = Property::Map()
+ .Add("alphaFunction", "BOUNCE")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.2f)
+ .Add("duration", 2.0f));
+
+ Property::Map map6;
+ map6["target"] = "Actor2";
+ map6["property"] = "size";
+ map6["initialValue"] = Vector2(10,10);
+ map6["targetValue"] = Vector2(100,100);
+ map6["animator"] = Property::Map()
+ .Add("alphaFunction", "SIN")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.4f)
+ .Add("duration", 3.0f));
+
+ Property::Map map7;
+ map7["target"] = "Actor4";
+ map7["property"] = "sizeModeFactor";
+ map7["initialValue"] = Vector3(1,1,1);
+ map7["targetValue"] = Vector3(2,2,2);
+ map7["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_IN_SINE")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.0f)
+ .Add("duration", 1.0f));
+
+ Property::Map map8;
+ map8["target"] = "Visual1";
+ map8["property"] = "colorAlpha";
+ map8["targetValue"] = 1.0f;
+ map8["animator"] = Property::Map()
+ .Add("alphaFunction", "EASE_IN")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.3f)
+ .Add("duration", 9.0f));
+
+ Property::Map map9;
+ map9["target"] = "Actor2";
+ map9["property"] = "scale";
+ map9["initialValue"] = Vector3(0,0,0);
+ map9["targetValue"] = Vector3(1,1,1);
+ map9["animator"] = Property::Map()
+ .Add("alphaFunction", "REVERSE")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.0f)
+ .Add("duration", 1.0f));
+
+ Property::Map map10;
+ 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);
+ array.PushBack(map2);
+ array.PushBack(map3);
+ array.PushBack(map4);
+ array.PushBack(map5);
+ array.PushBack(map6);
+ array.PushBack(map7);
+ array.PushBack(map8);
+ array.PushBack(map9);
+ array.PushBack(map10);
+ array.PushBack(map11);
+ array.PushBack(map12);
+
+ Dali::Toolkit::TransitionData transition = TransitionData::New( array );
+
+ DALI_TEST_EQUALS( transition.Count(), array.Count(), TEST_LOCATION );
+
+ for( unsigned int i=0; i < array.Count(); ++i )
+ {
+ Property::Map animatorMap = transition.GetAnimatorAt(i);
+ Property::Value& value = array.GetElementAt(i);
+ Property::Map* inputMap = value.GetMap();
+ DALI_TEST_CHECK( inputMap );
+ CHECK_MAP_EQUALS( *inputMap, animatorMap );
+ }
+
+ END_TEST;
+}
#include <dali/public-api/rendering/texture-set.h>
#include <dali/public-api/rendering/shader.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/dali-toolkit.h>
+#include "dummy-control.h"
using namespace Dali;
using namespace Dali::Toolkit;
END_TEST;
}
+int UtcDaliVisualSetName01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualSetName" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+
+ const char* visualName = "backgroundVisual";
+ visual.SetName( visualName );
+
+ DALI_TEST_EQUALS( visual.GetName(), visualName, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliVisualSetGetDepthIndex(void)
{
ToolkitTestApplication application;
$(devel_api_src_dir)/transition-effects/cube-transition-effect.cpp \
$(devel_api_src_dir)/transition-effects/cube-transition-fold-effect.cpp \
$(devel_api_src_dir)/transition-effects/cube-transition-wave-effect.cpp \
+ $(devel_api_src_dir)/visual-factory/transition-data.cpp \
$(devel_api_src_dir)/visual-factory/visual-factory.cpp \
$(devel_api_src_dir)/visual-factory/visual-base.cpp \
$(devel_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp
$(devel_api_src_dir)/controls/progress-bar/progress-bar.h
devel_api_visual_factory_header_files = \
+ $(devel_api_src_dir)/visual-factory/transition-data.h \
$(devel_api_src_dir)/visual-factory/visual-factory.h \
$(devel_api_src_dir)/visual-factory/visual-base.h
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
namespace Dali
{
Property::Map customShader;
customShader[ Visual::Shader::Property::VERTEX_SHADER ] = vertexShader;
- map[ Visual::Property::SHADER ] = customShader;
+ map[ VisualProperty::SHADER ] = customShader;
return map;
}
--- /dev/null
+#ifndef DALI_TOOLKIT_DEVEL_VISUAL_PROPERTIES_H
+#define DALI_TOOLKIT_DEVEL_VISUAL_PROPERTIES_H
+
+/*
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Visual
+{
+
+// Mirror of public API Property namespace with addition of enums that are not yet
+// public. A namespace alias is used below to reduce implementation cruft.
+
+namespace DevelProperty
+{
+
+enum Type
+{
+ TYPE = Dali::Toolkit::Visual::Property::TYPE,
+ SHADER = Dali::Toolkit::Visual::Property::SHADER,
+
+ /**
+ * @brief The transform used by the visual.
+ * @details Name "transform", type Property::Map.
+
+ * @note Optional.
+ * @see Transform::Property
+ */
+ TRANSFORM = SHADER+1//Dali::Toolkit::Visual::Property::SHADER+1
+};
+
+} // namespace DevelProperty
+
+} // namespace Visual
+
+namespace VisualProperty = Visual::DevelProperty;
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+
+#endif // DALI_TOOLKIT_DEVEL_VISUAL_PROPERTIES_H
--- /dev/null
+/*
+ * 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.
+ */
+
+#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+#include <dali-toolkit/internal/visuals/transition-data-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+
+TransitionData::TransitionData()
+{
+}
+
+TransitionData::~TransitionData()
+{
+}
+
+TransitionData TransitionData::New( const Property::Array& transition )
+{
+ Internal::TransitionDataPtr transitionData = Internal::TransitionData::New( transition );
+ return TransitionData( transitionData.Get() );
+}
+
+TransitionData TransitionData::New( const Property::Map& transition )
+{
+ Internal::TransitionDataPtr transitionData = Internal::TransitionData::New( transition );
+ return TransitionData( transitionData.Get() );
+}
+
+TransitionData TransitionData::DownCast( BaseHandle handle )
+{
+ return TransitionData( dynamic_cast<Dali::Toolkit::Internal::TransitionData*>(handle.GetObjectPtr()));
+}
+
+TransitionData::TransitionData( const TransitionData& handle )
+: BaseHandle( handle )
+{
+}
+
+TransitionData& TransitionData::operator=( const TransitionData& handle )
+{
+ BaseHandle::operator=( handle );
+ return *this;
+}
+
+size_t TransitionData::Count() const
+{
+ return GetImplementation( *this ).Count();
+}
+
+Property::Map TransitionData::GetAnimatorAt( size_t index )
+{
+ return GetImplementation( *this ).GetAnimatorAt( index );
+}
+
+TransitionData::TransitionData( Internal::TransitionData* pointer )
+: BaseHandle( pointer )
+{
+}
+
+} // namespace Toolkit
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TRANSITION_DATA_H__
+#define __DALI_TOOLKIT_TRANSITION_DATA_H__
+
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/animation/alpha-function.h>
+#include <dali/public-api/object/property-array.h>
+#include <dali/public-api/object/property-map.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+class TransitionData;
+}
+
+/**
+ * @brief This object translates data from a property array of maps
+ * into an array of animators.
+ *
+ * Each animator describes a named object and a named property of that object
+ * to be animated. Internally, these are translated into object instances and
+ * property indices to be animated.
+ * @see Dali::Toolkit::Internal::Control::CreateTransition()
+ *
+ * The animators can each be retrieved as a Property::Map by using Count() and
+ * GetAnimatorAt().
+ *
+ * In psuedo-JSON, the property array can be represented as follows:
+ *
+ * [
+ * {
+ * "target": "objectName",
+ * "property": "propertyKey",
+ * "initialValue": <value>, # The property value can be one of several types
+ * "targetValue": <value>,
+ * "animator": {
+ * "alphaFunction":<easing-function>",
+ * "timePeriod":{
+ * "duration": 1.0,
+ * "delay": 0.0
+ * }
+ * }
+ * },
+ * # more animators
+ * ]
+ *
+ */
+class DALI_IMPORT_API TransitionData : public BaseHandle
+{
+public:
+ /**
+ * Create an uninitialized handle
+ *
+ * @SINCE_1_2.12
+ */
+ TransitionData();
+
+ /**
+ * Destructor - non virtual
+ *
+ * @SINCE_1_2.12
+ */
+ ~TransitionData();
+
+ /**
+ * @brief Creates a TransitionData object
+ *
+ * @SINCE_1_2.12
+ * @param[in] transition The transition data to store (a single animator)
+ * @return A handle to an initialized data.
+ */
+ static TransitionData New( const Property::Map& transition );
+
+ /**
+ * @brief Creates a TransitionData object
+ *
+ * @SINCE_1_2.12
+ * @param[in] transition The transition data to store (an array of maps of animators)
+ * @return A handle to an initialized data.
+ */
+ static TransitionData New( const Property::Array& transition );
+
+ /**
+ * @brief Downcast to a TransitionData handle
+ *
+ * @SINCE_1_2.12
+ * If handle is not a TransitionData, the returned handle is left uninitialized.
+ * @param[in] handle Handle to an object
+ * @return TransitionData handle or an uninitialized handle.
+ */
+ static TransitionData DownCast( BaseHandle handle );
+
+ /**
+ * @brief Copy constructor
+ *
+ * @SINCE_1_2.12
+ * @param[in] handle Handle to an object
+ */
+ TransitionData( const TransitionData& handle );
+
+ /**
+ * @brief Assignment Operator
+ *
+ * @SINCE_1_2.12
+ * @param[in] handle Handle to an object
+ * @return A reference to this object.
+ */
+ TransitionData& operator=( const TransitionData& handle );
+
+ /**
+ * @brief returns the count of the individual property transitions
+ * stored within this handle.
+ *
+ * @SINCE_1_2.12
+ * @return The count of individual transitions
+ */
+ size_t Count() const;
+
+ /**
+ * @brief Return the animator at the given index as a property map.
+ * @param[in] index The index of the animator ( Must be less than Count() )
+ * @return A property map representing the animator
+ */
+ Property::Map GetAnimatorAt( size_t index );
+
+public: // Not intended for application developers
+
+ explicit DALI_INTERNAL TransitionData( Internal::TransitionData *impl );
+};
+
+} // namespace Toolkit
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TRANSITION_DATA_H__
{
}
+void Visual::Base::SetName( const std::string& name )
+{
+ GetImplementation( *this ).SetName( name );
+}
+
+const std::string& Visual::Base::GetName()
+{
+ return GetImplementation( *this ).GetName();
+}
+
void Visual::Base::SetSize( const Vector2& size )
{
GetImplementation( *this ).SetSize( size );
Base& operator=( const Base& handle );
/**
+ * @brief Set the name of the visual
+ *
+ * Used by the styling system to animate properties
+ * @param[in] name The name to give the visual
+ */
+ void SetName( const std::string& name );
+
+ /**
+ * @brief Get the name of the visual
+ *
+ * Used by the styling system to animate properties
+ * @return The name of the visual
+ */
+ const std::string& GetName();
+
+ /**
* @brief Set the size of the painting area.
*
* @param[in] size The size of the painting area.
} // namespace Toolkit
} // namespace Dali
-
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
namespace Dali
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = BLOOM_EXTRACT_FRAGMENT_SOURCE;
Property::Map visualMap;
- visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
+ visualMap.Insert( Toolkit::VisualProperty::SHADER, customShader );
mBloomExtractImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
// set GaussianBlurView to blur our extracted bloom
mCompositeImageView.SetImage( mRenderTargetForRenderingChildren );
// Create shader used to composite bloom and original image to output render target
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = COMPOSITE_FRAGMENT_SOURCE;
- visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
+ visualMap[ Toolkit::VisualProperty::SHADER ] = customShader;
mCompositeImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
TextureSet textureSet = mCompositeImageView.GetRendererAt(0).GetTextures();
TextureSetImage( textureSet, 1u, mBlurExtractTarget );
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#define DALI_COMPOSE_SHADER(STR) #STR
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentShader;
Property::Map map;
- map[ Toolkit::Visual::Property::SHADER ] = customShader;
+ map[ Toolkit::VisualProperty::SHADER ] = customShader;
return map;
}
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
Toolkit::Visual::Base visual;
Property::Map map;
- map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
+ map[ Toolkit::VisualProperty::TYPE ] = Toolkit::Visual::COLOR;
map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
visual = visualFactory.CreateVisual( map );
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
// TODO:
// pixel format / size - set from JSON
horizFragmentShaderStringStream << GAUSSIAN_BLUR_FRAGMENT_SOURCE;
Property::Map source;
source[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = horizFragmentShaderStringStream.str();
- mCustomShader[ Toolkit::Visual::Property::SHADER ] = source;
+ mCustomShader[ Toolkit::VisualProperty::SHADER ] = source;
//////////////////////////////////////////////////////
// Create actors
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
// if its not a string then get a Property::Map from the property if possible.
else if( value.Get( map ) )
{
- Property::Value* shaderValue = map.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER );
+ Property::Value* shaderValue = map.Find( Toolkit::VisualProperty::SHADER, CUSTOM_SHADER );
// set image only if property map contains image information other than custom shader
if( map.Count() > 1u || !shaderValue )
{
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
namespace Dali
{
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Property::Map map;
- map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::BORDER;
+ map[ Toolkit::VisualProperty::TYPE ] = Toolkit::Visual::BORDER;
map[ Toolkit::BorderVisual::Property::COLOR ] = Color::WHITE;
map[ Toolkit::BorderVisual::Property::SIZE ] = IMAGE_BORDER_INDENT;
Toolkit::Visual::Base borderVisual = visualFactory.CreateVisual( map );
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#define DALI_COMPOSE_SHADER(STR) #STR
customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = vertexSource;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentSource;
- map[ Toolkit::Visual::Property::SHADER ] = customShader;
+ map[ Toolkit::VisualProperty::SHADER ] = customShader;
return map;
}
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
using namespace Dali;
customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_X ] = 20;
customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_Y ] = 20;
- map[ Toolkit::Visual::Property::SHADER ] = customShader;
+ map[ Toolkit::VisualProperty::SHADER ] = customShader;
return map;
}
-
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
Shader PageTurnView::CreateShader( const Property::Map& shaderMap )
{
Shader shader;
- Property::Value* shaderValue = shaderMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER );
+ Property::Value* shaderValue = shaderMap.Find( Toolkit::VisualProperty::SHADER, CUSTOM_SHADER );
Property::Map shaderSource;
if( shaderValue && shaderValue->Get( shaderSource ) )
{
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h>
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
customShader[ Toolkit::Visual::Shader::Property::HINTS ] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
- mShadowVisualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
+ mShadowVisualMap[ Toolkit::VisualProperty::SHADER ] = customShader;
// Create render targets needed for rendering from light's point of view
mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 );
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/public-api/visuals/text-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/text/text-effects-style.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
// Creates the text's visual.
Property::Map visualMap;
- visualMap[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::TEXT;
+ visualMap[Toolkit::VisualProperty::TYPE] = Toolkit::Visual::TEXT;
visualMap[Toolkit::TextVisual::Property::RENDERING_BACKEND] = static_cast<int>( DEFAULT_RENDERING_BACKEND );
mVisual = Toolkit::VisualFactory::Get().CreateVisual( visualMap );
$(toolkit_src_dir)/visuals/svg/svg-visual.cpp \
$(toolkit_src_dir)/visuals/text/text-visual.cpp \
$(toolkit_src_dir)/visuals/wireframe/wireframe-visual.cpp \
+ $(toolkit_src_dir)/visuals/transition-data-impl.cpp \
$(toolkit_src_dir)/controls/alignment/alignment-impl.cpp \
$(toolkit_src_dir)/controls/bloom-view/bloom-view-impl.cpp \
$(toolkit_src_dir)/controls/bubble-effect/bubble-emitter-impl.cpp \
#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
namespace Dali
{
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentSource.str();
Property::Map visualMap;
- visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
+ visualMap.Insert( Toolkit::VisualProperty::SHADER, customShader );
mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
mActorForHorz.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
// Set up blend-two-image custom shader
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = BLEND_TWO_IMAGES_FRAGMENT_SOURCE;
- visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
+ visualMap[ Toolkit::VisualProperty::SHADER ] = customShader;
mActorForBlending.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
mRootActor.Add( mActorForInput );
#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Dali
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EMBOSS_FRAGMENT_SOURCE;
Property::Map visualMap;
- visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
+ visualMap.Insert( Toolkit::VisualProperty::SHADER, customShader );
// create actor to render input with applied emboss effect
mActorForInput1 = Toolkit::ImageView::New(mInputImage);
#include <dali/public-api/render-tasks/render-task-list.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
namespace Dali
{
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = SPREAD_FRAGMENT_SOURCE;
Property::Map visualMap;
- visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
+ visualMap.Insert( Toolkit::VisualProperty::SHADER, customShader );
// set SPREAD custom shader
mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
void Controller::Impl::ClampVerticalScroll( const Vector2& layoutSize )
{
+ if( LayoutEngine::SINGLE_LINE_BOX == mLayoutEngine.GetLayout() )
+ {
+ // Nothing to do if the text is single line.
+ return;
+ }
+
// Clamp between -space & 0.
if( layoutSize.height > mVisualModel->mControlSize.height )
{
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
{
}
-void BorderVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void BorderVisual::DoSetProperties( const Property::Map& propertyMap )
{
Property::Value* color = propertyMap.Find( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME );
if( !( color && color->Get(mBorderColor) ) )
void BorderVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::BORDER );
+ map.Insert( VisualProperty::TYPE, Toolkit::Visual::BORDER );
map.Insert( Toolkit::BorderVisual::Property::COLOR, mBorderColor );
map.Insert( Toolkit::BorderVisual::Property::SIZE, mBorderSize );
map.Insert( Toolkit::BorderVisual::Property::ANTI_ALIASING, mAntiAliasing );
virtual ~BorderVisual();
/**
- * @copydoc Visual::Base::DoInitialize
+ * @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage
//INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
{
}
-void ColorVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void ColorVisual::DoSetProperties( const Property::Map& propertyMap )
{
Property::Value* color = propertyMap.Find( Toolkit::ColorVisual::Property::MIX_COLOR, COLOR_NAME );
if( !( color && color->Get(mMixColor) ) )
void ColorVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::COLOR );
map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mMixColor );
}
virtual ~ColorVisual();
/**
- * @copydoc Visual::Base::DoInitialize
+ * @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
{
}
-void GradientVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void GradientVisual::DoSetProperties( const Property::Map& propertyMap )
{
Toolkit::GradientVisual::Units::Type gradientUnits = Toolkit::GradientVisual::Units::OBJECT_BOUNDING_BOX;
void GradientVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::GRADIENT );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::GRADIENT );
map.Insert( Toolkit::GradientVisual::Property::UNITS, mGradient->GetGradientUnits() );
map.Insert( Toolkit::GradientVisual::Property::SPREAD_METHOD, mGradient->GetSpreadMethod() );
virtual ~GradientVisual();
/**
- * @copydoc Visual::Base::DoInitialize
+ * @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage
// INTERNAL HEADER
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
{
}
-void BatchImageVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void BatchImageVisual::DoSetProperties( const Property::Map& propertyMap )
{
std::string oldImageUrl = mImageUrl;
Property::Value* imageURLValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::URL, Dali::Toolkit::Internal::IMAGE_URL_NAME );
mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
}
-
- // Remove old renderer if exit.
- if( mImpl->mRenderer )
- {
- if( actor ) // Remove old renderer from actor.
- {
- actor.RemoveRenderer( mImpl->mRenderer );
- }
- if( !oldImageUrl.empty() ) // Clean old renderer from cache.
- {
- CleanCache( oldImageUrl );
- }
- }
-
- // If actor is on stage, create new renderer and apply to actor.
- if( actor && actor.OnStage() )
- {
- SetOnStage( actor );
- }
}
void BatchImageVisual::SetSize( const Vector2& size )
void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
~BatchImageVisual();
/**
- * @copydoc Visua::Base::DoInitialize
+ * @copydoc Visua::Base::DoSetProperties
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage
// INTERNAL HEADER
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
: Visual::Base( factoryCache ),
mImage(),
mPixels(),
- mTextureSet(),
mPixelArea( FULL_TEXTURE_RECT ),
mPlacementActor(),
mImageUrl(),
- mNativeFragmentShaderCode(),
mDesiredSize(),
mFittingMode( FittingMode::DEFAULT ),
mSamplingMode( SamplingMode::DEFAULT ),
mWrapModeU( WrapMode::DEFAULT ),
- mWrapModeV( WrapMode::DEFAULT ),
- mNativeImageFlag( false )
+ mWrapModeV( WrapMode::DEFAULT )
{
}
: Visual::Base( factoryCache ),
mImage(),
mPixels(),
- mTextureSet(),
mPixelArea( FULL_TEXTURE_RECT ),
mPlacementActor(),
mImageUrl( imageUrl ),
- mNativeFragmentShaderCode(),
mDesiredSize( size ),
mFittingMode( fittingMode ),
mSamplingMode( samplingMode ),
mWrapModeU( WrapMode::DEFAULT ),
- mWrapModeV( WrapMode::DEFAULT ),
- mNativeImageFlag( false )
+ mWrapModeV( WrapMode::DEFAULT )
{
}
mPixelArea( FULL_TEXTURE_RECT ),
mPlacementActor(),
mImageUrl(),
- mNativeFragmentShaderCode(),
mDesiredSize(),
mFittingMode( FittingMode::DEFAULT ),
mSamplingMode( SamplingMode::DEFAULT ),
mWrapModeU( WrapMode::DEFAULT ),
- mWrapModeV( WrapMode::DEFAULT ),
- mNativeImageFlag( false )
+ mWrapModeV( WrapMode::DEFAULT )
{
- NativeImage newNativeImage = NativeImage::DownCast( image );
- if( newNativeImage )
- {
- SetNativeFragmentShaderCode( newNativeImage );
- mNativeImageFlag = true;
- }
- else
- {
- mNativeImageFlag = false;
- }
}
ImageVisual::~ImageVisual()
{
}
-void ImageVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void ImageVisual::DoSetProperties( const Property::Map& propertyMap )
{
- std::string oldImageUrl = mImageUrl;
-
Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
if( imageURLValue )
{
if( sync )
{
mImpl->mFlags |= Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
+ // if sync loading is required, the loading should start immediately when new image url is set or the actor is off stage
+ // ( for on-stage actor with image url unchanged, resource loading is already finished)
+ if( imageURLValue )
+ {
+ LoadResourceSynchronously();
+ }
}
else
{
mImpl->mFlags &= ~Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
}
}
-
- // if sync loading is required, the loading should start immediately when new image url is set or the actor is off stage
- // ( for on-stage actor with image url unchanged, resource loading is already finished)
- if( imageURLValue && IsSynchronousResourceLoading() )
- {
- LoadResourceSynchronously();
- }
-
- NativeImage nativeImage = NativeImage::DownCast( mImage );
-
- if( nativeImage )
- {
- SetNativeFragmentShaderCode( nativeImage );
- }
-
- // if actor is on stage, create new renderer and apply to actor
- if( actor && actor.OnStage() )
- {
- SetOnStage( actor );
- }
}
void ImageVisual::GetNaturalSize( Vector2& naturalSize ) const
naturalSize = Vector2::ZERO;
}
-void ImageVisual::CreateRenderer()
+void ImageVisual::CreateRenderer( TextureSet& textures )
{
Geometry geometry;
Shader shader;
- // If mImage is nativeImage with custom sampler or prefix, mNativeFragmentShaderCode will be applied.
- // Renderer can't be shared between NativeImage and other image types.
- if( !mNativeFragmentShaderCode.empty() )
- {
- CreateNativeImageRenderer();
- return;
- }
-
if( !mImpl->mCustomShader )
{
geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
geometry = CreateGeometry( mFactoryCache, mImpl->mCustomShader->mGridSize );
if( mImpl->mCustomShader->mVertexShader.empty() && mImpl->mCustomShader->mFragmentShader.empty() )
{
- shader = GetImageShader(mFactoryCache, false, true);
+ shader = GetImageShader( mFactoryCache, false, true );
}
else
{
}
mImpl->mRenderer = Renderer::New( geometry, shader );
- // apply the texture set as well so it's only done in one place
- DALI_ASSERT_DEBUG( mTextureSet );
- mImpl->mRenderer.SetTextures( mTextureSet );
+ DALI_ASSERT_DEBUG( textures );
+ mImpl->mRenderer.SetTextures( textures );
}
-void ImageVisual::CreateNativeImageRenderer()
+void ImageVisual::CreateNativeImageRenderer( NativeImage& nativeImage )
{
Geometry geometry;
Shader shader;
+ std::string fragmentShader;
+ const char* fragmentPreFix = nativeImage.GetCustomFragmentPreFix();
+ const char* customSamplerTypename = nativeImage.GetCustomSamplerTypename();
+ if( fragmentPreFix )
+ {
+ fragmentShader = fragmentPreFix;
+ fragmentShader += "\n";
+ }
+ if( mImpl->mCustomShader && !mImpl->mCustomShader->mFragmentShader.empty() )
+ {
+ fragmentShader += mImpl->mCustomShader->mFragmentShader;
+ }
+ else
+ {
+ fragmentShader += FRAGMENT_SHADER_NO_ATLAS;
+ }
+ if( customSamplerTypename )
+ {
+ fragmentShader.replace( fragmentShader.find( DEFAULT_SAMPLER_TYPENAME ), strlen( DEFAULT_SAMPLER_TYPENAME ), customSamplerTypename );
+ }
+
if( !mImpl->mCustomShader )
{
geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
- shader = Shader::New( VERTEX_SHADER, mNativeFragmentShaderCode );
+ shader = Shader::New( VERTEX_SHADER, fragmentShader );
shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
}
else
{
geometry = CreateGeometry( mFactoryCache, mImpl->mCustomShader->mGridSize );
shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? VERTEX_SHADER : mImpl->mCustomShader->mVertexShader,
- mNativeFragmentShaderCode,
+ fragmentShader,
mImpl->mCustomShader->mHints );
if( mImpl->mCustomShader->mVertexShader.empty() )
{
}
mImpl->mRenderer = Renderer::New( geometry, shader );
- // apply the texture set as well so it's only done in one place
- DALI_ASSERT_DEBUG( mTextureSet );
- mImpl->mRenderer.SetTextures( mTextureSet );
}
}
}
-void ImageVisual::CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading, bool attemptAtlasing )
+TextureSet ImageVisual::CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading, bool attemptAtlasing )
{
+ TextureSet textureSet;
textureRect = FULL_TEXTURE_RECT;
if( synchronousLoading )
{
if( !mPixels )
{
// use broken image
- mTextureSet = TextureSet::New();
- TextureSetImage( mTextureSet, 0u, VisualFactoryCache::GetBrokenVisualImage() );
+ textureSet = TextureSet::New();
+ TextureSetImage( textureSet, 0u, VisualFactoryCache::GetBrokenVisualImage() );
}
else
{
if( attemptAtlasing )
{
- mTextureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, mPixels );
+ textureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, mPixels );
mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
}
- if( !mTextureSet ) // big image, no atlasing or atlasing failed
+ if( !textureSet ) // big image, no atlasing or atlasing failed
{
mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, mPixels.GetPixelFormat(),
mPixels.GetWidth(), mPixels.GetHeight() );
texture.Upload( mPixels );
- mTextureSet = TextureSet::New();
- mTextureSet.SetTexture( 0u, texture );
+ textureSet = TextureSet::New();
+ textureSet.SetTexture( 0u, texture );
}
}
}
{
if( attemptAtlasing )
{
- mTextureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, url, mDesiredSize, mFittingMode, true, this );
+ textureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, url, mDesiredSize, mFittingMode, true, this );
mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
}
- if( !mTextureSet ) // big image, no atlasing or atlasing failed
+ if( !textureSet ) // big image, no atlasing or atlasing failed
{
mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
ResourceImage resourceImage = Dali::ResourceImage::New( url, mDesiredSize, mFittingMode, mSamplingMode );
resourceImage.LoadingFinishedSignal().Connect( this, &ImageVisual::OnImageLoaded );
- mTextureSet = TextureSet::New();
- TextureSetImage( mTextureSet, 0u, resourceImage );
+ textureSet = TextureSet::New();
+ TextureSetImage( textureSet, 0u, resourceImage );
}
}
{
Sampler sampler = Sampler::New();
sampler.SetWrapMode( mWrapModeU, mWrapModeV );
- mTextureSet.SetSampler( 0u, sampler );
+ textureSet.SetSampler( 0u, sampler );
}
+ return textureSet;
}
void ImageVisual::InitializeRenderer( const std::string& imageUrl )
Vector4 atlasRect;
// texture set has to be created first as we need to know if atlasing succeeded or not
// when selecting the shader
- CreateTextureSet( atlasRect, imageUrl, IsSynchronousResourceLoading(), true );
- CreateRenderer();
+ TextureSet textures = CreateTextureSet( atlasRect, imageUrl, IsSynchronousResourceLoading(), true );
+ CreateRenderer( textures );
if( mImpl->mFlags & Impl::IS_ATLASING_APPLIED ) // the texture is packed inside atlas
{
// for custom shader or remote image, renderer is not cached and atlas is not applied
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
Vector4 atlasRect; // ignored in this case
- CreateTextureSet( atlasRect, imageUrl, IsSynchronousResourceLoading(), false );
- CreateRenderer();
+ TextureSet textures = CreateTextureSet( atlasRect, imageUrl, IsSynchronousResourceLoading(), false );
+ CreateRenderer( textures );
}
}
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
// don't reuse CreateTextureSet
- mTextureSet = TextureSet::New();
- CreateRenderer();
+ TextureSet textures = TextureSet::New();
+ // Renderer can't be shared if mImage is NativeImage
+ NativeImage nativeImage = NativeImage::DownCast( image );
+ if( nativeImage )
+ {
+ CreateNativeImageRenderer( nativeImage );
+ DALI_ASSERT_DEBUG( textures );
+ mImpl->mRenderer.SetTextures( textures );
+ }
+ else
+ {
+ // reuse existing code for regular images
+ CreateRenderer( textures );
+ }
if( image )
{
mImpl->mRenderer.Reset();
}
mPlacementActor.Reset();
- mTextureSet.Reset(); // release texture when going offstage
}
void ImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
bool sync = IsSynchronousResourceLoading();
map.Insert( SYNCHRONOUS_LOADING, sync );
{
if( image )
{
- DALI_ASSERT_DEBUG( mTextureSet ); // texture set should always exist by this time
+ TextureSet textureSet = mImpl->mRenderer.GetTextures();
+ DALI_ASSERT_DEBUG( textureSet ); // texture set should always exist by this time
- TextureSetImage( mTextureSet, 0u, image );
+ TextureSetImage( textureSet, 0u, image );
Sampler sampler = Sampler::New();
sampler.SetWrapMode( mWrapModeU, mWrapModeV );
- mTextureSet.SetSampler( 0u, sampler );
+ textureSet.SetSampler( 0u, sampler );
}
}
atlasRectValue.Get( atlasRect );
}
+ TextureSet textureSet = mImpl->mRenderer.GetTextures();
mImpl->mRenderer.Reset();
if( mFactoryCache.CleanRendererCache( url ) && index != Property::INVALID_INDEX )
{
- mFactoryCache.GetAtlasManager()->Remove( mTextureSet, atlasRect );
+ mFactoryCache.GetAtlasManager()->Remove( textureSet, atlasRect );
}
}
}
-void ImageVisual::SetNativeFragmentShaderCode( Dali::NativeImage& nativeImage )
-{
- const char* fragmentPreFix = nativeImage.GetCustomFragmentPreFix();
- const char* customSamplerTypename = nativeImage.GetCustomSamplerTypename();
-
- if( fragmentPreFix )
- {
- mNativeFragmentShaderCode = fragmentPreFix;
- mNativeFragmentShaderCode += "\n";
- }
-
- if( mImpl->mCustomShader && !mImpl->mCustomShader->mFragmentShader.empty() )
- {
- mNativeFragmentShaderCode += mImpl->mCustomShader->mFragmentShader;
- }
- else
- {
- mNativeFragmentShaderCode += FRAGMENT_SHADER_NO_ATLAS;
- }
-
- if( customSamplerTypename )
- {
- mNativeFragmentShaderCode.replace( mNativeFragmentShaderCode.find( DEFAULT_SAMPLER_TYPENAME ), strlen( DEFAULT_SAMPLER_TYPENAME ), customSamplerTypename );
- }
-}
-
} // namespace Internal
} // namespace Toolkit
virtual ~ImageVisual();
/**
- * @copydoc Visual::Base::DoInitialize
+ * @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage
/**
* @brief Creates the Dali::Renderer (potentially from the renderer cache), initializing it
+ * @param[in] textures to use
*/
- void CreateRenderer();
+ void CreateRenderer( TextureSet& textures );
/**
* @brief Creates the Dali::Renderer for NativeImage with custom sampler type and prefix, initializing it
+ * @param NativeImageRenderer
*/
- void CreateNativeImageRenderer();
+ void CreateNativeImageRenderer( NativeImage& nativeImage );
/**
* @brief Query whether resources requires to be loaded synchronously.
* @param[in] url The URL of the image resource to use.
* @param[in] synchronousLoading If true, the resource is loaded synchronously, otherwise asynchronously.
* @param[in] attemptAtlasing If true will attempt atlasing, otherwise create unique texture
+ * @return the texture set to use
*/
- void CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading, bool attemptAtlasing );
+ TextureSet CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading, bool attemptAtlasing );
/**
* Callback function of image resource loading succeed
*/
void CleanCache(const std::string& url);
- /**
- * Set shader code for nativeimage if it exists
- */
- void SetNativeFragmentShaderCode( Dali::NativeImage& nativeImage );
-
private:
Image mImage;
PixelData mPixels;
- TextureSet mTextureSet;
Vector4 mPixelArea;
WeakHandle<Actor> mPlacementActor;
std::string mImageUrl;
- std::string mNativeFragmentShaderCode;
Dali::ImageDimensions mDesiredSize;
Dali::FittingMode::Type mFittingMode:3;
Dali::SamplingMode::Type mSamplingMode:4;
Dali::WrapMode::Type mWrapModeU:3;
Dali::WrapMode::Type mWrapModeV:3;
- bool mNativeImageFlag:1;
+
};
} // namespace Internal
#include <fstream>
//INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
namespace Dali
{
}
-void MeshVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void MeshVisual::DoSetProperties( const Property::Map& propertyMap )
{
Property::Value* objectUrl = propertyMap.Find( Toolkit::MeshVisual::Property::OBJECT_URL, OBJECT_URL_NAME );
if( !objectUrl || !objectUrl->Get( mObjectUrl ) )
void MeshVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::MESH );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::MESH );
map.Insert( Toolkit::MeshVisual::Property::OBJECT_URL, mObjectUrl );
map.Insert( Toolkit::MeshVisual::Property::MATERIAL_URL, mMaterialUrl );
map.Insert( Toolkit::MeshVisual::Property::TEXTURES_PATH, mTexturesPath );
virtual ~MeshVisual();
/**
- * @copydoc Visual::Base::DoInitialize
+ * @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage
// INTERNAL IINCLUDES
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
{
}
-void NPatchVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void NPatchVisual::DoSetProperties( const Property::Map& propertyMap )
{
Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
if( imageURLValue )
void NPatchVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
virtual ~NPatchVisual();
/**
- * @copydoc Visual::Base::DoInitialize
+ * @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage
#include <dali/devel-api/scripting/scripting.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
namespace Dali
{
}
-void PrimitiveVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void PrimitiveVisual::DoSetProperties( const Property::Map& propertyMap )
{
//Find out which shape to renderer.
Property::Value* primitiveTypeValue = propertyMap.Find( Toolkit::PrimitiveVisual::Property::SHAPE, PRIMITIVE_SHAPE );
void PrimitiveVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::PRIMITIVE );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::PRIMITIVE );
map.Insert( Toolkit::PrimitiveVisual::Property::SHAPE, mPrimitiveType );
map.Insert( Toolkit::PrimitiveVisual::Property::MIX_COLOR, mColor );
map.Insert( Toolkit::PrimitiveVisual::Property::SLICES, mSlices );
virtual ~PrimitiveVisual();
/**
- * @copydoc Visual::Base::DoInitialize
+ * @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/third-party/nanosvg/nanosvg.h>
#include <dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h>
#include <dali-toolkit/internal/visuals/image/image-visual.h>
}
}
-void SvgVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void SvgVisual::DoSetProperties( const Property::Map& propertyMap )
{
Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
if( imageURLValue )
void SvgVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
virtual ~SvgVisual();
/**
- * @copydoc Visual::Base::DoInitialize
+ * @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage
// INTERNAL HEADER
#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/public-api/visuals/text-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
#include <dali-toolkit/internal/text/text-view.h>
Property::Value value;
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::TEXT );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::TEXT );
map.Insert( Toolkit::TextVisual::Property::RENDERING_BACKEND, mRenderingBackend );
{
}
-void TextVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void TextVisual::DoSetProperties( const Property::Map& propertyMap )
{
- mSelf = actor;
-
for( Property::Map::SizeType index = 0u, count = propertyMap.Count(); index < count; ++index )
{
const KeyValuePair& keyValue = propertyMap.GetKeyValue( index );
{
case Property::Key::INDEX:
{
- if( Toolkit::Visual::Property::TYPE != keyValue.first.indexKey ) // Toolkit::Visual::Property::TYPE is not a TextVisual's property.
+ if( Toolkit::VisualProperty::TYPE != keyValue.first.indexKey ) // Toolkit::VisualProperty::TYPE is not a TextVisual's property.
{
DoSetProperty( keyValue.first.indexKey, keyValue.second );
}
void TextVisual::RenderText()
{
+ Actor self = mSelf.GetHandle();
+ if( !self )
+ {
+ // Nothing to do if the handle is not initialized.
+ return;
+ }
+
Actor renderableActor;
if( mRenderer )
const Vector2& scrollOffset = mController->GetScrollPosition();
renderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
- mSelf.Add( renderableActor );
+ self.Add( renderableActor );
}
mRenderableActor = renderableActor;
void TextVisual::SetUpAutoScrolling()
{
+ Actor self = mSelf.GetHandle();
+ if( !self )
+ {
+ // Nothing to do if the handle is not initialized.
+ return;
+ }
+
const Text::ScrollerData* const data = mController->GetAutoScrollData();
if( NULL != data )
mTextScroller->StartScrolling( mRenderableActor,
*data );
- mSelf.Add( mTextScroller->GetScrollingText() );
- mSelf.Add( mTextScroller->GetSourceCamera() );
+ self.Add( mTextScroller->GetScrollingText() );
+ self.Add( mTextScroller->GetSourceCamera() );
}
}
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/object/weak-handle.h>
#include <dali/public-api/common/intrusive-ptr.h>
// INTERNAL INCLUDES
// from Visual::Base
/**
- * @copydoc Visual::Base::DoInitialize()
+ * @copydoc Visual::Base::DoSetProperties()
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
+ virtual void DoSetProperties( const Property::Map& propertyMap );
/**
* @copydoc Visual::Base::DoSetOnStage()
private:
Text::ControllerPtr mController; ///< The text's controller.
- Actor mSelf;
+ WeakHandle<Actor> mSelf;
Text::RendererPtr mRenderer;
Text::TextScrollerPtr mTextScroller;
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/visuals/transition-data-impl.h>
+
+// EXTERNAL HEADERS
+#include <dali/dali.h>
+#include <dali/devel-api/scripting/enum-helper.h>
+#include <dali/integration-api/debug.h>
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <sstream>
+
+using namespace Dali;
+
+namespace
+{
+const char* TOKEN_TARGET("target");
+const char* TOKEN_PROPERTY("property");
+const char* TOKEN_INITIAL_VALUE("initialValue");
+const char* TOKEN_TARGET_VALUE("targetValue");
+const char* TOKEN_ANIMATOR("animator");
+const char* TOKEN_TIME_PERIOD("timePeriod");
+const char* TOKEN_DURATION("duration");
+const char* TOKEN_DELAY("delay");
+const char* TOKEN_ALPHA_FUNCTION("alphaFunction");
+
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( ALPHA_FUNCTION_BUILTIN )
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, LINEAR)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, REVERSE)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, EASE_IN)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, EASE_OUT)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, EASE_IN_OUT)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, EASE_IN_SQUARE)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, EASE_OUT_SQUARE)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, EASE_IN_SINE)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, EASE_OUT_SINE)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, EASE_IN_OUT_SINE)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, EASE_OUT_BACK)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, BOUNCE)
+DALI_ENUM_TO_STRING_WITH_SCOPE(AlphaFunction, SIN)
+DALI_ENUM_TO_STRING_TABLE_END( ALPHA_FUNCTION_BUILTIN )
+}
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+
+TransitionData::TransitionData()
+{
+}
+
+TransitionData::~TransitionData()
+{
+}
+
+TransitionDataPtr TransitionData::New( const Property::Array& value )
+{
+ TransitionDataPtr transitionData( new TransitionData() );
+ transitionData->Initialize(value);
+ return transitionData;
+}
+
+TransitionDataPtr TransitionData::New( const Property::Map& value )
+{
+ TransitionDataPtr transitionData( new TransitionData() );
+ transitionData->Initialize(value);
+ return transitionData;
+}
+
+
+void TransitionData::Initialize( const Property::Map& map )
+{
+ TransitionData::Animator* animator = ConvertMap( map );
+ Add( animator );
+}
+
+void TransitionData::Initialize( const Property::Array& array )
+{
+ for( unsigned int arrayIdx = 0, transitionArrayCount = array.Count(); arrayIdx < transitionArrayCount; ++arrayIdx )
+ {
+ const Property::Value& element = array.GetElementAt( arrayIdx );
+ // Expect each child to be an object representing an animator:
+
+ Property::Map* map = element.GetMap();
+ if( map != NULL )
+ {
+ TransitionData::Animator* animator = ConvertMap( *map );
+ Add( animator );
+ }
+ }
+}
+
+TransitionData::Animator* TransitionData::ConvertMap( const Property::Map& map)
+{
+ TransitionData::Animator* animator = new TransitionData::Animator();
+ animator->alphaFunction = AlphaFunction::LINEAR;
+ animator->timePeriodDelay = 0.0f;
+ animator->timePeriodDuration = 1.0f;
+
+ for( unsigned int mapIdx = 0; mapIdx < map.Count(); ++mapIdx )
+ {
+ const KeyValuePair pair( map.GetKeyValue( mapIdx ) );
+ if( pair.first.type == Property::Key::INDEX )
+ {
+ continue; // We don't consider index keys.
+ }
+
+ const std::string& key( pair.first.stringKey );
+ const Property::Value& value( pair.second );
+
+ if( key == TOKEN_TARGET )
+ {
+ animator->objectName = value.Get< std::string >();
+ }
+ else if( key == TOKEN_PROPERTY )
+ {
+ if( value.GetType() == Property::STRING )
+ {
+ animator->propertyKey = Property::Key( value.Get<std::string>() );
+ }
+ else
+ {
+ animator->propertyKey = Property::Key( value.Get<int>() );
+ }
+ }
+ else if( key == TOKEN_INITIAL_VALUE )
+ {
+ animator->initialValue = value;
+ }
+ else if( key == TOKEN_TARGET_VALUE )
+ {
+ animator->targetValue = value;
+ }
+ else if( key == TOKEN_ANIMATOR )
+ {
+ animator->animate = true;
+ Property::Map animatorMap = value.Get< Property::Map >();
+ for( size_t animatorMapIdx = 0; animatorMapIdx < animatorMap.Count(); ++animatorMapIdx )
+ {
+ const KeyValuePair pair( animatorMap.GetKeyValue( animatorMapIdx ) );
+
+ if( pair.first.type == Property::Key::INDEX )
+ {
+ continue; // We don't consider index keys.
+ }
+
+ const std::string& key( pair.first.stringKey );
+ const Property::Value& value( pair.second );
+
+ if( key == TOKEN_ALPHA_FUNCTION )
+ {
+ 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<float>();
+ }
+ else
+ {
+ valid = false;
+ break;
+ }
+ }
+ }
+ else
+ {
+ valid = false;
+ }
+
+ 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 )
+ {
+ Vector4 controlPoints = value.Get<Vector4>();
+ Vector2 controlPoint1( controlPoints.x, controlPoints.y );
+ Vector2 controlPoint2( controlPoints.z, controlPoints.w );
+ animator->alphaFunction = AlphaFunction( controlPoint1, controlPoint2 );
+ }
+ else if( value.GetType() == Property::STRING )
+ {
+ std::string alphaFunctionValue = value.Get< std::string >();
+
+ if( alphaFunctionValue == "LINEAR" )
+ {
+ animator->alphaFunction = AlphaFunction(AlphaFunction::LINEAR);
+ }
+ else if( ! alphaFunctionValue.compare(0, 5, "EASE_" ) )
+ {
+ if( alphaFunctionValue == "EASE_IN" )
+ {
+ animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_IN);
+ }
+ else if( alphaFunctionValue == "EASE_OUT" )
+ {
+ animator->alphaFunction = AlphaFunction(AlphaFunction::EASE_OUT);
+ }
+ else if( ! alphaFunctionValue.compare( 5, 3, "IN_" ) )
+ {
+ 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( 5, 4, "OUT_" ) )
+ {
+ 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 == "REVERSE" )
+ {
+ animator->alphaFunction = AlphaFunction(AlphaFunction::REVERSE);
+ }
+ else if( alphaFunctionValue == "BOUNCE" )
+ {
+ animator->alphaFunction = AlphaFunction(AlphaFunction::BOUNCE);
+ }
+ else if( alphaFunctionValue == "SIN" )
+ {
+ animator->alphaFunction = AlphaFunction(AlphaFunction::SIN);
+ }
+ }
+ else
+ {
+ animator->animate = false;
+ }
+ }
+ else if( key == TOKEN_TIME_PERIOD )
+ {
+ Property::Map timeMap = value.Get< Property::Map >();
+ for( size_t timeMapIdx = 0; timeMapIdx < timeMap.Count(); ++timeMapIdx )
+ {
+ const KeyValuePair pair( timeMap.GetKeyValue( timeMapIdx ) );
+ if( pair.first.type == Property::Key::INDEX )
+ {
+ continue;
+ }
+ const std::string& key( pair.first.stringKey );
+
+ if( key == TOKEN_DELAY )
+ {
+ animator->timePeriodDelay = pair.second.Get< float >();
+ }
+ else if( key == TOKEN_DURATION )
+ {
+ animator->timePeriodDuration = pair.second.Get< float >();
+ }
+ }
+ }
+ }
+ }
+ }
+ return animator;
+}
+
+void TransitionData::Add( Animator* animator )
+{
+ mAnimators.PushBack( animator );
+}
+
+TransitionData::Iterator TransitionData::Begin() const
+{
+ return mAnimators.Begin();
+}
+
+TransitionData::Iterator TransitionData::End() const
+{
+ return mAnimators.End();
+}
+
+size_t TransitionData::Count() const
+{
+ return mAnimators.Count();
+}
+
+Property::Map TransitionData::GetAnimatorAt( size_t index )
+{
+ DALI_ASSERT_ALWAYS( index < Count() && "index exceeds bounds" );
+
+ Animator* animator = mAnimators[index];
+ Property::Map map;
+ map[TOKEN_TARGET] = animator->objectName;
+ if( animator->propertyKey.type == Property::Key::INDEX )
+ {
+ map[TOKEN_PROPERTY] = animator->propertyKey.indexKey;
+ }
+ else
+ {
+ map[TOKEN_PROPERTY] = animator->propertyKey.stringKey;
+ }
+ if( animator->initialValue.GetType() != Property::NONE )
+ {
+ map[TOKEN_INITIAL_VALUE] = animator->initialValue;
+ }
+ if( animator->targetValue.GetType() != Property::NONE )
+ {
+ map[TOKEN_TARGET_VALUE] = animator->targetValue;
+ }
+ if( animator->animate )
+ {
+ 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;
+}
+
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_TRANSITION_DATA_H
+#define DALI_TOOLKIT_INTERNAL_TRANSITION_DATA_H
+
+/*
+ * 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.
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/animation/alpha-function.h>
+#include <dali/public-api/object/property-key.h>
+#include <dali/devel-api/common/owner-container.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+
+class TransitionData;
+typedef IntrusivePtr<TransitionData> TransitionDataPtr;
+
+/**
+ * TransitionData is an object that holds animator data.
+ */
+class TransitionData : public BaseObject
+{
+public:
+
+ /**
+ * @brief TransitionDataElement Describes one animator of an transition.
+ */
+ struct Animator
+ {
+ Animator()
+ : propertyKey( Property::INVALID_INDEX ),
+ alphaFunction( AlphaFunction::DEFAULT ),
+ timePeriodDelay( 0.0f ),
+ timePeriodDuration( 1.0f ),
+ animate(false)
+ {
+ }
+
+ std::string objectName; ///< An identifier of the actor or visual
+ 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 alphaFunction;
+ float timePeriodDelay;
+ float timePeriodDuration;
+ bool animate;
+ };
+
+ /**
+ * @brief TransitionData holds the required data required to define an
+ * transition to be performed on a property owner
+ */
+ typedef Dali::OwnerContainer< Animator* > AnimatorList;
+ typedef AnimatorList::Iterator Iterator;
+
+public:
+ /**
+ * @copydoc Dali::Transition::New()
+ */
+ static TransitionDataPtr New( const Property::Array& value );
+
+ /**
+ * @copydoc Dali::Transition::New()
+ */
+ static TransitionDataPtr New( const Property::Map& value );
+
+ /**
+ * @brief Iterator to the beginning of the data
+ */
+ Iterator Begin() const;
+
+ /**
+ * @brief Iterator to the end of the data (one past last element)
+ */
+ Iterator End() const;
+
+ /**
+ * @copydoc Dali::Transition::Count()
+ */
+ size_t Count() const;
+
+ /**
+ * @copydoc Dali::Transition::GetAnimatorAt()
+ */
+ Property::Map GetAnimatorAt( size_t index );
+
+private: // Implementation
+ /**
+ * Ref counted object - Only allow construction via New().
+ */
+ TransitionData();
+
+ /**
+ * Second stage initialiazation
+ */
+ void Initialize( const Property::Map& value );
+
+ /**
+ * Second stage initialiazation
+ */
+ void Initialize( const Property::Array& value );
+
+ /**
+ * @brief Adds one Animator to the list to describe a transition.
+ * @param[in] animator An animator data structure
+ */
+ void Add( Animator* animator );
+
+ /**
+ * Convert a Property map into Animator data
+ */
+ Animator* ConvertMap( const Property::Map& map );
+
+protected:
+ /**
+ * A ref counted object may only be deleted by calling Unreference
+ */
+ virtual ~TransitionData();
+
+private: // Unimplemented methods
+ TransitionData( const TransitionData& );
+ TransitionData& operator=( const TransitionData& );
+
+private: // Data members
+ AnimatorList mAnimators; ///< A vector of individual property transitions from which to generate a Dali::Animation.
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+inline Internal::TransitionData& GetImplementation( Dali::Toolkit::TransitionData& handle )
+{
+ DALI_ASSERT_ALWAYS(handle && "TransitionData handle is empty");
+ BaseObject& object = handle.GetBaseObject();
+ return static_cast<Internal::TransitionData&>(object);
+}
+
+inline const Internal::TransitionData& GetImplementation( const Dali::Toolkit::TransitionData& handle )
+{
+ DALI_ASSERT_ALWAYS(handle && "TransitionData handle is empty");
+ const BaseObject& object = handle.GetBaseObject();
+ return static_cast<const Internal::TransitionData&>(object);
+}
+
+} // namespace Toolkit
+} // namespace Dali
+
+
+#endif // DALI_TOOLKIT_INTERNAL_TRANSITION_DATA_H
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
namespace Dali
customShader.Insert( Toolkit::Visual::Shader::Property::HINTS, static_cast< int >( mHints ) );
}
- map.Insert( Toolkit::Visual::Property::SHADER, customShader );
+ map.Insert( Toolkit::VisualProperty::SHADER, customShader );
}
}
void CreatePropertyMap( Property::Map& map ) const;
};
- Renderer mRenderer;
-
+ Renderer mRenderer;
CustomShader* mCustomShader;
-
- Vector2 mSize;
- float mDepthIndex;
- int mFlags;
+ std::string mName;
+ Vector2 mSize;
+ float mDepthIndex;
+ int mFlags;
Impl();
~Impl();
#include <dali/integration-api/debug.h>
//INTERNAL HEARDER
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
}
else
{
- mImpl->mCustomShader = new Impl::CustomShader( shaderMap );
+ mImpl->mCustomShader = new Impl::CustomShader( shaderMap );
}
}
-void Visual::Base::Initialize( Actor& actor, const Property::Map& propertyMap )
+void Visual::Base::SetProperties( const Property::Map& propertyMap )
{
- Property::Value* customShaderValue = propertyMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER );
+ Property::Value* customShaderValue = propertyMap.Find( VisualProperty::SHADER, CUSTOM_SHADER );
if( customShaderValue )
{
Property::Map shaderMap;
}
}
- DoInitialize( actor, propertyMap );
+ DoSetProperties( propertyMap );
+}
+
+void Visual::Base::SetName( const std::string& name )
+{
+ mImpl->mName = name;
+}
+
+const std::string& Visual::Base::GetName()
+{
+ return mImpl->mName;
}
void Visual::Base::SetSize( const Vector2& size )
public:
/**
- * Initialisation of the visual, this API should only called by the VisualFactory:
- * request the geometry and shader from the cache, if not available, create and save to the cache for sharing;
- * record the property values.
- *
- * @param[in] actor The Actor the visual is applied to if, empty if the visual has not been applied to any Actor
+ * Setting the properties of the visual, this API should only called by the VisualFactory
* @param[in] propertyMap The properties for the requested Visual object.
*/
- void Initialize( Actor& actor, const Property::Map& propertyMap );
+ void SetProperties( const Property::Map& propertyMap );
+
+ /**
+ * @copydoc Toolkit::Visual::Base::SetName
+ */
+ void SetName( const std::string& name );
+
+ /**
+ * @copydoc Toolkit::Visual::Base::GetName
+ */
+ const std::string& GetName();
/**
* @copydoc Toolkit::Visual::Base::SetSize
virtual void DoCreatePropertyMap( Property::Map& map ) const = 0;
/**
- * @brief Called by Initialize() allowing sub classes to respond to the Initialize event
+ * @brief Called by SetProperties() allowing sub classes to set their properties
*
- * @param[in] actor The Actor the visual is applied to if, empty if the visual has not been applied to any Actor
* @param[in] propertyMap The properties for the requested Visual object.
*/
- virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap ) {}
+ virtual void DoSetProperties( const Property::Map& propertyMap ) = 0;
protected:
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/border/border-visual.h>
#include <dali-toolkit/internal/visuals/color/color-visual.h>
#include <dali-toolkit/internal/visuals/gradient/gradient-visual.h>
Visual::BasePtr visualPtr;
- Property::Value* typeValue = propertyMap.Find( Toolkit::Visual::Property::TYPE, VISUAL_TYPE );
+ Property::Value* typeValue = propertyMap.Find( Toolkit::VisualProperty::TYPE, VISUAL_TYPE );
Toolkit::Visual::Type visualType = Toolkit::Visual::IMAGE; // Default to IMAGE type.
if( typeValue )
{
if( visualPtr )
{
- Actor actor;
- visualPtr->Initialize( actor, propertyMap );
+ visualPtr->SetProperties( propertyMap );
}
else
{
#include "wireframe-visual.h"
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
{
}
+void WireframeVisual::DoSetProperties( const Property::Map& propertyMap )
+{
+ // no properties supported at the moment
+}
+
void WireframeVisual::DoSetOnStage( Actor& actor )
{
InitializeRenderer();
void WireframeVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::WIREFRAME );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::WIREFRAME );
}
void WireframeVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
virtual ~WireframeVisual();
/**
+ * @copydoc Visual::Base::DoSetProperties()
+ */
+ virtual void DoSetProperties( const Property::Map& propertyMap );
+
+ /**
* @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
#include <dali-toolkit/public-api/styling/style-manager.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
#include <dali-toolkit/internal/visuals/color/color-visual.h>
+#include <dali-toolkit/internal/visuals/transition-data-impl.h>
namespace Dali
{
namespace
{
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gLogFilter = Debug::Filter::New( Debug::General, false, "LOG_CONTROL_VISUALS");
+#endif
+
/**
* Struct used to store Visual within the control, index is a unique key for each visual.
*/
index(aIndex), visual(aVisual), placementActor(aPlacementActor), enabled(aEnabled) {}
};
+struct HandleIndex
+{
+ Handle handle; ///< a handle to the target object
+ Property::Index index; ///< The index of a property provided by the referenced object
+
+ HandleIndex( )
+ : handle(),
+ index( Property::INVALID_INDEX )
+ {
+ }
+
+ HandleIndex( Handle& handle, Property::Index index )
+ : handle( handle ),
+ index( index )
+ {
+ }
+};
+
+
typedef Dali::OwnerContainer< RegisteredVisual* > RegisteredVisualContainer;
/**
return false;
}
+HandleIndex GetVisualProperty(
+ Internal::Control& controlImpl,
+ RegisteredVisualContainer& visuals,
+ const std::string& visualName,
+ Property::Key propertyKey )
+{
+#if defined(DEBUG_ENABLED)
+ std::ostringstream oss;
+ oss << "Control::GetHandleIndex(" << visualName << ", " << propertyKey << ")" << std::endl;
+ DALI_LOG_INFO( gLogFilter, Debug::General, oss.str().c_str() );
+#endif
+
+ // Find visualName in the control
+ RegisteredVisualContainer::Iterator iter;
+ for ( iter = visuals.Begin(); iter != visuals.End(); iter++ )
+ {
+ if ( (*iter)->visual.GetName() == visualName )
+ {
+ break;
+ }
+ }
+
+ // Does either it's renderer or placement actor have an associated property?
+ if( iter != visuals.End() )
+ {
+ Actor placementActor = (*iter)->placementActor;
+ if( !placementActor )
+ {
+ placementActor = controlImpl.Self();
+ }
+
+ Property::Index index = placementActor.GetPropertyIndex( propertyKey );
+ if( index != Property::INVALID_INDEX )
+ {
+ // It's a placement actor property:
+ return HandleIndex( placementActor, index );
+ }
+ else
+ {
+ // Check if it is a renderer property:
+ if( placementActor.GetRendererCount() > 0 )
+ {
+ // @todo Need to use correct renderer index when placement actors
+ // are removed
+ Renderer renderer = placementActor.GetRendererAt(0);
+ Property::Index index = renderer.GetPropertyIndex( propertyKey );
+ if( index != Property::INVALID_INDEX )
+ {
+ // It's a renderer property:
+ return HandleIndex( renderer, index );
+ }
+ }
+ else
+ {
+ std::ostringstream oss;
+ oss << propertyKey;
+ DALI_LOG_WARNING( "Control::GetHandleIndex(%s, %s) No renderers\n", visualName.c_str(), oss.str().c_str() );
+ }
+ }
+ }
+ Handle handle;
+ return HandleIndex( handle, Property::INVALID_INDEX );
+}
+
+
/**
* Creates control through type registry
*/
// Construction & Destruction
Impl(Control& controlImpl)
-: mControlImpl( controlImpl ),
- mStyleName(""),
- mBackgroundVisual(),
- mBackgroundColor(Color::TRANSPARENT),
- mStartingPinchScale( NULL ),
- mKeyEventSignal(),
- mPinchGestureDetector(),
- mPanGestureDetector(),
- mTapGestureDetector(),
- mLongPressGestureDetector(),
- mFlags( Control::ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
- mIsKeyboardNavigationSupported( false ),
- mIsKeyboardFocusGroup( false )
-{
-}
+ : mControlImpl( controlImpl ),
+ mStyleName(""),
+ mBackgroundVisual(),
+ mBackgroundColor(Color::TRANSPARENT),
+ mStartingPinchScale( NULL ),
+ mKeyEventSignal(),
+ mPinchGestureDetector(),
+ mPanGestureDetector(),
+ mTapGestureDetector(),
+ mLongPressGestureDetector(),
+ mFlags( Control::ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
+ mIsKeyboardNavigationSupported( false ),
+ mIsKeyboardFocusGroup( false )
+ {
+ }
~Impl()
{
Actor self( Self() );
mImpl->mBackgroundColor = color;
Property::Map map;
- map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
+ map[ Toolkit::VisualProperty::TYPE ] = Toolkit::Visual::COLOR;
map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( map );
RegisterVisual( Toolkit::Control::Property::BACKGROUND, self, mImpl->mBackgroundVisual );
return Actor();
}
+Dali::Animation Control::CreateTransition( const Toolkit::TransitionData& handle )
+{
+ Dali::Animation transition;
+ const Internal::TransitionData& transitionData = Toolkit::GetImplementation( handle );
+
+ if( transitionData.Count() > 0 )
+ {
+ // Setup a Transition from TransitionData.
+ TransitionData::Iterator end = transitionData.End();
+ for( TransitionData::Iterator iter = transitionData.Begin() ;
+ iter != end; ++iter )
+ {
+ TransitionData::Animator* animator = (*iter);
+ HandleIndex handleIndex;
+
+ // Attempt to find the object name as a child actor
+ Actor child = Self().FindChildByName( animator->objectName );
+ if( child )
+ {
+ Property::Index propertyIndex = child.GetPropertyIndex( animator->propertyKey );
+ handleIndex = HandleIndex( child, propertyIndex );
+ }
+ else
+ {
+ // Is it a placement actor/visual pair?;
+ handleIndex = GetVisualProperty( *this, mImpl->mVisuals,
+ animator->objectName,
+ animator->propertyKey );
+ }
+
+ if( handleIndex.handle && handleIndex.index != Property::INVALID_INDEX )
+ {
+ if( animator->animate == false )
+ {
+ if( animator->targetValue.GetType() != Property::NONE )
+ {
+ handleIndex.handle.SetProperty( handleIndex.index, animator->targetValue );
+ }
+ }
+ else
+ {
+ if( animator->initialValue.GetType() != Property::NONE )
+ {
+ handleIndex.handle.SetProperty( handleIndex.index, animator->initialValue );
+ }
+
+ if( ! transition )
+ {
+ // Create an animation with a default .1 second duration - the animators
+ // will automatically force it to the 'right' duration.
+ transition = Dali::Animation::New( 0.1f );
+ }
+
+ transition.AnimateTo( Property( handleIndex.handle, handleIndex.index ),
+ animator->targetValue,
+ animator->alphaFunction,
+ TimePeriod( animator->timePeriodDelay,
+ animator->timePeriodDuration ) );
+ }
+ }
+ }
+ }
+
+ return transition;
+}
+
bool Control::OnAccessibilityActivated()
{
return false; // Accessibility activation is not handled by default
namespace Dali
{
-
namespace Toolkit
{
+
/**
* @addtogroup dali_toolkit_controls
* @{
*/
class StyleManager;
+class TransitionData;
namespace Visual
{
class Base;
}
+
namespace Internal
{
+
/**
* @brief This is the internal base class for all controls.
*
* @note Derived class should not call visual.SetOnStage(placementActor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
* Use below API with enabled set to false if derived class wishes to control when visual is staged.
*/
- void RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual );
-
- /**
- * @brief Register a visual by Property Index, linking an Actor to visual when required.
- * In the case of the visual being an actor or control deeming visual not required then visual should be an empty handle.
- * If enabled is false then the visual is not set on stage until enabled by the derived class.
- * @see EnableVisual
- *
- * @SINCE_1_2.11
- *
- * @param[in] index The Property index of the visual, used to reference visual
- * @param[in] placementActor The actor used to by the visual.
- * @param[in] visual The visual to register
- * @param[in] enabled false if derived class wants to control when visual is set on stage.
- *
- */
- void RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual, bool enabled );
-
- /**
- * @brief Erase the entry matching the given index from the list of registered visuals
- * @param[in] index The Property index of the visual, used to reference visual
- *
- * @SINCE_1_2.0
- */
- void UnregisterVisual( Property::Index index );
-
- /**
- * @brief Retrieve the visual associated with the given property index.
- *
- * @SINCE_1_2.2
- *
- * @param[in] index The Property index of the visual.
- * @return The registered visual if exist, otherwise empty handle.
- * @note For managing object life-cycle, do not store the returned visual as a member which increments its reference count.
- */
- Toolkit::Visual::Base GetVisual( Property::Index index ) const;
-
- /**
- * @brief Sets the given visual to be displayed or not when parent staged.
- *
- * @SINCE_1_2.11
- *
- * @param[in] index The Property index of the visual
- * @param[in] enable flag to set enabled or disabled.
- */
- void EnableVisual( Property::Index index, bool enable );
-
- /**
- * @brief Queries if the given visual is to be displayed when parent staged.
- *
- * @SINCE_1_2.11
- *
- * @param[in] index The Property index of the visual
- * @return bool whether visual is enabled or not
- */
- bool IsVisualEnabled( Property::Index index ) const;
-
- /**
- * @brief Retrieve the placement actor associated with the given index.
- *
- * @SINCE_1_2.2
- *
- * @@param[in] index The Property index of the visual.
- * @return Then placement actor if exist, otherwise empty handle.
- * @note For managing object life-cycle, do not store the returned placement actor as a member which increments its reference count.
- */
- Actor GetPlacementActor( Property::Index index ) const;
+ void RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual );
+
+ /**
+ * @brief Register a visual by Property Index, linking an Actor to visual when required.
+ * In the case of the visual being an actor or control deeming visual not required then visual should be an empty handle.
+ * If enabled is false then the visual is not set on stage until enabled by the derived class.
+ * @see EnableVisual
+ *
+ * @SINCE_1_2.11
+ *
+ * @param[in] index The Property index of the visual, used to reference visual
+ * @param[in] placementActor The actor used to by the visual.
+ * @param[in] visual The visual to register
+ * @param[in] enabled false if derived class wants to control when visual is set on stage.
+ *
+ */
+ void RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual, bool enabled );
+
+ /**
+ * @brief Erase the entry matching the given index from the list of registered visuals
+ * @param[in] index The Property index of the visual, used to reference visual
+ *
+ * @SINCE_1_2.0
+ */
+ void UnregisterVisual( Property::Index index );
+
+ /**
+ * @brief Retrieve the visual associated with the given property index.
+ *
+ * @SINCE_1_2.2
+ *
+ * @param[in] index The Property index of the visual.
+ * @return The registered visual if exist, otherwise empty handle.
+ * @note For managing object life-cycle, do not store the returned visual as a member which increments its reference count.
+ */
+ Toolkit::Visual::Base GetVisual( Property::Index index ) const;
+
+ /**
+ * @brief Sets the given visual to be displayed or not when parent staged.
+ *
+ * @SINCE_1_2.11
+ *
+ * @param[in] index The Property index of the visual
+ * @param[in] enable flag to set enabled or disabled.
+ */
+ void EnableVisual( Property::Index index, bool enable );
+
+ /**
+ * @brief Queries if the given visual is to be displayed when parent staged.
+ *
+ * @SINCE_1_2.11
+ *
+ * @param[in] index The Property index of the visual
+ * @return bool whether visual is enabled or not
+ */
+ bool IsVisualEnabled( Property::Index index ) const;
+
+ /**
+ * @brief Retrieve the placement actor associated with the given index.
+ *
+ * @SINCE_1_2.2
+ *
+ * @@param[in] index The Property index of the visual.
+ * @return Then placement actor if exist, otherwise empty handle.
+ * @note For managing object life-cycle, do not store the returned placement actor as a member which increments its reference count.
+ */
+ Actor GetPlacementActor( Property::Index index ) const;
+
+ /**
+ * @brief Create a transition effect on the control.
+ *
+ * @SINCE_1_2.12
+ *
+ * @param[in] transitionData The transition data describing the effect to create
+ * @return A handle to an animation defined with the given effect, or an empty
+ * handle if no properties match.
+ */
+ Dali::Animation CreateTransition( const Toolkit::TransitionData& transitionData );
/**
* @brief Emits KeyInputFocusGained signal if true else emits KeyInputFocusLost signal
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 11;
+const unsigned int TOOLKIT_MICRO_VERSION = 12;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
$(public_api_src_dir)/controls/text-controls/text-editor.cpp \
$(public_api_src_dir)/controls/text-controls/text-label.cpp \
$(public_api_src_dir)/controls/text-controls/text-field.cpp \
+ $(public_api_src_dir)/controls/video-view/video-view.cpp \
$(public_api_src_dir)/styling/style-manager.cpp \
$(public_api_src_dir)/accessibility-manager/accessibility-manager.cpp \
$(public_api_src_dir)/focus-manager/keyboard-focus-manager.cpp \
- $(public_api_src_dir)/controls/video-view/video-view.cpp \
$(public_api_src_dir)/dali-toolkit-version.cpp \
$(public_api_src_dir)/enums.cpp
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
namespace Dali
{
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
namespace Dali
{
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
namespace Dali
{
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
namespace Dali
{
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
namespace Dali
{
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
namespace Dali
{
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
namespace Dali
{
* @note Will override the existing shaders.
* @see Shader::Property
*/
- SHADER,
+ SHADER
};
} // namespace Property
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.11
+Version: 1.2.12
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: NDalic
Summary: dali wrapper
-Version: 1.2.11
+Version: 1.2.12
Release: 1
Group: uifw/graphic
License: TO_BE_FILLED_IN
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.11
+Version: 1.2.12
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+%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();
+ }
+%}
+
+
+
* 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<Dali::RefObject> mObjectHandle in BaseHandle;
if( *$self )
{
return true;
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;
+ }
+ }
+
};
/**
*/
%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
%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
%include events/timer-event.i
%include events/videoview-event.i
+%include alphafunction.i
+
%include dali-operator.i
%include dali-core.i
%include dali-adaptor.i
%define ACTOR_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
%typemap(cscode) NameSpace::ClassName %{
-
- /**
- * @brief Event arguments that passed via Touch signal
- *
- */
- public class TouchEventArgs : EventArgs
- {
- private Actor _actor;
- private TouchData _touchData;
-
- /**
- * @brief Actor - is the actor that is being touched
- *
- */
- public Actor Actor
- {
- get
- {
- return _actor;
- }
- set
- {
- _actor = value;
- }
- }
-
- /**
- * @brief TouchData - contains the information of touch points
- *
- */
- public TouchData TouchData
- {
- get
- {
- return _touchData;
- }
- set
- {
- _touchData = value;
- }
- }
- }
-
- /**
- * @brief Event arguments that passed via Hover signal
- *
- */
- public class HoverEventArgs : EventArgs
- {
- private Actor _actor;
- private HoverEvent _hoverEvent;
-
- /**
- * @brief Actor - is the actor that is being hovered
- *
- */
- public Actor Actor
- {
- get
- {
- return _actor;
- }
- set
- {
- _actor = value;
- }
- }
-
- /**
- * @brief HoverEvent - contains touch points that represent the points
- * that are currently being hovered or the points where a hover has stopped
- *
- */
- public HoverEvent HoverEvent
- {
- get
- {
- return _hoverEvent;
- }
- set
- {
- _hoverEvent = value;
- }
- }
- }
-
- /**
- * @brief Event arguments that passed via Wheel signal
- *
- */
- public class WheelEventArgs : EventArgs
- {
- private Actor _actor;
- private WheelEvent _wheelEvent;
-
- /**
- * @brief Actor - is the actor that is being wheeled
- *
- */
- public Actor Actor
- {
- get
- {
- return _actor;
- }
- set
- {
- _actor = value;
- }
- }
-
- /**
- * @brief WheelEvent - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL
- *
- */
- public WheelEvent WheelEvent
- {
- get
- {
- return _wheelEvent;
- }
- set
- {
- _wheelEvent = value;
- }
- }
- }
-
- /**
- * @brief Event arguments that passed via OnStage signal
- *
- */
- public class OnStageEventArgs : EventArgs
- {
- private Actor _actor;
-
- /**
- * @brief Actor - is the actor that is being connected to the stage
- *
- */
- public Actor Actor
- {
- get
- {
- return _actor;
- }
- set
- {
- _actor = value;
- }
- }
- }
-
- /**
- * @brief Event arguments that passed via OffStage signal
- *
- */
- public class OffStageEventArgs : EventArgs
- {
- private Actor _actor;
-
- /**
- * @brief Actor - is the actor that is being disconnected from the stage
- *
- */
- public Actor Actor
- {
- get
- {
- return _actor;
- }
- set
- {
- _actor = value;
- }
- }
- }
-
- /**
- * @brief Event arguments that passed via OnRelayout signal
- *
- */
- public class OnRelayoutEventArgs : EventArgs
- {
- private Actor _actor;
-
- /**
- * @brief Actor - is the actor that is being resized upon relayout
- *
- */
- public Actor Actor
- {
- get
- {
- return _actor;
- }
- set
- {
- _actor = value;
- }
- }
- }
-
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate bool TouchCallbackDelegate(IntPtr actor, IntPtr touchData);
- private DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> _actorTouchDataEventHandler;
- private TouchCallbackDelegate _actorTouchDataCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate bool HoverEventCallbackDelegate(IntPtr actor, IntPtr hoverEvent);
- private DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> _actorHoverEventHandler;
- private HoverEventCallbackDelegate _actorHoverEventCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate bool WheelEventCallbackDelegate(IntPtr actor, IntPtr wheelEvent);
- private DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> _actorWheelEventHandler;
- private WheelEventCallbackDelegate _actorWheelEventCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void OnStageEventCallbackDelegate(IntPtr actor);
- private DaliEventHandler<object,OnStageEventArgs> _actorOnStageEventHandler;
- private OnStageEventCallbackDelegate _actorOnStageEventCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void OffStageEventCallbackDelegate(IntPtr actor);
- private DaliEventHandler<object,OffStageEventArgs> _actorOffStageEventHandler;
- private OffStageEventCallbackDelegate _actorOffStageEventCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void OnRelayoutEventCallbackDelegate(IntPtr actor);
- private DaliEventHandler<object,OnRelayoutEventArgs> _actorOnRelayoutEventHandler;
- private OnRelayoutEventCallbackDelegate _actorOnRelayoutEventCallbackDelegate;
-
- /**
- * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of TouchEventHandler-DaliEventHandlerWithReturnType<object,TouchEventArgs,bool>)
- * provided by the user. Touched signal is emitted when touch input is received.
- */
- public event DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> Touched
- {
- add
- {
- lock(this)
- {
- // Restricted to only one listener
- if (_actorTouchDataEventHandler == null)
- {
- _actorTouchDataEventHandler += value;
-
- _actorTouchDataCallbackDelegate = new TouchCallbackDelegate(OnTouch);
- this.TouchSignal().Connect(_actorTouchDataCallbackDelegate);
- }
- }
- }
-
- remove
- {
- lock(this)
- {
- if (_actorTouchDataEventHandler != null)
- {
- this.TouchSignal().Disconnect(_actorTouchDataCallbackDelegate);
- }
-
- _actorTouchDataEventHandler -= value;
- }
- }
- }
-
- // Callback for Actor TouchSignal
- private bool OnTouch(IntPtr actor, IntPtr touchData)
- {
- TouchEventArgs e = new TouchEventArgs();
-
- // Populate all members of "e" (TouchEventArgs) with real data
- e.Actor = Actor.GetActorFromPtr(actor);
- e.TouchData = Dali.TouchData.GetTouchDataFromPtr(touchData);
-
- if (_actorTouchDataEventHandler != null)
- {
- //here we send all data to user event handlers
- return _actorTouchDataEventHandler(this, e);
- }
-
- return false;
- }
-
- /**
- * @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of HoverEventHandler-DaliEventHandlerWithReturnType<object,HoverEventArgs,bool>)
- * provided by the user. Hovered signal is emitted when hover input is received.
- */
- public event DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> Hovered
- {
- add
- {
- lock(this)
- {
- // Restricted to only one listener
- if (_actorHoverEventHandler == null)
- {
- _actorHoverEventHandler += value;
-
- _actorHoverEventCallbackDelegate = new HoverEventCallbackDelegate(OnHoverEvent);
- this.HoveredSignal().Connect(_actorHoverEventCallbackDelegate);
- }
- }
- }
-
- remove
- {
- lock(this)
- {
- if (_actorHoverEventHandler != null)
- {
- this.HoveredSignal().Disconnect(_actorHoverEventCallbackDelegate);
- }
-
- _actorHoverEventHandler -= value;
- }
- }
- }
-
- // Callback for Actor Hover signal
- private bool OnHoverEvent(IntPtr actor, IntPtr hoverEvent)
- {
- HoverEventArgs e = new HoverEventArgs();
-
- // Populate all members of "e" (HoverEventArgs) with real data
- e.Actor = Actor.GetActorFromPtr(actor);
- e.HoverEvent = Dali.HoverEvent.GetHoverEventFromPtr(hoverEvent);
-
- if (_actorHoverEventHandler != null)
- {
- //here we send all data to user event handlers
- return _actorHoverEventHandler(this, e);
- }
-
- return false;
- }
-
- /**
- * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of WheelEventHandler-DaliEventHandlerWithReturnType<object,WheelEventArgs,bool>)
- * provided by the user. WheelMoved signal is emitted when wheel event is received.
- */
- public event DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> WheelMoved
- {
- add
- {
- lock(this)
- {
- // Restricted to only one listener
- if (_actorWheelEventHandler == null)
- {
- _actorWheelEventHandler += value;
-
- _actorWheelEventCallbackDelegate = new WheelEventCallbackDelegate(OnWheelEvent);
- this.WheelEventSignal().Connect(_actorWheelEventCallbackDelegate);
- }
- }
- }
-
- remove
- {
- lock(this)
- {
- if (_actorWheelEventHandler != null)
- {
- this.WheelEventSignal().Disconnect(_actorWheelEventCallbackDelegate);
- }
-
- _actorWheelEventHandler -= value;
- }
- }
- }
-
- // Callback for Actor Wheel signal
- private bool OnWheelEvent(IntPtr actor, IntPtr wheelEvent)
- {
- WheelEventArgs e = new WheelEventArgs();
-
- // Populate all members of "e" (WheelEventArgs) with real data
- e.Actor = Actor.GetActorFromPtr(actor);
- e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr(wheelEvent);
-
- if (_actorWheelEventHandler != null)
- {
- //here we send all data to user event handlers
- return _actorWheelEventHandler(this, e);
- }
-
- return false;
- }
-
- /**
- * @brief Event for OnStage signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of OnStageEventHandler) provided by the user.
- * OnStage signal is emitted after the actor has been connected to the stage.
- */
- public event DaliEventHandler<object,OnStageEventArgs> OnStageEvent
- {
- add
- {
- lock(this)
- {
- // Restricted to only one listener
- if (_actorOnStageEventHandler == null)
- {
- _actorOnStageEventHandler += value;
-
- _actorOnStageEventCallbackDelegate = new OnStageEventCallbackDelegate(OnStage);
- this.OnStageSignal().Connect(_actorOnStageEventCallbackDelegate);
- }
- }
- }
-
- remove
- {
- lock(this)
- {
- if (_actorOnStageEventHandler != null)
- {
- this.OnStageSignal().Disconnect(_actorOnStageEventCallbackDelegate);
- }
-
- _actorOnStageEventHandler -= value;
- }
- }
- }
-
- // Callback for Actor OnStage signal
- private void OnStage(IntPtr data)
- {
- OnStageEventArgs e = new OnStageEventArgs();
-
- // Populate all members of "e" (OnStageEventArgs) with real data
- e.Actor = Actor.GetActorFromPtr(data);
-
- if (_actorOnStageEventHandler != null)
- {
- //here we send all data to user event handlers
- _actorOnStageEventHandler(this, e);
- }
- }
-
- /**
- * @brief Event for OffStage signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of OffStageEventHandler) provided by the user.
- * OffStage signal is emitted after the actor has been disconnected from the stage.
- */
- public event DaliEventHandler<object,OffStageEventArgs> OffStageEvent
- {
- add
- {
- lock(this)
- {
- // Restricted to only one listener
- if (_actorOffStageEventHandler == null)
- {
- _actorOffStageEventHandler += value;
-
- _actorOffStageEventCallbackDelegate = new OffStageEventCallbackDelegate(OffStage);
- this.OnStageSignal().Connect(_actorOffStageEventCallbackDelegate);
- }
- }
- }
-
- remove
- {
- lock(this)
- {
- if (_actorOffStageEventHandler != null)
- {
- this.OnStageSignal().Disconnect(_actorOffStageEventCallbackDelegate);
- }
-
- _actorOffStageEventHandler -= value;
- }
- }
- }
-
- // Callback for Actor OffStage signal
- private void OffStage(IntPtr data)
- {
- OffStageEventArgs e = new OffStageEventArgs();
-
- // Populate all members of "e" (OffStageEventArgs) with real data
- e.Actor = Actor.GetActorFromPtr(data);
-
- if (_actorOffStageEventHandler != null)
- {
- //here we send all data to user event handlers
- _actorOffStageEventHandler(this, e);
- }
- }
-
- /**
- * @brief Event for OnRelayout signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of OnRelayoutEventHandler) provided by the user.
- * OnRelayout signal is emitted after the size has been set on the actor during relayout.
- */
- public event DaliEventHandler<object,OnRelayoutEventArgs> OnRelayoutEvent
- {
- add
- {
- lock(this)
- {
- // Restricted to only one listener
- if (_actorOnRelayoutEventHandler == null)
- {
- _actorOnRelayoutEventHandler += value;
-
- _actorOnRelayoutEventCallbackDelegate = new OnRelayoutEventCallbackDelegate(OnRelayout);
- this.OnRelayoutSignal().Connect(_actorOnRelayoutEventCallbackDelegate);
- }
- }
- }
-
- remove
- {
- lock(this)
- {
- if (_actorOnRelayoutEventHandler != null)
- {
- this.OnRelayoutSignal().Disconnect(_actorOnRelayoutEventCallbackDelegate);
- }
-
- _actorOnRelayoutEventHandler -= value;
- }
- }
- }
-
- // Callback for Actor OnRelayout signal
- private void OnRelayout(IntPtr data)
- {
- OnRelayoutEventArgs e = new OnRelayoutEventArgs();
-
- // Populate all members of "e" (OnRelayoutEventArgs) with real data
- e.Actor = Actor.GetActorFromPtr(data);
-
- if (_actorOnRelayoutEventHandler != null)
- {
- //here we send all data to user event handlers
- _actorOnRelayoutEventHandler(this, e);
- }
- }
-
public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
ClassName ret = new ClassName(cPtr, false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
- public bool Vibility
+ public bool Visibility
{
get
{
{
SetOpacity(value);
}
- }
-
- public float CurrentOpacity
- {
get
{
float ret = GetCurrentOpacity();
return ret;
}
- }
+ }
public bool StateFocusEnable
{
}
}
+ public void Show()
+ {
+ SetVisible(true);
+ }
+
+ public void Hide()
+ {
+ SetVisible(false);
+ }
+
%}
%enddef
%define Animation_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
%typemap(cscode) NameSpace::ClassName %{
+ public static readonly int ParentOrigin = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_get();
+ public static readonly int ParentOriginX = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_X_get();
+ public static readonly int ParentOriginY = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Y_get();
+ public static readonly int ParentOriginZ = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Z_get();
+ public static readonly int AnchorPoint = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_get();
+ public static readonly int AnchorPointX = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_X_get();
+ public static readonly int AnchorPointY = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Y_get();
+ public static readonly int AnchorPointZ = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Z_get();
+ public static readonly int Size = NDalicPINVOKE.Actor_Property_SIZE_get();
+ public static readonly int SizeWidth = NDalicPINVOKE.Actor_Property_SIZE_WIDTH_get();
+ public static readonly int SizeHeight = NDalicPINVOKE.Actor_Property_SIZE_HEIGHT_get();
+ public static readonly int SizeDepth = NDalicPINVOKE.Actor_Property_SIZE_DEPTH_get();
+ public static readonly int Position = NDalicPINVOKE.Actor_Property_POSITION_get();
+ public static readonly int PositionX = NDalicPINVOKE.Actor_Property_POSITION_X_get();
+ public static readonly int PositionY = NDalicPINVOKE.Actor_Property_POSITION_Y_get();
+ public static readonly int PositionZ = NDalicPINVOKE.Actor_Property_POSITION_Z_get();
+ public static readonly int WorldPosition = NDalicPINVOKE.Actor_Property_WORLD_POSITION_get();
+ public static readonly int WorldPositionX = NDalicPINVOKE.Actor_Property_WORLD_POSITION_X_get();
+ public static readonly int WorldPositionY = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Y_get();
+ public static readonly int WorldPositionZ = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Z_get();
+ public static readonly int Orientation = NDalicPINVOKE.Actor_Property_ORIENTATION_get();
+ public static readonly int WorldOrientation = NDalicPINVOKE.Actor_Property_WORLD_ORIENTATION_get();
+ public static readonly int Scale = NDalicPINVOKE.Actor_Property_SCALE_get();
+ public static readonly int ScaleX = NDalicPINVOKE.Actor_Property_SCALE_X_get();
+ public static readonly int ScaleY = NDalicPINVOKE.Actor_Property_SCALE_Y_get();
+ public static readonly int ScaleZ = NDalicPINVOKE.Actor_Property_SCALE_Z_get();
+ public static readonly int WorldScale = NDalicPINVOKE.Actor_Property_WORLD_SCALE_get();
+ public static readonly int Visibile = NDalicPINVOKE.Actor_Property_VISIBLE_get();
+ public static readonly int Color = NDalicPINVOKE.Actor_Property_COLOR_get();
+ public static readonly int ColorRed = NDalicPINVOKE.Actor_Property_COLOR_RED_get();
+ public static readonly int ColorGreeb = NDalicPINVOKE.Actor_Property_COLOR_GREEN_get();
+ public static readonly int ColorBlue = NDalicPINVOKE.Actor_Property_COLOR_BLUE_get();
+ public static readonly int ColorAlpha = NDalicPINVOKE.Actor_Property_COLOR_ALPHA_get();
+ public static readonly int WorldColor = NDalicPINVOKE.Actor_Property_WORLD_COLOR_get();
+ public static readonly int WorldMatrix = 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 LeaveRequired = NDalicPINVOKE.Actor_Property_LEAVE_REQUIRED_get();
+ public static readonly int InheritOrientation = NDalicPINVOKE.Actor_Property_INHERIT_ORIENTATION_get();
+ public static readonly int InheritScale = NDalicPINVOKE.Actor_Property_INHERIT_SCALE_get();
+ public static readonly int ColorMode = NDalicPINVOKE.Actor_Property_COLOR_MODE_get();
+ public static readonly int PositionInheritance = NDalicPINVOKE.Actor_Property_POSITION_INHERITANCE_get();
+ public static readonly int DrawMode = NDalicPINVOKE.Actor_Property_DRAW_MODE_get();
+ public static readonly int SizeModeFactor = NDalicPINVOKE.Actor_Property_SIZE_MODE_FACTOR_get();
+ public static readonly int WidthResizePolicy = NDalicPINVOKE.Actor_Property_WIDTH_RESIZE_POLICY_get();
+ public static readonly int HeightResizePolicy = NDalicPINVOKE.Actor_Property_HEIGHT_RESIZE_POLICY_get();
+ public static readonly int SizeScalePolicy = NDalicPINVOKE.Actor_Property_SIZE_SCALE_POLICY_get();
+ public static readonly int WidthForHeight = NDalicPINVOKE.Actor_Property_WIDTH_FOR_HEIGHT_get();
+ public static readonly int HeightForWidth = NDalicPINVOKE.Actor_Property_HEIGHT_FOR_WIDTH_get();
+ public static readonly int Padding = NDalicPINVOKE.Actor_Property_PADDING_get();
+ public static readonly int MinimumSize = NDalicPINVOKE.Actor_Property_MINIMUM_SIZE_get();
+ public static readonly int MaximumSize = NDalicPINVOKE.Actor_Property_MAXIMUM_SIZE_get();
+ public static readonly int InheritPosition = NDalicPINVOKE.Actor_Property_INHERIT_POSITION_get();
+ public static readonly int ClippingMode = NDalicPINVOKE.Actor_Property_CLIPPING_MODE_get();
+ public static readonly int BatchParent = NDalicPINVOKE.Actor_Property_BATCH_PARENT_get();
+
+
/**
* @brief Event arguments that passed via Finished signal
*
}
}
+ public int DurationMilliSecs
+ {
+ set
+ {
+ SetDuration(value/1000);
+ }
+ get
+ {
+ int ret = (int) GetDuration() * 1000;
+ return ret;
+ }
+ }
+
public AlphaFunction DefaultAlphaFunction
{
set
}
}
+ public int LoopCount
+ {
+ set
+ {
+ SetLoopCount(value);
+ }
+ get
+ {
+ int ret = GetLoopCount();
+ return ret;
+ }
+ }
+
+ public bool Looping
+ {
+ set
+ {
+ SetLooping(value);
+ }
+ get
+ {
+ bool ret = IsLooping();
+ return ret;
+ }
+ }
+
+ public void AnimateBy<T,U>(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<T,U>(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<T,U>(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<T,U>(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<T,U>(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<T,U>(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<T,U>(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<T,U>(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<U>(Actor target, U propertyIndex, KeyFrames keyFrames)
+ {
+ dynamic var = (object)(propertyIndex);
+ AnimateBetween(new Property(target, var), keyFrames);
+ }
+
+ public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, Animation.Interpolation interpolation)
+ {
+ dynamic var = (object)(propertyIndex);
+ AnimateBetween(new Property(target, var), keyFrames, interpolation);
+ }
+
+ public void AnimateBetween<U>(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha)
+ {
+ dynamic var = (object)(propertyIndex);
+ AnimateBetween(new Property(target, var), keyFrames, alpha);
+ }
+
+ public void AnimateBetween<U>(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<U>(Actor target, U propertyIndex, KeyFrames keyFrames, TimePeriod period)
+ {
+ dynamic var = (object)(propertyIndex);
+ AnimateBetween(new Property(target, var), keyFrames, period);
+ }
+
+ public void AnimateBetween<U>(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<U>(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<U>(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);
+ }
+
+ public void Stop(Animation.EndAction action) {
+ SetEndAction(action);
+ NDalicPINVOKE.Animation_Stop(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /**
+ * @brief Create an initialized Animation.
+ *
+ * The animation will not loop.
+ * The default end action is "Bake".
+ * The default Alpha function is linear.
+ * @since 1.0.0
+ * @param [in] durationmSeconds The duration in milli seconds (int).
+ * @return A handle to a newly allocated Dali resource.
+ * @pre DurationmSeconds must be greater than zero.
+ */
+ public Animation (int durationmSeconds) : this (NDalicPINVOKE.Animation_New((float)durationmSeconds/1000.0f), true) {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
%}
%enddef
*/
%define CONTROL_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
-%typemap(csimports) NameSpace::ClassName %{
-using System;
-using System.Runtime.InteropServices;
+ %typemap(csimports) NameSpace::ClassName %{
+ using System;
+ using System.Runtime.InteropServices;
-%}
+ %}
-%enddef
+ %enddef
%define CONTROL_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
-%typemap(cscode) NameSpace::ClassName %{
+ %typemap(cscode) NameSpace::ClassName %{
-/**
- * @brief Event arguments that passed via KeyInputFocusGained signal
- *
- */
-public class KeyInputFocusGainedEventArgs : EventArgs
-{
- private View _view;
-
- /**
- * @brief View - is the view that gets Key Input Focus
+ /**
+ * @brief Event arguments that passed via KeyInputFocusGained signal
*
*/
- public View View
- {
- get
+ public class KeyInputFocusGainedEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that gets Key Input Focus
+ *
+ */
+ public View View
{
- return _view;
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
}
- set
+ }
+
+ /**
+ * @brief Event arguments that passed via KeyInputFocusLost signal
+ *
+ */
+ public class KeyInputFocusLostEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that loses Key Input Focus
+ *
+ */
+ public View View
{
- _view = value;
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
}
- }
-}
-
-/**
- * @brief Event arguments that passed via KeyInputFocusLost signal
- *
- */
-public class KeyInputFocusLostEventArgs : EventArgs
-{
- private View _view;
+ }
- /**
- * @brief View - is the view that loses Key Input Focus
+ /**
+ * @brief Event arguments that passed via KeyEvent signal
*
*/
- public View View
- {
- get
+ public class KeyEventArgs : EventArgs
+ {
+ private View _view;
+ private KeyEvent _keyEvent;
+
+ /**
+ * @brief View - is the view that recieves the keyevent.
+ *
+ */
+ public View View
{
- return _view;
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
}
- set
+
+ /**
+ * @brief KeyEvent - is the keyevent sent to the View.
+ *
+ */
+ public KeyEvent KeyEvent
{
- _view = value;
+ get
+ {
+ return _keyEvent;
+ }
+ set
+ {
+ _keyEvent = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via OnRelayout signal
+ *
+ */
+ public class OnRelayoutEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that is being resized upon relayout
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+ }
+
+
+ /**
+ * @brief Event arguments that passed via Touch signal
+ *
+ */
+ public class TouchEventArgs : EventArgs
+ {
+ private View _view;
+ private TouchData _touchData;
+
+ /**
+ * @brief View - is the view that is being touched
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
}
- }
-}
-/**
- * @brief Event arguments that passed via KeyEvent signal
- *
- */
-public class KeyEventArgs : EventArgs
-{
- private View _view;
- private KeyEvent _keyEvent;
+ /**
+ * @brief TouchData - contains the information of touch points
+ *
+ */
+ public TouchData TouchData
+ {
+ get
+ {
+ return _touchData;
+ }
+ set
+ {
+ _touchData = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via Hover signal
+ *
+ */
+ public class HoverEventArgs : EventArgs
+ {
+ private View _view;
+ private HoverEvent _hoverEvent;
+
+ /**
+ * @brief View - is the view that is being hovered
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
- /**
- * @brief View - is the view that recieves the keyevent.
- *
+ /**
+ * @brief HoverEvent - contains touch points that represent the points
+ * that are currently being hovered or the points where a hover has stopped
+ *
+ */
+ public HoverEvent HoverEvent
+ {
+ get
+ {
+ return _hoverEvent;
+ }
+ set
+ {
+ _hoverEvent = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via Wheel signal
+ *
+ */
+ public class WheelEventArgs : EventArgs
+ {
+ private View _view;
+ private WheelEvent _wheelEvent;
+
+ /**
+ * @brief View - is the view that is being wheeled
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+
+ /**
+ * @brief WheelEvent - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL
+ *
+ */
+ public WheelEvent WheelEvent
+ {
+ get
+ {
+ return _wheelEvent;
+ }
+ set
+ {
+ _wheelEvent = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via OnStage signal
+ *
+ */
+ public class OnStageEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that is being connected to the stage
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via OffStage signal
+ *
+ */
+ public class OffStageEventArgs : EventArgs
+ {
+ private View _view;
+
+ /**
+ * @brief View - is the view that is being disconnected from the stage
+ *
+ */
+ public View View
+ {
+ get
+ {
+ return _view;
+ }
+ set
+ {
+ _view = value;
+ }
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void KeyInputFocusGainedCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,KeyInputFocusGainedEventArgs> _KeyInputFocusGainedEventHandler;
+ private KeyInputFocusGainedCallbackDelegate _KeyInputFocusGainedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void KeyInputFocusLostCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,KeyInputFocusLostEventArgs> _KeyInputFocusLostEventHandler;
+ private KeyInputFocusLostCallbackDelegate _KeyInputFocusLostCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr keyEvent);
+ private DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> _KeyEventHandler;
+ private KeyCallbackDelegate _KeyCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OnRelayoutEventCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,OnRelayoutEventArgs> _viewOnRelayoutEventHandler;
+ private OnRelayoutEventCallbackDelegate _viewOnRelayoutEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool TouchCallbackDelegate(IntPtr view, IntPtr touchData);
+ private DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> _viewTouchDataEventHandler;
+ private TouchCallbackDelegate _viewTouchDataCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool HoverEventCallbackDelegate(IntPtr view, IntPtr hoverEvent);
+ private DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> _viewHoverEventHandler;
+ private HoverEventCallbackDelegate _viewHoverEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool WheelEventCallbackDelegate(IntPtr view, IntPtr wheelEvent);
+ private DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> _viewWheelEventHandler;
+ private WheelEventCallbackDelegate _viewWheelEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OnStageEventCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,OnStageEventArgs> _viewOnStageEventHandler;
+ private OnStageEventCallbackDelegate _viewOnStageEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OffStageEventCallbackDelegate(IntPtr control);
+ private DaliEventHandler<object,OffStageEventArgs> _viewOffStageEventHandler;
+ private OffStageEventCallbackDelegate _viewOffStageEventCallbackDelegate;
+
+ /**
+ * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyInputFocusGainedEventHandler-DaliEventHandler<object,KeyInputFocusGainedEventArgs>)
+ * provided by the user. KeyInputFocusGained signal is emitted when the control gets Key Input Focus.
*/
- public View View
- {
- get
+ public event DaliEventHandler<object,KeyInputFocusGainedEventArgs> KeyInputFocusGained
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_KeyInputFocusGainedEventHandler == null)
+ {
+ _KeyInputFocusGainedEventHandler += value;
+ Console.WriteLine("View Keyevent EVENT Locked....");
+ _KeyInputFocusGainedCallbackDelegate = new KeyInputFocusGainedCallbackDelegate(OnKeyInputFocusGained);
+ this.KeyInputFocusGainedSignal().Connect(_KeyInputFocusGainedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
{
- return _view;
+ lock(this)
+ {
+ if (_KeyInputFocusGainedEventHandler != null)
+ {
+ this.KeyInputFocusGainedSignal().Disconnect(_KeyInputFocusGainedCallbackDelegate);
+ }
+
+ _KeyInputFocusGainedEventHandler -= value;
+ }
}
- set
+ }
+
+ private void OnKeyInputFocusGained(IntPtr view)
+ {
+ KeyInputFocusGainedEventArgs e = new KeyInputFocusGainedEventArgs();
+ Console.WriteLine("View Keyevent ....");
+ // Populate all members of "e" (KeyInputFocusGainedEventArgs) with real data
+ e.View = Dali.View.GetViewFromPtr(view);
+
+ if (_KeyInputFocusGainedEventHandler != null)
{
- _view = value;
+ //here we send all data to user event handlers
+ _KeyInputFocusGainedEventHandler(this, e);
}
- }
- /**
- * @brief KeyEvent - is the keyevent sent to the View.
- *
+ }
+
+ /**
+ * @brief Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyInputFocusLostEventHandler-DaliEventHandler<object,KeyInputFocusLostEventArgs>)
+ * provided by the user. KeyInputFocusLost signal is emitted when the control loses Key Input Focus.
*/
- public KeyEvent KeyEvent
- {
- get
+ public event DaliEventHandler<object,KeyInputFocusLostEventArgs> KeyInputFocusLost
+ {
+ add
{
- return _keyEvent;
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_KeyInputFocusLostEventHandler == null)
+ {
+ _KeyInputFocusLostEventHandler += value;
+
+ _KeyInputFocusLostCallbackDelegate = new KeyInputFocusLostCallbackDelegate(OnKeyInputFocusLost);
+ this.KeyInputFocusLostSignal().Connect(_KeyInputFocusLostCallbackDelegate);
+ }
+ }
}
- set
+
+ remove
{
- _keyEvent = value;
+ lock(this)
+ {
+ if (_KeyInputFocusLostEventHandler != null)
+ {
+ this.KeyInputFocusLostSignal().Disconnect(_KeyInputFocusLostCallbackDelegate);
+ }
+
+ _KeyInputFocusLostEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnKeyInputFocusLost(IntPtr view)
+ {
+ KeyInputFocusLostEventArgs e = new KeyInputFocusLostEventArgs();
+
+ // Populate all members of "e" (KeyInputFocusLostEventArgs) with real data
+ e.View = Dali.View.GetViewFromPtr(view);
+
+ if (_KeyInputFocusLostEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _KeyInputFocusLostEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyEventEventHandler-DaliEventHandlerWithReturnType<object,KeyEventArgs,bool>)
+ * provided by the user. KeyPressed signal is emitted when key event is received.
+ */
+ public event DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> KeyPressed
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_KeyEventHandler == null)
+ {
+ _KeyEventHandler += value;
+
+ _KeyCallbackDelegate = new KeyCallbackDelegate(OnKeyEvent);
+ this.KeyEventSignal().Connect(_KeyCallbackDelegate);
+ }
+ }
}
- }
-}
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void KeyInputFocusGainedCallbackDelegate(IntPtr control);
- private DaliEventHandler<object,KeyInputFocusGainedEventArgs> _KeyInputFocusGainedEventHandler;
- private KeyInputFocusGainedCallbackDelegate _KeyInputFocusGainedCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void KeyInputFocusLostCallbackDelegate(IntPtr control);
- private DaliEventHandler<object,KeyInputFocusLostEventArgs> _KeyInputFocusLostEventHandler;
- private KeyInputFocusLostCallbackDelegate _KeyInputFocusLostCallbackDelegate;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr keyEvent);
- private DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> _KeyEventHandler;
- private KeyCallbackDelegate _KeyCallbackDelegate;
-
- /**
- * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of KeyInputFocusGainedEventHandler-DaliEventHandler<object,KeyInputFocusGainedEventArgs>)
- * provided by the user. KeyInputFocusGained signal is emitted when the control gets Key Input Focus.
- */
- public event DaliEventHandler<object,KeyInputFocusGainedEventArgs> KeyInputFocusGained
- {
- add
- {
+ remove
+ {
lock(this)
{
- // Restricted to only one listener
- if (_KeyInputFocusGainedEventHandler == null)
- {
- _KeyInputFocusGainedEventHandler += value;
+ if (_KeyEventHandler != null)
+ {
+ this.KeyEventSignal().Disconnect(_KeyCallbackDelegate);
+ }
+
+ _KeyEventHandler -= value;
+ }
+ }
+ }
+
+ private bool OnKeyEvent(IntPtr view, IntPtr keyEvent)
+ {
+ KeyEventArgs e = new KeyEventArgs();
+
+ // Populate all members of "e" (KeyEventArgs) with real data
+ e.View = Dali.View.GetViewFromPtr(view);
+ e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr(keyEvent);
- _KeyInputFocusGainedCallbackDelegate = new KeyInputFocusGainedCallbackDelegate(OnKeyInputFocusGained);
- this.KeyInputFocusGainedSignal().Connect(_KeyInputFocusGainedCallbackDelegate);
- }
+ if (_KeyEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _KeyEventHandler(this, e);
+ }
+ return false;
+
+ }
+
+ /**
+ * @brief Event for OnRelayout signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of OnRelayoutEventHandler) provided by the user.
+ * OnRelayout signal is emitted after the size has been set on the view during relayout.
+ */
+ public event DaliEventHandler<object,OnRelayoutEventArgs> OnRelayoutEvent
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewOnRelayoutEventHandler == null)
+ {
+ _viewOnRelayoutEventHandler += value;
+ Console.WriteLine("View OnRelayoutEventArgs Locked....");
+ _viewOnRelayoutEventCallbackDelegate = new OnRelayoutEventCallbackDelegate(OnRelayout);
+ this.OnRelayoutSignal().Connect(_viewOnRelayoutEventCallbackDelegate);
+ }
}
- }
+ }
- remove
- {
+ remove
+ {
lock(this)
{
- if (_KeyInputFocusGainedEventHandler != null)
- {
- this.KeyInputFocusGainedSignal().Disconnect(_KeyInputFocusGainedCallbackDelegate);
- }
+ if (_viewOnRelayoutEventHandler != null)
+ {
+ this.OnRelayoutSignal().Disconnect(_viewOnRelayoutEventCallbackDelegate);
+ }
- _KeyInputFocusGainedEventHandler -= value;
+ _viewOnRelayoutEventHandler -= value;
}
- }
- }
+ }
+ }
+
+ // Callback for View OnRelayout signal
+ private void OnRelayout(IntPtr data)
+ {
+ OnRelayoutEventArgs e = new OnRelayoutEventArgs();
+ Console.WriteLine("View OnRelayoutEventArgs....");
+ // Populate all members of "e" (OnRelayoutEventArgs) with real data
+ e.View = View.GetViewFromPtr(data);
- private void OnKeyInputFocusGained(IntPtr view)
- {
- KeyInputFocusGainedEventArgs e = new KeyInputFocusGainedEventArgs();
+ if (_viewOnRelayoutEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _viewOnRelayoutEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of TouchEventHandler-DaliEventHandlerWithReturnType<object,TouchEventArgs,bool>)
+ * provided by the user. Touched signal is emitted when touch input is received.
+ */
+ public event DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> Touched
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewTouchDataEventHandler == null)
+ {
+ _viewTouchDataEventHandler += value;
+ Console.WriteLine("View Touch EVENT LOCKED....");
+ _viewTouchDataCallbackDelegate = new TouchCallbackDelegate(OnTouch);
+ this.TouchSignal().Connect(_viewTouchDataCallbackDelegate);
+ }
+ }
+ }
- // Populate all members of "e" (KeyInputFocusGainedEventArgs) with real data
- e.View = Dali.View.GetViewFromPtr(view);
+ remove
+ {
+ lock(this)
+ {
+ if (_viewTouchDataEventHandler != null)
+ {
+ this.TouchSignal().Disconnect(_viewTouchDataCallbackDelegate);
+ }
- if (_KeyInputFocusGainedEventHandler != null)
- {
- //here we send all data to user event handlers
- _KeyInputFocusGainedEventHandler(this, e);
- }
+ _viewTouchDataEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for View TouchSignal
+ private bool OnTouch(IntPtr view, IntPtr touchData)
+ {
+ TouchEventArgs e = new TouchEventArgs();
+ Console.WriteLine("View Touch EVENT....");
+ // Populate all members of "e" (TouchEventArgs) with real data
+ e.View = View.GetViewFromPtr(view);
+ e.TouchData = Dali.TouchData.GetTouchDataFromPtr(touchData);
+
+ if (_viewTouchDataEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _viewTouchDataEventHandler(this, e);
+ }
- }
+ return false;
+ }
+
+ /**
+ * @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of HoverEventHandler-DaliEventHandlerWithReturnType<object,HoverEventArgs,bool>)
+ * provided by the user. Hovered signal is emitted when hover input is received.
+ */
+ public event DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> Hovered
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewHoverEventHandler == null)
+ {
+ _viewHoverEventHandler += value;
+
+ _viewHoverEventCallbackDelegate = new HoverEventCallbackDelegate(OnHoverEvent);
+ this.HoveredSignal().Connect(_viewHoverEventCallbackDelegate);
+ }
+ }
+ }
- /**
- * @brief Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of KeyInputFocusLostEventHandler-DaliEventHandler<object,KeyInputFocusLostEventArgs>)
- * provided by the user. KeyInputFocusLost signal is emitted when the control loses Key Input Focus.
- */
- public event DaliEventHandler<object,KeyInputFocusLostEventArgs> KeyInputFocusLost
- {
- add
- {
+ remove
+ {
lock(this)
{
- // Restricted to only one listener
- if (_KeyInputFocusLostEventHandler == null)
- {
- _KeyInputFocusLostEventHandler += value;
+ if (_viewHoverEventHandler != null)
+ {
+ this.HoveredSignal().Disconnect(_viewHoverEventCallbackDelegate);
+ }
- _KeyInputFocusLostCallbackDelegate = new KeyInputFocusLostCallbackDelegate(OnKeyInputFocusLost);
- this.KeyInputFocusLostSignal().Connect(_KeyInputFocusLostCallbackDelegate);
- }
+ _viewHoverEventHandler -= value;
}
- }
+ }
+ }
+
+ // Callback for View Hover signal
+ private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent)
+ {
+ HoverEventArgs e = new HoverEventArgs();
+
+ // Populate all members of "e" (HoverEventArgs) with real data
+ e.View = View.GetViewFromPtr(view);
+ e.HoverEvent = Dali.HoverEvent.GetHoverEventFromPtr(hoverEvent);
+
+ if (_viewHoverEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _viewHoverEventHandler(this, e);
+ }
- remove
- {
+ return false;
+ }
+
+ /**
+ * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of WheelEventHandler-DaliEventHandlerWithReturnType<object,WheelEventArgs,bool>)
+ * provided by the user. WheelMoved signal is emitted when wheel event is received.
+ */
+ public event DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> WheelMoved
+ {
+ add
+ {
lock(this)
{
- if (_KeyInputFocusLostEventHandler != null)
- {
- this.KeyInputFocusLostSignal().Disconnect(_KeyInputFocusLostCallbackDelegate);
- }
-
- _KeyInputFocusLostEventHandler -= value;
- }
- }
- }
-
- private void OnKeyInputFocusLost(IntPtr view)
- {
- KeyInputFocusLostEventArgs e = new KeyInputFocusLostEventArgs();
-
- // Populate all members of "e" (KeyInputFocusLostEventArgs) with real data
- e.View = Dali.View.GetViewFromPtr(view);
-
- if (_KeyInputFocusLostEventHandler != null)
- {
- //here we send all data to user event handlers
- _KeyInputFocusLostEventHandler(this, e);
- }
- }
-
- /**
- * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of KeyEventEventHandler-DaliEventHandlerWithReturnType<object,KeyEventArgs,bool>)
- * provided by the user. KeyPressed signal is emitted when key event is received.
- */
- public event DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> KeyPressed
- {
- add
- {
+ // Restricted to only one listener
+ if (_viewWheelEventHandler == null)
+ {
+ _viewWheelEventHandler += value;
+ Console.WriteLine("View Wheel EVENT LOCKED....");
+ _viewWheelEventCallbackDelegate = new WheelEventCallbackDelegate(OnWheelEvent);
+ this.WheelEventSignal().Connect(_viewWheelEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
lock(this)
{
- // Restricted to only one listener
- if (_KeyEventHandler == null)
- {
- _KeyEventHandler += value;
+ if (_viewWheelEventHandler != null)
+ {
+ this.WheelEventSignal().Disconnect(_viewWheelEventCallbackDelegate);
+ }
+
+ _viewWheelEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for View Wheel signal
+ private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent)
+ {
+ WheelEventArgs e = new WheelEventArgs();
+ Console.WriteLine("View Wheel EVENT ....");
+ // Populate all members of "e" (WheelEventArgs) with real data
+ e.View = View.GetViewFromPtr(view);
+ e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr(wheelEvent);
+
+ if (_viewWheelEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _viewWheelEventHandler(this, e);
+ }
- _KeyCallbackDelegate = new KeyCallbackDelegate(OnKeyEvent);
- this.KeyEventSignal().Connect(_KeyCallbackDelegate);
- }
+ return false;
+ }
+
+ /**
+ * @brief Event for OnStage signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of OnStageEventHandler) provided by the user.
+ * OnStage signal is emitted after the view has been connected to the stage.
+ */
+ public event DaliEventHandler<object,OnStageEventArgs> OnStageEvent
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewOnStageEventHandler == null)
+ {
+ _viewOnStageEventHandler += value;
+
+ _viewOnStageEventCallbackDelegate = new OnStageEventCallbackDelegate(OnStage);
+ this.OnStageSignal().Connect(_viewOnStageEventCallbackDelegate);
+ }
}
- }
+ }
- remove
- {
+ remove
+ {
lock(this)
{
- if (_KeyEventHandler != null)
- {
- this.KeyEventSignal().Disconnect(_KeyCallbackDelegate);
- }
+ if (_viewOnStageEventHandler != null)
+ {
+ this.OnStageSignal().Disconnect(_viewOnStageEventCallbackDelegate);
+ }
+
+ _viewOnStageEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for View OnStage signal
+ private void OnStage(IntPtr data)
+ {
+ OnStageEventArgs e = new OnStageEventArgs();
- _KeyEventHandler -= value;
+ // Populate all members of "e" (OnStageEventArgs) with real data
+ e.View = View.GetViewFromPtr(data);
+
+ if (_viewOnStageEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _viewOnStageEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for OffStage signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of OffStageEventHandler) provided by the user.
+ * OffStage signal is emitted after the view has been disconnected from the stage.
+ */
+ public event DaliEventHandler<object,OffStageEventArgs> OffStageEvent
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_viewOffStageEventHandler == null)
+ {
+ _viewOffStageEventHandler += value;
+
+ _viewOffStageEventCallbackDelegate = new OffStageEventCallbackDelegate(OffStage);
+ this.OnStageSignal().Connect(_viewOffStageEventCallbackDelegate);
+ }
}
- }
- }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_viewOffStageEventHandler != null)
+ {
+ this.OnStageSignal().Disconnect(_viewOffStageEventCallbackDelegate);
+ }
- private bool OnKeyEvent(IntPtr view, IntPtr keyEvent)
- {
- KeyEventArgs e = new KeyEventArgs();
+ _viewOffStageEventHandler -= value;
+ }
+ }
+ }
- // Populate all members of "e" (KeyEventArgs) with real data
- e.View = Dali.View.GetViewFromPtr(view);
- e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr(keyEvent);
+ // Callback for View OffStage signal
+ private void OffStage(IntPtr data)
+ {
+ OffStageEventArgs e = new OffStageEventArgs();
- if (_KeyEventHandler != null)
- {
- //here we send all data to user event handlers
- return _KeyEventHandler(this, e);
- }
- return false;
+ // Populate all members of "e" (OffStageEventArgs) with real data
+ e.View = View.GetViewFromPtr(data);
- }
+ if (_viewOffStageEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _viewOffStageEventHandler(this, e);
+ }
+ }
- public static View GetViewFromPtr(global::System.IntPtr cPtr) {
- View ret = new View(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ public static View GetViewFromPtr(global::System.IntPtr cPtr) {
+ View ret = new View(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
-%}
+ %}
-%enddef
+ %enddef
%define DALI_CONTROL_EVENTHANDLER_PARAM( NameSpace, ClassName)
CONTROL_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
CONTROL_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
-%enddef
+ %enddef
-namespace Dali
+ namespace Dali
{
DALI_CONTROL_EVENTHANDLER_PARAM( Dali::Toolkit, Control);
}
--- /dev/null
+/*
+ * 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<int>);
+}
}
}
- public Vector2 Size
+ ///< name "Size", type Dali.Size (Stage Size value)
+ //@since 1.0.0
+ public Dali.Size Size
{
get
{
- Vector2 ret = GetSize();
+ Vector2 ret1 = GetSize();
+ Dali.Size ret= new Size(ret1);
return ret;
}
}
- public Vector4 BackgroundColor
+ ///< name "BackgroundColor", type Dali.Color (Stage background color value)
+ //@since 1.0.0
+ public Dali.Color BackgroundColor
{
set
{
}
get
{
- Vector4 ret = GetBackgroundColor();
+ Vector4 ret1 = GetBackgroundColor();
+ Dali.Color ret = new Color(ret1);
return ret;
}
}
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;
handle.GetProperty(myPropertyIndex).Get(ref myProperty);
Console.WriteLine( "myProperty value: " + myProperty );
- int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Vector2(5.0f, 5.0f)), Property.AccessMode.READ_WRITE);
- Vector2 myProperty2 = new Vector2(0.0f, 0.0f);
+ int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Size(5.0f, 5.0f)), Property.AccessMode.READ_WRITE);
+ Size myProperty2 = new Size(0.0f, 0.0f);
handle.GetProperty(myPropertyIndex2).Get(myProperty2);
Console.WriteLine( "myProperty2 value: " + myProperty2.x + ", " + myProperty2.y );
Actor actor = new Actor();
- actor.Size = new Vector3(200.0f, 200.0f, 0.0f);
+ actor.Size = new Position(200.0f, 200.0f, 0.0f);
actor.Name = "MyActor";
- actor.Color = new Vector4(1.0f, 0.0f, 1.0f, 0.8f);
+ 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 name: " + actor.Name);
Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = NDalic.WHITE ;
+ stage.BackgroundColor = new Color("white") ;
- Vector2 stageSize = stage.Size;
+ Size stageSize = stage.Size;
Console.WriteLine("Stage size: " + stageSize.x + ", " + stageSize.y);
stage.Add(actor);
Console.WriteLine( " Area = " + rd2.Area() );
Console.WriteLine( " *************************" );
- Vector2 vector2 = new Vector2(100, 50);
- Console.WriteLine( " Created " + vector2 );
- Console.WriteLine( " Vector2 x = " + vector2.x + ", y = " + vector2.y );
- vector2 += new Vector2(20, 20);
- Console.WriteLine( " Vector2 x = " + vector2[0] + ", y = " + vector2[1] );
- vector2.x += 10;
- vector2.y += 10;
- Console.WriteLine( " Vector2 width = " + vector2.width + ", height = " + vector2.height );
- vector2 += new Vector2(15, 15);
- Console.WriteLine( " Vector2 width = " + vector2[0] + ", height = " + vector2[1] );
+ Size Size = new Size(100, 50);
+ Console.WriteLine( " Created " + Size );
+ Console.WriteLine( " Size x = " + Size.x + ", y = " + Size.y );
+ Size += new Size(20, 20);
+ Console.WriteLine( " Size x = " + Size[0] + ", y = " + Size[1] );
+ Size.x += 10;
+ Size.y += 10;
+ Console.WriteLine( " Size width = " + Size.width + ", height = " + Size.height );
+ Size += new Size(15, 15);
+ Console.WriteLine( " Size width = " + Size[0] + ", height = " + Size[1] );
Console.WriteLine( " *************************" );
- Vector3 vector3 = new Vector3(20, 100, 50);
- Console.WriteLine( " Created " + vector3 );
- Console.WriteLine( " Vector3 x = " + vector3.x + ", y = " + vector3.y + ", z = " + vector3.z );
- vector3 += new Vector3(20, 20, 20);
- Console.WriteLine( " Vector3 x = " + vector3[0] + ", y = " + vector3[1] + ", z = " + vector3[2] );
- vector3.x += 10;
- vector3.y += 10;
- vector3.z += 10;
- Console.WriteLine( " Vector3 width = " + vector3.width + ", height = " + vector3.height + ", depth = " + vector3.depth );
- Vector3 parentOrigin = NDalic.ParentOriginBottomRight;
+ Position Position = new Position(20, 100, 50);
+ Console.WriteLine( " Created " + Position );
+ Console.WriteLine( " Position x = " + Position.x + ", y = " + Position.y + ", z = " + Position.z );
+ Position += new Position(20, 20, 20);
+ Console.WriteLine( " Position x = " + Position[0] + ", y = " + Position[1] + ", z = " + Position[2] );
+ Position.x += 10;
+ Position.y += 10;
+ Position.z += 10;
+ Console.WriteLine( " Position width = " + Position.width + ", height = " + Position.height + ", depth = " + Position.depth );
+ Position parentOrigin = new Dali.Position(NDalic.ParentOriginBottomRight);
Console.WriteLine( " parentOrigin x = " + parentOrigin.x + ", y = " + parentOrigin.y + ", z = " + parentOrigin.z );
Console.WriteLine( " *************************" );
- Vector4 vector4 = new Vector4(20, 100, 50, 200);
- Console.WriteLine( " Created " + vector4 );
- Console.WriteLine( " Vector4 x = " + vector4.x + ", y = " + vector4.y + ", z = " + vector4.z + ", w = " + vector4.w );
- vector4 += new Vector4(20, 20, 20, 20);
- Console.WriteLine( " Vector4 x = " + vector4[0] + ", y = " + vector4[1] + ", z = " + vector4[2] + ", w = " + vector4[3] );
- vector4.x += 10;
- vector4.y += 10;
- vector4.z += 10;
- vector4.w += 10;
- Console.WriteLine( " Vector4 r = " + vector4.r + ", g = " + vector4.g + ", b = " + vector4.b + ", a = " + vector4.a );
+ Color Color = new Color(20, 100, 50, 200);
+ Console.WriteLine( " Created " + Color );
+ Console.WriteLine( " Color x = " + Color.x + ", y = " + Color.y + ", z = " + Color.z + ", w = " + Color.w );
+ Color += new Color(20, 20, 20, 20);
+ Console.WriteLine( " Color x = " + Color[0] + ", y = " + Color[1] + ", z = " + Color[2] + ", w = " + Color[3] );
+ Color.x += 10;
+ Color.y += 10;
+ Color.z += 10;
+ Color.w += 10;
+ Console.WriteLine( " Color r = " + Color.r + ", g = " + Color.g + ", b = " + Color.b + ", a = " + Color.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()
{
private View _topContainer;
private View _bottomContainer;
- private EdenEffect _edenEffect;
+ private FocusEffect _focusEffect;
private string _imagePath;
private ImageView _keyboardFocusIndicator;
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)
_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)
}
// 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";
_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);
keyboardFocusManager.SetFocusIndicatorActor(_keyboardFocusIndicator);
- _edenEffect = new EdenEffect();
+ _focusEffect = new FocusEffect();
// Move Fcous to Bottom Container (Menu ScrollContainer)
ShowBottomContainer();
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
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;
_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;
Vertical
};
- public Direction EdenDirection
+ public Direction FocusDirection
{
get {return _direction;}
set {_direction = value;}
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;
}
_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;
}
// 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;
}
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));
}
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);
}
}
}
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);
}
}
}
// 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)
{
}
+ 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
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);
}
}
{
class Example
{
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- delegate void CallbackDelegate(IntPtr data);
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- delegate void TouchCallbackDelegate(IntPtr data);
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- delegate void AnimationCallbackDelegate(IntPtr data);
-
private Dali.Application _application;
private Animation _animation;
{
Console.WriteLine("Customized Application Initialize event handler");
Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = NDalic.WHITE;
+ stage.BackgroundColor = new Color("white");
stage.Touched += OnStageTouched;
{
Console.WriteLine("Customized Animation Finished Event handler");
Console.WriteLine("Animation finished: duration = " + e.Animation.Duration);
+ Console.WriteLine("End Action = " + e.Animation.GetEndAction());
}
// Callback for stage touched signal handling
_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(Dali.Constants.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(Dali.Constants.AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f));
// Connect the signal callback for animaiton finished signal
_animation.Finished += AnimationFinished;
// Play the _animation
_animation.Play();
+
+ Console.WriteLine("Looping:" + _animation.Looping);
}
}
namespace MyCSharpExample
{
- class Example
- {
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- delegate void CallbackDelegate(IntPtr data);
+ class Example
+ {
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate void CallbackDelegate(IntPtr data);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- delegate void ActorCallbackDelegate(IntPtr data);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate void ActorCallbackDelegate(IntPtr data);
- private Dali.Application _application;
- private ScrollView _scrollView;
- private ScrollBar _scrollBar;
+ private Dali.Application _application;
+ private ScrollView _scrollView;
+ private ScrollBar _scrollBar;
+ private Animation _animation;
+ private TextLabel _text;
- public Example(Dali.Application application)
- {
- _application = application;
- _application.Initialized += Initialize;
- }
+ public Example(Dali.Application application)
+ {
+ _application = application;
+ _application.Initialized += Initialize;
+ }
- public void Initialize(object source, AUIApplicationInitEventArgs e)
- {
- CreateScrollView();
- }
+ public void Initialize(object source, AUIApplicationInitEventArgs e)
+ {
+ CreateScrollView();
+ }
- private void CreateScrollView()
+ private void CreateScrollView()
+ {
+ Stage stage = Stage.GetCurrent();
+ stage.BackgroundColor = new Color("white");
+
+ // Create a scroll view
+ _scrollView = new ScrollView();
+ Size stageSize = stage.Size;
+ _scrollView.Size = new Position(stageSize.x, stageSize.y, 0.0f);
+ _scrollView.ParentOrigin = NDalic.ParentOriginCenter;
+ _scrollView.AnchorPoint = NDalic.AnchorPointCenter;
+ stage.Add(_scrollView);
+
+ // Add actors to a scroll view with 3 pages
+ int pageRows = 1;
+ int pageColumns = 3;
+ for(int pageRow = 0; pageRow < pageRows; pageRow++)
+ {
+ for(int pageColumn = 0; pageColumn < pageColumns; pageColumn++)
{
- Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = NDalic.WHITE;
-
- // Create a scroll view
- _scrollView = new ScrollView();
- Vector2 stageSize = stage.Size;
- _scrollView.Size = new Vector3(stageSize.x, stageSize.y, 0.0f);
- _scrollView.ParentOrigin = NDalic.ParentOriginCenter;
- _scrollView.AnchorPoint = NDalic.AnchorPointCenter;
- stage.Add(_scrollView);
-
- // Add actors to a scroll view with 3 pages
- int pageRows = 1;
- int pageColumns = 3;
- for(int pageRow = 0; pageRow < pageRows; pageRow++)
+ View pageActor = new View();
+ pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
+ pageActor.ParentOrigin = NDalic.ParentOriginCenter;
+ pageActor.AnchorPoint = NDalic.AnchorPointCenter;
+ pageActor.Position = new Position(pageColumn * stageSize.x, pageRow * stageSize.y, 0.0f);
+
+ // Add images in a 3x4 grid layout for each page
+ int imageRows = 4;
+ int imageColumns = 3;
+ float margin = 10.0f;
+ Position imageSize = new Position((stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0f);
+
+ for(int row = 0; row < imageRows; row++)
+ {
+ for(int column = 0; column < imageColumns;column++)
{
- for(int pageColumn = 0; pageColumn < pageColumns; pageColumn++)
- {
- View pageActor = new View();
- pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
- pageActor.ParentOrigin = NDalic.ParentOriginCenter;
- pageActor.AnchorPoint = NDalic.AnchorPointCenter;
- pageActor.Position = new Vector3(pageColumn * stageSize.x, pageRow * stageSize.y, 0.0f);
-
- // Add images in a 3x4 grid layout for each page
- int imageRows = 4;
- int imageColumns = 3;
- float margin = 10.0f;
- Vector3 imageSize = new Vector3((stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0f);
-
- for(int row = 0; row < imageRows; row++)
- {
- for(int column = 0; column < imageColumns;column++)
- {
- int imageId = (row * imageColumns + column) % 2 + 1;
- ImageView imageView = new ImageView("images/image-" + imageId + ".jpg");
- imageView.ParentOrigin = NDalic.ParentOriginCenter;
- imageView.AnchorPoint = NDalic.AnchorPointCenter;
- imageView.Size = imageSize;
- imageView.Position = new Vector3( margin * 0.5f + (imageSize.x + margin) * column - stageSize.x * 0.5f + imageSize.x * 0.5f,
- margin * 0.5f + (imageSize.y + margin) * row - stageSize.y * 0.5f + imageSize.y * 0.5f, 0.0f );
- pageActor.Add(imageView);
- }
- }
-
- _scrollView.Add(pageActor);
- }
+ int imageId = (row * imageColumns + column) % 2 + 1;
+ ImageView imageView = new ImageView("images/image-" + imageId + ".jpg");
+ imageView.ParentOrigin = NDalic.ParentOriginCenter;
+ imageView.AnchorPoint = NDalic.AnchorPointCenter;
+ imageView.Size = imageSize;
+ imageView.Position = new Position( margin * 0.5f + (imageSize.x + margin) * column - stageSize.x * 0.5f + imageSize.x * 0.5f,
+ margin * 0.5f + (imageSize.y + margin) * row - stageSize.y * 0.5f + imageSize.y * 0.5f, 0.0f );
+ pageActor.Add(imageView);
}
+ }
- _scrollView.SetAxisAutoLock(true);
-
- // Set scroll view to have 3 pages in X axis and allow page snapping,
- // and also disable scrolling in Y axis.
- RulerPtr scrollRulerX = new RulerPtr(new FixedRuler(stageSize.width));
- RulerPtr scrollRulerY = new RulerPtr(new DefaultRuler());
- scrollRulerX.SetDomain(new RulerDomain(0.0f, stageSize.width * pageColumns, true));
- scrollRulerY.Disable();
- _scrollView.SetRulerX(scrollRulerX);
- _scrollView.SetRulerY(scrollRulerY);
-
- // Create a horizontal scroll bar in the bottom of scroll view (which is optional)
- _scrollBar = new ScrollBar();
- _scrollBar.ParentOrigin = NDalic.ParentOriginBottomLeft;
- _scrollBar.AnchorPoint = NDalic.AnchorPointTopLeft;
- _scrollBar.SetResizePolicy(ResizePolicyType.FIT_TO_CHILDREN, DimensionType.WIDTH);
- _scrollBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
- _scrollBar.Orientation = new Quaternion( new Radian( new Degree( 270.0f ) ), Vector3.ZAXIS );
- _scrollBar.SetScrollDirection(ScrollBar.Direction.Horizontal);
- _scrollView.Add(_scrollBar);
-
- // Connect to the OnRelayout signal
- _scrollView.OnRelayoutEvent += OnScrollViewRelayout;
+ _scrollView.Add(pageActor);
}
+ }
+
+ _scrollView.SetAxisAutoLock(true);
+
+ // Set scroll view to have 3 pages in X axis and allow page snapping,
+ // and also disable scrolling in Y axis.
+ RulerPtr scrollRulerX = new RulerPtr(new FixedRuler(stageSize.width));
+ RulerPtr scrollRulerY = new RulerPtr(new DefaultRuler());
+ scrollRulerX.SetDomain(new RulerDomain(0.0f, stageSize.width * pageColumns, true));
+ scrollRulerY.Disable();
+ _scrollView.SetRulerX(scrollRulerX);
+ _scrollView.SetRulerY(scrollRulerY);
+
+ // Create a horizontal scroll bar in the bottom of scroll view (which is optional)
+ _scrollBar = new ScrollBar();
+ _scrollBar.ParentOrigin = NDalic.ParentOriginBottomLeft;
+ _scrollBar.AnchorPoint = NDalic.AnchorPointTopLeft;
+ _scrollBar.SetResizePolicy(ResizePolicyType.FIT_TO_CHILDREN, DimensionType.WIDTH);
+ _scrollBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
+ _scrollBar.Orientation = new Quaternion( new Radian( new Degree( 270.0f ) ), Position.ZAXIS );
+ _scrollBar.SetScrollDirection(ScrollBar.Direction.Horizontal);
+ _scrollView.Add(_scrollBar);
+
+ // Connect to the OnRelayout signal
+ _scrollView.OnRelayoutEvent += OnScrollViewRelayout;
+ _scrollView.Touched += OnTouch;
+ _scrollView.WheelMoved += Onwheel;
+ _scrollView.KeyInputFocusGained += OnKey;
+ _text = new TextLabel("View Touch Event Handler Test");
+ _text.ParentOrigin = NDalic.ParentOriginCenter;
+ _text.AnchorPoint = NDalic.AnchorPointCenter;
+ _text.HorizontalAlignment = "CENTER";
+ _text.PointSize = 48.0f;
+
+ _scrollView.Add(_text);
+ }
- private void OnScrollViewRelayout(object source, View.OnRelayoutEventArgs e)
- {
- // Set the correct scroll bar size after size negotiation of scroll view is done
- _scrollBar.Size = new Vector3(0.0f, _scrollView.GetRelayoutSize(DimensionType.WIDTH), 0.0f);
- }
+ // Callback for _animation finished signal handling
+ public void AnimationFinished(object source, Animation.FinishedEventArgs e)
+ {
+ Console.WriteLine("Customized Animation Finished Event handler");
+ Console.WriteLine("Animation finished: duration = " + e.Animation.Duration);
+ }
+ private void OnKey(object source, View.KeyInputFocusGainedEventArgs e)
+ {
+ Console.WriteLine("View Keyevent EVENT callback....");
+ }
- public void MainLoop()
- {
- _application.MainLoop ();
- }
+ private bool Onwheel(object source, View.WheelEventArgs e)
+ {
+ Console.WriteLine("View Wheel EVENT callback....");
+ return true;
+ }
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main(string[] args)
+ private bool OnTouch(object source, View.TouchEventArgs e)
+ {
+ Console.WriteLine("View TOUCH EVENT callback....");
+
+ // Only animate the _text label when touch down happens
+ if( e.TouchData.GetState(0) == PointStateType.DOWN )
+ {
+ Console.WriteLine("Customized Stage Touch event handler");
+ // Create a new _animation
+ if( _animation )
{
- Example example = new Example(Application.NewApplication());
- example.MainLoop ();
+ _animation.Reset();
}
+
+ _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 ) ), Position.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 ) ), Position.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.5f, 0.5f));
+
+ // Connect the signal callback for animaiton finished signal
+ _animation.Finished += AnimationFinished;
+
+ // Play the _animation
+ _animation.Play();
+ }
+ return true;
}
+
+ private void OnScrollViewRelayout(object source, View.OnRelayoutEventArgs e)
+ {
+ Console.WriteLine("View OnRelayoutEventArgs EVENT callback....");
+
+ // Set the correct scroll bar size after size negotiation of scroll view is done
+ _scrollBar.Size = new Position(0.0f, _scrollView.GetRelayoutSize(DimensionType.WIDTH), 0.0f);
+ }
+
+ public void MainLoop()
+ {
+ _application.MainLoop ();
+ }
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Example example = new Example(Application.NewApplication());
+ example.MainLoop ();
+ }
+ }
}
--- /dev/null
+namespace Dali {
+
+using System;
+
+public class Color : Vector4
+ {
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ */
+ public Color()
+ : base()
+ { }
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] red The Color r.
+ * @param [in] green The Color g.
+ * @param [in] blue The Color b.
+ * @param [in] alpha The Color a.
+ */
+ public Color(float red, float green, float blue, float alpha)
+ : base(red, green, blue, alpha)
+ { }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] o The Vector4 having r g b a components
+ */
+ public Color(Vector4 o)
+ : base(o.x, o.y, o.z, o.w)
+ {
+
+ }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] color as string.
+ */
+ public Color(string color)
+ : base(0, 0, 0, 0)
+ {
+ switch (color)
+ {
+ case "red":
+ SetColor(255, 0, 0, 255);
+ break;
+ case "white":
+ SetColor(255, 255, 255, 255);
+ break;
+ case "blue":
+ SetColor(0, 0, 255, 255);
+ break;
+ case "green":
+ SetColor(0, 255, 0, 255);
+ break;
+ case "black":
+ SetColor(0, 0, 0, 255);
+ break;
+ case "grey":
+ SetColor(128, 128, 128, 255);
+ break;
+ case "yellow":
+ SetColor(255, 255, 0, 255);
+ break;
+ case "azure":
+ SetColor(0, 255, 255, 255);
+ break;
+ case "rose":
+ SetColor(255, 0, 255, 255);
+ break;
+ }
+ }
+
+ /**
+ * @brief SetColor
+ *
+ * @since 1.0.0
+ * @param [in] red The Color r.
+ * @param [in] green The Color g.
+ * @param [in] blue The Color b.
+ * @param [in] alpha The Color a.
+ */
+ public void SetColor(float red, float green, float blue, float alpha)
+ {
+ r = red;
+ g = green;
+ b = blue;
+ a = alpha;
+ }
+
+ /**
+ * @brief name "R", type float (Color's Red component)
+ * @SINCE_1_0.0
+ */
+
+ public float R
+ {
+ get { return r; }
+ set { r = value; }
+ }
+
+ /**
+ * @brief name "G", type float (Color's Green component)
+ * @SINCE_1_0.0
+ */
+ public float G
+ {
+ get { return g; }
+ set { g = value; }
+ }
+
+ /**
+ * @brief name "B", type float (Color's Blue component)
+ * @SINCE_1_0.0
+ */
+ public float B
+ {
+ get { return b; }
+ set { b = value; }
+ }
+
+ /**
+ * @brief name "A", type float (Color's Alpha value)
+ * @SINCE_1_0.0
+ */
+ public float A
+ {
+ get { return a; }
+ set { a = value; }
+ }
+
+ /**
+ * @brief operator+
+ *
+ * @since 1.0.0
+ * @param [in] l The Color to add.
+ * @param [in] r The Color to add
+ * @return A reference to this
+ */
+ public static Color operator +(Color l, Color r)
+ {
+ return new Color(l.R + r.R, l.G + r.G, l.B + r.B, l.A + r.A);
+ }
+
+ /**
+ * @brief operator-
+ *
+ * @since 1.0.0
+ * @param [in] l The Color to substract.
+ * @param [in] r The Color to substract
+ * @return A reference to this
+ */
+ public static Color operator -(Color l, Color r)
+ {
+ return new Color(l.R - r.R, l.G - r.G, l.B - r.B, l.A - r.A);
+ }
+
+ /**
+ * @brief operator*
+ *
+ * @since 1.0.0
+ * @param [in] a The Color to multiply.
+ * @param [in] b The Color to multiply
+ * @return A reference to this
+ */
+ public static Color operator *(Color a, double b)
+ {
+ return new Color((int)(a.R * b), (int)(a.G * b), (int)(a.B * b), (int)(a.A * b));
+ }
+
+ /**
+ * @brief operator/
+ *
+ * @since 1.0.0
+ * @param [in] a The Color to divide.
+ * @param [in] b The Color to divide
+ * @return float value of division operation
+ */
+ public static float operator /(Color a, Color b)
+ {
+ return (float)System.Math.Sqrt((a.R / b.R) * (a.G / b.G) * (a.B / b.B) * (a.A / b.A));
+ }
+
+ /**
+ * @brief Equals
+ *
+ * @since 1.0.0
+ * @param [in] o The Color object to compare.
+ * @param [in] r The Color to add
+ * @return bool, whether object equal or not
+ */
+ public override bool Equals(object obj)
+ {
+ Color l = this;
+ Color r = obj as Color;
+ if (r == null)
+ {
+ return false;
+ }
+ return l.R == r.R && l.G == r.G && l.B == r.B && l.A == r.A;
+ }
+
+ /**
+ * @brief GetHashCode
+ *
+ * @since 1.0.0
+ * @return int, hascode of Color
+ */
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ /**
+ * @brief Clone
+ *
+ * @since 1.0.0
+ * @return Color object
+ */
+ public Color Clone()
+ {
+ Color copy = new Color(R, G, B, A);
+ return copy;
+ }
+ }
+
+}
--- /dev/null
+/** 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;
+
+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
+ // Preset bit-mask combinations:
+ DepthStencil = Dali.FrameBuffer.Attachment.Mask.DEPTH_STENCIL ///< The Framebuffer will be created with depth and stencil buffer @SINCE_1_1.45
+ }
+ } //namespace FrameBuffer
+ } // namespace Attachment
+
+
+ public enum TextureType {
+ Texture2D = Dali.TextureType.TEXTURE_2D, ///< One 2D image @SINCE_1_1.43
+ TextureCube = Dali.TextureType.TEXTURE_CUBE ///< Six 2D images arranged in a cube-shape @SINCE_1_1.43
+ }
+
+ /**
+ * @brief Stereoscopic view modes
+ * @SINCE_1_0.0
+ */
+ public enum ViewMode {
+ Mono = Dali.ViewMode.MONO, ///< Monoscopic (single camera). This is the default @SINCE_1_0.0
+ StereoHorizontal = Dali.ViewMode.STEREO_HORIZONTAL, ///< Stereoscopic. Frame buffer is split horizontally with the left and right camera views in their respective sides. @SINCE_1_0.0
+ StereoVertical = Dali.ViewMode.STEREO_VERTICAL, ///< Stereoscopic. Frame buffer is split vertically with the left camera view at the top and the right camera view at the bottom. @SINCE_1_0.0
+ StereoInterlaced = Dali.ViewMode.STEREO_INTERLACED ///< @DEPRECATED_1_1.19 @brief Stereoscopic. Left/Right camera views are rendered into the framebuffer on alternate frames. @SINCE_1_0.0
+ }
+
+ public enum MeshVisualShadingModeValue {
+ TexturelessWithDiffuseLighting = Dali.MeshVisualShadingModeValue.TEXTURELESS_WITH_DIFFUSE_LIGHTING, ///< *Simplest*. One color that is lit by ambient and diffuse lighting. @SINCE_1_1.45
+ TexturedWithSpecularLigting = Dali.MeshVisualShadingModeValue.TEXTURED_WITH_SPECULAR_LIGHTING, ///< Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting. @SINCE_1_1.45
+ TexturedWithDetailedSpecularLighting = Dali.MeshVisualShadingModeValue.TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING ///< Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting. @SINCE_1_1.45
+ }
+
+ /**
+ * @brief Projection modes.
+ * @SINCE_1_0.0
+ */
+ public enum ProjectionMode {
+ PerspectiveProjection = Dali.ProjectionMode.PERSPECTIVE_PROJECTION, ///< Distance causes foreshortening; objects further from the camera appear smaller @SINCE_1_0.0
+ OrthographicProjection = Dali.ProjectionMode.ORTHOGRAPHIC_PROJECTION ///< Relative distance from the camera does not affect the size of objects @SINCE_1_0.0
+ }
+
+
+ } // namespace Constants
+} // namesapce Dali
--- /dev/null
+namespace Dali {
+
+using System;
+
+public class Position : Vector3
+ {
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ */
+ public Position()
+ : base()
+ {
+ }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] a The Position X.
+ * @param [in] b The Position Y.
+ * @param [in] c The Position Z.
+ */
+ public Position(float a, float b, float c)
+ : base(a, b, c)
+ {
+ }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] o The Vector Position X, Y, Z.
+ */
+ public Position(Vector3 o)
+ : base(o.x, o.y, o.z)
+ {
+ }
+
+ ///< name "X", type float (Position X value)
+ //@since 1.0.0
+ public float X
+ {
+ get { return width; }
+ set { width = value; }
+ }
+
+ ///< name "Y", type float (Position Y value)
+ //@since 1.0.0
+ public float Y
+ {
+ get { return height; }
+ set { height = value; }
+ }
+
+ ///< name "Z", type float (Position Z value)
+ //@since 1.0.0
+ public float Z
+ {
+ get { return depth; }
+ set { depth = value; }
+ }
+
+ /**
+ * @brief operator+
+ *
+ * @since 1.0.0
+ * @param [in] l The Position to add.
+ * @param [in] r The Position to add
+ * @return A reference to this
+ */
+ public static Position operator +(Position l, Position r)
+ {
+ return new Position(l.X + r.X, l.Y + r.Y, l.Z + r.Z);
+ }
+
+ /**
+ * @brief operator-
+ *
+ * @since 1.0.0
+ * @param [in] l The Position to substract.
+ * @param [in] r The Position to substract
+ * @return A reference to this
+ */
+ public static Position operator -(Position l, Position r)
+ {
+ return new Position(l.X - r.X, l.Y - r.Y, l.Z - r.Z);
+ }
+
+ /**
+ * @brief operator*
+ *
+ * @since 1.0.0
+ * @param [in] a The Position to multiply.
+ * @param [in] b The Position to multiply
+ * @return A reference to this
+ */
+ public static Position operator *(Position a, double b)
+ {
+ return new Position((int)(a.X * b), (int)(a.Y * b), (int)(a.Z * b));
+ }
+
+ /**
+ * @brief operator/
+ *
+ * @since 1.0.0
+ * @param [in] a The Position to divide.
+ * @param [in] b The Position to divide
+ * @return float value of division operation
+ */
+ public static float operator /(Position a, Position b)
+ {
+ return (float)System.Math.Sqrt((a.X / b.X) * (a.Y / b.Y) * (a.Z / b.Z));
+ }
+
+ /**
+ * @brief Equals
+ *
+ * @since 1.0.0
+ * @param [in] o The Position object to compare.
+ * @return bool, whether object equal or not
+ */
+ public override bool Equals(object obj)
+ {
+ Position r = obj as Position;
+ if (r == null)
+ {
+ return false;
+ }
+ return this.X == r.X && this.Y == r.Y && this.Z == r.Z;
+ }
+
+ /**
+ * @brief GetHashCode
+ *
+ * @since 1.0.0
+ * @return int, hascode of position
+ */
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ /**
+ * @brief Clone
+ *
+ * @since 1.0.0
+ * @return Position object
+ */
+ public Position Clone()
+ {
+ Position copy = new Position(X, Y, Z);
+ return copy;
+ }
+ }
+
+}
--- /dev/null
+namespace Dali {
+
+using System;
+
+public class Size : Vector2
+ {
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] a Width value .
+ * @param [in] b Height value.
+ */
+ public Size(float a, float b)
+ : base(a, b)
+ {
+ }
+ /**
+ * @brief default constructor
+ *
+ * @since 1.0.0
+ */
+ public Size()
+ : base()
+ {
+ }
+
+ /**
+ * @brief constructor with base class object
+ *
+ * @since 1.0.0
+ * @param [in] o The Vector2 with Width, Height values.
+ */
+ public Size(Vector2 o)
+ : base(o.x, o.y)
+ {
+
+ }
+
+ /**
+ * @brief Copy constructor
+ *
+ * @since 1.0.0
+ * @param [in] o The Size having Width & Y.
+ */
+ public Size(Size a)
+ : base(a.width, a.height)
+ {
+ }
+
+ ///< name "W", type float (Size Width value)
+ //@since 1.0.0
+ public float W
+ {
+ get { return width; }
+ set { width = value; }
+ }
+
+ ///< name "H", type float (Size Height value)
+ //@since 1.0.0
+ public float H
+ {
+ get { return height; }
+ set { height = value; }
+ }
+
+ /**
+ * @brief operator+
+ *
+ * @since 1.0.0
+ * @param [in] l The Size to add.
+ * @param [in] r The Size to add
+ * @return A reference to this
+ */
+ public static Size operator +(Size l, Size r)
+ {
+ return new Size(l.W + r.W, l.H + r.H);
+ }
+
+ /**
+ * @brief operator-
+ *
+ * @since 1.0.0
+ * @param [in] l The Size to substract.
+ * @param [in] r The Size to substract
+ * @return A reference to this
+ */
+ public static Size operator -(Size l, Size r)
+ {
+ return new Size(l.W - r.W, l.H - r.H);
+ }
+
+ /**
+ * @brief operator*
+ *
+ * @since 1.0.0
+ * @param [in] a The Size to multiply
+ * @param [in] b The Size to multiply
+ * @return A reference to this
+ */
+ public static Size operator *(Size a, double b)
+ {
+ return new Size((int)(a.W * b), (int)(a.H * b));
+ }
+
+ /**
+ * @brief operator/
+ *
+ * @since 1.0.0
+ * @param [in] a The Size to divide.
+ * @param [in] b The Size to divide
+ * @return float of the size division
+ */
+ public static float operator /(Size a, Size b)
+ {
+ return (float)System.Math.Sqrt((a.W / b.W) * (a.H / b.H));
+ }
+
+ /**
+ * @brief Equals
+ *
+ * @since 1.0.0
+ * @param [in] obj The Size object to compare.
+ * @return bool, whether object equal or not
+ */
+ public override bool Equals(object obj)
+ {
+ Size that = obj as Size;
+ if (that == null)
+ {
+ return false;
+ }
+ return this.W == that.W && this.H == that.H;
+ }
+
+ /**
+ * @brief GetHashCode
+ *
+ * @since 1.0.0
+ * @return int, hascode of Size
+ */
+ public override int GetHashCode()
+ {
+ return (int)(W + H);
+ }
+
+ /**
+ * @brief Clone
+ *
+ * @since 1.0.0
+ * @return returns a copy of Size object
+ */
+ public Size Clone()
+ {
+ Size copy = new Size(W, H);
+ return copy;
+ }
+ }
+}
/// This application is created before OnCreate() or created event. And the DaliApplication will be terminated when this application is closed.
/// </remarks>
protected Dali.Application application;
+
+ /// <summary>
+ /// The instance of the Dali Application extension.
+ /// </summary>
protected Dali.ApplicationExtensions applicationExt;
/// <summary>
+ /// Store the stylesheet value.
+ /// </summary>
+ protected string m_stylesheet;
+
+ /// <summary>
+ /// Store the window mode value.
+ /// </summary>
+ protected Dali.Application.WINDOW_MODE m_windowMode;
+
+ /// <summary>
+ /// Store the app mode value.
+ /// </summary>
+ protected APP_MODE appMode;
+
+ /// <summary>
/// The instance of the Dali Stage.
/// </summary>
public Stage stage { get; private set; }
+ /// <summary>
+ /// The default constructor.
+ /// </summary>
+ public DaliApplication():base()
+ {
+ appMode = APP_MODE.DEFAULT;
+ }
+
+ /// <summary>
+ /// The constructor with stylesheet.
+ /// </summary>
+ public DaliApplication(string stylesheet):base()
+ {
+ //handle the stylesheet
+ appMode = APP_MODE.STYLESHEETONLY;
+ m_stylesheet = stylesheet;
+ }
+
+ /// <summary>
+ /// The constructor with stylesheet and window mode.
+ /// </summary>
+ 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;
+ }
/// <summary>
/// Overrides this method if want to handle behavior before calling OnCreate().
/// </summary>
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();
base.OnLocaleChanged(e);
applicationExt.LanguageChange();
}
+
+ /// <summary>
+ /// The mode of creating Dali application.
+ /// </summary>
+ protected enum APP_MODE
+ {
+ DEFAULT = 0,
+ STYLESHEETONLY = 1,
+ STYLESHEETWITHWINDOWMODE = 2
+ }
}
}