f2fa94723fd949095689938be83e5d81eaec7640
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / text-controls / text-editor-devel.h
1 #ifndef DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
2 #define DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
3
4 /*
5  * Copyright (c) 2017 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/text-controls/text-editor.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace DevelTextEditor
31 {
32
33 namespace Property
34 {
35   enum Type
36   {
37       RENDERING_BACKEND = Dali::Toolkit::TextEditor::Property::RENDERING_BACKEND,
38       TEXT = Dali::Toolkit::TextEditor::Property::TEXT,
39       TEXT_COLOR = Dali::Toolkit::TextEditor::Property::TEXT_COLOR,
40       FONT_FAMILY = Dali::Toolkit::TextEditor::Property::FONT_FAMILY,
41       FONT_STYLE = Dali::Toolkit::TextEditor::Property::FONT_STYLE,
42       POINT_SIZE = Dali::Toolkit::TextEditor::Property::POINT_SIZE,
43       HORIZONTAL_ALIGNMENT = Dali::Toolkit::TextEditor::Property::HORIZONTAL_ALIGNMENT,
44       SCROLL_THRESHOLD = Dali::Toolkit::TextEditor::Property::SCROLL_THRESHOLD,
45       SCROLL_SPEED = Dali::Toolkit::TextEditor::Property::SCROLL_SPEED,
46       PRIMARY_CURSOR_COLOR = Dali::Toolkit::TextEditor::Property::PRIMARY_CURSOR_COLOR,
47       SECONDARY_CURSOR_COLOR = Dali::Toolkit::TextEditor::Property::SECONDARY_CURSOR_COLOR,
48       ENABLE_CURSOR_BLINK = Dali::Toolkit::TextEditor::Property::ENABLE_CURSOR_BLINK,
49       CURSOR_BLINK_INTERVAL = Dali::Toolkit::TextEditor::Property::CURSOR_BLINK_INTERVAL,
50       CURSOR_BLINK_DURATION = Dali::Toolkit::TextEditor::Property::CURSOR_BLINK_DURATION,
51       CURSOR_WIDTH = Dali::Toolkit::TextEditor::Property::CURSOR_WIDTH,
52       GRAB_HANDLE_IMAGE = Dali::Toolkit::TextEditor::Property::GRAB_HANDLE_IMAGE,
53       GRAB_HANDLE_PRESSED_IMAGE = Dali::Toolkit::TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE,
54       SELECTION_HANDLE_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT,
55       SELECTION_HANDLE_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT,
56       SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT,
57       SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT,
58       SELECTION_HANDLE_MARKER_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT,
59       SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT,
60       SELECTION_HIGHLIGHT_COLOR = Dali::Toolkit::TextEditor::Property::SELECTION_HIGHLIGHT_COLOR,
61       DECORATION_BOUNDING_BOX = Dali::Toolkit::TextEditor::Property::DECORATION_BOUNDING_BOX,
62       ENABLE_MARKUP = Dali::Toolkit::TextEditor::Property::ENABLE_MARKUP,
63       INPUT_COLOR = Dali::Toolkit::TextEditor::Property::INPUT_COLOR,
64       INPUT_FONT_FAMILY = Dali::Toolkit::TextEditor::Property::INPUT_FONT_FAMILY,
65       INPUT_FONT_STYLE = Dali::Toolkit::TextEditor::Property::INPUT_FONT_STYLE,
66       INPUT_POINT_SIZE = Dali::Toolkit::TextEditor::Property::INPUT_POINT_SIZE,
67       LINE_SPACING = Dali::Toolkit::TextEditor::Property::LINE_SPACING,
68       INPUT_LINE_SPACING = Dali::Toolkit::TextEditor::Property::INPUT_LINE_SPACING,
69       UNDERLINE = Dali::Toolkit::TextEditor::Property::UNDERLINE,
70       INPUT_UNDERLINE = Dali::Toolkit::TextEditor::Property::INPUT_UNDERLINE,
71       SHADOW = Dali::Toolkit::TextEditor::Property::SHADOW,
72       INPUT_SHADOW = Dali::Toolkit::TextEditor::Property::INPUT_SHADOW,
73       EMBOSS = Dali::Toolkit::TextEditor::Property::EMBOSS,
74       INPUT_EMBOSS = Dali::Toolkit::TextEditor::Property::INPUT_EMBOSS,
75       OUTLINE = Dali::Toolkit::TextEditor::Property::OUTLINE,
76       INPUT_OUTLINE = Dali::Toolkit::TextEditor::Property::INPUT_OUTLINE,
77
78       /**
79        * @brief name "smoothScroll", type bool
80        * @details Enable or disable the smooth scroll animation
81        * @note This property is currently being used for some applications, so it can't be changed.
82        */
83       SMOOTH_SCROLL = INPUT_OUTLINE + 1,
84
85       /**
86        * @brief name "smoothScrollDuration", type float
87        * @details Sets the duration of smooth scroll animation
88        * @note This property is currently being used for some applications, so it can't be changed.
89        */
90       SMOOTH_SCROLL_DURATION,
91
92       /**
93        * @brief name "enableScrollBar", type bool
94        * @details Enable or disable the scroll bar
95        * @note This property is currently being used for some applications, so it can't be changed.
96        */
97       ENABLE_SCROLL_BAR,
98
99       /**
100        * @brief name "scrollBarShowDuration", type float
101        * @details Sets the duration of scroll bar to show
102        * @note This property is currently being used for some applications, so it can't be changed.
103        */
104       SCROLL_BAR_SHOW_DURATION,
105
106       /**
107        * @brief name "scrollBarFadeDuration", type float
108        * @details Sets the duration of scroll bar to fade out
109        * @note This property is currently being used for some applications, so it can't be changed.
110        */
111       SCROLL_BAR_FADE_DURATION,
112
113       /**
114        * @brief The size of font in pixels.
115        *
116        * Conversion from Point size to Pixel size :
117        *  Pixel size = Point size * DPI / 72
118        * @details name "pixelSize", type float
119        */
120       PIXEL_SIZE,
121
122       /**
123        * @brief The line count of text.
124        * @details name "lineCount", type int
125        * @note this property is read-only.
126        */
127       LINE_COUNT,
128
129       /**
130        * @brief The text to display when the TextEditor is empty and inactive.
131        * @details name "placeholderText", type string
132        */
133       PLACEHOLDER_TEXT,
134
135       /**
136        * @brief The placeholder-text color.
137        * @details name "placeholderTextColor", type vector4
138        */
139       PLACEHOLDER_TEXT_COLOR,
140
141       /**
142        * @brief Enables Text selection, such as the cursor, handle, clipboard, and highlight color.
143        * @details name "enableSelection", type bool
144        */
145       ENABLE_SELECTION,
146
147       /**
148        * @brief Sets the placeholder : text, color, font family, font style, point size, and pixel size.
149        *
150        * @code
151        *   Property::Map propertyMap;
152        *   propertyMap["placeholderText"] = "Setting Placeholder Text";
153        *   propertyMap["placeholderColor"] = Color::RED;
154        *   propertyMap["placeholderFontFamily"] = "Arial";
155        *   propertyMap["placeholderPointSize"] = 12.0f;
156        *
157        *   Property::Map fontStyleMap;
158        *   fontstyleMap.Insert( "weight", "bold" );
159        *   fontstyleMap.Insert( "width", "condensed" );
160        *   fontstyleMap.Insert( "slant", "italic" );
161        *   propertyMap["placeholderFontStyle"] = fontStyleMap;
162        *
163        *   editor.SetProperty( DevelTextEditor::Property::PLACEHOLDER, propertyMap );
164        * @endcode
165        *
166        * @details name "placeholder", type MAP
167        */
168       PLACEHOLDER
169   };
170 } // namespace Property
171
172 namespace Scroll
173 {
174   enum Type
175   {
176     STARTED,   ///< Scrolling is started.
177     FINISHED   ///< Scrolling is finished.
178   };
179 } // namespace Scroll
180
181 typedef Signal< void ( TextEditor, Scroll::Type ) > ScrollStateChangedSignalType;
182
183 /**
184  * @brief This signal is emitted when TextEditor scrolling is started or finished.
185  *
186  * A callback of the following type may be connected:
187  * @code
188  *   void YourCallbackName( ScrollState::Type type );
189  * @endcode
190  * type: Whether the scrolling is started or finished.
191  * @return The signal to connect to
192  */
193 DALI_IMPORT_API ScrollStateChangedSignalType& ScrollStateChangedSignal( TextEditor textEditor );
194
195 } // namespace DevelTextEditor
196
197 } // namespace Toolkit
198
199 } // namespace Dali
200
201 #endif // DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H