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.
18 * @file FUiCtrlKeypad.cpp
19 * @brief This file contains implementation of Keypad class
21 * This file contains implementation of Keypad class.
24 #include <FBaseSysLog.h>
25 #include <FUiCtrlKeypad.h>
26 #include "FUiCtrl_KeypadImpl.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Runtime;
31 namespace Tizen { namespace Ui { namespace Controls
45 Keypad::Construct(KeypadStyle keypadStyle, int limitLength)
47 return Construct(keypadStyle, KEYPAD_MODE_ALPHA, limitLength);
51 Keypad::Construct(KeypadStyle keypadStyle, KeypadInputModeCategory category, int limitLength)
55 _KeypadImpl* pImpl = _KeypadImpl::GetInstance(*this);
56 SysAssertf(pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
57 SysTryReturn(NID_UI_CTRL, limitLength > 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
59 pImpl = _KeypadImpl::CreateKeypadImplN(this);
61 SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
63 _pControlImpl = pImpl;
65 r = pImpl->Initialize(keypadStyle, category, limitLength);
66 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
78 Keypad::IsTextPredictionEnabled(void) const
80 const _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
81 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
83 return pKeypadImpl->IsTextPredictionEnabled();
87 Keypad::SetTextPredictionEnabled(bool enable)
89 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
90 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
92 pKeypadImpl->SetTextPredictionEnabled(enable);
98 Keypad::SetSingleLineEnabled(bool enabled)
100 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
101 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
102 return pKeypadImpl->SetSingleLineEnabled(enabled);
106 Keypad::IsSingleLineEnabled(void) const
108 const _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
109 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
110 return pKeypadImpl->IsSingleLineEnabled();
114 Keypad::AddTextEventListener(ITextEventListener& listener)
116 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
117 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
118 pKeypadImpl->AddTextEventListener(listener);
122 Keypad::RemoveTextEventListener(ITextEventListener& listener)
124 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
125 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
126 pKeypadImpl->RemoveTextEventListener(listener);
130 Keypad::GetText(void) const
132 const _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
133 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
134 return pKeypadImpl->GetText();
138 Keypad::SetText(String text)
140 _KeypadImpl* pKeypadImpl = _KeypadImpl::GetInstance(*this);
141 SysAssertf(pKeypadImpl != null, "Not yet constructed. Construct() should be called before use.");
142 return pKeypadImpl->SetText(text);
145 }}} // Tizen::Ui::Controls