2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiInputConnection.cpp
20 * @brief This is the implementation file for InputConnection class.
23 #include <FBaseSysLog.h>
24 #include <FGrpRectangle.h>
25 #include <FLclLocale.h>
26 #include <FUiInputConnection.h>
27 #include "FUi_ControlImpl.h"
28 #include "FUi_InputConnectionImpl.h"
31 using namespace Tizen::Graphics;
32 using namespace Tizen::Locales;
33 using namespace Tizen::Security;
35 namespace Tizen { namespace Ui {
37 InputConnection::InputConnection(void)
38 :__pInputConnectionImpl(null)
43 InputConnection::~InputConnection(void)
45 if (__pInputConnectionImpl)
47 delete __pInputConnectionImpl;
48 __pInputConnectionImpl = null;
53 InputConnection::Construct(const Control* pControl, IInputConnectionEventListener& listener, IInputConnectionProvider& provider)
55 SysTryReturnResult(NID_UI, pControl, E_INVALID_ARG, "The argument is invalid.");
57 __pInputConnectionImpl = _InputConnectionImpl::CreateInputConnectionImplN(this);
58 result r = GetLastResult();
59 SysTryReturn(NID_UI, __pInputConnectionImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
61 r = __pInputConnectionImpl->Initialize(_ControlImpl::GetInstance(*pControl)->GetCore(), listener, provider);
62 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
67 delete __pInputConnectionImpl;
68 __pInputConnectionImpl = null;
73 InputConnection::BindInputMethod(void)
77 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
79 r = __pInputConnectionImpl->BindInputMethod();
80 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
86 InputConnection::UnbindInputMethod(void)
88 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
90 __pInputConnectionImpl->UnbindInputMethod();
96 InputConnection::ShowInputPanel(void)
100 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
102 r = __pInputConnectionImpl->ShowInputPanel();
103 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
109 InputConnection::HideInputPanel(void)
111 result r = E_SUCCESS;
113 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
115 r = __pInputConnectionImpl->HideInputPanel();
116 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
122 InputConnection::SetInputPanelStyle(InputPanelStyle style)
124 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
126 __pInputConnectionImpl->SetInputPanelStyle(style);
132 InputConnection::SetAutoCapitalizationMode(AutoCapitalizationMode autoCapitalizationMode)
134 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
136 __pInputConnectionImpl->SetAutoCapitalizationMode(autoCapitalizationMode);
142 InputConnection::FinishTextComposition(void)
144 result r = E_SUCCESS;
146 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
148 r = __pInputConnectionImpl->FinishTextComposition();
149 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
155 InputConnection::SetInputPanelAction(InputPanelAction inputPanelAction)
157 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
159 __pInputConnectionImpl->SetInputPanelAction(inputPanelAction);
165 InputConnection::SetInputPanelActionEnabled(bool enable)
167 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
169 __pInputConnectionImpl->SetInputPanelActionEnabled(enable);
175 InputConnection::SetInputPanelLanguage(LanguageCode languageCode)
177 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
179 return __pInputConnectionImpl->SetInputPanelLanguage(languageCode);
183 InputConnection::SetCursorPosition(int position)
185 result r = E_SUCCESS;
187 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
189 r = __pInputConnectionImpl->SetCursorPosition(position);
190 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
196 InputConnection::SetCursorBounds(const Rectangle& rect)
198 result r = E_SUCCESS;
200 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
202 r = __pInputConnectionImpl->SetCursorBounds(rect);
203 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
209 InputConnection::GetInputPanelBounds(void) const
211 result r = E_SUCCESS;
213 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
215 Rectangle bounds = __pInputConnectionImpl->GetInputPanelBounds();
217 SysTryReturn(NID_UI, r == E_SUCCESS, Rectangle(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r));
223 InputConnection::SetTextPredictionEnabled(bool enable)
225 SysAssertf(__pInputConnectionImpl, "Not yet constructed. Construct() should be called before use.");
227 __pInputConnectionImpl->SetTextPredictionEnabled(enable);