Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_EditModel.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file                FUiCtrl_EditModel.h
19  * @brief               This is the header file for the _EditModel class.
20  *
21  * This header file contains the declarations of the %_EditModel class.
22  */
23
24 #ifndef _FUI_CTRL_INTERNAL_EDIT_MODEL_H_
25 #define _FUI_CTRL_INTERNAL_EDIT_MODEL_H_
26
27 #include <FBaseObject.h>
28 #include <FLclLocale.h>
29 #include <FUiCtrlEditTypes.h>
30 #include "FUiCtrl_FooterImpl.h"
31 #include "FUiCtrl_IKeypadEventListener.h"
32
33
34 namespace Tizen { namespace Ui { namespace Controls
35 {
36 /**
37  * @class _EditModel
38  * @brief
39  * @since       1.0
40  *
41  *
42  *
43  *
44  */
45 class _EditModel
46         : public Tizen::Base::Object
47 {
48 // Lifecycle
49 public:
50         _EditModel(void);
51         virtual ~_EditModel(void);
52
53 // Operations
54 public:
55         /**
56          * Sets the auto-link mask.
57          *
58          * @since                       2.0
59          * @return                      An error code
60          * @param[in]   autoLinks                               The auto-link mask.@n
61          *                                                                              Multiple link types can be combined using bitwise OR (see Tizen::Base::Utility::LinkType).
62          *                                                                              For more information, refer to @ref linkAutoLinkDetection "here".
63          * @exception   E_SUCCESS                               The method was successful.
64          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation.@n
65          *                                                                              -- The operation is not supported if the input style is not INPUT_STYLE_OVERLAY.
66          * @exception   E_SYSTEM                                A system error occurred.
67          * @remarks             When @c autoLinks is set to zero, the auto-link detection is disabled.
68          * @see                 Tizen::Base::Utility::LinkType
69          * @see                 GetAutoLinkMask()
70          * @see                 IsViewModeEnabled()
71          * @see                 SetViewModeEnabled()
72          */
73         result SetAutoLinkMask(unsigned long autoLinks);
74
75         /**
76          * Gets the auto-link mask.
77          *
78          * @since                       2.0
79          * @return                      The auto-link mask
80          * @exception   E_SUCCESS                               The method was successful.
81          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation.@n
82          *                                                                              -- The operation is not supported if the input style is not INPUT_STYLE_OVERLAY.
83          * @exception   E_SYSTEM                                A system error occurred.
84          * @remarks             The specific error code can be accessed using the GetLastResult()() method.
85          * @see                 SetAutoLinkMask()
86          */
87         unsigned long GetAutoLinkMask(void) const;
88
89         /**
90          * Determines whether the view mode is enabled.
91          *
92          * @since                       2.0
93          * @return                      A Boolean value indicating whether the view mode is enabled.
94          * @exception   E_SUCCESS                       The method was successful.
95          * @exception   E_SYSTEM                        A system error occurred.
96          * @remarks             The specific error code can be accessed using the GetLastResult() method.
97          * @see                 SetViewModeEnabled()
98          */
99         bool IsViewModeEnabled(void) const;
100
101         /**
102          * Enables or disables the view mode.
103          *
104          * @since                       2.0
105          * @return                      An error code.
106          * @param[in]   enable              The view mode enabled flag
107          * @exception   E_SUCCESS           The method was successful.
108          * @exception   E_SYSTEM            A system error occurred.
109          * @remarks             When the view mode is enabled, the auto-detected links will be displayed as linked text.
110          * @see                 IsViewModeEnabled()
111          */
112         result SetViewModeEnabled(bool enable);
113
114         /**
115          * Enables or disables the keypad action.
116          *
117          * @since 2.0
118          * @return                      An error code.
119          * @param[in]   enable  A Boolean value indicating whether the keypad action is enabled.
120          * @exception   E_SUCCESS           The method was successful.
121          */
122         result SetKeypadActionEnabled(bool enable);
123
124         /**
125          * Checks whether the keypad action is enabled.
126          *
127          * @since 2.0
128          * @return       @c true if the keypad action is enabled @n
129          *               @c false, otherwise
130          */
131         bool IsKeypadActionEnabled(void) const;
132
133 // Keypad Action
134         /**
135          * Gets the keypad action type.
136          *
137          * @since                       2.0
138          * @return                      The keypad action
139          * @exception   E_SUCCESS               The method was successful.
140          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation.@n
141          *                                                                              -- The operation is not supported if the input style is not INPUT_STYLE_OVERLAY.
142          * @exception   E_SYSTEM                A system error occurred.
143          * @remarks             The specific error code can be accessed using the GetLastResult()() method.
144          */
145         Tizen::Ui::Controls::CoreKeypadAction GetKeypadAction(void) const;
146
147         /**
148          * Sets the keypad action type.
149          *
150          * @since                       2.0
151          * @return                      An error code
152          * @param[in]   keypadAction                    The keypad action
153          * @exception   E_SUCCESS                               The method was successful.
154          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation.@n
155          *                                                                              -- The operation is not supported if the input style is not INPUT_STYLE_OVERLAY.
156          * @exception   E_SYSTEM                                A system error occurred.
157          * @remarks             Depending on the value of @c keypadAction specified, the keypad's enter key label will change accordingly.
158          */
159         result SetKeypadAction(Tizen::Ui::Controls::CoreKeypadAction keypadAction);
160
161         /**
162          * Sets the input language.
163          *
164          * @since                       1.0
165          * @return                      An error code
166          * @param[in]   language               The language to set
167          * @exception   E_SUCCESS              The method was successful.
168          * @exception   E_INVALID_ARG          The specified input parameter is invalid. @n
169          *                                    -- The specified language is not supported or unavailable.
170          * @exception   E_SYSTEM               A system error occurred.
171          */
172         result SetCurrentLanguage(Tizen::Locales::LanguageCode languageCode);
173
174         /**
175          * Gets the current input language.
176          *
177          * @since                       1.0
178          * @return                      An error code
179          * @param[out]  language               The current input language
180          * @exception   E_SUCCESS              The method was successful.
181          * @exception   E_SYSTEM               A system error occurred.
182          */
183         result GetCurrentLanguage(Tizen::Locales::LanguageCode& language) const;
184
185         /**
186          * Sets the input language.
187          *
188          * @since 2.0
189          * @return                      An error code
190          * @param[in]   language               The inital keypad language to set
191          * @exception   E_SUCCESS              The method was successful.
192          * @exception   E_SYSTEM               A system error occurred.
193          */
194         result SetInitialKeypadLanguage(Tizen::Locales::LanguageCode languageCode);
195
196         /**
197          * Gets the current input language.
198          *
199          * @since 2.0
200          * @return                      An error code
201          * @param[out]  language               The current inital keypad language
202          * @exception   E_SUCCESS              The method was successful.
203          * @exception   E_SYSTEM               A system error occurred.
204          */
205         result GetInitialKeypadLanguage(Tizen::Locales::LanguageCode& language) const;
206
207         /**
208          * Enables or disables the keypad.
209          *
210          * @since               1.0
211          * @param[in]   enable  A Boolean value indicating whether the keypad is enabled.
212          */
213         void SetKeypadEnabled(bool enable);
214
215         /**
216          * Checks whether the keypad is enabled.
217          *
218          * @since        1.0
219          * @return       @c true if the keypad is enabled @n
220          *               @c false, otherwise
221          */
222         bool IsKeypadEnabled(void) const;
223
224         /**
225          * Enables or disables the lowercase mode.
226          *
227          * @since               1.0
228          * @param[in]   enable  Set to @c true to enable lowercase mode @n
229          *              @c false, otherwise
230          */
231         void SetLowerCaseModeEnabled(bool enable);
232
233         /**
234          * Checks whether the lowercase mode is enabled.
235          *
236          * @since       1.0
237          * @return      @c true if the lowercase mode is set @n
238          *                      @c false, otherwise
239          */
240         bool IsLowerCaseModeEnabled(void) const;
241
242         /**
243          * Gets the keypad style.
244          *
245          * @since               2.0
246          * @return              The keypad style
247          * @exception   E_SUCCESS                       The method was successful.
248          * @exception   E_SYSTEM            A system error occurred.
249          * @remarks             The specific error code can be accessed using the GetLastResult()() method.
250          * @see         SetKeypadStyle()
251          */
252         KeypadStyle GetKeypadStyle(void) const;
253
254         /**
255          * Sets the keypad style.
256          *
257          * @since               2.0
258          * @return      An error code
259          * @param[in]   keypadStyle                     The keypad style
260          * @exception   E_SUCCESS                       The method was successful.
261          * @exception   E_INVALID_ARG           A specified input parameter is invalid. @n
262          *                                  -- @c keypadStyle cannot be @c KEYPAD_STYLE_PASSWORD.
263          * @exception   E_SYSTEM            A system error occurred.
264          * @remarks     Depending on the value of the specified @c keypadStyle, the keypad's layout will change accordingly.
265          * @see         GetKeypadStyle()
266          */
267         result SetKeypadStyle(KeypadStyle keypadStyle);
268
269         result SetTextPredictionEnabled(bool enable);
270
271         bool IsTextPredictionEnabled(void) const;
272
273         /**
274          * Enables or disables the auto resizing if the candidate word list appears.
275          *
276          * @since       2.0
277          * @return      An error code
278          * @param[in]   enable                  Set to @c true to enable the auto resizing, @n
279          *                                                                              else @c false
280          * @exception   E_SUCCESS               The method is successful.
281          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
282          *                                      The current style of the %ExpandableEditArea does not support the operation.
283          * @remarks     Note that when this option is enabled, the normal style %ExpandableEditArea is auto resized and the line added and removed events are
284          *                              generated if the candidate word list pop-up appears during the predictive texting. @n
285          *              The operation is not supported by the token style %ExpandableEditArea.
286          * @see         IsAutoResizingEnabled()
287          * @see         Tizen::Ui::Controls::IExpandableEditAreaEventListener
288          */
289         result SetAutoResizingEnabled(bool enable);
290
291         /**
292          * Checks whether the auto-resizing is enabled.
293          *
294          * @since       2.0
295          * @return      @c true if the auto-resizing is enabled, @n
296          *                              else @c false
297          * @exception   E_SUCCESS               The method is successful.
298          * @exception   E_UNSUPPORTED_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
299          *                                                                              The current style of the %ExpandableEditArea control does not support the operation.
300          * @remarks     The specific error code can be accessed using the GetLastResult() method.
301          * @see         SetAutoResizingEnabled()
302          */
303         bool IsAutoResizingEnabled(void) const;
304
305         void SetMaxLineCount(int maxLineCount);
306
307         /**
308          * Gets the maximum line count supported by the flexible text edit.
309          *
310          * @since       2.0
311          * @return      The maximum line count, @n
312          *                  else @c -1 if an error occurs
313          * @exception   E_SUCCESS           The method is successful.
314          * @exception   E_SYSTEM            A system error has occurred.
315          * @remarks     The specific error code can be accessed using the GetLastResult() method.
316          */
317         int GetMaxLineCount(void) const;
318
319         // command button
320         result SetCommandButtonItem(CommandButtonPosition buttonPosition, int actionId, const Tizen::Base::String& text);
321         Tizen::Base::String GetKeypadCommandButtonText(CommandButtonPosition position) const;
322         int GetKeypadCommandButtonActionId(CommandButtonPosition position) const;
323
324 private:
325         _EditModel(const _EditModel& value);
326         _EditModel& operator =(const _EditModel& value);
327
328 private:
329 // Attributes
330         unsigned long __autoLinkMask;
331
332         bool __keypadActionEnabled;
333
334         bool __viewModeEnabled;
335
336         KeypadStyle __keypadStyle;
337
338         bool __keypadEnabled;
339
340         bool __isLowerCase;
341
342         bool __isTextPredictionEnabled;
343
344         CoreKeypadAction __keypadAction;
345
346         bool __enablePredictiveAutoResizing;
347
348         int __maxLineCount;
349
350         Tizen::Locales::LanguageCode __languageCode;
351         Tizen::Locales::LanguageCode __initialKeypadLanguageCode;
352
353         int __leftCommandButtonActionId;
354         int __rightCommandButtonActionId;
355         Tizen::Base::String __leftCommandButtonText;
356         Tizen::Base::String __rightCommandButtonText;
357 }; // _EditModel
358
359 }}} // Tizen::Ui::Controls
360
361 #endif  // _FUI_CTRL_INTERNAL_EDIT_MODEL_H_