2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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 FUiCtrlKeypad.cpp
20 * @brief This file contains implementation of Keypad class
22 * This file contains implementation of Keypad class.
25 #include <FBaseSysLog.h>
26 #include <FUiCtrlKeypad.h>
27 #include "FUiCtrl_KeypadImpl.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Runtime;
32 namespace Tizen { namespace Ui { namespace Controls
46 Keypad::Construct(KeypadStyle keypadStyle, int limitLength)
48 return Construct(keypadStyle, KEYPAD_MODE_ALPHA, limitLength);
52 Keypad::Construct(KeypadStyle keypadStyle, KeypadInputModeCategory category, int limitLength)
56 _KeypadImpl* pImpl = _KeypadImpl::GetInstance(*this);
57 SysAssertf(pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
58 SysTryReturn(NID_UI_CTRL, limitLength > 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
60 pImpl = _KeypadImpl::CreateKeypadImplN(this);
62 SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
64 _pControlImpl = pImpl;
66 r = pImpl->Initialize(keypadStyle, category, limitLength);
67 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
79 Keypad::IsTextPredictionEnabled(void) const
81 const _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
82 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
84 return pKeypadImpl->IsTextPredictionEnabled();
88 Keypad::SetTextPredictionEnabled(bool enable)
90 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
91 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
93 pKeypadImpl->SetTextPredictionEnabled(enable);
99 Keypad::SetSingleLineEnabled(bool enabled)
101 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
102 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
103 return pKeypadImpl->SetSingleLineEnabled(enabled);
107 Keypad::IsSingleLineEnabled(void) const
109 const _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
110 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
111 return pKeypadImpl->IsSingleLineEnabled();
115 Keypad::AddTextEventListener(ITextEventListener& listener)
117 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
118 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
119 pKeypadImpl->AddTextEventListener(listener);
125 Keypad::RemoveTextEventListener(ITextEventListener& listener)
127 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
128 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
129 pKeypadImpl->RemoveTextEventListener(listener);
135 Keypad::GetText(void) const
137 const _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
138 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
139 return pKeypadImpl->GetText();
143 Keypad::SetText(String text)
145 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
146 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
147 return pKeypadImpl->SetText(text);
151 Keypad::SetEditTextFilter(IEditTextFilter* pFilter)
153 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
154 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
156 pKeypadImpl->SetEditTextFilter(pFilter);
162 Keypad::SendOpaqueCommand (const Tizen::Base::String& command)
164 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
165 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
167 pKeypadImpl->SendOpaqueCommand(command);
172 }}} // Tizen::Ui::Controls