Merge "Add a TextEditor property to limit input to maximum characters" into devel...
[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) 2020 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 // EXTERNAL INCLUDES
21 #include <dali/devel-api/adaptor-framework/input-method-context.h>
22
23 // INTERNAL INCLUDES
24 #include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
25
26 namespace Dali
27 {
28
29 namespace Toolkit
30 {
31
32 namespace DevelTextEditor
33 {
34
35 namespace Property
36 {
37   enum Type
38   {
39       TEXT = Dali::Toolkit::TextEditor::Property::TEXT,
40       TEXT_COLOR = Dali::Toolkit::TextEditor::Property::TEXT_COLOR,
41       FONT_FAMILY = Dali::Toolkit::TextEditor::Property::FONT_FAMILY,
42       FONT_STYLE = Dali::Toolkit::TextEditor::Property::FONT_STYLE,
43       POINT_SIZE = Dali::Toolkit::TextEditor::Property::POINT_SIZE,
44       HORIZONTAL_ALIGNMENT = Dali::Toolkit::TextEditor::Property::HORIZONTAL_ALIGNMENT,
45       SCROLL_THRESHOLD = Dali::Toolkit::TextEditor::Property::SCROLL_THRESHOLD,
46       SCROLL_SPEED = Dali::Toolkit::TextEditor::Property::SCROLL_SPEED,
47       PRIMARY_CURSOR_COLOR = Dali::Toolkit::TextEditor::Property::PRIMARY_CURSOR_COLOR,
48       SECONDARY_CURSOR_COLOR = Dali::Toolkit::TextEditor::Property::SECONDARY_CURSOR_COLOR,
49       ENABLE_CURSOR_BLINK = Dali::Toolkit::TextEditor::Property::ENABLE_CURSOR_BLINK,
50       CURSOR_BLINK_INTERVAL = Dali::Toolkit::TextEditor::Property::CURSOR_BLINK_INTERVAL,
51       CURSOR_BLINK_DURATION = Dali::Toolkit::TextEditor::Property::CURSOR_BLINK_DURATION,
52       CURSOR_WIDTH = Dali::Toolkit::TextEditor::Property::CURSOR_WIDTH,
53       GRAB_HANDLE_IMAGE = Dali::Toolkit::TextEditor::Property::GRAB_HANDLE_IMAGE,
54       GRAB_HANDLE_PRESSED_IMAGE = Dali::Toolkit::TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE,
55       SELECTION_HANDLE_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT,
56       SELECTION_HANDLE_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT,
57       SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT,
58       SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT,
59       SELECTION_HANDLE_MARKER_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT,
60       SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT,
61       SELECTION_HIGHLIGHT_COLOR = Dali::Toolkit::TextEditor::Property::SELECTION_HIGHLIGHT_COLOR,
62       DECORATION_BOUNDING_BOX = Dali::Toolkit::TextEditor::Property::DECORATION_BOUNDING_BOX,
63       ENABLE_MARKUP = Dali::Toolkit::TextEditor::Property::ENABLE_MARKUP,
64       INPUT_COLOR = Dali::Toolkit::TextEditor::Property::INPUT_COLOR,
65       INPUT_FONT_FAMILY = Dali::Toolkit::TextEditor::Property::INPUT_FONT_FAMILY,
66       INPUT_FONT_STYLE = Dali::Toolkit::TextEditor::Property::INPUT_FONT_STYLE,
67       INPUT_POINT_SIZE = Dali::Toolkit::TextEditor::Property::INPUT_POINT_SIZE,
68       LINE_SPACING = Dali::Toolkit::TextEditor::Property::LINE_SPACING,
69       INPUT_LINE_SPACING = Dali::Toolkit::TextEditor::Property::INPUT_LINE_SPACING,
70       UNDERLINE = Dali::Toolkit::TextEditor::Property::UNDERLINE,
71       INPUT_UNDERLINE = Dali::Toolkit::TextEditor::Property::INPUT_UNDERLINE,
72       SHADOW = Dali::Toolkit::TextEditor::Property::SHADOW,
73       INPUT_SHADOW = Dali::Toolkit::TextEditor::Property::INPUT_SHADOW,
74       EMBOSS = Dali::Toolkit::TextEditor::Property::EMBOSS,
75       INPUT_EMBOSS = Dali::Toolkit::TextEditor::Property::INPUT_EMBOSS,
76       OUTLINE = Dali::Toolkit::TextEditor::Property::OUTLINE,
77       INPUT_OUTLINE = Dali::Toolkit::TextEditor::Property::INPUT_OUTLINE,
78       SMOOTH_SCROLL = Dali::Toolkit::TextEditor::Property::SMOOTH_SCROLL,
79       SMOOTH_SCROLL_DURATION = Dali::Toolkit::TextEditor::Property::SMOOTH_SCROLL_DURATION,
80       ENABLE_SCROLL_BAR = Dali::Toolkit::TextEditor::Property::ENABLE_SCROLL_BAR,
81       SCROLL_BAR_SHOW_DURATION = Dali::Toolkit::TextEditor::Property::SCROLL_BAR_SHOW_DURATION,
82       SCROLL_BAR_FADE_DURATION = Dali::Toolkit::TextEditor::Property::SCROLL_BAR_FADE_DURATION,
83       PIXEL_SIZE = Dali::Toolkit::TextEditor::Property::PIXEL_SIZE,
84       LINE_COUNT = Dali::Toolkit::TextEditor::Property::LINE_COUNT,
85       ENABLE_SELECTION = Dali::Toolkit::TextEditor::Property::ENABLE_SELECTION,
86       PLACEHOLDER = Dali::Toolkit::TextEditor::Property::PLACEHOLDER,
87       LINE_WRAP_MODE = Dali::Toolkit::TextEditor::Property::LINE_WRAP_MODE,
88
89       /**
90        * @brief The text to display when the TextEditor is empty and inactive.
91        * @details Name "placeholderText", type Property::STRING.
92        */
93       PLACEHOLDER_TEXT,
94
95       /**
96        * @brief The placeholder-text color.
97        * @details Name "placeholderTextColor", type Property::VECTOR4.
98        */
99       PLACEHOLDER_TEXT_COLOR,
100
101       /**
102        * @brief Enables Text selection using Shift key.
103        * @details Name "enableShiftSelection", type Property::BOOLEAN.
104        */
105       ENABLE_SHIFT_SELECTION,
106
107       /**
108        * @brief Enables the grab handles for text selection.
109        * @details Name "enableGrabHandle", type Property::BOOLEAN.
110        * @note The default value is true, which means the grab handles are enabled by default.
111        */
112       ENABLE_GRAB_HANDLE,
113
114       /**
115        * @brief Modifies the default text alignment to match the direction of the system language.
116        * @details Name "matchSystemLanguageDirection", type (Property::BOOLEAN), Read/Write
117        * @note The default value is false
118        */
119       MATCH_SYSTEM_LANGUAGE_DIRECTION,
120
121       /**
122        * @brief The type or rendering e.g. bitmap-based.
123        * @details Name "renderingBackend", type Property::INTEGER.
124        */
125       RENDERING_BACKEND,
126
127       /**
128        * @brief The maximum number of characters that can be inserted.
129        * @details Name "maxLength", type Property::INTEGER.
130        */
131       MAX_LENGTH,
132   };
133
134 } // namespace Property
135
136 /**
137  * @brief Return the input method context of TextEditor.
138  *
139  * @param[in] textEditor The instance of TextEditor.
140  * @return InputMethodContext instance.
141  */
142 DALI_TOOLKIT_API InputMethodContext GetInputMethodContext( TextEditor textEditor );
143
144 /**
145  * @brief Max Characters Exceed signal type.
146   */
147 using MaxLengthReachedSignalType = Signal< void ( TextEditor ) >;
148
149 /**
150  * @brief This signal is emitted when inserted text exceeds the maximum character limit.
151  *
152  * A callback of the following type may be connected:
153  * @code
154  *   void YourCallbackName( TextEditor textEditor );
155  * @endcode
156  * @param[in] textEditor The instance of TextEditor.
157  * @return The signal to connect to
158  */
159 DALI_TOOLKIT_API MaxLengthReachedSignalType& MaxLengthReachedSignal( TextEditor textEditor );
160
161 } // namespace DevelTextEditor
162
163 } // namespace Toolkit
164
165 } // namespace Dali
166
167 #endif // DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H