DALi C# binding 07/72507/73
authorNick Holland <nick.holland@partner.samsung.com>
Fri, 5 Aug 2016 14:09:13 +0000 (15:09 +0100)
committerRichard Huang <r.huang@samsung.com>
Fri, 19 Aug 2016 14:07:45 +0000 (15:07 +0100)
Generated binding for overloadable operators in DALi math objects

Change-Id: Iec9b0ee03fa43d1b624eb5e683a5a91bad612354

33 files changed:
plugins/dali-swig/.gitignore [new file with mode: 0644]
plugins/dali-swig/Makefile.am [new file with mode: 0644]
plugins/dali-swig/README [new file with mode: 0644]
plugins/dali-swig/SWIG/dali-adaptor.i [new file with mode: 0644]
plugins/dali-swig/SWIG/dali-core.i [new file with mode: 0644]
plugins/dali-swig/SWIG/dali-operator.i [new file with mode: 0644]
plugins/dali-swig/SWIG/dali-toolkit.i [new file with mode: 0644]
plugins/dali-swig/SWIG/dali.i [new file with mode: 0644]
plugins/dali-swig/SWIG/signal-parameters.i [new file with mode: 0644]
plugins/dali-swig/SWIG/signals.i [new file with mode: 0644]
plugins/dali-swig/autogen.sh [new file with mode: 0755]
plugins/dali-swig/configure.ac [new file with mode: 0644]
plugins/dali-swig/constructor-generator.rb [new file with mode: 0755]
plugins/dali-swig/cpp/DaliWrapper.cpp [new file with mode: 0644]
plugins/dali-swig/cpp/DaliWrapper.h [new file with mode: 0644]
plugins/dali-swig/cpp/stdafx.h [new file with mode: 0644]
plugins/dali-swig/csharp/.gitignore [new file with mode: 0644]
plugins/dali-swig/examples/dali-test.cs [new file with mode: 0644]
plugins/dali-swig/examples/hello-world.cs [new file with mode: 0755]
plugins/dali-swig/examples/images/gallery-0.jpg [new file with mode: 0644]
plugins/dali-swig/examples/images/gallery-1.jpg [new file with mode: 0644]
plugins/dali-swig/examples/images/gallery-2.jpg [new file with mode: 0644]
plugins/dali-swig/examples/images/gallery-3.jpg [new file with mode: 0644]
plugins/dali-swig/examples/images/gallery-4.jpg [new file with mode: 0644]
plugins/dali-swig/examples/images/gallery-5.jpg [new file with mode: 0644]
plugins/dali-swig/examples/images/image-1.jpg [new file with mode: 0644]
plugins/dali-swig/examples/images/image-2.jpg [new file with mode: 0644]
plugins/dali-swig/examples/images/image-3.jpg [new file with mode: 0644]
plugins/dali-swig/examples/images/star-dim.png [new file with mode: 0644]
plugins/dali-swig/examples/images/star-highlight.png [new file with mode: 0644]
plugins/dali-swig/examples/scroll-view.cs [new file with mode: 0644]
plugins/dali-swig/property-wrapper.rb [new file with mode: 0755]
plugins/dali-swig/swig.cmd [new file with mode: 0644]

