Manual binding for C# Actor APIs e.g. RaiseToTop, LowerBelow, etc.
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / dali-adaptor.i
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 %ignore *::Application(Internal::Adaptor::Application*);
19 %ignore *::DragAndDropDetector(Internal::Adaptor::DragAndDropDetector*);
20 %ignore *::Timer(Internal::Adaptor::Timer*);
21 %ignore *::Window(Internal::Adaptor::Window*);
22
23 %rename(StyleChangeType) Dali::StyleChange::Type;
24
25 %include <dali/public-api/adaptor-framework/style-change.h>
26 %include <dali/public-api/adaptor-framework/timer.h>
27 %include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
28 %include <dali/devel-api/adaptor-framework/application-extensions.h>
29 %include <dali/public-api/adaptor-framework/window.h>
30
31 #if defined(SWIGCSHARP)
32
33 // %include <arrays_csharp.i>
34 // CSHARP_ARRAYS(char **, string)
35 // %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[]"
36 // %apply int *INPUT { int *argc };
37 // %apply char **INPUT[]  { char **argv[] };
38
39 %{
40   // keep argcs and argv so they're always available to DALi
41   int argC = 1;
42   char **argV = NULL;
43 %}
44
45 // Temporary hack to generate argv. Todo... support conversions from the C# strings[] in the argv that is generated below
46
47 %typemap(in) ( int* argc, char **argv[]  ) {
48
49   // Todo generate argv data from the C# args
50   char **array;         // two dimensional array
51   int numStrings = 1;     // number of strings
52   int stringLength = 30;      // max string length.
53   array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
54   argV = array;
55
56   // allocate the string data
57   for( int i=0; i < numStrings; i++)
58   {
59     array[i]=(char *)malloc( stringLength * sizeof(char *) );
60   }
61   array[ numStrings ] =  NULL; // we allocated +1 for hold the NULL part
62
63   strcpy( array[0], "dali-csharp-app");
64
65   $1 = &argC;
66   $2 = &argV;
67 }
68
69 // add interop services to the file
70 //%typemap(csimports) Dali::Application "using System.Runtime.InteropServices;"
71
72 %csmethodmodifiers Dali::Application::New() "
73   /**
74   * Outer::outer_method(int)
75   */
76   public";
77
78 %typemap(in) ( int* argc, char **argv[]  ) {
79
80   // Todo generate argv data from the C# args
81   char **array;         // two dimensional array
82   int numStrings = 1;     // number of strings
83   int stringLength = 30;      // max string length.
84   array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
85   argV = array;
86
87   // allocate the string data
88   for( int i=0; i < numStrings; i++)
89   {
90     array[i]=(char *)malloc( stringLength * sizeof(char *) );
91   }
92   array[ numStrings ] =  NULL; // we allocated +1 for hold the NULL part
93
94   strcpy( array[0], "dali-csharp-app");
95
96   $1 = &argC;
97   $2 = &argV;
98 }
99
100 %apply int* INPUT { int* argc };
101
102 #endif
103
104 %include <dali/public-api/adaptor-framework/application.h>
105
106 %template(ApplicationSignal) Dali::Signal<void(Dali::Application&)>;
107 %template(ApplicationControlSignal) Dali::Signal<void(Dali::Application&, void*)>;
108 %template(TimerSignalType) Dali::Signal<bool()>;
109
110
111 // Application specialisation
112 // Macro to convert from a void * callback to a DALi C# object
113