Support legacy way to create InputMethodContext
[platform/core/uifw/dali-csharp-binder.git] / dali-csharp-binder / src / event-thread-callback-wrap.cpp
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 #ifndef CSHARP_EVENT_THREAD_CALLBACK
19 #define CSHARP_EVENT_THREAD_CALLBACK
20 #endif
21
22 #include "common.h"
23 #include <dali/devel-api/adaptor-framework/event-thread-callback.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 typedef void (SWIGSTDCALL* SWIG_CallbackMakeCallback)(void);
30
31 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_EventThreadCallback(SWIG_CallbackMakeCallback callbackOnMakeCallback) {
32   void * jresult ;
33   void (*arg1)(void) = (void (*)(void)) 0 ;
34   Dali::EventThreadCallback *result = 0 ;
35   Dali::CallbackBase * callbackBase = 0 ;
36
37   arg1 = (void (*)(void))callbackOnMakeCallback;
38   callbackBase = (Dali::CallbackBase *)Dali::MakeCallback(arg1);
39
40   {
41     try {
42       result = (Dali::EventThreadCallback *)new Dali::EventThreadCallback(callbackBase);
43     } catch (std::out_of_range& e) {
44       {
45         delete result;
46         delete callbackBase;
47         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
48       };
49     } catch (std::exception& e) {
50       {
51         delete result;
52         delete callbackBase;
53         SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return 0;
54       };
55     } catch (Dali::DaliException e) {
56       {
57         delete result;
58         delete callbackBase;
59         SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
60       };
61     } catch (...) {
62       {
63         delete result;
64         delete callbackBase;
65         SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
66       };
67     }
68   }
69   jresult = (void *)result;
70   return jresult;
71 }
72
73 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_EventThreadCallback(void * jarg1) {
74   Dali::EventThreadCallback *arg1 = (Dali::EventThreadCallback *) 0 ;
75
76   arg1 = (Dali::EventThreadCallback *)jarg1;
77   {
78     try {
79       delete arg1;
80     } catch (std::out_of_range& e) {
81       {
82         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return ;
83       };
84     } catch (std::exception& e) {
85       {
86         SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return ;
87       };
88     } catch (Dali::DaliException e) {
89       {
90         SWIG_CSharpException(SWIG_UnknownError, e.condition); return ;
91       };
92     } catch (...) {
93       {
94         SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return ;
95       };
96     }
97   }
98
99 }
100
101
102 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_EventThreadCallback_Trigger(void * jarg1) {
103   Dali::EventThreadCallback *arg1 = (Dali::EventThreadCallback *) 0 ;
104
105   arg1 = (Dali::EventThreadCallback *)jarg1;
106   {
107     try {
108       (arg1)->Trigger();
109     } catch (std::out_of_range& e) {
110       {
111         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return ;
112       };
113     } catch (std::exception& e) {
114       {
115         SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return ;
116       };
117     } catch (Dali::DaliException e) {
118       {
119         SWIG_CSharpException(SWIG_UnknownError, e.condition); return ;
120       };
121     } catch (...) {
122       {
123         SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return ;
124       };
125     }
126   }
127
128 }
129
130 #ifdef __cplusplus
131 }
132 #endif //CSHARP_EVENT_THREAD_CALLBACK
133