2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #if defined(SWIGCSHARP)
19 %module(directors="1") NDalic
20 #define DALI_EXPORT_API
21 #define DALI_IMPORT_API
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()));
38 SWIG_exception(SWIG_UnknownError,"unknown error");
42 #if defined(SWIGCSHARP)
49 #include <dali/dali.h>
50 #include <dali-toolkit/dali-toolkit.h>
52 #include <dali/devel-api/actors/actor-devel.h>
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>
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>
68 #include <dali/devel-api/images/nine-patch-image.h>
70 #include <dali-toolkit/devel-api/builder/builder.h>
72 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
73 #include <dali-toolkit/devel-api/focus-manager/keyboard-focus-manager-devel.h>
75 #include <dali-toolkit/devel-api/controls/popup/popup.h>
76 #include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
77 #include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
78 #include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
79 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
80 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
81 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
82 #include <dali-toolkit/devel-api/controls/buttons/toggle-button.h>
84 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
85 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
86 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
88 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
90 #include <dali-toolkit/devel-api/controls/tooltip/tooltip-properties.h>
92 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
94 // add here SWIG version check
96 #if defined(_MSC_VER) // Microsoft Visual C++ 6.0
97 // disable Swig-dependent warnings
99 // 'identifier1' has C-linkage specified,
100 // but returns UDT 'identifier2' which is incompatible with C
101 #pragma warning(disable: 4190)
103 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
104 #pragma warning(disable: 4800)
106 // debug info too long etc etc
107 #pragma warning(disable: 4786)
114 %include std_common.i
118 %pointer_class(float, floatp);
119 %pointer_class(int, intp);
120 %pointer_class(double, doublep);
121 %pointer_class(unsigned int, uintp);
122 %pointer_class(unsigned short, ushortp);
123 %pointer_cast(int, unsigned int, int_to_uint);
125 %apply unsigned char { uint8_t };
126 %apply unsigned short int { uint16_t };
127 %apply unsigned int { uint32_t };
128 %apply int { int32_t };
130 #if defined(SWIGCSHARP)
132 %typemap(ctype) void * "void *"
133 %typemap(imtype) void * "System.IntPtr"
134 %typemap(cstype) void * "System.IntPtr"
135 %typemap(csin) void * "$csinput"
136 %typemap(in) void * %{ $1 = $input; %}
137 %typemap(out) void * %{ $result = $1; %}
138 %typemap(csout) void * { return $imcall; }
142 #if defined(SWIGCSHARP)
145 %typemap(ctype) std::string & "char**"
146 %typemap(imtype) std::string & "out string"
147 %typemap(cstype) std::string & "out string"
150 %typemap(in, canthrow=1) std::string &
157 %typemap(argout) std::string &
159 //Typemap argout in c++ file.
160 //This will convert c++ string to c# string
161 *$input = SWIG_csharp_string_callback($1->c_str());
164 %typemap(argout) const std::string &
166 //argout typemap for const std::string&
169 %typemap(csin) std::string & "out $csinput"
171 %typemap(throws, canthrow=1) string &
173 SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
180 // Type registry type maps
181 %typemap(cstype) Dali::TypeInfo::CreateFunction "System.Delegate"
182 %typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
183 Dali::TypeInfo::CreateFunction "new System.Runtime.InteropServices.HandleRef(null, ip)" // null was this
185 %typemap(cstype) Dali::CSharpTypeInfo::CreateFunction "System.Delegate"
186 %typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
187 Dali::CSharpTypeInfo::CreateFunction "new System.Runtime.InteropServices.HandleRef(null, ip)" // null was this
191 %typemap(cstype) Dali::CSharpTypeInfo::SetPropertyFunction "System.Delegate"
192 %typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
193 Dali::CSharpTypeInfo::SetPropertyFunction "new System.Runtime.InteropServices.HandleRef(null, ip)" // null was this
197 %typemap(cstype) Dali::CSharpTypeInfo::GetPropertyFunction "System.Delegate"
198 %typemap(csin, pre ="System.IntPtr ip2 = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
199 Dali::CSharpTypeInfo::GetPropertyFunction "new System.Runtime.InteropServices.HandleRef(null, ip2)" // null was this
212 * Extend the type registry to allow for registering of C# controls and custom properties
214 %extend Dali::TypeRegistration {
217 static void RegisterControl( const std::string& controlName, Dali::CSharpTypeInfo::CreateFunction createFunc )
219 Dali::CSharpTypeRegistry::RegisterType( controlName, typeid( Dali::Toolkit::Control), createFunc );
223 static void RegisterProperty( const std::string& controlName,
224 const std::string& propertyName,
227 Dali::CSharpTypeInfo::SetPropertyFunction setFunc,
228 Dali::CSharpTypeInfo::GetPropertyFunction getFunc )
230 Dali::CSharpTypeRegistry::RegisterProperty( controlName, propertyName, index, type, setFunc, getFunc );
237 %ignore *::GetImplementation();
238 %ignore *::GetImplementation(Dali::BaseHandle&);
241 using namespace Dali;
242 using namespace Dali::Toolkit;
245 %feature("director") Dali::Toolkit::Internal::Control;
246 %feature("notabstract") Dali::Toolkit::FixedRuler;
247 %feature("notabstract") Dali::Toolkit::DefaultRuler;
249 %feature("director") Dali::Toolkit::DevelKeyboardFocusManager::CustomAlgorithmInterface;
251 // Note... all the typemap declarations have to be included before the DALi C++ head files are include otherwise
252 // they have no effect.
254 %include signal-parameters.i
259 %include events/actor-event.i
260 %include events/accessibilitymanager-event.i
261 %include events/application-event.i
262 %include events/animation-event.i
263 %include events/button-event.i
264 %include events/builder-event.i
265 %include events/control-event.i
266 %include events/gaussian-blur-view-event.i
267 %include events/image-event.i
268 %include events/itemview-event.i
269 %include events/objectregistry-event.i
270 %include events/popup-event.i
271 %include events/pinchgesture-event.i
272 %include events/pageturnview-event.i
273 %include events/pangesture-event.i
274 %include events/progress-bar-event.i
275 %include events/propertynotification-event.i
276 %include events/longpressgesture-event.i
277 %include events/rectangle.i
278 %include events/padding.i
279 %include events/resourceimage-event.i
280 %include events/scrollable-event.i
281 %include events/scrollbar-event.i
282 %include events/scrollview-event.i
283 %include events/slider-event.i
284 %include events/stage-event.i
285 %include events/stylemanager-event.i
286 %include events/tapgesture-event.i
287 %include events/texteditor-event.i
288 %include events/textfield-event.i
289 %include events/timer-event.i
290 %include events/videoview-event.i
292 %include alphafunction.i
294 %include name-changed.i
295 %include property-value.i
296 %include dali-operator.i
297 %include devel-properties.i
299 %include gestures/hover.i
300 %include gestures/gesture.i
301 %include gestures/long-press-gesture.i
302 %include gestures/pan-gesture.i
303 %include gestures/tap-gesture.i
304 %include gestures/pinch-gesture.i
305 %include gestures/wheel.i
306 %include gestures/touch.i
307 %include gestures/key.i
309 %include adaptor/window.i
312 %include dali-adaptor.i
313 %include dali-toolkit.i