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