Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / text-controls / text-field.h
1 #ifndef __DALI_TOOLKIT_TEXT_FIELD_H__
2 #define __DALI_TOOLKIT_TEXT_FIELD_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class TextField;
33 }
34
35 /**
36  * @brief A control which provides a single-line editable text field.
37  */
38 class DALI_IMPORT_API TextField : public Control
39 {
40 public:
41
42   /**
43    * @brief The start and end property ranges for this control.
44    */
45   enum PropertyRange
46   {
47     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
48     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices
49   };
50
51   /**
52    * @brief An enumeration of properties belonging to the TextLabel class.
53    */
54   struct Property
55   {
56     enum
57     {
58       RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "rendering-backend",       The type or rendering e.g. bitmap-based,                                  type INT
59       PLACEHOLDER_TEXT,                         ///< name "placeholder-text",        The text to display when the TextField is empty,                          type STRING
60       TEXT,                                     ///< name "text",                    The text to display in UTF-8 format,                                      type STRING
61       FONT_FAMILY,                              ///< name "font-family",             The requested font family,                                                type STRING
62       FONT_STYLE,                               ///< name "font-style",              The requested font style e.g. Regular/Italic,                             type STRING
63       POINT_SIZE,                               ///< name "point-size",              The size of font in points,                                               type FLOAT
64       CURSOR_IMAGE,                             ///< name "cursor-image",            The image to display for cursors,                                         type STRING
65       PRIMARY_CURSOR_COLOR,                     ///< name "primary-cursor-color",    The color to apply to the primary cursor,                                 type VECTOR4
66       SECONDARY_CURSOR_COLOR,                   ///< name "secondary-cursor-color",  The color to apply to the secondary cursor,                               type VECTOR4
67       ENABLE_CURSOR_BLINK,                      ///< name "enable-cursor-blink",     Whether the cursor should blink or not,                                   type BOOLEAN
68       CURSOR_BLINK_INTERVAL,                    ///< name "cursor-blink-interval",   The time interval between cursor on/off states,                           type FLOAT
69       CURSOR_BLINK_DURATION,                    ///< name "cursor-blink-duration",   The cursor will stop blinking after this duration (if non-zero),          type FLOAT
70       GRAB_HANDLE_IMAGE,                        ///< name "grab-handle-image",       The image to display for grab handle,                                     type STRING
71       DECORATION_BOUNDING_BOX                   ///< name "decoration-bounding-box", The decorations (handles etc) will positioned within this area on-screen, type RECTANGLE
72     };
73   };
74
75   /**
76    * Create the TextField control.
77    * @return A handle to the TextField control.
78    */
79   static TextField New();
80
81   /**
82    * @brief Creates an empty handle.
83    */
84   TextField();
85
86   /**
87    * @brief Copy constructor.
88    *
89    * @param[in] handle The handle to copy from.
90    */
91   TextField( const TextField& handle );
92
93   /**
94    * @brief Assignment operator.
95    *
96    * @param[in] handle The handle to copy from.
97    * @return A reference to this.
98    */
99   TextField& operator=( const TextField& handle );
100
101   /**
102    * @brief Destructor
103    *
104    * This is non-virtual since derived Handle types must not contain data or virtual methods.
105    */
106   ~TextField();
107
108   /**
109    * @brief Downcast a handle to TextField.
110    *
111    * If the BaseHandle points is a TextField the downcast returns a valid handle.
112    * If not the returned handle is left empty.
113    *
114    * @param[in] handle Handle to an object
115    * @return handle to a TextField or an empty handle
116    */
117   static TextField DownCast( BaseHandle handle );
118
119 public: // Not intended for application developers
120
121   /**
122    * @brief Creates a handle using the Toolkit::Internal implementation.
123    *
124    * @param[in] implementation The Control implementation.
125    */
126   DALI_INTERNAL TextField( Internal::TextField& implementation );
127
128   /**
129    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
130    *
131    * @param[in]  internal  A pointer to the internal CustomActor.
132    */
133   explicit DALI_INTERNAL TextField( Dali::Internal::CustomActor* internal );
134 };
135
136 } // namespace Toolkit
137
138 } // namespace Dali
139
140 #endif // __DALI_TOOLKIT_TEXT_FIELD_H__