diff --git a/plugins/dali-swig/.gitignore b/plugins/dali-swig/.gitignore
new file mode 100644 (file)
index 0000000..43660d7
--- /dev/null
@@ -0,0 +1,9 @@
+*.dll
+examples/*.exe
+autom4te.cache/
+aclocal.m4
+config/
+config.*
+cpp/dali_wrap.cpp
+cpp/dali_wrap.h
+configure
diff --git a/plugins/dali-swig/Makefile.am b/plugins/dali-swig/Makefile.am
new file mode 100644 (file)
index 0000000..48e0d93
--- /dev/null
@@ -0,0 +1,75 @@
+# 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.
+
+CLEANFILES = cpp/dali_wrap.* csharp/*.cs *.so *.dll \
+             examples/*.so examples/*.dll examples/*.exe
+
+BUILT_SOURCES = cpp/dali_wrap.cpp cpp/dali_wrap.h
+
+if HAVE_MCS
+if BUILD_MCS
+
+all-local: libNDalic.so NDali.dll
+
+libNDalic.so: cpp/dali_wrap.o
+       g++ -shared cpp/dali_wrap.o -o libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
+
+cpp/dali_wrap.o: $(BUILT_SOURCES)
+       g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) cpp/dali_wrap.cpp -o cpp/dali_wrap.o
+
+NDali.dll: $(BUILT_SOURCES)
+       $(MCS) -nologo -target:library -out:NDali.dll csharp/*.cs
+
+check-local: examples/dali-test.exe \
+             examples/hello-world.exe \
+             examples/scroll-view.exe \
+             examples/libNDalic.so examples/NDali.dll
+
+examples/%.exe: examples/%.cs
+       $(MCS) -nologo -target:exe -out:$@ -reference:NDali.dll $<
+
+examples/libNDalic.so: libNDalic.so
+       cd examples && ln -sf ../libNDalic.so
+
+examples/NDali.dll: NDali.dll
+       cd examples && ln -sf ../NDali.dll
+
+endif
+endif
+
+# use swig to generate the CS wrapper code
+# then call our property-wrapper to inject DALi property getters / setters
+$(BUILT_SOURCES): SWIG/*.i
+       rm -f csharp/*.cs
+       $(SWIG) -csharp -c++ -outdir csharp \
+            $(DALI_CFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) -namespace Dali -o cpp/dali_wrap.cpp SWIG/dali.i
+       ./property-wrapper.rb
+       ./constructor-generator.rb
+
+dist-hook: $(BUILT_SOURCES)
+       mkdir -p $(distdir)/cpp
+       cp ./cpp/dali_wrap.cpp $(distdir)/cpp
+       cp ./cpp/dali_wrap.h $(distdir)/cpp
+       cp ./cpp/DaliWrapper.h ./cpp/DaliWrapper.cpp $(distdir)/cpp
+       cp ./cpp/stdafx.h $(distdir)/cpp
+       mkdir -p $(distdir)/csharp
+       cp ./csharp/*.csproj $(distdir)/csharp
+       cp ./csharp/*.cs $(distdir)/csharp
+       mkdir -p $(distdir)/examples
+       cp ./examples/*.csproj $(distdir)/examples
+       cp ./examples/*.cs $(distdir)/examples
+
+EXTRA_DIST = \
+    swig.cmd
+
diff --git a/plugins/dali-swig/README b/plugins/dali-swig/README
new file mode 100644 (file)
index 0000000..6cc67c4
--- /dev/null
@@ -0,0 +1,21 @@
+To build C# binding for Ubuntu desktop using SWIG for the first time:
+
+./autogen.sh
+./configure
+make
+
+To build C# binding for Ubuntu desktop using SWIG after updating:
+
+make maintainer-clean
+./configure
+make
+
+To build C# examples with the C# binding together for Ubuntu desktop:
+
+make check
+
+To run examples on Ubuntu desktop:
+
+cd examples
+DALI_WINDOW_WIDTH=480 DALI_WINDOW_HEIGHT=800 ./hello-world.exe
+
diff --git a/plugins/dali-swig/SWIG/dali-adaptor.i b/plugins/dali-swig/SWIG/dali-adaptor.i
new file mode 100644 (file)
index 0000000..ddd74c3
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * 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.
+ *
+ */
+
+%ignore *::Application(Internal::Adaptor::Application*);
+%ignore *::DragAndDropDetector(Internal::Adaptor::DragAndDropDetector*);
+%ignore *::Timer(Internal::Adaptor::Timer*);
+%ignore *::Window(Internal::Adaptor::Window*);
+
+%rename(StyleChangeType) Dali::StyleChange::Type;
+
+%include <dali/public-api/adaptor-framework/style-change.h>
+%include <dali/public-api/adaptor-framework/timer.h>
+%include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
+%include <dali/public-api/adaptor-framework/window.h>
+
+#if defined(SWIGCSHARP)
+
+// %include <arrays_csharp.i>
+// CSHARP_ARRAYS(char **, string)
+// %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray, SizeParamIndex=0, ArraySubType=global::System.Runtime.InteropServices.UnmanagedType.LPStr)]") char **INPUT[] "string[]"
+// %apply int *INPUT { int *argc };
+// %apply char **INPUT[]  { char **argv[] };
+
+%{
+  // keep argcs and argv so they're always available to DALi
+  int argC = 1;
+  char **argV = NULL;
+%}
+
+// Temporary hack to generate argv. Todo... support conversions from the C# strings[] in the argv that is generated below
+
+%typemap(in) ( int* argc, char **argv[]  ) {
+
+  // Todo generate argv data from the C# args
+  char **array;         // two dimensional array
+  int numStrings = 1;     // number of strings
+  int stringLength = 30;      // max string length.
+  array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
+  argV = array;
+
+  // allocate the string data
+  for( int i=0; i < numStrings; i++)
+  {
+    array[i]=(char *)malloc( stringLength * sizeof(char *) );
+  }
+  array[ numStrings ] =  NULL; // we allocated +1 for hold the NULL part
+
+  strcpy( array[0], "dali-csharp-app");
+
+  $1 = &argC;
+  $2 = &argV;
+}
+
+// add interop services to the file
+//%typemap(csimports) Dali::Application "using System.Runtime.InteropServices;"
+
+%csmethodmodifiers Dali::Application::New() "
+  /**
+  * Outer::outer_method(int)
+  */
+  public";
+
+%typemap(cscode) Dali::Application %{
+
+  private static  Application instance; // singleton
+
+  public delegate void InitDelegate();
+
+  public delegate void TerminateDelegate();
+
+  public delegate void PauseDelegate();
+
+  public delegate void ResumeDelegate();
+
+  public delegate void ResizeDelegate();
+
+  public delegate void AppControlDelegate();
+
+  public delegate void LanguageChangedDelegate();
+
+  public delegate void RegionChangedDelegate();
+
+  public delegate void BatteryLowDelegate();
+
+  public delegate void MemoryLowDelegate();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void InitDelegateInternal();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void TerminateDelegateInternal();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void PauseDelegateInternal();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void ResumeDelegateInternal();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void ResizeDelegateInternal();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void AppControlDelegateInternal();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void LanguageChangedDelegateInternal();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void RegionChangedDelegateInternal();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void BatteryLowDelegateInternal();
+
+  [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+  internal delegate void MemoryLowDelegateInternal();
+
+  static void Initialize()
+  {
+  //   instance.InitDelegate();
+  }
+
+ public static Application ApplicationFromPtr(global::System.IntPtr cPtr) {
+    Application ret = new Application(cPtr, false);
+       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  internal void SetupDelegates() {
+    InitDelegateInternal initializeCallback = new InitDelegateInternal( Initialize );
+    System.Console.WriteLine( "InitSignal connection count");
+
+    this.InitSignal().Connect( initializeCallback );
+    //Console.WriteLine( "InitSignal connection count = " + app.InitSignal().GetConnectionCount() );
+ }
+
+   public static Application NewApplication() {
+    Application ret = New(1);
+       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+    // we've got an application now connect the signals
+    ret.SetupDelegates();
+    // set the singleton
+
+    return ret;
+  }
+
+%}
+
+%typemap(in) ( int* argc, char **argv[]  ) {
+
+  // Todo generate argv data from the C# args
+  char **array;         // two dimensional array
+  int numStrings = 1;     // number of strings
+  int stringLength = 30;      // max string length.
+  array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
+  argV = array;
+
+  // allocate the string data
+  for( int i=0; i < numStrings; i++)
+  {
+    array[i]=(char *)malloc( stringLength * sizeof(char *) );
+  }
+  array[ numStrings ] =  NULL; // we allocated +1 for hold the NULL part
+
+  strcpy( array[0], "dali-csharp-app");
+
+  $1 = &argC;
+  $2 = &argV;
+}
+
+%apply int* INPUT { int* argc };
+
+#endif
+
+%include <dali/public-api/adaptor-framework/application.h>
+
+%template(ApplicationSignal) Dali::Signal<void(Dali::Application&)>;
+%template(ApplicationControlSignal) Dali::Signal<void(Dali::Application&, void*)>;
+%template(TimerSignalType) Dali::Signal<bool()>;
+
+
+// Application specialisation
+// Macro to convert from a void * callback to a DALi C# object
+
diff --git a/plugins/dali-swig/SWIG/dali-core.i b/plugins/dali-swig/SWIG/dali-core.i
new file mode 100644 (file)
index 0000000..e941834
--- /dev/null
@@ -0,0 +1,294 @@
+/*
+ * 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.
+ *
+ */
+
+%apply int& INOUT { int& integerValue };
+%apply float& INOUT { float& floatValue };
+%apply bool& INOUT { bool& boolValue };
+%apply float& OUTPUT { float& localX };
+%apply float& OUTPUT { float& localY };
+%apply float& OUTPUT { float& viewportX };
+%apply float& OUTPUT { float& viewportY };
+
+#if defined(SWIGCSHARP)
+
+%include arrays_csharp.i
+%apply unsigned char INPUT[] { unsigned char* pixelBuffer}
+%apply unsigned char INPUT[] { unsigned char* buffer}
+%apply unsigned char INPUT[] { unsigned char* at}
+%apply unsigned char INPUT[] { unsigned char* iterator}
+%apply unsigned char INPUT[] { unsigned char* first}
+//%apply unsigned char OUTPUT[] { unsigned char* GetBuffer}
+//%apply unsigned char OUTPUT[] { unsigned char* Begin}
+//%apply unsigned char OUTPUT[] { unsigned char* End}
+%apply unsigned char OUTPUT[] { unsigned char* ValueOfIndex}
+%apply unsigned short INPUT[] { unsigned short* indices}
+%apply float INPUT[] { float* array }
+
+#endif
+
+%ignore *::Animation(Internal::Animation*);
+%ignore *::Actor(Internal::Actor*);
+%ignore *::BufferImage(Internal::BufferImage*);
+%ignore *::CameraActor(Internal::CameraActor*);
+%ignore *::CustomActor(Internal::CustomActor*);
+%ignore *::EncodedBufferImage(Internal::EncodedBufferImage*);
+%ignore *::FrameBuffer(Internal::FrameBuffer*);
+%ignore *::FrameBufferImage(Internal::FrameBufferImage*);
+%ignore *::Geometry(Internal::Geometry*);
+%ignore *::Handle(Dali::Internal::Object*);
+%ignore *::Image(Internal::Image*);
+%ignore *::KeyFrames(Internal::KeyFrames*);
+%ignore *::Layer(Internal::Layer*);
+%ignore *::LinearConstrainer(Internal::LinearConstrainer*);
+%ignore *::LongPressGestureDetector(Internal::LongPressGestureDetector*);
+%ignore *::NativeImage(Internal::NativeImage*);
+%ignore *::NinePatchImage(Internal::NinePatchImage*);
+%ignore *::ObjectRegistry(Internal::ObjectRegistry*);
+%ignore *::PanGestureDetector(Internal::PanGestureDetector*);
+%ignore *::Path(Internal::Path*);
+%ignore *::PathConstrainer(Internal::PathConstrainer*);
+%ignore *::PinchGestureDetector(Internal::PinchGestureDetector*);
+%ignore *::PixelData(Internal::PixelData*);
+%ignore *::PropertyBuffer(Internal::PropertyBuffer*);
+%ignore *::PropertyNotification(Internal::PropertyNotification*);
+%ignore *::Renderer(Internal::Renderer*);
+%ignore *::RenderTask(Internal::RenderTask*);
+%ignore *::RenderTaskList(Internal::RenderTaskList*);
+%ignore *::ResourceImage(Internal::ResourceImage*);
+%ignore *::Sampler(Internal::Sampler*);
+%ignore *::Shader(Internal::Shader*);
+%ignore *::Stage(Internal::Stage*);
+%ignore *::TapGestureDetector(Internal::TapGestureDetector*);
+%ignore *::Texture(Internal::NewTexture*);
+%ignore *::TextureSet(Internal::TextureSet*);
+%ignore *::TouchData(Internal::TouchData*);
+%ignore *::TypeInfo(Internal::TypeInfo*);
+%ignore *::GetExtension();
+%ignore *::Initialize(Internal::CustomActor&);
+%ignore *::GetOwner() const;
+
+%rename(ParentOriginDefault) Dali::ParentOrigin::DEFAULT;
+%rename(ParentOriginTop) Dali::ParentOrigin::TOP;
+%rename(ParentOriginBottom) Dali::ParentOrigin::BOTTOM;
+%rename(ParentOriginLeft) Dali::ParentOrigin::LEFT;
+%rename(ParentOriginRight) Dali::ParentOrigin::RIGHT;
+%rename(ParentOriginMiddle) Dali::ParentOrigin::MIDDLE;
+%rename(ParentOriginTopLeft) Dali::ParentOrigin::TOP_LEFT;
+%rename(ParentOriginTopCenter) Dali::ParentOrigin::TOP_CENTER;
+%rename(ParentOriginTopRight) Dali::ParentOrigin::TOP_RIGHT;
+%rename(ParentOriginCenterLeft) Dali::ParentOrigin::CENTER_LEFT;
+%rename(ParentOriginCenter) Dali::ParentOrigin::CENTER;
+%rename(ParentOriginCenterRight) Dali::ParentOrigin::CENTER_RIGHT;
+%rename(ParentOriginBottomLeft) Dali::ParentOrigin::BOTTOM_LEFT;
+%rename(ParentOriginBottomCenter) Dali::ParentOrigin::BOTTOM_CENTER;
+%rename(ParentOriginBottomRight) Dali::ParentOrigin::BOTTOM_RIGHT;
+%rename(AnchorPointDefault) Dali::AnchorPoint::DEFAULT;
+%rename(AnchorPointTop) Dali::AnchorPoint::TOP;
+%rename(AnchorPointBottom) Dali::AnchorPoint::BOTTOM;
+%rename(AnchorPointLeft) Dali::AnchorPoint::LEFT;
+%rename(AnchorPointRight) Dali::AnchorPoint::RIGHT;
+%rename(AnchorPointMiddle) Dali::AnchorPoint::MIDDLE;
+%rename(AnchorPointTopLeft) Dali::AnchorPoint::TOP_LEFT;
+%rename(AnchorPointTopCenter) Dali::AnchorPoint::TOP_CENTER;
+%rename(AnchorPointTopRight) Dali::AnchorPoint::TOP_RIGHT;
+%rename(AnchorPointCenterLeft) Dali::AnchorPoint::CENTER_LEFT;
+%rename(AnchorPointCenter) Dali::AnchorPoint::CENTER;
+%rename(AnchorPointCenterRight) Dali::AnchorPoint::CENTER_RIGHT;
+%rename(AnchorPointBottomLeft) Dali::AnchorPoint::BOTTOM_LEFT;
+%rename(AnchorPointBottomCenter) Dali::AnchorPoint::BOTTOM_CENTER;
+%rename(AnchorPointBottomRight) Dali::AnchorPoint::BOTTOM_RIGHT;
+%rename(ConvertToFloat) operator float;
+%rename(DimensionType) Dali::Dimension::Type;
+%rename(ResizePolicyType) Dali::ResizePolicy::Type;
+%rename(ResizePolicyDefault) Dali::ResizePolicy::DEFAULT;
+%rename(SizeScalePolicyType) Dali::SizeScalePolicy::Type;
+%rename(HorizontalAlignmentType) Dali::HorizontalAlignment::Type;
+%rename(VerticalAlignmentType) Dali::VerticalAlignment::Type;
+%rename(FilterModeType) Dali::FilterMode::Type;
+%rename(WrapModeType) Dali::WrapMode::Type;
+%rename(PixelFormat) Dali::Pixel::Format;
+%rename(TextureType) Dali::TextureType::Type;
+%rename(FaceCullingModeType) Dali::FaceCullingMode::Type;
+%rename(BlendModeType) Dali::BlendMode::Type;
+%rename(BlendEquationType) Dali::BlendEquation::Type;
+%rename(BlendFactorType) Dali::BlendFactor::Type;
+%rename(DepthWriteModeType) Dali::DepthWriteMode::Type;
+%rename(DepthTestModeType) Dali::DepthTestMode::Type;
+%rename(DepthFunctionType) Dali::DepthFunction::Type;
+%rename(StencilFunctionType) Dali::StencilFunction::Type;
+%rename(StencilModeType) Dali::StencilMode::Type;
+%rename(StencilOperationType) Dali::StencilOperation::Type;
+%rename(DrawModeType) Dali::DrawMode::Type;
+%rename(PointStateType) Dali::PointState::Type;
+%rename(FittingModeType) Dali::FittingMode::Type;
+%rename(FittingModeDefault) Dali::FittingMode::DEFAULT;
+%rename(SamplingModeType) Dali::SamplingMode::Type;
+%rename(RenderBufferFormat) Dali::RenderBuffer::Format;
+%rename(BlendingModeType) Dali::BlendingMode::Type;
+%rename(BlendingFactorType) Dali::BlendingFactor::Type;
+%rename(BlendingEquationType) Dali::BlendingEquation::Type;
+%rename(CameraType) Dali::Camera::Type;
+%rename(LayerBehavior) Dali::Layer::Behavior;
+
+typedef std::pair<std::string, Dali::Property::Value> StringValuePair;
+typedef std::vector<Dali::TouchPoint> TouchPointContainer;
+typedef std::pair< Dali::Radian, Dali::Radian > AngleThresholdPair;
+
+%include <dali/public-api/object/ref-object.h>
+%include <dali/public-api/object/any.h>
+
+%include <dali/public-api/common/intrusive-ptr.h>
+
+%include <dali/public-api/math/vector2.h>
+%include <dali/public-api/math/vector3.h>
+%include <dali/public-api/math/vector4.h>
+%include <dali/public-api/math/rect.h>
+%include <dali/public-api/math/uint-16-pair.h>
+%include <dali/public-api/math/degree.h>
+%include <dali/public-api/math/radian.h>
+%include <dali/public-api/math/quaternion.h>
+%include <dali/public-api/math/matrix.h>
+%include <dali/public-api/math/matrix3.h>
+%include <dali/public-api/math/random.h>
+%include <dali/public-api/math/angle-axis.h>
+%include <dali/public-api/math/viewport.h>
+
+%include <dali/public-api/object/property-index-ranges.h>
+%include <dali/public-api/object/property.h>
+%include <dali/public-api/object/property-array.h>
+%include <dali/public-api/object/property-map.h>
+%include <dali/public-api/object/property-types.h>
+%include <dali/public-api/object/property-value.h>
+%include <dali/public-api/object/base-object.h>
+%include <dali/public-api/object/base-handle.h>
+
+%include <dali/public-api/signals/connection-tracker-interface.h>
+%include <dali/public-api/signals/signal-slot-observers.h>
+%include <dali/public-api/signals/connection-tracker.h>
+%include <dali/public-api/signals/dali-signal.h>
+
+%include <dali/public-api/object/object-registry.h>
+%include <dali/public-api/object/property-conditions.h>
+%include <dali/public-api/object/property-notification-declarations.h>
+%include <dali/public-api/object/property-notification.h>
+%include <dali/public-api/object/handle.h>
+%include <dali/public-api/object/type-info.h>
+
+%include <dali/public-api/common/constants.h>
+%include <dali/public-api/actors/actor-enumerations.h>
+%include <dali/public-api/common/dali-vector.h>
+%include <dali/public-api/common/vector-wrapper.h>
+
+%include <dali/public-api/images/image.h>
+%include <dali/public-api/actors/sampling.h>
+%include <dali/public-api/images/pixel.h>
+%include <dali/public-api/images/pixel-data.h>
+
+%include <dali/public-api/rendering/texture.h>
+%include <dali/public-api/rendering/sampler.h>
+%include <dali/public-api/rendering/texture-set.h>
+%include <dali/public-api/rendering/property-buffer.h>
+%include <dali/public-api/rendering/geometry.h>
+%include <dali/public-api/rendering/shader.h>
+%include <dali/public-api/rendering/renderer.h>
+%include <dali/public-api/actors/draw-mode.h>
+%include <dali/public-api/common/loading-state.h>
+%include <dali/public-api/rendering/frame-buffer.h>
+%include <dali/public-api/render-tasks/render-task-list.h>
+%include <dali/public-api/render-tasks/render-task.h>
+
+%include <dali/public-api/events/touch-point.h>
+%include <dali/public-api/events/point-state.h>
+%include <dali/public-api/events/touch-data.h>
+%include <dali/public-api/events/gesture-detector.h>
+%include <dali/public-api/events/gesture.h>
+%include <dali/public-api/events/hover-event.h>
+%include <dali/public-api/events/key-event.h>
+%include <dali/public-api/events/long-press-gesture-detector.h>
+%include <dali/public-api/events/long-press-gesture.h>
+%include <dali/public-api/events/wheel-event.h>
+
+%include <dali/public-api/actors/actor.h>
+%include <dali/public-api/actors/layer.h>
+%include <dali/public-api/common/stage.h>
+%include <dali/public-api/size-negotiation/relayout-container.h>
+%include <dali/public-api/actors/custom-actor-impl.h>
+%include <dali/public-api/actors/custom-actor.h>
+
+%include <dali/public-api/events/pan-gesture-detector.h>
+%include <dali/public-api/events/pan-gesture.h>
+%include <dali/public-api/events/pinch-gesture-detector.h>
+%include <dali/public-api/events/pinch-gesture.h>
+%include <dali/public-api/events/tap-gesture-detector.h>
+%include <dali/public-api/events/tap-gesture.h>
+%include <dali/public-api/events/touch-event.h>
+
+%include <dali/public-api/animation/alpha-function.h>
+%include <dali/public-api/animation/key-frames.h>
+%include <dali/public-api/animation/path.h>
+%include <dali/public-api/animation/time-period.h>
+%include <dali/public-api/animation/animation.h>
+%include <dali/public-api/animation/linear-constrainer.h>
+%include <dali/devel-api/animation/path-constrainer.h>
+
+%include <dali/public-api/common/view-mode.h>
+%include <dali/public-api/images/image-operations.h>
+%include <dali/public-api/images/buffer-image.h>
+%include <dali/public-api/images/encoded-buffer-image.h>
+%include <dali/public-api/images/native-image.h>
+%include <dali/public-api/images/native-image-interface.h>
+%include <dali/public-api/images/resource-image.h>
+%include <dali/public-api/images/nine-patch-image.h>
+%include <dali/public-api/images/frame-buffer-image.h>
+
+%include <dali/public-api/actors/blending.h>
+%include <dali/public-api/actors/camera-actor.h>
+
+%template(StringValuePair) std::pair<std::string, Dali::Property::Value>;
+%template(TouchPointContainer) std::vector<Dali::TouchPoint>;
+%template(RectDouble) Dali::Rect<double>;
+%template(RectInteger)  Dali::Rect<int>;
+%template(RectUnsignedInteger)  Dali::Rect<unsigned int>;
+%template(RectFloat)  Dali::Rect<float>;
+%template(VectorInteger) Dali::Vector<int>;
+%template(VectorFloat) Dali::Vector<float>;
+%template(VectorUnsignedChar) Dali::Vector<unsigned char>;
+%template(VectorUint16Pair) Dali::Vector<Dali::Uint16Pair>;
+%template(VoidSignal) Dali::Signal<void()>;
+%template(BoolSignal) Dali::Signal<bool()>;
+%template(FloatSignal) Dali::Signal<void(float)>;
+%template(ObjectCreatedSignal) Dali::Signal<void(Dali::BaseHandle)>;
+%template(ObjectDestroyedSignal) Dali::Signal<void(const Dali::RefObject*)>;
+%template(PropertyNotifySignal) Dali::Signal<void(Dali::PropertyNotification&)>;
+%template(ImageSignal) Dali::Signal<void(Dali::Image)>;
+%template(RenderTaskSignal) Dali::Signal<void(Dali::RenderTask&)>;
+%template(LongPressGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::LongPressGesture&)>;
+%template(ActorTouchEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchEvent&)>;
+%template(ActorTouchDataSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchData&)>;
+%template(ActorHoverEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::HoverEvent&)>;
+%template(ActorWheelEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::WheelEvent&)>;
+%template(ActorSignal) Dali::Signal<void (Dali::Actor)>;
+%template(KeyEventSignal) Dali::Signal<void (const Dali::KeyEvent&)>;
+%template(TouchEventSignal) Dali::Signal<void (const Dali::TouchEvent&)>;
+%template(TouchSignal) Dali::Signal<void (const Dali::TouchData&)>;
+%template(StageWheelEventSignal) Dali::Signal<void (const Dali::WheelEvent&)>;
+%template(AngleThresholdPair) std::pair<Dali::Radian, Dali::Radian>;
+%template(PanGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::PanGesture&)>;
+%template(PinchGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::PinchGesture&)>;
+%template(TapGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::TapGesture&)>;
+%template(AnimationSignal) Dali::Signal<void(Dali::Animation&)>;
+%template(ResourceImageSignal) Dali::Signal<void(Dali::ResourceImage)>;
diff --git a/plugins/dali-swig/SWIG/dali-operator.i b/plugins/dali-swig/SWIG/dali-operator.i
new file mode 100644 (file)
index 0000000..9554651
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+ * 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.
+ *
+ */
+
+// common name mappings
+#if defined(SWIGCSHARP)
+%rename(Assign)            operator=;
+%rename(Add)               operator+;
+%rename(AddAssign)         operator+=;
+%rename(Subtract)          operator-;
+%rename(SubtractAssign)    operator-=;
+%rename(Multiply)          operator*;
+%rename(MultiplyAssign)    operator*=;
+%rename(Divide)            operator/;
+%rename(DivideAssign)      operator/=;
+%rename(Assign)            operator=;
+%rename(EqualTo)           operator==;
+%rename(NotEqualTo)        operator!=;
+%rename(LessThan)          operator<;
+%rename(GreaterThan)       operator>;
+%rename(ValueOfIndex)      operator[];
+#endif
+
+%typemap(cscode) Dali::Vector2 %{
+  public static Vector2 operator+(Vector2 arg1, Vector2 arg2) {
+    return arg1.Add(arg2);
+  }
+  
+  public static Vector2 operator-(Vector2 arg1, Vector2 arg2) {
+    return arg1.Subtract(arg2);
+  }
+
+  public static Vector2 operator-(Vector2 arg1) {
+    return arg1.Subtract();
+  }
+
+  public static Vector2 operator*(Vector2 arg1, Vector2 arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Vector2 operator*(Vector2 arg1, float arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Vector2 operator/(Vector2 arg1, Vector2 arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public static Vector2 operator/(Vector2 arg1, float arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public float this[uint index]
+  {
+    get
+    {
+      return ValueOfIndex(index);
+    }
+  }
+%}
+
+%typemap(cscode) Dali::Vector3 %{
+  public static Vector3 operator+(Vector3 arg1, Vector3 arg2) {
+    return arg1.Add(arg2);
+  }
+  
+  public static Vector3 operator-(Vector3 arg1, Vector3 arg2) {
+    return arg1.Subtract(arg2);
+  }
+
+  public static Vector3 operator-(Vector3 arg1) {
+    return arg1.Subtract();
+  }
+
+  public static Vector3 operator*(Vector3 arg1, Vector3 arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Vector3 operator*(Vector3 arg1, float arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Vector3 operator/(Vector3 arg1, Vector3 arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public static Vector3 operator/(Vector3 arg1, float arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public float this[uint index]
+  {
+    get
+    {
+      return ValueOfIndex(index);
+    }
+  }
+%}
+
+%typemap(cscode) Dali::Vector4 %{
+  public static Vector4 operator+(Vector4 arg1, Vector4 arg2) {
+    return arg1.Add(arg2);
+  }
+  
+  public static Vector4 operator-(Vector4 arg1, Vector4 arg2) {
+    return arg1.Subtract(arg2);
+  }
+
+  public static Vector4 operator-(Vector4 arg1) {
+    return arg1.Subtract();
+  }
+
+  public static Vector4 operator*(Vector4 arg1, Vector4 arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Vector4 operator*(Vector4 arg1, float arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Vector4 operator/(Vector4 arg1, Vector4 arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public static Vector4 operator/(Vector4 arg1, float arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public float this[uint index]
+  {
+    get
+    {
+      return ValueOfIndex(index);
+    }
+  }
+%}
+
+%typemap(cscode) Dali::Matrix %{
+  public static Vector4 operator*(Matrix arg1, Vector4 arg2) {
+    return arg1.Multiply(arg2);
+  }
+%}
+
+%typemap(cscode) Dali::Quaternion %{
+  public static Quaternion operator+(Quaternion arg1, Quaternion arg2) {
+    return arg1.Add(arg2);
+  }
+  
+  public static Quaternion operator-(Quaternion arg1, Quaternion arg2) {
+    return arg1.Subtract(arg2);
+  }
+
+  public static Quaternion operator-(Quaternion arg1) {
+    return arg1.Subtract();
+  }
+
+  public static Quaternion operator*(Quaternion arg1, Quaternion arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Vector3 operator*(Quaternion arg1, Vector3 arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Quaternion operator*(Quaternion arg1, float arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Quaternion operator/(Quaternion arg1, Quaternion arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public static Quaternion operator/(Quaternion arg1, float arg2) {
+    return arg1.Divide(arg2);
+  }
+%}
+
+%typemap(cscode) Dali::Property::Array %{
+  public Property.Value this[uint index]
+  {
+    get
+    {
+      return ValueOfIndex(index);
+    }
+  }
+%}
+
+%typemap(cscode) Dali::Property::Map %{
+  public Property.Value this[string key]
+  {
+    get
+    {
+      return ValueOfIndex(key);
+    }
+  }
+
+  public Property.Value this[int key]
+  {
+    get
+    {
+      return ValueOfIndex(key);
+    }
+  }
+%}
+
+%typemap(cscode) Dali::Uint16Pair %{
+  public static bool operator<(Uint16Pair arg1, Uint16Pair arg2) {
+    return arg1.LessThan(arg2);
+  }
+  
+  public static bool operator>(Uint16Pair arg1, Uint16Pair arg2) {
+    return arg1.GreaterThan(arg2);
+  }
+%}
+
+/**
+ * Extend the C++ base handle to include  a IsHandleEmpty() function
+ * This is because from C# we can't wrap the operator BooleanType() function
+ */
+%extend Dali::BaseHandle {
+   bool IsHandleEmpty() const {
+     if( *$self )
+     {
+       return true;
+     }
+     else
+     {
+       return false;
+     }
+    }
+};
+
+/**
+ * Extend C# base handle to support true / false testing of base handle
+ * so we can do
+ *  if ( actor )
+ *  {
+ *    ...
+ *  }
+ */
+%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();
+ }
+%}
+
+
diff --git a/plugins/dali-swig/SWIG/dali-toolkit.i b/plugins/dali-swig/SWIG/dali-toolkit.i
new file mode 100644 (file)
index 0000000..63c28f6
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * 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.
+ *
+ */
+%apply unsigned int& OUTPUT { unsigned int& volume };
+
+%ignore *::AccessibilityManager(Internal::AccessibilityManager*);
+%ignore *::Alignment(Internal::Alignment&);
+%ignore *::Alignment(Dali::Internal::CustomActor*);
+%ignore *::Button(Internal::Button&);
+%ignore *::Button(Dali::Internal::CustomActor*);
+%ignore *::CheckBoxButton(Internal::CheckBoxButton&);
+%ignore *::CheckBoxButton(Dali::Internal::CustomActor*);
+%ignore *::Control(Dali::Internal::CustomActor*);
+%ignore *::FlexContainer(Internal::FlexContainer&);
+%ignore *::FlexContainer(Dali::Internal::CustomActor*);
+%ignore *::GaussianBlurView(Internal::GaussianBlurView&);
+%ignore *::GaussianBlurView(Dali::Internal::CustomActor*);
+%ignore *::ImageView(Internal::ImageView&);
+%ignore *::ImageView(Dali::Internal::CustomActor*);
+%ignore *::ItemView(Internal::ItemView&);
+%ignore *::ItemView(Dali::Internal::CustomActor*);
+%ignore *::KeyboardFocusManager(Internal::KeyboardFocusManager*);
+%ignore *::Model3dView(Internal::Model3dView&);
+%ignore *::Model3dView(Dali::Internal::CustomActor*);
+%ignore *::PageTurnLandscapeView(Internal::PageTurnLandscapeView&);
+%ignore *::PageTurnLandscapeView(Dali::Internal::CustomActor*);
+%ignore *::PageTurnPortraitView(Internal::PageTurnPortraitView&);
+%ignore *::PageTurnPortraitView(Dali::Internal::CustomActor*);
+%ignore *::PageTurnView(Internal::PageTurnView&);
+%ignore *::PageTurnView(Dali::Internal::CustomActor*);
+%ignore *::Popup(Internal::Popup&);
+%ignore *::Popup(Dali::Internal::CustomActor*);
+%ignore *::PushButton(Internal::PushButton&);
+%ignore *::PushButton(Dali::Internal::CustomActor*);
+%ignore *::RadioButton(Internal::RadioButton&);
+%ignore *::RadioButton(Dali::Internal::CustomActor*);
+%ignore *::Scrollable(Internal::Scrollable&);
+%ignore *::Scrollable(Dali::Internal::CustomActor*);
+%ignore *::ScrollBar(Internal::ScrollBar&);
+%ignore *::ScrollBar(Dali::Internal::CustomActor*);
+%ignore *::ScrollView(Internal::ScrollView&);
+%ignore *::ScrollView(Dali::Internal::CustomActor*);
+%ignore *::ScrollViewEffect(Internal::ScrollViewEffect*);
+%ignore *::Slider(Internal::Slider&);
+%ignore *::Slider(Dali::Internal::CustomActor*);
+%ignore *::StyleManager(Internal::StyleManager*);
+%ignore *::TableView(Internal::TableView&);
+%ignore *::TableView(Dali::Internal::CustomActor*);
+%ignore *::TextEditor(Internal::TextEditor&);
+%ignore *::TextEditor(Dali::Internal::CustomActor*);
+%ignore *::TextField(Internal::TextField&);
+%ignore *::TextField(Dali::Internal::CustomActor*);
+%ignore *::TextLabel(Internal::TextLabel&);
+%ignore *::TextLabel(Dali::Internal::CustomActor*);
+%ignore *::VideoView(Internal::VideoView&);
+%ignore *::VideoView(Dali::Internal::CustomActor*);
+%ignore *::VisualFactory(Dali::Internal::VisualFactory*);
+%ignore *::Base(Dali::Internal::Visual::Base*);
+%ignore *::GetExtension();
+%ignore *::GetControlExtension();
+
+%rename(ControlImpl) Dali::Toolkit::Internal::Control;
+%rename(VisualBase) Dali::Toolkit::Visual::Base;
+%rename(ControlOrientationType) Dali::Toolkit::ControlOrientation::Type;
+%rename(DefaultItemLayoutType) Dali::Toolkit::DefaultItemLayout::Type;
+%rename(NewItemLayout) Dali::Toolkit::DefaultItemLayout::New;
+%rename(ContentDirectionType) Dali::Toolkit::FlexContainer::ContentDirection;
+%rename(FlexDirectionType) Dali::Toolkit::FlexContainer::FlexDirection;
+%rename(IluminationTypeEnum) Dali::Toolkit::Model3dView::IlluminationType;
+%rename(DisplayStateType) Dali::Toolkit::Popup::DisplayState;
+%rename(ContextualModeType) Dali::Toolkit::Popup::ContextualMode;
+%rename(AnimationModeType) Dali::Toolkit::Popup::AnimationMode;
+%rename(IndicatorHeightPolicyType) Dali::Toolkit::ScrollBar::IndicatorHeightPolicy;
+%rename(ExceedPolicyType) Dali::Toolkit::TextField::ExceedPolicy;
+%rename(ToolkitPropertyRange) Dali::Toolkit::PropertyRanges;
+%rename(VisualType) Dali::Toolkit::Visual::Type;
+%rename(VisualShaderType) Dali::Toolkit::Visual::Shader::Property;
+%rename(GradientVisualUnitsType) Dali::Toolkit::GradientVisual::Units::Type;
+%rename(GradientVisualSpreadMethodType) Dali::Toolkit::GradientVisual::SpreadMethod::Type;
+%rename(MeshVisualShadingModeValue) Dali::Toolkit::MeshVisual::ShadingMode::Value;
+%rename(PrimitiveVisualShapeType) Dali::Toolkit::PrimitiveVisual::Shape::Type;
+%rename(PRIMITIVE_VISUAL_COLOR) Dali::Toolkit::PrimitiveVisual::Property::COLOR;
+%rename(PRIMITIVE_VISUAL_LIGHT_POSITION) Dali::Toolkit::PrimitiveVisual::Property::LIGHT_POSITION;
+%rename(VISUAL_PROPERTY_TYPE) Dali::Toolkit::Visual::Property::TYPE;
+%rename(VISUAL_PROPERTY_SHADER) Dali::Toolkit::Visual::Property::SHADER;
+%rename(IMAGE_VISUAL_URL) Dali::Toolkit::ImageVisual::Property::URL;
+%rename(IMAGE_VISUAL_FITTING_MODE) Dali::Toolkit::ImageVisual::Property::FITTING_MODE;
+%rename(IMAGE_VISUAL_SAMPLING_MODE) Dali::Toolkit::ImageVisual::Property::SAMPLING_MODE;
+%rename(IMAGE_VISUAL_DESIRED_WIDTH) Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH;
+%rename(IMAGE_VISUAL_DESIRED_HEIGHT) Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT;
+%rename(IMAGE_VISUAL_SYNCHRONOUS_LOADING) Dali::Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING;
+%rename(IMAGE_VISUAL_BORDER_ONLY) Dali::Toolkit::ImageVisual::Property::BORDER_ONLY;
+
+%csconstvalue("PropertyRanges.PROPERTY_REGISTRATION_START_INDEX") PROPERTY_START_INDEX;
+%csconstvalue("Control.PropertyRange.PROPERTY_START_INDEX+1000") PROPERTY_END_INDEX;
+%csconstvalue("PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX") CHILD_PROPERTY_START_INDEX;
+%csconstvalue("PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX+1000") CHILD_PROPERTY_END_INDEX;
+%csconstvalue("PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX") ANIMATABLE_PROPERTY_START_INDEX;
+%csconstvalue("PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX+1000") ANIMATABLE_PROPERTY_END_INDEX;
+%csconstvalue("PropertyRanges.CORE_PROPERTY_MAX_INDEX+1") VISUAL_PROPERTY_BASE_START_INDEX;
+%csconstvalue("1 << 5") REQUIRES_STYLE_CHANGE_SIGNALS;
+%csconstvalue("1 << 6") REQUIRES_KEYBOARD_NAVIGATION_SUPPORT;
+
+typedef unsigned int ItemId;
+typedef std::vector<ItemId> ItemIdContainer;
+typedef std::pair<ItemId, Actor> Item;
+typedef std::vector<Item> ItemContainer;
+typedef Dali::IntrusivePtr<Dali::Toolkit::Ruler> RulerPtr;
+
+%include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
+
+%include <dali-toolkit/public-api/visuals/visual-properties.h>
+%include <dali-toolkit/public-api/visuals/border-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/color-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
+
+%include <dali-toolkit/devel-api/builder/builder.h>
+
+%include <dali-toolkit/public-api/controls/control-impl.h>
+%include <dali-toolkit/public-api/controls/control.h>
+
+%include <dali-toolkit/public-api/controls/alignment/alignment.h>
+%include <dali-toolkit/public-api/controls/buttons/button.h>
+%include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
+%include <dali-toolkit/public-api/controls/buttons/push-button.h>
+%include <dali-toolkit/public-api/controls/buttons/radio-button.h>
+%include <dali-toolkit/public-api/controls/flex-container/flex-container.h>
+%include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+%include <dali-toolkit/public-api/controls/image-view/image-view.h>
+%include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
+%include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
+%include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
+%include <dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h>
+%include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
+%include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
+%include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
+%include <dali-toolkit/public-api/enums.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+%include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-constraints.h>
+%include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
+%include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-path-effect.h>
+%include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
+%include <dali-toolkit/public-api/controls/table-view/table-view.h>
+%include <dali-toolkit/public-api/text/rendering-backend.h>
+%include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
+%include <dali-toolkit/public-api/controls/text-controls/text-field.h>
+%include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+%include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+%include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
+%include <dali-toolkit/public-api/styling/style-manager.h>
+%include <dali-toolkit/public-api/controls/slider/slider.h>
+%include <dali-toolkit/public-api/controls/video-view/video-view.h>
+%include <dali-toolkit/devel-api/controls/popup/popup.h>
+
+%include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+%include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+
+%template(ItemIdContainer) std::vector<unsigned int>;
+%template(Item) std::pair<unsigned int, Dali::Actor>;
+%template(ItemContainer) std::vector<std::pair<unsigned int, Dali::Actor>>;
+%template(ActorContainer) std::vector<Dali::Actor>;
+%template(AccessibilityActionSignal) Dali::Signal<bool(Dali::Toolkit::AccessibilityManager&)>;
+%template(AccessibilityActionScrollSignal) Dali::Signal<bool(Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&)>;
+%template(AccessibilityFocusOvershotSignal) Dali::Signal<void(Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection)>;
+%template(FocusChangedSignal) Dali::Signal<void(Dali::Actor, Dali::Actor)>;
+%template(KeyboardPreFocusChangeSignal) Dali::Signal<Dali::Actor(Dali::Actor, Dali::Actor, Dali::Toolkit::Control::KeyboardFocus::Direction)>;
+%template(FocusGroupChangedSignal) Dali::Signal<void(Dali::Actor, bool)>;
+%template(StyleChangedSignal) Dali::Signal<void(Dali::Toolkit::StyleManager, Dali::StyleChange::Type)>;
+%template(ButtonSignal) Dali::Signal<bool(Dali::Toolkit::Button)>;
+%template(GaussianBlurViewSignal) Dali::Signal<void (Dali::Toolkit::GaussianBlurView)>;
+%template(PageTurnSignal) Dali::Signal<void(Dali::Toolkit::PageTurnView, unsigned int, bool)>;
+%template(PagePanSignal) Dali::Signal<void(Dali::Toolkit::PageTurnView)>;
+%template(ScrollViewSnapStartedSignal) Dali::Signal< void(const Dali::Toolkit::ScrollView::SnapEvent&)>;
+%template(ScrollableSignal) Dali::Signal< void(const Dali::Vector2&)>;
+%template(TextEditorSignal) Dali::Signal<void(Dali::Toolkit::TextEditor)>;
+%template(TextFieldSignal) Dali::Signal<void(Dali::Toolkit::TextField)>;
+%template(ControlKeyEventSignal) Dali::Signal<bool(Dali::Toolkit::Control, const Dali::KeyEvent&)>;
+%template(KeyInputFocusSignal) Dali::Signal<void(Dali::Toolkit::Control)>;
+%template(VideoViewSignal) Dali::Signal<void(Dali::Toolkit::VideoView&)>;
+%template(SliderValueChangedSignal) Dali::Signal<bool(Dali::Toolkit::Slider, float)>;
+%template(SliderMarkReachedSignal) Dali::Signal<bool(Dali::Toolkit::Slider, int)>;
+%template(RulerPtr) Dali::IntrusivePtr<Dali::Toolkit::Ruler>;
diff --git a/plugins/dali-swig/SWIG/dali.i b/plugins/dali-swig/SWIG/dali.i
new file mode 100644 (file)
index 0000000..542ed73
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * 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.
+ *
+ */
+
+#if defined(SWIGCSHARP)
+%module(directors="1") NDalic
+#define DALI_EXPORT_API
+#define DALI_IMPORT_API
+#define DALI_INTERNAL
+#else
+%module Dali
+#endif
+
+%include exception.i
+
+%exception {
+    try {
+        $action
+    } catch (std::out_of_range& e) {
+        SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
+    } catch (std::exception& e) {
+        SWIG_exception(SWIG_RuntimeError,const_cast<char*>(e.what()));
+    } catch (...) {
+        SWIG_exception(SWIG_UnknownError,"unknown error");
+    }
+}
+
+#if defined(SWIGCSHARP)
+%{
+#define SWIGSTDCALL
+%}
+#endif
+
+%{
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/matrix3.h>
+#include <dali/public-api/math/viewport.h>
+
+
+#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/adaptor-framework/window.h>
+#include <dali/public-api/adaptor-framework/style-change.h>
+#include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
+
+#include <dali-toolkit/devel-api/builder/builder.h>
+#include <dali-toolkit/devel-api/controls/popup/popup.h>
+
+#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+
+#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
+
+// add here SWIG version check
+
+#if defined(_MSC_VER)         // Microsoft Visual C++ 6.0
+// disable Swig-dependent warnings
+
+// 'identifier1' has C-linkage specified,
+// but returns UDT 'identifier2' which is incompatible with C
+#pragma warning(disable: 4190)
+
+// 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#pragma warning(disable: 4800)
+
+// debug info too long etc etc
+#pragma warning(disable: 4786)
+#endif
+%}
+
+%include stl.i
+%include exception.i
+%include typemaps.i
+%include std_common.i
+%include carrays.i
+
+%include cpointer.i
+%pointer_class(float, floatp);
+%pointer_class(int, intp);
+%pointer_class(double, doublep);
+%pointer_class(unsigned int, uintp);
+%pointer_class(unsigned short, ushortp);
+%pointer_cast(int, unsigned int, int_to_uint);
+
+%apply unsigned char { uint8_t };
+%apply unsigned short int { uint16_t };
+%apply unsigned int { uint32_t };
+%apply int { int32_t };
+
+#if defined(SWIGCSHARP)
+
+%typemap(ctype)  void * "void *"
+%typemap(imtype) void * "System.IntPtr"
+%typemap(cstype) void * "System.IntPtr"
+%typemap(csin)   void * "$csinput"
+%typemap(in)     void * %{ $1 = $input; %}
+%typemap(out)    void * %{ $result = $1; %}
+%typemap(csout)  void * { return $imcall; }
+
+#endif
+
+#if defined(SWIGCSHARP)
+
+// string &
+%typemap(ctype) std::string & "char**"
+%typemap(imtype) std::string & "out string"
+%typemap(cstype) std::string & "out string"
+
+//C++
+%typemap(in, canthrow=1) std::string &
+%{
+  //typemap in
+  std::string temp;
+  $1 = &temp;
+%}
+
+%typemap(argout) std::string &
+%{
+  //Typemap argout in c++ file.
+  //This will convert c++ string to c# string
+  *$input = SWIG_csharp_string_callback($1->c_str());
+%}
+
+%typemap(argout) const std::string &
+%{
+  //argout typemap for const std::string&
+%}
+
+%typemap(csin) std::string & "out $csinput"
+
+%typemap(throws, canthrow=1) string &
+%{
+  SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
+  return $null;
+%}
+
+#endif
+
+%ignore operator<<;
+%ignore *::GetImplementation();
+%ignore *::GetImplementation(Dali::BaseHandle&);
+
+%{
+using namespace Dali;
+using namespace Dali::Toolkit;
+%}
+
+//%feature("director") Dali::Internal::CustomActorImpl;
+//%feature("notabstract") Dali::Internal::CustomActorImpl;
+//%feature("director") Dali::Toolkit::Internal::Control;
+//%feature("notabstract") Dali::Toolkit::Internal::Control;
+%feature("notabstract") Dali::Toolkit::FixedRuler;
+%feature("notabstract") Dali::Toolkit::DefaultRuler;
+
+// Note... all the typemap declarations have to be included before the DALi C++ head files are include otherwise
+// they have no effect.
+
+%include signal-parameters.i
+%include signals.i
+%include dali-operator.i
+%include dali-core.i
+%include dali-adaptor.i
+%include dali-toolkit.i
+
diff --git a/plugins/dali-swig/SWIG/signal-parameters.i b/plugins/dali-swig/SWIG/signal-parameters.i
new file mode 100644 (file)
index 0000000..fd57e1c
--- /dev/null
@@ -0,0 +1,87 @@
+ /*
+ * 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.
+ *
+ */
+
+ /**
+  * WARNING: The macro below may be over-ridden by any other typemap(cscode)
+  * customisation for a class.
+  *
+  * MACRO to inject a  C# function in to a SWIG generated DALi C# wrapper class.
+  * The MACRO allow you to create a C# wrapper class for a DALi C++ object (passed as a C PTR).
+  *
+  * Required to get access to any data passed as a parameter in a Signal ( in C# they are delegate parameters).
+  * E.g.
+  *
+  * CREATE_CSHARP_WRAPPER_FROM_C_PTR_FUNCTION( TouchData );
+  * Creates a function called GetTouchDataFromPtr which allows you to:
+  *
+  * static void OnStageTouched(IntPtr data)
+  * {
+  *    TouchData touchData = TouchData.GetTouchDataFromPtr( data );
+  * }
+  *
+  * ## means concat in a SWIG macro
+  */
+
+%define DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( NameSpace, ClassName )
+
+ %typemap(cscode) NameSpace::ClassName %{
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+    ClassName ret = new ClassName(cPtr, false);
+       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+%}
+
+%enddef
+
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Application );
+
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Actor );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Image );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, ResourceImage );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Animation );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchEvent );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchData );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, HoverEvent );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, WheelEvent );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, KeyEvent );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, LongPressGesture );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, PanGesture );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, PinchGesture );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TapGesture );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, PropertyNotification );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, BaseHandle );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, RefObject );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, RenderTask );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Vector2 );
+
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, AccessibilityManager );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, StyleManager );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, Control );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, Button );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, GaussianBlurView );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, PageTurnView );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, TextEditor );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, TextField );
+
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, TextField );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, VideoView );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, Slider );
+  
+
+
diff --git a/plugins/dali-swig/SWIG/signals.i b/plugins/dali-swig/SWIG/signals.i
new file mode 100644 (file)
index 0000000..65a6ce9
--- /dev/null
@@ -0,0 +1,349 @@
+/*
+ * 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.
+ *
+ */
+
+// Example from Swig CSHARP documentation
+// To allow a CDate class to take
+// To achieve this mapping, we need to alter the default code generation slightly so that at the C# layer, a System.DateTime is converted into a CDate. The
+// intermediary layer will still take a pointer to the underlying CDate class. The typemaps to achieve this are shown below.
+
+// %typemap(cstype) const CDate & "System.DateTime"
+// %typemap(csin,
+// pre="
+// CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);"
+// ) const CDate &
+// "$csclassname.getCPtr(temp$csinput)"
+// The csin typemap is used for converting function parameter types from the type
+// used in the proxy, module or type wrapper class to the type used in the PInvoke class.
+
+
+%include <dali/public-api/signals/dali-signal.h>
+
+/*
+ * By default SWIG maps Derived types, structs, and classes to C pointers.
+ * So for Signals which have a Connect /Disconnect function, the function parameter just gets maps to a C pointer.
+ * However, call backs in C# are done using delegates, so we change the Connect / Disconnect parameter from
+ * something like  void (*func)( Dali::Actor ) to a C# delegate.
+ * the parameter type is changed using the typemap(cstype)  cstype = csharp-type
+ * The actual conversion from a C# delegate to a c function pointer is done when Connect/Disconnect is called
+ * using  typemap(csin) with GetFunctionPointerForDelegate ( csin = csharp in code?).
+ * So when connect is called on a Signal it will call the   void Signal::Connect( void (*func)( Arg0 arg0 ) ) -- which
+ * just takes a standard C function pointer. Not ideal as there is no delegate / connection tracking.
+ *
+ */
+%define SIGNAL_TYPEMAP_HELPER( SignalSignature )
+%typemap(cstype) SignalSignature "System.Delegate"
+%typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
+   SignalSignature "new System.Runtime.InteropServices.HandleRef(this, ip)"
+%enddef
+
+/**
+ * SWIG can't auto generate wrappers for template parameters that are functions ( which dali-signal has)
+ * so we have make them ourselves
+ */
+
+%define SIGNAL_TEMPLATE_HELPER_1( returnType,  returnFunc, argumentType )
+  template<> class Signal< returnType ( argumentType ) >
+  {
+  public:
+    %extend
+    {
+      bool Empty() const
+      {
+         return $self->Empty();
+      }
+      std::size_t GetConnectionCount() const
+      {
+        return $self->GetConnectionCount();
+      }
+      void Connect( returnType ( *func ) (  argumentType  ) )
+      {
+          $self->Connect( func );
+      }
+      void Disconnect( returnType ( *func ) (  argumentType  ) )
+      {
+          $self->Disconnect( func );
+      }
+      returnType Emit( argumentType arg)
+      {
+          returnFunc $self->Emit( arg );
+      }
+    }
+  };
+%enddef
+
+%define SIGNAL_TEMPLATE_HELPER_2( returnType,  returnFunc, argumentType1, argumentType2 )
+  template<> class Signal< returnType (  argumentType1, argumentType2 ) >
+  {
+  public:
+    %extend
+    {
+      bool Empty() const
+      {
+         return $self->Empty();
+      }
+      std::size_t GetConnectionCount() const
+      {
+        return $self->GetConnectionCount();
+      }
+      void Connect( returnType ( *func ) (  argumentType1, argumentType2   ) )
+      {
+        $self->Connect( func );
+      }
+      void Disconnect( returnType ( *func ) (  argumentType1, argumentType2  ) )
+      {
+        $self->Disconnect( func );
+      }
+      returnType Emit( argumentType1 arg1, argumentType2 arg2 )
+      {
+        returnFunc $self->Emit( arg1, arg2 );
+      }
+    }
+  };
+%enddef
+
+%define SIGNAL_TEMPLATE_HELPER_3( returnType, returnFunc, argumentType1, argumentType2, argumentType3 )
+  template<> class Signal< returnType ( argumentType1, argumentType2, argumentType3 ) >
+  {
+  public:
+    %extend
+    {
+      bool Empty() const
+      {
+         return $self->Empty();
+      }
+      std::size_t GetConnectionCount() const
+      {
+        return $self->GetConnectionCount();
+      }
+      void Connect( returnType ( *func ) ( argumentType1, argumentType2, argumentType3  ) )
+      {
+          return $self->Connect( func );
+      }
+      void Disconnect( returnType ( *func ) ( argumentType1, argumentType2, argumentType3  ) )
+      {
+          $self->Disconnect( func );
+      }
+      returnType Emit( argumentType1 arg1, argumentType2 arg2, argumentType3 arg3 )
+      {
+          returnFunc $self->Emit( arg1, arg2, arg3 );
+      }
+    }
+  };
+%enddef
+
+////////////////////////////////
+/*****************
+ Macros for signals  without return values
+*****************/
+
+// the emit for some signal has to emit a return value
+// this macro is just for signals that don't (instead of return Emit();.. it just does ;Emit();
+%define NO_RETURN_FUNC;
+%enddef
+
+// Macro to define a csharp signal.
+// 1 param signals ( no return )
+%define DALI_SIGNAL_1_PARAM( argumentType1 )
+
+  SIGNAL_TYPEMAP_HELPER( void (*func) ( argumentType1 ) );
+  SIGNAL_TEMPLATE_HELPER_1( void, NO_RETURN_FUNC, argumentType1);
+%enddef
+
+// 2 param signals ( no return )
+%define DALI_SIGNAL_2_PARAM( argumentType1, argumentType2)
+
+  SIGNAL_TYPEMAP_HELPER( void (*func) ( argumentType1, argumentType2) );
+  SIGNAL_TEMPLATE_HELPER_2( void, NO_RETURN_FUNC, argumentType1, argumentType2);
+
+%enddef
+
+// 3 param signals ( no return )
+%define DALI_SIGNAL_3_PARAM( argumentType1, argumentType2, argumentType3 )
+
+  SIGNAL_TYPEMAP_HELPER( void (*func) ( argumentType1, argumentType2, argumentType3 ) );
+  SIGNAL_TEMPLATE_HELPER_3( void, NO_RETURN_FUNC, argumentType1, argumentType2, argumentType3);
+
+%enddef
+
+/*****************
+ Macros for signals with return values
+*****************/
+
+// 1 param signals ( with return )
+%define DALI_SIGNAL_1_PARAM_RETURN( returnType, argumentType1 )
+
+  SIGNAL_TYPEMAP_HELPER( returnType (*func) ( argumentType1 ) );
+  SIGNAL_TEMPLATE_HELPER_1( returnType, return, argumentType1);
+
+%enddef
+
+// 2 param signals ( with return )
+%define DALI_SIGNAL_2_PARAM_RETURN( returnType, argumentType1, argumentType2)
+
+  SIGNAL_TYPEMAP_HELPER( returnType (*func) ( argumentType1, argumentType2) );
+  SIGNAL_TEMPLATE_HELPER_2( returnType, return, argumentType1, argumentType2);
+
+%enddef
+
+// 3 param signals ( with return )
+%define DALI_SIGNAL_3_PARAM_RETURN( returnType, argumentType1, argumentType2, argumentType3 )
+
+  SIGNAL_TYPEMAP_HELPER( returnType (*func) ( argumentType1, argumentType2, argumentType3 ) );
+  SIGNAL_TEMPLATE_HELPER_3( returnType, return, argumentType1, argumentType2, argumentType3);
+
+%enddef
+
+namespace Dali
+{
+// Signal< void (Actor) >
+DALI_SIGNAL_1_PARAM( Dali::Actor );
+
+//  Signal< void (float) >
+DALI_SIGNAL_1_PARAM( float );
+
+// Signal< void (Dali::Application&) >
+DALI_SIGNAL_1_PARAM( Dali::Application& );
+
+// Signal< void (Dali::Application&, void*) >
+DALI_SIGNAL_2_PARAM( Dali::Application& , void* );
+
+// Signal< void (Dali::Image) >
+DALI_SIGNAL_1_PARAM( Dali::Image );
+
+// Signal< void (Dali::ResourceImage) >
+DALI_SIGNAL_1_PARAM( Dali::ResourceImage );
+
+// Signal< void (Dali::Animation&) >
+DALI_SIGNAL_1_PARAM( Dali::Animation& );
+
+// Signal< void (Dali::Actor, const Dali::TouchEvent&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::TouchEvent& );
+
+//  Signal< bool (Dali::Actor, const Dali::TouchData&) >
+DALI_SIGNAL_2_PARAM_RETURN( bool, Dali::Actor, const Dali::TouchData& );
+
+// Signal< bool (Dali::Actor, const Dali::HoverEvent&) >
+DALI_SIGNAL_2_PARAM_RETURN( bool , Dali::Actor, const Dali::HoverEvent& );
+
+// Signal< bool (Dali::Actor, const Dali::WheelEvent&) >
+DALI_SIGNAL_2_PARAM_RETURN( bool , Dali::Actor, const Dali::WheelEvent& );
+
+// Signal< void (const Dali::KeyEvent&) >
+DALI_SIGNAL_1_PARAM( const Dali::KeyEvent&  );
+
+// Signal< void (const Dali::TouchData&) >
+DALI_SIGNAL_1_PARAM( const Dali::TouchData& );
+
+// Signal< void (const Dali::HoverEvent&) >
+DALI_SIGNAL_1_PARAM( const Dali::HoverEvent& );
+
+// Signal< void (const Dali::WheelEvent&) >
+DALI_SIGNAL_1_PARAM( const Dali::WheelEvent& );
+
+// Signal< void (const Dali::LongPressGesture&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::LongPressGesture& );
+
+// Signal< void (Dali::Actor, const Dali::PanGesture&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::PanGesture& );
+
+// Signal< void (Dali::Actor, const Dali::PinchGesture&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::PinchGesture& );
+
+// Signal< void (Dali::Actor, const Dali::TapGesture&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::TapGesture& );
+
+// Signal< void (Dali::PropertyNotification) >
+DALI_SIGNAL_1_PARAM( Dali::PropertyNotification& ) ;
+
+//  Signal< void (Dali::BaseHandle) >
+DALI_SIGNAL_1_PARAM( Dali::BaseHandle );
+
+//  Signal< void (const Dali::RefObject*) >
+DALI_SIGNAL_1_PARAM( const Dali::RefObject* );
+
+// Signal< void (const Dali::RenderTask&) >
+DALI_SIGNAL_1_PARAM( const Dali::RenderTask& );
+
+// Signal< bool ( const Dali::Toolkit::AccessibilityManager& ) >
+DALI_SIGNAL_1_PARAM_RETURN( bool ,const Dali::Toolkit::AccessibilityManager& );
+
+// Signal< bool ( const Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent& ) >
+DALI_SIGNAL_2_PARAM_RETURN( bool ,const Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent& );
+
+// Signal< void ( const Dali::Actor Dali::Toolkit::AccessibilityManager::FocusOvershotDirection ) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection );
+
+// Signal< bool ( Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent& ) >
+DALI_SIGNAL_2_PARAM_RETURN( bool ,Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&);
+
+// Signal< void ( Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection) >
+//DALI_SIGNAL_2_PARAM( Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection );
+
+// Signal< void (  Dali::Toolkit::StyleManager, Dali::StyleChange::Type) >
+DALI_SIGNAL_2_PARAM( Dali::Toolkit::StyleManager, Dali::StyleChange::Type);
+
+// Signal< void (  Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection )>
+//DALI_SIGNAL_2_PARAM( Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection );
+
+// Signal<  Dali::Actor (  Dali::Actor, Dali::Actor, Dali::Actor, Dali::Toolkit::Control::KeyboardFocus::Direction) >
+DALI_SIGNAL_3_PARAM_RETURN( Dali::Actor, Dali::Actor, Dali::Actor, Dali::Toolkit::Control::KeyboardFocus::Direction);
+
+// void Signal<  Dali::Actor, bool >;
+DALI_SIGNAL_2_PARAM( Dali::Actor, bool);
+
+// bool Signal< Dali::Toolkit::Button >;
+DALI_SIGNAL_1_PARAM_RETURN( bool, Dali::Toolkit::Button);
+
+// void Signal< Dali::Toolkit::GaussianBlurView >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::GaussianBlurView);
+
+// void Signal< Dali::Toolkit::PageTurnView, unsigned int, bool >;
+DALI_SIGNAL_3_PARAM( Dali::Toolkit::PageTurnView, unsigned int, bool );
+
+// void Signal< Dali::Toolkit::PageTurnView >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::PageTurnView );
+
+// void Signal< const Dali::Toolkit::ScrollView::SnapEvent& >;
+DALI_SIGNAL_1_PARAM( const Dali::Toolkit::ScrollView::SnapEvent& );
+
+// void Signal< const Dali::Vector2& >;
+DALI_SIGNAL_1_PARAM( const Dali::Vector2& );
+
+// void Signal< Dali::Toolkit::TextEditor >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::TextEditor );
+
+// void Signal< Dali::Toolkit::TextField >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::TextField )
+
+// bool Signal< Dali::Toolkit::Control, const Dali::KeyEvent& >;
+DALI_SIGNAL_2_PARAM_RETURN( bool, Dali::Toolkit::Control, const Dali::KeyEvent& );
+
+// void Signal< Dali::Toolkit::Control >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::Control );
+
+// void Signal< Dali::Toolkit::VideoView& >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::VideoView& );
+
+// Signal< bool (Dali::Toolkit::Slider, float) >;
+DALI_SIGNAL_2_PARAM_RETURN( bool,Dali::Toolkit::Slider, float );
+
+//  Signal< bool(Dali::Toolkit::Slider, int) >;
+DALI_SIGNAL_2_PARAM_RETURN( bool,Dali::Toolkit::Slider, int );
+
+} // namespace DALi
+
+
diff --git a/plugins/dali-swig/autogen.sh b/plugins/dali-swig/autogen.sh
new file mode 100755 (executable)
index 0000000..aa44b10
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Run this to generate all the auto-generated files needed by the GNU
+# configure program
+
+autoreconf --force --install
+
diff --git a/plugins/dali-swig/configure.ac b/plugins/dali-swig/configure.ac
new file mode 100644 (file)
index 0000000..25f5b99
--- /dev/null
@@ -0,0 +1,65 @@
+# 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.
+
+# Process this file with autoconf to produce a configure script.
+AC_INIT([Dali-SWIG], [0.1.1],
+        [Dali-SWIG])
+AC_PREREQ(2.50)
+AC_CONFIG_AUX_DIR([config])
+AM_INIT_AUTOMAKE([-Wall foreign])
+
+# check target
+AC_MSG_CHECKING([system])
+target=`uname`
+AC_MSG_RESULT([$target])
+
+# check compiler
+AC_LANG([C++])
+
+# check for Dali libraries
+PKG_CHECK_MODULES(DALICORE, dali-core)
+PKG_CHECK_MODULES(DALIADAPTOR, dali-adaptor)
+PKG_CHECK_MODULES(DALITOOLKIT, dali-toolkit)
+
+# check for tools
+AC_PATH_PROG([SWIG], [swig])
+AC_PATH_PROG([RUBY], [ruby])
+
+AC_PATH_PROGS([MCS], [gmcs mcs gmcs2])
+AM_CONDITIONAL(HAVE_MCS, test "x${MCS}" != "x")
+
+AC_ARG_ENABLE([csharp],
+              AC_HELP_STRING([--disable-csharp],
+                             [If disabled, the C# module
+                              will not be built]),
+              [build_mcs=$enableval],
+              [build_mcs=yes])
+AM_CONDITIONAL(BUILD_MCS, test "$build_mcs" != "no")
+
+# flags
+
+case "$target" in
+Darwin)
+    AC_SUBST([SHARED_LIB],[${SHARED_LIB='-dynamiclib'}])
+    AC_SUBST([JNILIB_EXTENSION],[${JNILIB_EXTENSION='jnilib'}]) ;;
+*)
+    AC_SUBST([SHARED_LIB],[${SHARED_LIB='-shared'}])
+    AC_SUBST([JNILIB_EXTENSION],[${JNILIB_EXTENSION='so'}]) ;;
+esac
+
+
+# done, output the configured files
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+
diff --git a/plugins/dali-swig/constructor-generator.rb b/plugins/dali-swig/constructor-generator.rb
new file mode 100755 (executable)
index 0000000..cb5cf25
--- /dev/null
@@ -0,0 +1,312 @@
+#!/usr/bin/env ruby
+# encoding: utf-8
+require 'pathname'
+require 'scanf'
+require 'fileutils'
+#
+# DALi traditonally use a static New function to create an object.
+# E.g. Actor myActor = Actor::New();
+#
+# However it has been request that for the CSharp DALi API we this coding convention
+#
+#  Actor myActor = new Actor();
+#
+# Script does the follow:
+#
+# - greps dali csharp wrapper files for the class constructor (new Actor()) and the static New() e.g. functions ( TextLabel::New(), TextLabel::New( string label) )
+#
+# regexp for searching swig generated constructors grep  -oP -n  'public [A-Z]([A-Z]*[a-z])*\(\)'  *
+# regexp for searching for swig genereated New functions  grep -oP -n -i 'static [a-zA-Z]\+ New'
+
+
+$fileHeader = "/*"\
+ "* Copyright (c) #{Time.now.year} Samsung Electronics Co., Ltd.\n"\
+ "*\n"\
+ "* Licensed under the Apache License, Version 2.0 (the \"License\");\n"\
+ "* you may not use this file except in compliance with the License.\n"\
+ "* You may obtain a copy of the License at\n"\
+ "*\n"\
+ "* http://www.apache.org/licenses/LICENSE-2.0\n"\
+ "*\n"\
+ "* Unless required by applicable law or agreed to in writing, software\n"\
+ "* distributed under the License is distributed on an \"AS IS\" BASIS,\n"\
+ "* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"\
+ "* See the License for the specific language governing permissions and\n"\
+ "* limitations under the License.\n"\
+ "*\n"\
+ "*/\n"\
+ "// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts\n"
+
+# global paths
+$rootPath = ""
+$daliCSharpPath = ""
+$totalDaliClasses = 0
+$totalConstructorsGenerated = 0
+
+
+$swigConstructorNumLines = 3
+$swigNewFuncNumLines = 4
+
+
+# daliClass struct stores information about where the constructor / static New functions are in the file
+$daliClassStruct = Struct.new("DaliClass", :name, :file, :hasNewFunction, :hasConstructor, :constructorLine, :staticNewLines, :generatedConstructors)
+
+# Array
+$daliClassArray = Array.new
+
+def init
+
+    pn = Pathname.new(Dir.pwd)
+    fullPath = pn.to_s
+
+    $rootPath = fullPath.slice(0..( fullPath.index('/dali-toolkit')))
+    $daliCSharpPath = $rootPath + "dali-toolkit/plugins/dali-swig/csharp"
+    puts("--------------------------------------------")
+    puts("Modifying constructors for DALi C# files ")
+    puts("E.g. modify TextLabel::New() ==>  new TextLabel() ")
+    puts("")
+
+
+end
+
+def getDaliClassItem( className )
+
+   # puts( "getDaliClassItem  "+ className )
+    index = $daliClassArray.index{ |a| a.name == className }
+
+    if( index == nil)
+        # create a new item along with a array for it's properites
+        classItem = $daliClassStruct.new( className );
+
+        classItem.name = className
+        classItem.hasNewFunction = false
+        classItem.hasConstructor = false
+        classItem.generatedConstructors = Array.new
+        classItem.staticNewLines =  Array.new
+
+        $daliClassArray.push( classItem )
+
+    else
+
+        classItem = $daliClassArray[ index ]
+    end
+
+    return classItem;
+
+end
+
+def grepConstructorInfo
+
+    # grep for strings like    public Actor(), have to use double black slash on the parenthesis for some reason
+   result =`grep -oP -n "public [A-Z]([A-Z]*[0-9]*[a-z])*\\(\\)"   #{$daliCSharpPath}/*`
+
+   # result is an array of lines that look like this:
+   #  /homepath/dali-toolkit/plugins/dali-swig/csharp/Window.cs:66:public Window()
+
+   lines = result.split(/\n+/);
+   for line in lines
+
+      # Split the line into file name, line number
+      data  = line.split(":",3)
+      fileName = data[0];
+      lineNum = data[1]
+
+
+      # Get the class name from the filename
+      className =  File.basename(fileName,".cs")
+
+       # get or create a new DALi class item which stores the new / constructor information
+      classItem  = getDaliClassItem( className )
+
+      classItem.file = fileName
+      classItem.constructorLine = lineNum.to_i
+      classItem.hasConstructor = true
+    #  puts classItem.name
+
+    end
+
+end
+
+
+
+def grepStaticNewInfo
+
+    # grep for strings like    static Actor::New()
+   result =`grep -oP -n -i "static [a-zA-Z0-9]\+ New"   #{$daliCSharpPath}/*`
+
+   lines = result.split(/\n+/);
+   for line in lines
+
+      #puts line
+      # Split the line into file name and property macro, split 2 means just create two strings
+      data  = line.split(":",3)
+      fileName = data[0];
+      lineNum = data[1]
+
+        #  # Get the class name from the filename  ( e.g. image-actor-impl.cpp => image-actor)
+      className = File.basename(fileName,".cs")
+
+       # get or create a new DALi class item which stores the property information
+      classItem  = getDaliClassItem( className )
+
+      classItem.file = fileName
+      classItem.hasNewFunction = true
+      classItem.staticNewLines.push( lineNum.to_i )
+     # puts "added line number #{lineNum} for #{classItem.name}"
+
+    end
+
+end
+
+
+
+
+def generateNewConstructors
+    todo = 2
+
+    for daliClass in  $daliClassArray
+
+        # if the class doesn't have a New function and a constructor then skip it
+        if ! (daliClass.hasNewFunction && daliClass.hasConstructor)
+            #puts( "Doesn't have a New function #{daliClass.file}" )
+            next
+        end
+
+        File.open(daliClass.file, 'r+') do |file|
+
+          currentLine = 0
+          for newEntryLine in daliClass.staticNewLines
+              linesToRead = newEntryLine - currentLine -1
+            #  puts("lineToRead = #{linesToRead} #{newEntryLine}")
+              linesToRead.times{  file.gets }
+
+              currentLine += linesToRead +$swigConstructorNumLines # +3 for 3 lines of the New function that we read in below
+              line =  file.readline
+              #puts("line = #{line} _________")
+              parameterString = /\((.*)\)/.match(line) # pulls out the New parameter e.g. (float duration)
+
+              #read the next line
+              #file.gets
+              line =  file.readline
+              constructorCall = /\((.*)\)/.match(line) # pulls out the constructor call e.g. ((NDalicPINVOKE.TextLabel_New__SWIG_1(text), true))
+
+              exceptionLine =  file.readline
+
+              #res = file.line.line.grep(/asd/i)
+              constructorCode = "  public #{daliClass.name} #{parameterString} : this #{constructorCall} {\n"\
+                                "  #{exceptionLine}\n"\
+                                "  }\n"
+
+
+              daliClass.generatedConstructors.push( constructorCode )
+              #puts constructorCode
+          end # for
+      end  # file open
+    end # for
+end
+
+def InjectConstructors( daliClass, file )
+
+  for code in daliClass.generatedConstructors
+      file.puts( code )
+      #puts code
+      $totalConstructorsGenerated+=1
+  end
+end
+
+def lineShouldBeSkipped(daliClass, line)
+
+  if line.between?(daliClass.constructorLine-1, daliClass.constructorLine+$swigConstructorNumLines -1)
+    return true
+  end
+
+
+  for n in daliClass.staticNewLines
+    if line.between?(n-1, n+$swigNewFuncNumLines )
+      return true
+    end
+  end
+
+  return false
+end
+
+
+# helper class to color the background
+class String
+def blueBackground;   "\e[45m#{self}\e[0m" end
+end
+
+def updateCSharpFiles
+
+  # we now have a populated array of daliClassStructs.
+  # With each class we open it's SWIG generated csharp file
+  # create a new temp file, and copy the SWIG generated code over to the temporary one
+  # except for the existing constructors and New() functions. e.g. Actor() and Actor::New()
+  # We also inject our new constructor functions e.g. Actor()
+
+  for daliClass in  $daliClassArray
+     #  puts "writing file #{daliClass.name}..."
+
+      # check the class has some constructors to write
+      if (daliClass.generatedConstructors.length == 0 )
+        #   puts "no constructors for  #{daliClass.name}..."
+        next
+      end
+
+      if daliClass.name == "Application"
+        next
+      end
+
+      $totalDaliClasses+=1  # for stats
+
+      # create a file to store the modified output
+      tempFileName = "#{daliClass.file}.tmp"
+      tempFile = File.new(tempFileName, 'w')
+
+      tempFile.puts $fileHeader
+      currentLine = 0
+      # open the the file
+      constructorsWritten = false
+
+      File.open(daliClass.file, 'r') do |file|
+
+        file.each do |line|
+
+          if lineShouldBeSkipped( daliClass, currentLine ) # lineShouldBeSkipped ( daliClass, currentLine )
+            currentLine +=1
+            if( !constructorsWritten )
+                # inject our newly generated constructors
+              InjectConstructors( daliClass, tempFile );
+              puts("Converting static Class::New(xxx) ---> new Class(xxx) into #{daliClass.name}".blueBackground)
+
+              constructorsWritten = true  # only write our new constructors to the file once
+            end
+            next
+          end # line should be skipped
+
+          currentLine +=1
+          tempFile.puts( line )
+
+        end # file each
+      end # file open
+
+      tempFile.close
+
+      # copy the temp file over the top of the exiting file
+      FileUtils.mv tempFileName, daliClass.file
+
+  end
+  puts"\n"
+  puts("Done. Generated #{$totalConstructorsGenerated} Constructors for #{$totalDaliClasses} DALi C# classes".blueBackground)
+
+
+
+end
+
+init
+grepConstructorInfo
+grepStaticNewInfo
+generateNewConstructors
+updateCSharpFiles
+
+
diff --git a/plugins/dali-swig/cpp/DaliWrapper.cpp b/plugins/dali-swig/cpp/DaliWrapper.cpp
new file mode 100644 (file)
index 0000000..562ca05
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ *
+ */
+
+// DaliWrapper.cpp : Defines the entry point for the DLL application.
+//
+
+#include "stdafx.h"
+#include "DaliWrapper.h"
+
+BOOL APIENTRY DllMain( HANDLE hModule,
+                        DWORD  ul_reason_for_call,
+                        LPVOID lpReserved
+                      )
+{
+  switch (ul_reason_for_call)
+  {
+    case DLL_PROCESS_ATTACH:
+    case DLL_THREAD_ATTACH:
+    case DLL_THREAD_DETACH:
+    case DLL_PROCESS_DETACH:
+    break;
+  }
+  return TRUE;
+}
+
+// This is an example of an exported variable
+DALIWRAPPER_API int nDaliWrapper=0;
+
+// This is an example of an exported function.
+DALIWRAPPER_API int fnDaliWrapper(void)
+{
+  return 18;
+}
+
+// This is the constructor of a class that has been exported.
+// see DaliWrapper.h for the class definition
+CDaliWrapper::CDaliWrapper()
+{
+  return;
+}
diff --git a/plugins/dali-swig/cpp/DaliWrapper.h b/plugins/dali-swig/cpp/DaliWrapper.h
new file mode 100644 (file)
index 0000000..df8f4ca
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ *
+ */
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the DALIWRAPPER_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// DALIWRAPPER_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+
+#ifdef DALIWRAPPER_EXPORTS
+#define DALIWRAPPER_API __declspec(dllexport)
+#else
+#define DALIWRAPPER_API __declspec(dllimport)
+#endif
+
+// This class is exported from the DaliWrapper.dll
+class DALIWRAPPER_API CDaliWrapper
+{
+
+public:
+  CDaliWrapper(void);
+  // TODO: add your methods here.
+
+};
+
+extern DALIWRAPPER_API int nDaliWrapper;
+
+DALIWRAPPER_API int fnDaliWrapper(void);
diff --git a/plugins/dali-swig/cpp/stdafx.h b/plugins/dali-swig/cpp/stdafx.h
new file mode 100644 (file)
index 0000000..d42a852
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN        // Exclude rarely-used stuff from Windows headers
+
+// Windows Header Files:
+#include <windows.h>
+
+// TODO: reference additional headers your program requires here
diff --git a/plugins/dali-swig/csharp/.gitignore b/plugins/dali-swig/csharp/.gitignore
new file mode 100644 (file)
index 0000000..c96a04f
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
\ No newline at end of file
diff --git a/plugins/dali-swig/examples/dali-test.cs b/plugins/dali-swig/examples/dali-test.cs
new file mode 100644 (file)
index 0000000..60b6c7a
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Dali;
+
+namespace MyCSharpExample
+{
+    class Example
+    {
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        delegate void CallbackDelegate(IntPtr appPtr); // void, void delgate
+
+        private Dali.Application _application;
+
+        public Example(Dali.Application application)
+        {
+            _application = application;
+
+            CallbackDelegate initializeCallback = new CallbackDelegate( Initialize );
+            Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() );
+
+            _application.InitSignal().Connect( initializeCallback );
+            Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() );
+        }
+
+        private void Initialize(IntPtr appPtr)
+        {
+            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);
+            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.Name = "MyActor";
+            actor.Color = new Vector4(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.SetBackgroundColor( NDalic.WHITE );
+
+            Vector2 stageSize = stage.GetSize();
+            Console.WriteLine("Stage size: " + stageSize.x + ", " + stageSize.y);
+            stage.Add(actor);
+
+            TextLabel text = new TextLabel("Hello Mono World");
+            text.ParentOrigin = NDalic.ParentOriginCenter;
+            text.AnchorPoint = NDalic.AnchorPointCenter;
+            text.HorizontalAlignment = "CENTER";
+            stage.Add(text);
+
+            Console.WriteLine( "Text label text:  " + text.Text );
+
+            Console.WriteLine( "Text label point size:  " + text.PointSize );
+            text.PointSize = 32.0f;
+            Console.WriteLine( "Text label new point size:  " + text.PointSize );
+
+            using (RectInteger ri = new RectInteger(02,05,20,30))
+            {
+                Console.WriteLine( "    Created " + ri );
+                Console.WriteLine( "    IsEmpty() =  " + ri.IsEmpty() );
+                Console.WriteLine( "    Left =  " + ri.Left() );
+                Console.WriteLine( "    Right =  " + ri.Right() );
+                Console.WriteLine( "    Top  = " + ri.Top() );
+                Console.WriteLine( "    Bottom  = " + ri.Bottom() );
+                Console.WriteLine( "    Area  = " + ri.Area() );
+            }
+            Console.WriteLine( " *************************" );
+            using (RectInteger ri2 = new RectInteger(02,05,20,30))
+            {
+                Console.WriteLine( "    Created " + ri2 );
+                ri2.Set(1,1,40,40);
+                Console.WriteLine( "    IsEmpty() =  " + ri2.IsEmpty() );
+                Console.WriteLine( "    Left =  " + ri2.Left() );
+                Console.WriteLine( "    Right =  " + ri2.Right() );
+                Console.WriteLine( "    Top  = " + ri2.Top() );
+                Console.WriteLine( "    Bottom  = " + ri2.Bottom() );
+                Console.WriteLine( "    Area  = " + ri2.Area() );
+            }
+            Console.WriteLine( " *************************" );
+            using (RectDouble rd = new RectDouble(02,05,20.5,30.5))
+            {
+                Console.WriteLine( "    Created " + rd );
+                Console.WriteLine( "    IsEmpty() =  " + rd.IsEmpty() );
+                Console.WriteLine( "    Left =  " + rd.Left() );
+                Console.WriteLine( "    Right =  " + rd.Right() );
+                Console.WriteLine( "    Top  = " + rd.Top() );
+                Console.WriteLine( "    Bottom  = " + rd.Bottom() );
+                Console.WriteLine( "    Area  = " + rd.Area() );
+            }
+            Console.WriteLine( " *************************" );
+            RectDouble rd2 = new RectDouble();
+            rd2.x = 10;
+            rd2.y = 10;
+            rd2.width = 20;
+            rd2.height = 20;
+            Console.WriteLine( "    Created " + rd2 );
+            Console.WriteLine( "    IsEmpty() =  " + rd2.IsEmpty() );
+            Console.WriteLine( "    Left =  " + rd2.Left() );
+            Console.WriteLine( "    Right =  " + rd2.Right() );
+            Console.WriteLine( "    Top  = " + rd2.Top() );
+            Console.WriteLine( "    Bottom  = " + rd2.Bottom() );
+            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] );
+
+            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;
+            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 );
+        }
+
+        public void MainLoop()
+        {
+            _application.MainLoop ();
+        }
+
+        /// <summary>
+        /// The main entry point for the application.
+        /// </summary>
+        [STAThread]
+        static void Main(string[] args)
+        {
+            Console.WriteLine ("Hello Mono World");
+
+            Example example = new Example(Application.NewApplication());
+            example.MainLoop ();
+        }
+    }
+}
diff --git a/plugins/dali-swig/examples/hello-world.cs b/plugins/dali-swig/examples/hello-world.cs
new file mode 100755 (executable)
index 0000000..d96d977
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Dali;
+
+namespace MyCSharpExample
+{
+    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;
+        private TextLabel _text;
+
+        public Example(Dali.Application application)
+        {
+            _application = application;
+
+            CallbackDelegate initializeCallback = new CallbackDelegate( Initialize );
+            _application.InitSignal().Connect( initializeCallback );
+        }
+
+        private void Initialize(IntPtr appPtr)
+        {
+            Stage stage = Stage.GetCurrent();
+            stage.SetBackgroundColor( NDalic.WHITE );
+
+            // Connect the signal callback for stage touched signal
+            TouchCallbackDelegate stageTouchedCallback = new TouchCallbackDelegate( OnStageTouched );
+            stage.TouchSignal().Connect( stageTouchedCallback );
+
+            // Add a _text label to the stage
+            _text = new TextLabel("Hello Mono World");
+            _text.ParentOrigin = NDalic.ParentOriginCenter;
+            _text.AnchorPoint = NDalic.AnchorPointCenter;
+            _text.HorizontalAlignment = "CENTER";
+            _text.PointSize = 32.0f;
+
+            stage.Add(_text);
+        }
+
+        // Callback for _animation finished signal handling
+        private void AnimationFinished(IntPtr data)
+        {
+            Animation _animation = Animation.GetAnimationFromPtr( data );
+            Console.WriteLine("Animation finished: duration = " + _animation.GetDuration());
+        }
+
+        // Callback for stage touched signal handling
+        private void OnStageTouched(IntPtr data)
+        {
+            TouchData touchData = TouchData.GetTouchDataFromPtr( data );
+
+            // Only animate the _text label when touch down happens
+            if( touchData.GetState(0) == PointStateType.DOWN )
+            {
+                // Create a new _animation
+                if( _animation )
+                {
+                    _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 ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, 0.5f));
+                _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.5f, 0.5f));
+
+                // Connect the signal callback for animaiton finished signal
+                AnimationCallbackDelegate animFinishedDelegate = new AnimationCallbackDelegate( AnimationFinished );
+                _animation.FinishedSignal().Connect( animFinishedDelegate );
+
+                // Play the _animation
+                _animation.Play();
+            }
+        }
+
+        public void MainLoop()
+        {
+            _application.MainLoop ();
+        }
+
+        /// <summary>
+        /// The main entry point for the application.
+        /// </summary>
+
+        [STAThread]
+        static void Main(string[] args)
+        {
+            Console.WriteLine ("Hello Mono World");
+
+            Example example = new Example(Application.NewApplication());
+            example.MainLoop ();
+        }
+    }
+}
diff --git a/plugins/dali-swig/examples/images/gallery-0.jpg b/plugins/dali-swig/examples/images/gallery-0.jpg
new file mode 100644 (file)
index 0000000..e42dba7
Binary files /dev/null and b/plugins/dali-swig/examples/images/gallery-0.jpg differ
diff --git a/plugins/dali-swig/examples/images/gallery-1.jpg b/plugins/dali-swig/examples/images/gallery-1.jpg
new file mode 100644 (file)
index 0000000..6a427ad
Binary files /dev/null and b/plugins/dali-swig/examples/images/gallery-1.jpg differ
diff --git a/plugins/dali-swig/examples/images/gallery-2.jpg b/plugins/dali-swig/examples/images/gallery-2.jpg
new file mode 100644 (file)
index 0000000..30b1a51
Binary files /dev/null and b/plugins/dali-swig/examples/images/gallery-2.jpg differ
diff --git a/plugins/dali-swig/examples/images/gallery-3.jpg b/plugins/dali-swig/examples/images/gallery-3.jpg
new file mode 100644 (file)
index 0000000..2da2ceb
Binary files /dev/null and b/plugins/dali-swig/examples/images/gallery-3.jpg differ
diff --git a/plugins/dali-swig/examples/images/gallery-4.jpg b/plugins/dali-swig/examples/images/gallery-4.jpg
new file mode 100644 (file)
index 0000000..902b711
Binary files /dev/null and b/plugins/dali-swig/examples/images/gallery-4.jpg differ
diff --git a/plugins/dali-swig/examples/images/gallery-5.jpg b/plugins/dali-swig/examples/images/gallery-5.jpg
new file mode 100644 (file)
index 0000000..490fb56
Binary files /dev/null and b/plugins/dali-swig/examples/images/gallery-5.jpg differ
diff --git a/plugins/dali-swig/examples/images/image-1.jpg b/plugins/dali-swig/examples/images/image-1.jpg
new file mode 100644 (file)
index 0000000..155ab30
Binary files /dev/null and b/plugins/dali-swig/examples/images/image-1.jpg differ
diff --git a/plugins/dali-swig/examples/images/image-2.jpg b/plugins/dali-swig/examples/images/image-2.jpg
new file mode 100644 (file)
index 0000000..e855ecf
Binary files /dev/null and b/plugins/dali-swig/examples/images/image-2.jpg differ
diff --git a/plugins/dali-swig/examples/images/image-3.jpg b/plugins/dali-swig/examples/images/image-3.jpg
new file mode 100644 (file)
index 0000000..8dee462
Binary files /dev/null and b/plugins/dali-swig/examples/images/image-3.jpg differ
diff --git a/plugins/dali-swig/examples/images/star-dim.png b/plugins/dali-swig/examples/images/star-dim.png
new file mode 100644 (file)
index 0000000..38cc674
Binary files /dev/null and b/plugins/dali-swig/examples/images/star-dim.png differ
diff --git a/plugins/dali-swig/examples/images/star-highlight.png b/plugins/dali-swig/examples/images/star-highlight.png
new file mode 100644 (file)
index 0000000..f99ee25
Binary files /dev/null and b/plugins/dali-swig/examples/images/star-highlight.png differ
diff --git a/plugins/dali-swig/examples/scroll-view.cs b/plugins/dali-swig/examples/scroll-view.cs
new file mode 100644 (file)
index 0000000..1c81f38
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Dali;
+
+namespace MyCSharpExample
+{
+    class Example
+    {
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        delegate void CallbackDelegate(IntPtr data);
+
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        delegate void ActorCallbackDelegate(IntPtr data);
+
+        private Dali.Application _application;
+        private ScrollView _scrollView;
+        private ScrollBar _scrollBar;
+
+        public Example(Dali.Application application)
+        {
+            _application = application;
+
+            CallbackDelegate initializeCallback = new CallbackDelegate( Initialize );
+            _application.InitSignal().Connect( initializeCallback );
+        }
+
+        private void Initialize(IntPtr appPtr)
+        {
+            CreateScrollView();
+        }
+
+        private void CreateScrollView()
+        {
+            Stage stage = Stage.GetCurrent();
+            stage.SetBackgroundColor(NDalic.WHITE);
+
+            // Create a scroll view
+            _scrollView = new ScrollView();
+            Vector2 stageSize = stage.GetSize();
+            _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++)
+            {
+                for(int pageColumn = 0; pageColumn < pageColumns; pageColumn++)
+                {
+                    Control pageActor = new Control();
+                    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);
+                }
+            }
+
+            _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
+            ActorCallbackDelegate ScrollViewRelayoutCallback = new ActorCallbackDelegate( OnScrollViewRelayout );
+            _scrollView.OnRelayoutSignal().Connect( ScrollViewRelayoutCallback );
+        }
+
+        private void OnScrollViewRelayout(IntPtr data)
+        {
+          // 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);
+        }
+
+        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 ();
+        }
+    }
+}
diff --git a/plugins/dali-swig/property-wrapper.rb b/plugins/dali-swig/property-wrapper.rb
new file mode 100755 (executable)
index 0000000..5e60919
--- /dev/null
@@ -0,0 +1,477 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'scanf'
+
+# Script does the following:
+# - greps dali-core for DALI_PROPERTY macro which holds all the information about a property ( type, read only etc)
+# - uses the filename of the macro to detect the class the properties belong to. E.g. actor-impl.cpp  = Actor
+# - Scans each property macro and builds a list of DALi classes with an array of properties
+# - Generates the csharp get/set  code for each property
+# - Pastes the property get / set code into the DALi csharp files
+
+# Given a DALi C++ property type this table stores the
+# information needed to produce a csharp getter / setter
+$typeTable =  [
+        ["BOOLEAN",     "bool",             "ref",  "bool temp = false;"],
+        ["FLOAT",       "float",            "ref",  "float temp = 0.0f;"],
+        ["INTEGER",     "int",              "ref",  "int temp = 0;"],
+        ["VECTOR2",     "Vector2",          "",     "Vector2 temp = new Vector2(0.0f,0.0f);"],
+        ["VECTOR3",     "Vector3",          "",     "Vector3 temp = new Vector3(0.0f,0.0f,0.0f);"],
+        ["VECTOR4",     "Vector4",          "",     "Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);"],
+        ["MATRIX3",     "Matrix3",          "",     "Matrix3 temp = new Matrix3();"],
+        ["MATRIX",      "Matrix",           "",     "Matrix temp = new Matrix();"  ],
+        ["RECTANGLE",   "RectInteger",      "",     "RectInteger temp = new RectInteger(0,0,0,0);"],
+        ["ROTATION",    "Quaternion",       "",    "Quaternion temp = new Quaternion();"],
+        ["STRING",      "string",           "out",  "string temp;"],
+        ["ARRAY",       "Dali.Property.Array",   "",     "Dali.Property.Array temp = new Dali.Property.Array();"],
+        ["MAP",         "Dali.Property.Map",     "",     "Dali.Property.Map temp = new Dali.Property.Map();"],
+    ]
+$daliSwigPath = String.new;
+
+# use the table above to get information for a specific type
+def getCSharpType( type )
+
+    entry = $typeTable.select{ |a| a.first == type }
+    if( entry == nil )
+      return nil
+    end
+    return entry[0]
+end
+
+
+# Property struct stores the information about a property after parsing the C++ DALI_PROPERTY macro
+$propertyStruct = Struct.new("Property", :name, :type, :writable, :animatable,:constrainInput, :enum, :shortenum,  :csharpGetter, :csharpSetter, :childProperty,)
+
+# daliClass struct stores a class name and an array of properties
+$daliClassStruct = Struct.new("DaliClass", :name, :properties )
+
+# class array stores all the dali classes ( actor, image etc)
+$daliClassArray = Array.new
+
+# list of files not generated by swig that we have tried to inject properties into
+$filesNotWrapped= Array.new
+
+# stats
+$totalProperties = 0
+$totalDaliClasses = 0
+
+# global paths
+$rootPath = ""
+$daliCorePath = ""
+$daliSwigPath = ""
+
+# Extracts data  DALI__PROPERTY( "points", ARRAY,true,false,false,Dali::Path::Property::POINTS )
+def extractPropertyInfo( propertyMacro )
+
+    # want to extract the property name, type + read only status
+    # split the DALI_PROPERTY macro definition by comma and quotes, and delete any empty segments
+    data = propertyMacro.split(/[\s,"]/).reject { |s| s.empty? }
+
+    propertyName = data[1]
+
+    # e.g. turn viewMatrix into ViewMatrix
+    propertyName[0] = propertyName[0].capitalize
+
+    # extract the property enum name Dali::Path::Property::POINTS -> POINTS
+    shortenum =  data[6].split(":").last
+
+    # store the :name, :type, :writable, :animatable, :constrainInput, :enum
+    property = $propertyStruct.new;
+
+    property.name = propertyName
+    property.type = data[2]
+    property.writable = (data[3]=="true")
+    property.animatable = (data[4] == "true")
+    property.constrainInput = (data[5]=="true")
+    property.enum = shortenum
+
+    return property;
+end
+
+# Extracts data from Toolkit property definition
+def extractToolkitPropertyInfo( propertyMacro )
+
+    # Extract the property name, type
+    property = $propertyStruct.new;
+
+    # Split the macro definition by comma and quotes, close bracket and delete any empty segments
+    data = propertyMacro.split(/[\s,")]/).reject { |s| s.empty? }
+
+    if(data[1] == "PropertyRegistration")
+
+      # Properties defined in Control using PropertyRegistration
+      # const PropertyRegistration Control::Impl::PROPERTY_1(typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+
+      # Creates an array of strings that looks like this:
+      # const 0
+      # PropertyRegistration 1
+      # Control::Impl::PROPERTY_1 2
+      # typeRegistration 3
+      # styleName 4
+      # Toolkit::Control::Property::STYLE_NAME 5
+      # Property::STRING 6
+      # &Control::Impl::SetProperty 7
+      # &Control::Impl::GetProperty 8
+      #
+
+      property.name = data[4]
+
+      propertyType = data[6].rpartition("::")
+      property.type = propertyType[2]
+
+      propertyEnum = data[5].rpartition("::")
+      property.enum = propertyEnum[2]
+
+    else
+
+      # Properties defined in macro DALI_PROPERTY_REGISTRATION or DALI_ANIMATABLE_PROPERTY_REGISTRATION or DALI_CHILD_PROPERTY_REGISTRATION
+      # or DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT:
+      # DALI_PROPERTY_REGISTRATION(Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE)
+      # DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, ImageView, "pixelArea", Vector4(0.f, 0.f, 1.f, 1.f), PIXEL_AREA)
+
+      # Creates an array of strings that looks like this:
+      # DALI_PROPERTY_REGISTRATION( 0
+      # Toolkit 1
+      # PageTurnView 2
+      # pageSize 3
+      # VECTOR2 4
+      # PAGE_SIZE 5
+      #
+
+      property.name = data[3]
+
+      #puts property.name
+      if property.name == "image"
+        property.name = "imageMap"
+      end
+
+      if( data[0] == "DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(" )
+        # TODO: Need to work out the property type from the value
+        property.type = "VECTOR4"
+      else
+        property.type = data[4]
+      end
+
+      property.enum = data[data.length-1]
+
+    end
+
+    # e.g. turn styleName into StyleName
+    property.name[0] = property.name[0].capitalize
+
+    property.writable = true
+    property.animatable = false
+    property.constrainInput = false
+    property.childProperty = false;
+
+    # check to see if it's a child property
+    if( data[0] == "DALI_CHILD_PROPERTY_REGISTRATION(" )
+      #puts(" #{property.name} is child property ")
+      property.childProperty = true;
+    end
+    if( data[0] == "DALI_ANIMATABLE_PROPERTY_REGISTRATION(" )
+      #puts("  #{property.name} is animatable")
+      property.animatable = true;
+    end
+
+    return property;
+end
+
+def writePropertiesToCSharpFile( daliClass )
+
+   # open the CSharp file autogenerated by SWIG
+  swigFiles =  $daliSwigPath + "/csharp/"
+
+  fileName =(swigFiles+daliClass.name) + ".cs"
+
+  # it's possible some classes in dali-core aren't being wrapped by swig, so if the swig generated file
+  # doesn't exist just return
+  if( ! File.exist?(fileName) )
+    $filesNotWrapped.push("#{daliClass.name}.cs ")
+    return
+  end
+
+  File.open(fileName, 'r+') do |file|
+
+  last_line  =0
+  file.each { last_line = file.pos unless file.eof? }
+
+  # we seek to the end of the file... minus 3 characters which lets us overwrite the 2 closing brackets
+  # so we can insert the getter/setter stuff into the file.
+  file.seek( last_line-3, IO::SEEK_SET)
+
+  for property in daliClass.properties
+
+    if (!property.childProperty)
+      file.write( property.csharpGetter );
+      file.write( property.csharpSetter );
+    end
+
+  end
+
+  file.write("\n}\n\n}");  # re-insert the closing brackets we over-wrote
+  end
+
+  puts("Injected #{daliClass.properties.length} C# Properties into #{daliClass.name}.cs".blueBackground)
+
+end
+
+def writeChildPropertiesToCSharpFile( daliClass )
+
+  # open the CSharp file autogenerated by SWIG
+  swigFiles =  $daliSwigPath + "/csharp/"
+
+  # Add all the child properties to Control
+  fileName = (swigFiles+"Control") + ".cs"
+
+  if( ! File.exist?(fileName) )
+    return
+  end
+
+  File.open(fileName, 'r+') do |file|
+
+  last_line  =0
+  file.each { last_line = file.pos unless file.eof? }
+
+  # we seek to the end of the file... minus 3 characters which lets us overwrite the 2 closing brackets
+  # so we can insert the getter/setter stuff into the file.
+  file.seek( last_line-3, IO::SEEK_SET)
+
+  $childPropertyCount = 0
+
+  for property in daliClass.properties
+
+    if (property.childProperty)
+      file.write( property.csharpGetter );
+      file.write( property.csharpSetter );
+      $childPropertyCount += 1
+    end
+
+  end
+
+  file.write("\n}\n\n}");  # re-insert the closing brackets we over-wrote
+  end
+
+  puts("Injected #{$childPropertyCount} C# Child Properties into #{"Control"}.cs".blueBackground)
+
+end
+
+# Write the CSharp data to the generated .cs file
+def writeCSharpData
+
+    for daliClass in  $daliClassArray
+
+        #puts ( daliClass.name )
+
+        hasChildProperties = false
+
+        for property in daliClass.properties
+            propertyInfo = getCSharpType( property.type )
+
+            if( propertyInfo.length() < 2 )
+                # some types aren't supported yet like Rotation
+                next
+            end
+
+            $totalProperties+=1  #  keep track of total
+
+            propertyType = propertyInfo[1]    # e.g. bool or int
+            propertyArg =  propertyInfo[2]  # e.g. ref or out
+            tempDeclaration = propertyInfo[3] # e.g. bool temp;
+
+            propertyName = "#{daliClass.name}.Property.#{property.enum}"
+
+            if property.childProperty
+              propertyName = "#{daliClass.name}.ChildProperty.#{property.enum}"
+              hasChildProperties = true
+            end
+
+            property.csharpGetter ="  public #{propertyType} #{property.name} \n"\
+                     "  { \n"\
+                     "    get \n" \
+                     "    {\n"\
+                     "      #{tempDeclaration}\n"\
+                     "      GetProperty( #{propertyName}).Get( #{propertyArg} temp );\n"\
+                     "      return temp;\n"\
+                     "    }\n"
+
+            if property.writable
+                  #text.SetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT, new Property.Value("CENTER"));
+                  property.csharpSetter = "    set \n" \
+                         "    { \n"\
+                         "      SetProperty( #{propertyName}, new Dali.Property.Value( value ) );\n" \
+                         "    }\n"\
+                         "  }\n"
+            else
+                   property.csharpSetter = "}"  # close the opening property declaration
+            end
+        end
+        # write normal properties to the class's own csharp file
+        writePropertiesToCSharpFile( daliClass )
+        # write child properties to Control.cs
+        if (hasChildProperties)
+          writeChildPropertiesToCSharpFile( daliClass )
+        end
+    end
+
+end
+
+def getDaliClassItem( className )
+
+   # puts( "getDaliClassItem  "+ className )
+    index = $daliClassArray.index{ |a| a.name == className }
+
+    if( index == nil)
+        # create a new item along with a array for it's properites
+        classItem = $daliClassStruct.new( className, Array.new )
+        $daliClassArray.push( classItem )
+        $totalDaliClasses+=1  # for stats
+    else
+        # puts("class found " + className )
+        classItem = $daliClassArray[ index ]
+    end
+
+    return classItem;
+
+end
+
+
+
+def init
+
+    pn = Pathname.new(Dir.pwd)
+    fullPath = pn.to_s
+
+    $rootPath = fullPath.slice(0..( fullPath.index('/dali-toolkit')))
+    $daliCorePath = $rootPath + "dali-core/dali"   # source code path
+    $daliSwigPath = $rootPath + "dali-toolkit/plugins/dali-swig"
+    $daliToolkitPath = $rootPath + "dali-toolkit/dali-toolkit"  # source code path
+
+    puts("--------------------------------------------")
+    puts("Injecting DALi properties into SWIG generated C# files ")
+    puts("")
+
+
+end
+
+def writeDaliCoreProperties
+
+    puts("Scanning for DALI_PROPERTY macro in dali-core");
+    puts("Scanning folder: #{$daliCorePath}\n\n");
+
+    # Executed a recursive grep over dali-core for the DALI_PROPERTY macro
+    result =`grep --include *.cpp  -r "DALI_PROPERTY( \" #{$daliCorePath}`
+
+
+    # We now have a list of lines that look like this:
+    # dali/internal/event/animation/path-impl.cpp:DALI__PROPERTY( "points", ARRAY,true,false,false,Dali::Path::Property::POINTS )
+
+    lines = result.split(/\n+/);
+    for line in lines
+
+
+      # Split the line into file name and property macro, splt 2 means just create two strings as we don't want to split
+      # property Dali::Path::Property::POINTS string as well
+
+      data  = line.split(":",2)
+      fileName = data[0];
+      macro = data[1];
+
+      # Get the class name from the filename  ( e.g. image-actor-impl.cpp => image-actor)
+      className = File.basename(fileName,"-impl.cpp").capitalize
+
+      # convert it from image-actor to ImageActor
+      className = className.split(/ |\_|\-/).map(&:capitalize).join
+
+      # Get the property information ( name, type, read/writeable)
+      propertyInfo = extractPropertyInfo( macro );
+
+      # get or create a new DALi class item which stores the property information
+      classItem  = getDaliClassItem( className )
+
+      classItem.properties.push( propertyInfo )
+
+    end
+
+    writeCSharpData()
+end
+
+def writeDaliToolkitProperties
+
+
+    puts("\nScanning for PROPERTY_REGISTRATION macros in dali-toolkit");
+    puts("Scanning folder: #{$daliToolkitPath}\n\n");
+
+    $daliClassArray.clear;
+
+    # Executed a recursive grep over dali-toolkit for following macros
+    # DALI_PROPERTY_REGISTRATION
+    # DALI_ANIMATABLE_PROPERTY_REGISTRATION
+    # DALI_CHILD_PROPERTY_REGISTRATION
+    result =`grep --include *.cpp  -w 'Control::Impl::SetProperty\\|DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(\\|DALI_CHILD_PROPERTY_REGISTRATION(\\|DALI_ANIMATABLE_PROPERTY_REGISTRATION(\\|DALI_PROPERTY_REGISTRATION' -r #{$daliToolkitPath}`
+
+    if( result == "" )
+      puts("Error parsing #{$daliToolkitPath} no properties found")
+      return
+    end
+    # create an array to store each DALi class and it's assoc
+    classArray = Array.new
+
+    # We now have a list of lines that look like this:
+    # text-controls/text-label-impl.cpp:DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE )
+    lines = result.split(/\n+/);
+    for line in lines
+
+
+      # Split the line into file name and property macro, split 2 means just create two strings
+      data  = line.split(":",2)
+      fileName = data[0];
+      macro = data[1];
+
+      # Get the class name from the filename  ( e.g. image-actor-impl.cpp => image-actor)
+      className = File.basename(fileName,"-impl.cpp").capitalize
+
+      # convert it from image-actor to ImageActor
+      className = className.split(/ |\_|\-/).map(&:capitalize).join
+
+      #puts(className);
+      #puts(fileName);
+
+        # Get the property information ( name, type, read/writeable)
+      propertyInfo = extractToolkitPropertyInfo( macro );
+
+      # get or create a new DALi class item which stores the property information
+      classItem  = getDaliClassItem( className )
+
+      classItem.properties.push( propertyInfo )
+
+    end
+
+    writeCSharpData()
+
+end
+
+# helper class to color the background
+class String
+def blueBackground;   "\e[44m#{self}\e[0m" end
+end
+
+def writeStats
+
+  puts("\nFiles that have not been wrapped file by SWIG ( not included in dali.i file):")
+  for i in $filesNotWrapped
+    puts(i)
+  end
+
+  puts("Done. Injected #{$totalProperties} properties into #{$totalDaliClasses} DALi C# classes".blueBackground)
+
+end
+
+init()
+
+writeDaliCoreProperties()
+
+writeDaliToolkitProperties()
+
+writeStats()
+
diff --git a/plugins/dali-swig/swig.cmd b/plugins/dali-swig/swig.cmd
new file mode 100644 (file)
index 0000000..adc59ba
--- /dev/null
@@ -0,0 +1 @@
+swig -csharp -c++ -outdir ./csharp -namespace Dali -o ./cpp/dali_wrap.cpp ./SWIG/dali.i