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 FUiCtrl_EditModel.cpp
20 * @brief This is the implementation file for the _EditModel class.
23 #include <FBaseErrorDefine.h>
24 #include <FBaseSysLog.h>
25 #include <FBaseUtilTypes.h>
26 #include <FUiIKeypadEventListener.h>
27 #include "FUi_ResourceManager.h"
28 #include "FUiCtrl_EditModel.h"
30 using namespace Tizen::Base;
31 using namespace Tizen::Locales;
33 namespace Tizen { namespace Ui { namespace Controls
36 _EditModel::_EditModel(void)
37 : __autoLinkMask(Utility::LINK_TYPE_NONE)
38 , __keypadActionEnabled(true)
39 , __viewModeEnabled(false)
40 , __keypadStyle(KEYPAD_STYLE_NORMAL)
41 , __keypadEnabled(false)
42 , __isLowerCase(false)
43 , __isTextPredictionEnabled(true)
44 , __keypadAction(CORE_KEYPAD_ACTION_ENTER)
45 , __enablePredictiveAutoResizing(false)
47 , __languageCode(LANGUAGE_ENG)
48 , __initialKeypadLanguageCode(LANGUAGE_INVALID)
49 , __leftCommandButtonActionId(100)
50 , __rightCommandButtonActionId(101)
51 , __leftCommandButtonText()
52 , __rightCommandButtonText()
54 GET_STRING_CONFIG(IDS_COM_SK_DONE, __leftCommandButtonText);
55 GET_STRING_CONFIG(IDS_COM_SK_CANCEL, __rightCommandButtonText);
58 _EditModel::~_EditModel(void)
63 _EditModel::SetAutoLinkMask(unsigned long autoLinks)
67 __autoLinkMask = autoLinks;
73 _EditModel::GetAutoLinkMask(void) const
75 return __autoLinkMask;
79 _EditModel::IsViewModeEnabled(void) const
81 return __viewModeEnabled;
85 _EditModel::SetViewModeEnabled(bool enable)
89 __viewModeEnabled = enable;
95 _EditModel::SetKeypadActionEnabled(bool enable)
99 __keypadActionEnabled = enable;
105 _EditModel::IsKeypadActionEnabled(void) const
107 return __keypadActionEnabled;
111 _EditModel::GetKeypadAction(void) const
113 return __keypadAction;
117 _EditModel::SetKeypadAction(CoreKeypadAction keypadAction)
119 result r = E_SUCCESS;
121 __keypadAction = keypadAction;
127 _EditModel::SetCurrentLanguage(LanguageCode languageCode)
129 result r = E_SUCCESS;
131 __languageCode = languageCode;
137 _EditModel::GetCurrentLanguage(LanguageCode& language) const
139 result r = E_SUCCESS;
141 language = __languageCode;
147 _EditModel::SetInitialKeypadLanguage(LanguageCode languageCode)
149 result r = E_SUCCESS;
151 __initialKeypadLanguageCode = languageCode;
157 _EditModel::GetInitialKeypadLanguage(LanguageCode& language) const
159 result r = E_SUCCESS;
161 language = __initialKeypadLanguageCode;
167 _EditModel::SetTextPredictionEnabled(bool enable)
169 __isTextPredictionEnabled = enable;
175 _EditModel::IsTextPredictionEnabled(void) const
177 return __isTextPredictionEnabled;
181 _EditModel::SetKeypadEnabled(bool enable)
183 __keypadEnabled = enable;
189 _EditModel::IsKeypadEnabled(void) const
191 return __keypadEnabled;
195 _EditModel::SetLowerCaseModeEnabled(bool enable)
197 __isLowerCase = enable;
203 _EditModel::IsLowerCaseModeEnabled(void) const
205 return __isLowerCase;
209 _EditModel::GetKeypadStyle(void) const
211 return __keypadStyle;
215 _EditModel::SetKeypadStyle(KeypadStyle keypadStyle)
217 __keypadStyle = keypadStyle;
222 _EditModel::SetAutoResizingEnabled(bool enable)
224 __enablePredictiveAutoResizing = enable;
229 _EditModel::IsAutoResizingEnabled(void) const
231 return __enablePredictiveAutoResizing;
235 _EditModel::SetMaxLineCount(int maxLineCount)
237 __maxLineCount = maxLineCount;
244 _EditModel::GetMaxLineCount(void) const
246 return __maxLineCount;
250 _EditModel::SetCommandButtonItem(CommandButtonPosition buttonPosition, int actionId, const String& text)
252 result r = E_SUCCESS;
253 if (buttonPosition == COMMAND_BUTTON_POSITION_LEFT)
255 __leftCommandButtonActionId = actionId;
256 __leftCommandButtonText = text;
260 __rightCommandButtonActionId = actionId;
261 __rightCommandButtonText = text;
268 _EditModel::GetKeypadCommandButtonText(CommandButtonPosition position) const
270 if (position == COMMAND_BUTTON_POSITION_LEFT)
272 return __leftCommandButtonText;
276 return __rightCommandButtonText;
281 _EditModel::GetKeypadCommandButtonActionId(CommandButtonPosition position) const
283 if (position == COMMAND_BUTTON_POSITION_LEFT)
285 return __leftCommandButtonActionId;
289 return __rightCommandButtonActionId;
293 }}} // Tizen::Ui::Controls