1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
19 #include <dali/integration-api/debug.h>
20 #include <dali/public-api/adaptor-framework/key-grab.h>
21 #include <dali/devel-api/adaptor-framework/window-devel.h>
25 //#define LOG DALI_LOG_ERROR
34 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_GrabKeyTopmost(void * window, int daliKey)
36 Dali::Window *_win = (Dali::Window *)window;
39 LOG("CSharp_Dali_GrabKeyTopmost() [DP1] window=%d, dalikey=%d", window, daliKey);
43 ret = Dali::KeyGrab::GrabKeyTopmost(*_win, (Dali::KEY)daliKey);
44 } catch (std::out_of_range& e) {
46 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
48 } catch (std::exception& e) {
50 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
54 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
59 LOG("CSharp_Dali_GrabKeyTopmost() [DP2] ret=%d", ret);
64 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKeyTopmost(void * window, int daliKey)
66 Dali::Window *_win = (Dali::Window *)window;
69 LOG("CSharp_Dali_UngrabKeyTopmost() [DP1] window=%d, dalikey=%d", window, daliKey);
73 ret = Dali::KeyGrab::UngrabKeyTopmost(*_win, (Dali::KEY)daliKey);
74 } catch (std::out_of_range& e) {
76 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
78 } catch (std::exception& e) {
80 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
84 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
89 LOG("CSharp_Dali_UngrabKeyTopmost() [DP2] ret=%d", ret);
94 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_GrabKey(void * window, int daliKey, int grabMode)
96 Dali::Window *_win = (Dali::Window *)window;
99 LOG("CSharp_Dali_GrabKey() [DP1] window=%d, dalikey=%d, grabmode=%d", window, daliKey, grabMode);
103 ret = Dali::KeyGrab::GrabKey(*_win, (Dali::KEY)daliKey, (Dali::KeyGrab::KeyGrabMode)grabMode);
104 } catch (std::out_of_range& e) {
106 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
108 } catch (std::exception& e) {
110 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
114 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
119 DALI_LOG_ERROR("CSharp_Dali_GrabKey() [DP2] ret=%d", ret);
124 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKey(void * window, int daliKey)
126 Dali::Window *_win = (Dali::Window *)window;
129 LOG("CSharp_Dali_UngrabKey() [DP1] window=%d, dalikey=%d", window, daliKey);
133 ret = Dali::KeyGrab::UngrabKey(*_win, (Dali::KEY)daliKey);
134 } catch (std::out_of_range& e) {
136 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
138 } catch (std::exception& e) {
140 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
144 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
149 LOG("CSharp_Dali_UngrabKey() [DP2] ret=%d", ret);
154 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_GetNativeWindowHandler( void* window )
156 Dali::Window *_win = (Dali::Window *)window;
159 LOG("CSharp_Dali_GetNativeWindowHandler() [DP1] window=%d", window);
163 ret = Dali::DevelWindow::GetNativeWindowHandler(*_win);
164 } catch (std::out_of_range& e) {
166 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return NULL;
168 } catch (std::exception& e) {
170 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return NULL;
174 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return NULL;
181 LOG("CSharp_Dali_GetNativeWindowHandler() [DP2] ret=%d", ret);