Added C# bindings for Window Show/Hide
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / dali.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 #if defined(SWIGCSHARP)
19 %module(directors="1") NDalic
20 #define DALI_EXPORT_API
21 #define DALI_IMPORT_API
22 #define DALI_INTERNAL
23 #else
24 %module Dali
25 #endif
26
27 %include exception.i
28 %include dali-gc.i
29
30 %exception {
31     try {
32         $action
33     } catch (std::out_of_range& e) {
34         SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
35     } catch (std::exception& e) {
36         SWIG_exception(SWIG_RuntimeError,const_cast<char*>(e.what()));
37     } catch (...) {
38         SWIG_exception(SWIG_UnknownError,"unknown error");
39     }
40 }
41
42 #if defined(SWIGCSHARP)
43 %{
44 #define SWIGSTDCALL
45 %}
46 #endif
47
48 %{
49 #include <dali/dali.h>
50 #include <dali-toolkit/dali-toolkit.h>
51
52 #include <dali/devel-api/actors/actor-devel.h>
53
54 #include <dali/public-api/math/matrix.h>
55 #include <dali/public-api/math/matrix3.h>
56 #include <dali/public-api/math/viewport.h>
57 #include <dali/public-api/object/property-key.h>
58 #include <dali/devel-api/object/csharp-type-info.h>
59 #include <dali/devel-api/object/csharp-type-registry.h>
60
61 #include <dali/public-api/adaptor-framework/timer.h>
62 #include <dali/public-api/adaptor-framework/window.h>
63 #include <dali/public-api/adaptor-framework/style-change.h>
64 #include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
65 #include <dali/devel-api/adaptor-framework/application-extensions.h>
66 #include <dali/devel-api/adaptor-framework/window-devel.h>
67
68 #include <dali/devel-api/images/nine-patch-image.h>
69
70 #include <dali-toolkit/devel-api/builder/builder.h>
71
72 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
73
74 #include <dali-toolkit/devel-api/controls/popup/popup.h>
75 #include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
76 #include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
77 #include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
78 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
79 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
80 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
81 #include <dali-toolkit/devel-api/controls/buttons/toggle-button.h>
82
83 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
84 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
85 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
86
87 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
88
89 #include <dali-toolkit/devel-api/controls/tooltip/tooltip-properties.h>
90
91 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
92
93 // add here SWIG version check
94
95 #if defined(_MSC_VER)         // Microsoft Visual C++ 6.0
96 // disable Swig-dependent warnings
97
98 // 'identifier1' has C-linkage specified,
99 // but returns UDT 'identifier2' which is incompatible with C
100 #pragma warning(disable: 4190)
101
102 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
103 #pragma warning(disable: 4800)
104
105 // debug info too long etc etc
106 #pragma warning(disable: 4786)
107 #endif
108 %}
109
110 %include stl.i
111 %include exception.i
112 %include typemaps.i
113 %include std_common.i
114 %include carrays.i
115
116 %include cpointer.i
117 %pointer_class(float, floatp);
118 %pointer_class(int, intp);
119 %pointer_class(double, doublep);
120 %pointer_class(unsigned int, uintp);
121 %pointer_class(unsigned short, ushortp);
122 %pointer_cast(int, unsigned int, int_to_uint);
123
124 %apply unsigned char { uint8_t };
125 %apply unsigned short int { uint16_t };
126 %apply unsigned int { uint32_t };
127 %apply int { int32_t };
128
129 #if defined(SWIGCSHARP)
130
131 %typemap(ctype)  void * "void *"
132 %typemap(imtype) void * "System.IntPtr"
133 %typemap(cstype) void * "System.IntPtr"
134 %typemap(csin)   void * "$csinput"
135 %typemap(in)     void * %{ $1 = $input; %}
136 %typemap(out)    void * %{ $result = $1; %}
137 %typemap(csout)  void * { return $imcall; }
138
139 #endif
140
141 #if defined(SWIGCSHARP)
142
143 // string &
144 %typemap(ctype) std::string & "char**"
145 %typemap(imtype) std::string & "out string"
146 %typemap(cstype) std::string & "out string"
147
148 //C++
149 %typemap(in, canthrow=1) std::string &
150 %{
151   //typemap in
152   std::string temp;
153   $1 = &temp;
154 %}
155
156 %typemap(argout) std::string &
157 %{
158   //Typemap argout in c++ file.
159   //This will convert c++ string to c# string
160   *$input = SWIG_csharp_string_callback($1->c_str());
161 %}
162
163 %typemap(argout) const std::string &
164 %{
165   //argout typemap for const std::string&
166 %}
167
168 %typemap(csin) std::string & "out $csinput"
169
170 %typemap(throws, canthrow=1) string &
171 %{
172   SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
173   return $null;
174 %}
175
176
177
178
179 // Type registry type maps
180 %typemap(cstype) Dali::TypeInfo::CreateFunction "System.Delegate"
181 %typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
182   Dali::TypeInfo::CreateFunction "new System.Runtime.InteropServices.HandleRef(null, ip)" // null was this
183
184 %typemap(cstype) Dali::CSharpTypeInfo::CreateFunction "System.Delegate"
185 %typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
186    Dali::CSharpTypeInfo::CreateFunction "new System.Runtime.InteropServices.HandleRef(null, ip)" // null was this
187
188
189
190 %typemap(cstype) Dali::CSharpTypeInfo::SetPropertyFunction "System.Delegate"
191 %typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
192    Dali::CSharpTypeInfo::SetPropertyFunction "new System.Runtime.InteropServices.HandleRef(null, ip)" // null was this
193
194
195
196 %typemap(cstype) Dali::CSharpTypeInfo::GetPropertyFunction "System.Delegate"
197 %typemap(csin, pre ="System.IntPtr ip2 = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
198    Dali::CSharpTypeInfo::GetPropertyFunction "new System.Runtime.InteropServices.HandleRef(null, ip2)" // null was this
199
200
201
202
203
204
205
206 #endif
207
208
209
210 /**
211  * Extend the type registry to allow for registering of C# controls and custom properties
212  */
213 %extend Dali::TypeRegistration {
214
215
216    static void RegisterControl( const std::string& controlName, Dali::CSharpTypeInfo::CreateFunction createFunc )
217    {
218      Dali::CSharpTypeRegistry::RegisterType( controlName, typeid( Dali::Toolkit::Control), createFunc );
219    };
220
221
222    static void RegisterProperty( const std::string& controlName,
223                     const std::string& propertyName,
224                     int index,
225                     Property::Type type,
226                     Dali::CSharpTypeInfo::SetPropertyFunction setFunc,
227                     Dali::CSharpTypeInfo::GetPropertyFunction getFunc )
228    {
229      Dali::CSharpTypeRegistry::RegisterProperty( controlName, propertyName, index, type, setFunc, getFunc );
230    };
231
232 };
233
234
235 %ignore operator<<;
236 %ignore *::GetImplementation();
237 %ignore *::GetImplementation(Dali::BaseHandle&);
238
239 %{
240 using namespace Dali;
241 using namespace Dali::Toolkit;
242 %}
243
244 %feature("director") Dali::Toolkit::Internal::Control;
245 %feature("notabstract") Dali::Toolkit::FixedRuler;
246 %feature("notabstract") Dali::Toolkit::DefaultRuler;
247
248 // Note... all the typemap declarations have to be included before the DALi C++ head files are include otherwise
249 // they have no effect.
250
251 %include signal-parameters.i
252 %include signals.i
253
254 %include doxygen.i
255
256 %include events/actor-event.i
257 %include events/accessibilitymanager-event.i
258 %include events/application-event.i
259 %include events/animation-event.i
260 %include events/button-event.i
261 %include events/builder-event.i
262 %include events/control-event.i
263 %include events/gaussian-blur-view-event.i
264 %include events/image-event.i
265 %include events/itemview-event.i
266 %include events/objectregistry-event.i
267 %include events/popup-event.i
268 %include events/pinchgesture-event.i
269 %include events/pageturnview-event.i
270 %include events/pangesture-event.i
271 %include events/progress-bar-event.i
272 %include events/propertynotification-event.i
273 %include events/longpressgesture-event.i
274 %include events/rectangle.i
275 %include events/padding.i
276 %include events/resourceimage-event.i
277 %include events/scrollable-event.i
278 %include events/scrollbar-event.i
279 %include events/scrollview-event.i
280 %include events/slider-event.i
281 %include events/stage-event.i
282 %include events/stylemanager-event.i
283 %include events/tapgesture-event.i
284 %include events/texteditor-event.i
285 %include events/textfield-event.i
286 %include events/timer-event.i
287 %include events/videoview-event.i
288
289 %include alphafunction.i
290 %include rotation.i
291 %include name-changed.i
292 %include property-value.i
293 %include dali-operator.i
294 %include devel-properties.i
295
296 %include gestures/hover.i
297 %include gestures/gesture.i
298 %include gestures/long-press-gesture.i
299 %include gestures/pan-gesture.i
300 %include gestures/tap-gesture.i
301 %include gestures/pinch-gesture.i
302 %include gestures/wheel.i
303 %include gestures/touch.i
304 %include gestures/key.i
305
306 %include adaptor/window.i
307
308 %include dali-core.i
309 %include dali-adaptor.i
310 %include dali-toolkit.i