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);
44 ret = Dali::KeyGrab::GrabKeyTopmost(*_win, (Dali::KEY)daliKey);
46 } catch (std::out_of_range& e) {
48 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
50 } catch (std::exception& e) {
52 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
56 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
61 LOG("CSharp_Dali_GrabKeyTopmost() [DP2] ret=%d", ret);
66 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKeyTopmost(void * window, int daliKey)
68 Dali::Window *_win = (Dali::Window *)window;
71 LOG("CSharp_Dali_UngrabKeyTopmost() [DP1] window=%d, dalikey=%d", window, daliKey);
76 ret = Dali::KeyGrab::UngrabKeyTopmost(*_win, (Dali::KEY)daliKey);
78 } catch (std::out_of_range& e) {
80 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
82 } catch (std::exception& e) {
84 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
88 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
93 LOG("CSharp_Dali_UngrabKeyTopmost() [DP2] ret=%d", ret);
98 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_GrabKey(void * window, int daliKey, int grabMode)
100 Dali::Window *_win = (Dali::Window *)window;
103 LOG("CSharp_Dali_GrabKey() [DP1] window=%d, dalikey=%d, grabmode=%d", window, daliKey, grabMode);
108 ret = Dali::KeyGrab::GrabKey(*_win, (Dali::KEY)daliKey, (Dali::KeyGrab::KeyGrabMode)grabMode);
110 } catch (std::out_of_range& e) {
112 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
114 } catch (std::exception& e) {
116 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
120 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
125 DALI_LOG_ERROR("CSharp_Dali_GrabKey() [DP2] ret=%d", ret);
130 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_UngrabKey(void * window, int daliKey)
132 Dali::Window *_win = (Dali::Window *)window;
135 LOG("CSharp_Dali_UngrabKey() [DP1] window=%d, dalikey=%d", window, daliKey);
140 ret = Dali::KeyGrab::UngrabKey(*_win, (Dali::KEY)daliKey);
142 } catch (std::out_of_range& e) {
144 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
146 } catch (std::exception& e) {
148 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
152 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
157 LOG("CSharp_Dali_UngrabKey() [DP2] ret=%d", ret);
162 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_GetNativeWindowHandler( void* window )
164 Dali::Window *_win = (Dali::Window *)window;
167 LOG("CSharp_Dali_GetNativeWindowHandler() [DP1] window=%d", window);
172 ret = Dali::DevelWindow::GetNativeWindowHandler(*_win);
174 } catch (std::out_of_range& e) {
176 SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
178 } catch (std::exception& e) {
180 SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
184 SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return false;
191 LOG("CSharp_Dali_GetNativeWindowHandler() [DP2] ret=%d", ret);