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 #include <dali-toolkit/public-api/text/rendering/text-renderer.h>
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Internal DALI_INTERNAL
32 {
33 class TextField;
34 }
35
36 /**
37  * @brief A control which provides a single-line editable text field.
38  */
39 class DALI_IMPORT_API TextField : public Control
40 {
41 public:
42
43   // Property indices
44   static const Dali::Property::Index PROPERTY_RENDERING_BACKEND;       ///< name "rendering-backend",       type INT
45   static const Dali::Property::Index PROPERTY_PLACEHOLDER_TEXT;        ///< name "placeholder-text",        type STRING
46   static const Dali::Property::Index PROPERTY_TEXT;                    ///< name "text",                    type STRING
47   static const Dali::Property::Index PROPERTY_CURSOR_IMAGE;            ///< name "cursor-image",            type STRING
48   static const Dali::Property::Index PROPERTY_PRIMARY_CURSOR_COLOR;    ///< name "primary-cursor-color",    type VECTOR4
49   static const Dali::Property::Index PROPERTY_SECONDARY_CURSOR_COLOR;  ///< name "secondary-cursor-color",  type VECTOR4
50   static const Dali::Property::Index PROPERTY_ENABLE_CURSOR_BLINK;     ///< name "enable-cursor-blink",     type BOOLEAN
51   static const Dali::Property::Index PROPERTY_CURSOR_BLINK_INTERVAL;   ///< name "cursor-blink-interval",   type FLOAT
52   static const Dali::Property::Index PROPERTY_CURSOR_BLINK_DURATION;   ///< name "cursor-blink-duration",   type FLOAT
53   static const Dali::Property::Index PROPERTY_GRAB_HANDLE_IMAGE;       ///< name "grab-handle-image",       type STRING
54   static const Dali::Property::Index PROPERTY_DECORATION_BOUNDING_BOX; ///< name "decoration-bounding-box", type RECTANGLE
55
56   // Property names
57   static const std::string RENDERING_BACKEND_PROPERTY_NAME;      ///< Property, name "rendering-backend",       type INT
58   static const std::string PLACEHOLDER_TEXT_PROPERTY_NAME;       ///< Property, name "placeholder-text",        type STRING
59   static const std::string TEXT_PROPERTY_NAME;                   ///< Property, name "text",                    type STRING
60   static const std::string CURSOR_IMAGE_PROPERTY_NAME;           ///< Property, name "cursor-image",            type STRING
61   static const std::string PRIMARY_CURSOR_COLOR_PROPERTY_NAME;   ///< Property, name "primary-cursor-color",    type VECTOR4
62   static const std::string SECONDARY_CURSOR_COLOR_PROPERTY_NAME; ///< Property, name "secondary-cursor-color",  type VECTOR4
63   static const std::string ENABLE_CURSOR_BLINK_PROPERTY_NAME;    ///< Property, name "enable-cursor-blink",     type BOOLEAN
64   static const std::string CURSOR_BLINK_INTERVAL_PROPERTY_NAME;  ///< Property, name "cursor-blink-interval",   type FLOAT
65   static const std::string CURSOR_BLINK_DURATION_PROPERTY_NAME;  ///< Property, name "cursor-blink-duration",   type FLOAT
66   static const std::string GRAB_HANDLE_IMAGE_PROPERTY_NAME;      ///< Property, name "grab-handle-image",       type STRING
67   static const std::string DECORATION_BOUNDING_BOX;              ///< Property, name "decoration-bounding-box", type RECTANGLE
68
69   /**
70    * Create the TextField control.
71    * @return A handle to the TextField control.
72    */
73   static TextField New();
74
75   /**
76    * @brief Creates an empty handle.
77    */
78   TextField();
79
80   /**
81    * @brief Copy constructor.
82    *
83    * @param[in] handle The handle to copy from.
84    */
85   TextField( const TextField& handle );
86
87   /**
88    * @brief Assignment operator.
89    *
90    * @param[in] handle The handle to copy from.
91    * @return A reference to this.
92    */
93   TextField& operator=( const TextField& handle );
94
95   /**
96    * @brief Destructor
97    *
98    * This is non-virtual since derived Handle types must not contain data or virtual methods.
99    */
100   ~TextField();
101
102   /**
103    * @brief Downcast a handle to TextField.
104    *
105    * If the BaseHandle points is a TextField the downcast returns a valid handle.
106    * If not the returned handle is left empty.
107    *
108    * @param[in] handle Handle to an object
109    * @return handle to a TextField or an empty handle
110    */
111   static TextField DownCast( BaseHandle handle );
112
113 public: // Not intended for application developers
114
115   /**
116    * @brief Creates a handle using the Toolkit::Internal implementation.
117    *
118    * @param[in] implementation The Control implementation.
119    */
120   DALI_INTERNAL TextField( Internal::TextField& implementation );
121
122   /**
123    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
124    *
125    * @param[in]  internal  A pointer to the internal CustomActor.
126    */
127   explicit DALI_INTERNAL TextField( Dali::Internal::CustomActor* internal );
128 };
129
130 } // namespace Toolkit
131
132 } // namespace Dali
133
134 #endif // __DALI_TOOLKIT_TEXT_FIELD_H__