2 * Copyright (c) 2016 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/public-api/math/matrix.h>
53 #include <dali/public-api/math/matrix3.h>
54 #include <dali/public-api/math/viewport.h>
55 #include <dali/public-api/object/property-key.h>
56 #include <dali/devel-api/object/csharp-type-info.h>
57 #include <dali/devel-api/object/csharp-type-registry.h>
59 #include <dali/public-api/adaptor-framework/timer.h>
60 #include <dali/public-api/adaptor-framework/window.h>
61 #include <dali/public-api/adaptor-framework/style-change.h>
62 #include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
63 #include <dali/devel-api/adaptor-framework/application-extensions.h>
65 #include <dali/devel-api/images/nine-patch-image.h>
67 #include <dali-toolkit/devel-api/builder/builder.h>
69 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
71 #include <dali-toolkit/devel-api/controls/popup/popup.h>
72 #include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
73 #include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
74 #include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
75 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
76 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
77 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
79 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
80 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
81 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
83 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
85 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
87 // add here SWIG version check
89 #if defined(_MSC_VER) // Microsoft Visual C++ 6.0
90 // disable Swig-dependent warnings
92 // 'identifier1' has C-linkage specified,
93 // but returns UDT 'identifier2' which is incompatible with C
94 #pragma warning(disable: 4190)
96 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
97 #pragma warning(disable: 4800)
99 // debug info too long etc etc
100 #pragma warning(disable: 4786)
107 %include std_common.i
111 %pointer_class(float, floatp);
112 %pointer_class(int, intp);
113 %pointer_class(double, doublep);
114 %pointer_class(unsigned int, uintp);
115 %pointer_class(unsigned short, ushortp);
116 %pointer_cast(int, unsigned int, int_to_uint);
118 %apply unsigned char { uint8_t };
119 %apply unsigned short int { uint16_t };
120 %apply unsigned int { uint32_t };
121 %apply int { int32_t };
123 #if defined(SWIGCSHARP)
125 %typemap(ctype) void * "void *"
126 %typemap(imtype) void * "System.IntPtr"
127 %typemap(cstype) void * "System.IntPtr"
128 %typemap(csin) void * "$csinput"
129 %typemap(in) void * %{ $1 = $input; %}
130 %typemap(out) void * %{ $result = $1; %}
131 %typemap(csout) void * { return $imcall; }
135 #if defined(SWIGCSHARP)
138 %typemap(ctype) std::string & "char**"
139 %typemap(imtype) std::string & "out string"
140 %typemap(cstype) std::string & "out string"
143 %typemap(in, canthrow=1) std::string &
150 %typemap(argout) std::string &
152 //Typemap argout in c++ file.
153 //This will convert c++ string to c# string
154 *$input = SWIG_csharp_string_callback($1->c_str());
157 %typemap(argout) const std::string &
159 //argout typemap for const std::string&
162 %typemap(csin) std::string & "out $csinput"
164 %typemap(throws, canthrow=1) string &
166 SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
173 // Type registry type maps
174 %typemap(cstype) Dali::TypeInfo::CreateFunction "System.Delegate"
175 %typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
176 Dali::TypeInfo::CreateFunction "new System.Runtime.InteropServices.HandleRef(null, ip)" // null was this
178 %typemap(cstype) Dali::CSharpTypeInfo::CreateFunction "System.Delegate"
179 %typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
180 Dali::CSharpTypeInfo::CreateFunction "new System.Runtime.InteropServices.HandleRef(null, ip)" // null was this
184 %typemap(cstype) Dali::CSharpTypeInfo::SetPropertyFunction "System.Delegate"
185 %typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
186 Dali::CSharpTypeInfo::SetPropertyFunction "new System.Runtime.InteropServices.HandleRef(null, ip)" // null was this
190 %typemap(cstype) Dali::CSharpTypeInfo::GetPropertyFunction "System.Delegate"
191 %typemap(csin, pre ="System.IntPtr ip2 = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
192 Dali::CSharpTypeInfo::GetPropertyFunction "new System.Runtime.InteropServices.HandleRef(null, ip2)" // null was this
205 * Extend the type registry to allow for registering of C# controls and custom properties
207 %extend Dali::TypeRegistration {
210 static void RegisterControl( const std::string& controlName, Dali::CSharpTypeInfo::CreateFunction createFunc )
212 Dali::CSharpTypeRegistry::RegisterType( controlName, typeid( Dali::Toolkit::Control), createFunc );
216 static void RegisterProperty( const std::string& controlName,
217 const std::string& propertyName,
220 Dali::CSharpTypeInfo::SetPropertyFunction setFunc,
221 Dali::CSharpTypeInfo::GetPropertyFunction getFunc )
223 Dali::CSharpTypeRegistry::RegisterProperty( controlName, propertyName, index, type, setFunc, getFunc );
232 %ignore *::GetImplementation();
233 %ignore *::GetImplementation(Dali::BaseHandle&);
236 using namespace Dali;
237 using namespace Dali::Toolkit;
240 %feature("director") Dali::Toolkit::Internal::Control;
241 %feature("notabstract") Dali::Toolkit::FixedRuler;
242 %feature("notabstract") Dali::Toolkit::DefaultRuler;
244 // Note... all the typemap declarations have to be included before the DALi C++ head files are include otherwise
245 // they have no effect.
247 %include signal-parameters.i
250 %include events/actor-event.i
251 %include events/accessibilitymanager-event.i
252 %include events/application-event.i
253 %include events/animation-event.i
254 %include events/button-event.i
255 %include events/builder-event.i
256 %include events/control-event.i
257 %include events/gaussian-blur-view-event.i
258 %include events/image-event.i
259 %include events/itemview-event.i
260 %include events/objectregistry-event.i
261 %include events/popup-event.i
262 %include events/pinchgesture-event.i
263 %include events/pageturnview-event.i
264 %include events/pangesture-event.i
265 %include events/propertynotification-event.i
266 %include events/longpressgesture-event.i
267 %include events/rectinteger.i
268 %include events/resourceimage-event.i
269 %include events/scrollable-event.i
270 %include events/scrollbar-event.i
271 %include events/scrollview-event.i
272 %include events/slider-event.i
273 %include events/stage-event.i
274 %include events/stylemanager-event.i
275 %include events/tapgesture-event.i
276 %include events/texteditor-event.i
277 %include events/textfield-event.i
278 %include events/timer-event.i
279 %include events/videoview-event.i
281 %include alphafunction.i
282 %include name-changed.i
283 %include property-value.i
284 %include dali-operator.i
285 %include devel-properties.i
288 %include dali-adaptor.i
289 %include dali-toolkit.i