69cbd041e1299d060632902cf16d215ba0acef32
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / dali.i
1 /*
2  * Copyright (c) 2016 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 // This define is needed to fix SWIG compilation error when compiling / parsing DALi deprecated APIs.
49 #define DALI_DEPRECATED_API
50
51 %{
52 #include <dali/dali.h>
53 #include <dali-toolkit/dali-toolkit.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
60 #include <dali/public-api/adaptor-framework/timer.h>
61 #include <dali/public-api/adaptor-framework/window.h>
62 #include <dali/public-api/adaptor-framework/style-change.h>
63 #include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
64 #include <dali/devel-api/adaptor-framework/application-extensions.h>
65
66 #include <dali/devel-api/images/nine-patch-image.h>
67
68 #include <dali-toolkit/devel-api/builder/builder.h>
69
70 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
71
72 #include <dali-toolkit/devel-api/controls/popup/popup.h>
73 #include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
74 #include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
75 #include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
76 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
77 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
78 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.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/public-api/controls/scrollable/item-view/item-view-declarations.h>
87
88 // add here SWIG version check
89
90 #if defined(_MSC_VER)         // Microsoft Visual C++ 6.0
91 // disable Swig-dependent warnings
92
93 // 'identifier1' has C-linkage specified,
94 // but returns UDT 'identifier2' which is incompatible with C
95 #pragma warning(disable: 4190)
96
97 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
98 #pragma warning(disable: 4800)
99
100 // debug info too long etc etc
101 #pragma warning(disable: 4786)
102 #endif
103 %}
104
105 %include stl.i
106 %include exception.i
107 %include typemaps.i
108 %include std_common.i
109 %include carrays.i
110
111 %include cpointer.i
112 %pointer_class(float, floatp);
113 %pointer_class(int, intp);
114 %pointer_class(double, doublep);
115 %pointer_class(unsigned int, uintp);
116 %pointer_class(unsigned short, ushortp);
117 %pointer_cast(int, unsigned int, int_to_uint);
118
119 %apply unsigned char { uint8_t };
120 %apply unsigned short int { uint16_t };
121 %apply unsigned int { uint32_t };
122 %apply int { int32_t };
123
124 #if defined(SWIGCSHARP)
125
126 %typemap(ctype)  void * "void *"
127 %typemap(imtype) void * "System.IntPtr"
128 %typemap(cstype) void * "System.IntPtr"
129 %typemap(csin)   void * "$csinput"
130 %typemap(in)     void * %{ $1 = $input; %}
131 %typemap(out)    void * %{ $result = $1; %}
132 %typemap(csout)  void * { return $imcall; }
133
134 #endif
135
136 #if defined(SWIGCSHARP)
137
138 // string &
139 %typemap(ctype) std::string & "char**"
140 %typemap(imtype) std::string & "out string"
141 %typemap(cstype) std::string & "out string"
142
143 //C++
144 %typemap(in, canthrow=1) std::string &
145 %{
146   //typemap in
147   std::string temp;
148   $1 = &temp;
149 %}
150
151 %typemap(argout) std::string &
152 %{
153   //Typemap argout in c++ file.
154   //This will convert c++ string to c# string
155   *$input = SWIG_csharp_string_callback($1->c_str());
156 %}
157
158 %typemap(argout) const std::string &
159 %{
160   //argout typemap for const std::string&
161 %}
162
163 %typemap(csin) std::string & "out $csinput"
164
165 %typemap(throws, canthrow=1) string &
166 %{
167   SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
168   return $null;
169 %}
170
171 #endif
172
173 %ignore operator<<;
174 %ignore *::GetImplementation();
175 %ignore *::GetImplementation(Dali::BaseHandle&);
176
177 %{
178 using namespace Dali;
179 using namespace Dali::Toolkit;
180 %}
181
182 %feature("director") Dali::Toolkit::Internal::Control;
183 %feature("notabstract") Dali::Toolkit::FixedRuler;
184 %feature("notabstract") Dali::Toolkit::DefaultRuler;
185
186 // Note... all the typemap declarations have to be included before the DALi C++ head files are include otherwise
187 // they have no effect.
188
189 %include signal-parameters.i
190 %include signals.i
191
192 %include events/actor-event.i
193 %include events/accessibilitymanager-event.i
194 %include events/application-event.i
195 %include events/animation-event.i
196 %include events/button-event.i
197 %include events/builder-event.i
198 %include events/control-event.i
199 %include events/gaussian-blur-view-event.i
200 %include events/image-event.i
201 %include events/itemview-event.i
202 %include events/keyboardFocusManager-event.i
203 %include events/objectregistry-event.i
204 %include events/popup-event.i
205 %include events/pinchgesture-event.i
206 %include events/pageturnview-event.i
207 %include events/pangesture-event.i
208 %include events/propertynotification-event.i
209 %include events/longpressgesture-event.i
210 %include events/rectinteger.i
211 %include events/resourceimage-event.i
212 %include events/scrollable-event.i
213 %include events/scrollbar-event.i
214 %include events/scrollview-event.i
215 %include events/slider-event.i
216 %include events/stage-event.i
217 %include events/stylemanager-event.i
218 %include events/tapgesture-event.i
219 %include events/texteditor-event.i
220 %include events/textfield-event.i
221 %include events/timer-event.i
222 %include events/videoview-event.i
223
224 %include alphafunction.i
225
226 %include dali-operator.i
227 %include dali-core.i
228 %include dali-adaptor.i
229 %include dali-toolkit.i
230