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