Added C# bindings for Window Show/Hide
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / dali-adaptor.i
1 /*
2  * Copyright (c) 2017 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 %include <dali/devel-api/adaptor-framework/window-devel.h>
31
32 #if defined(SWIGCSHARP)
33
34 // %include <arrays_csharp.i>
35 // CSHARP_ARRAYS(char **, string)
36 // %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[]"
37 // %apply int *INPUT { int *argc };
38 // %apply char **INPUT[]  { char **argv[] };
39
40 %{
41   // keep argcs and argv so they're always available to DALi
42   int argC = 1;
43   char **argV = NULL;
44 %}
45
46 // Temporary hack to generate argv. Todo... support conversions from the C# strings[] in the argv that is generated below
47
48 %typemap(in) ( int* argc, char **argv[]  ) {
49
50   // Todo generate argv data from the C# args
51   char **array;         // two dimensional array
52   int numStrings = 1;     // number of strings
53   int stringLength = 30;      // max string length.
54   array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
55   argV = array;
56
57   // allocate the string data
58   for( int i=0; i < numStrings; i++)
59   {
60     array[i]=(char *)malloc( stringLength * sizeof(char *) );
61   }
62   array[ numStrings ] =  NULL; // we allocated +1 for hold the NULL part
63
64   strcpy( array[0], "dali-csharp-app");
65
66   $1 = &argC;
67   $2 = &argV;
68 }
69
70 // add interop services to the file
71 //%typemap(csimports) Dali::Application "using System.Runtime.InteropServices;"
72
73 %csmethodmodifiers Dali::Application::New() "
74   /**
75   * Outer::outer_method(int)
76   */
77   public";
78
79 %typemap(in) ( int* argc, char **argv[]  ) {
80
81   // Todo generate argv data from the C# args
82   char **array;         // two dimensional array
83   int numStrings = 1;     // number of strings
84   int stringLength = 30;      // max string length.
85   array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
86   argV = array;
87
88   // allocate the string data
89   for( int i=0; i < numStrings; i++)
90   {
91     array[i]=(char *)malloc( stringLength * sizeof(char *) );
92   }
93   array[ numStrings ] =  NULL; // we allocated +1 for hold the NULL part
94
95   strcpy( array[0], "dali-csharp-app");
96
97   $1 = &argC;
98   $2 = &argV;
99 }
100
101 %apply int* INPUT { int* argc };
102
103 #endif
104
105 %include <dali/public-api/adaptor-framework/application.h>
106
107 %template(ApplicationSignal) Dali::Signal<void(Dali::Application&)>;
108 %template(ApplicationControlSignal) Dali::Signal<void(Dali::Application&, void*)>;
109 %template(TimerSignalType) Dali::Signal<bool()>;
110
111
112 // Application specialisation
113 // Macro to convert from a void * callback to a DALi C# object
114