1 #ifndef DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
2 #define DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <dali/devel-api/adaptor-framework/input-method-context.h>
24 #include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
30 namespace DevelTextEditor
36 TEXT = Dali::Toolkit::TextEditor::Property::TEXT,
37 TEXT_COLOR = Dali::Toolkit::TextEditor::Property::TEXT_COLOR,
38 FONT_FAMILY = Dali::Toolkit::TextEditor::Property::FONT_FAMILY,
39 FONT_STYLE = Dali::Toolkit::TextEditor::Property::FONT_STYLE,
40 POINT_SIZE = Dali::Toolkit::TextEditor::Property::POINT_SIZE,
41 HORIZONTAL_ALIGNMENT = Dali::Toolkit::TextEditor::Property::HORIZONTAL_ALIGNMENT,
42 SCROLL_THRESHOLD = Dali::Toolkit::TextEditor::Property::SCROLL_THRESHOLD,
43 SCROLL_SPEED = Dali::Toolkit::TextEditor::Property::SCROLL_SPEED,
44 PRIMARY_CURSOR_COLOR = Dali::Toolkit::TextEditor::Property::PRIMARY_CURSOR_COLOR,
45 SECONDARY_CURSOR_COLOR = Dali::Toolkit::TextEditor::Property::SECONDARY_CURSOR_COLOR,
46 ENABLE_CURSOR_BLINK = Dali::Toolkit::TextEditor::Property::ENABLE_CURSOR_BLINK,
47 CURSOR_BLINK_INTERVAL = Dali::Toolkit::TextEditor::Property::CURSOR_BLINK_INTERVAL,
48 CURSOR_BLINK_DURATION = Dali::Toolkit::TextEditor::Property::CURSOR_BLINK_DURATION,
49 CURSOR_WIDTH = Dali::Toolkit::TextEditor::Property::CURSOR_WIDTH,
50 GRAB_HANDLE_IMAGE = Dali::Toolkit::TextEditor::Property::GRAB_HANDLE_IMAGE,
51 GRAB_HANDLE_PRESSED_IMAGE = Dali::Toolkit::TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE,
52 SELECTION_HANDLE_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT,
53 SELECTION_HANDLE_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT,
54 SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT,
55 SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT,
56 SELECTION_HANDLE_MARKER_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT,
57 SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT,
58 SELECTION_HIGHLIGHT_COLOR = Dali::Toolkit::TextEditor::Property::SELECTION_HIGHLIGHT_COLOR,
59 DECORATION_BOUNDING_BOX = Dali::Toolkit::TextEditor::Property::DECORATION_BOUNDING_BOX,
60 ENABLE_MARKUP = Dali::Toolkit::TextEditor::Property::ENABLE_MARKUP,
61 INPUT_COLOR = Dali::Toolkit::TextEditor::Property::INPUT_COLOR,
62 INPUT_FONT_FAMILY = Dali::Toolkit::TextEditor::Property::INPUT_FONT_FAMILY,
63 INPUT_FONT_STYLE = Dali::Toolkit::TextEditor::Property::INPUT_FONT_STYLE,
64 INPUT_POINT_SIZE = Dali::Toolkit::TextEditor::Property::INPUT_POINT_SIZE,
65 LINE_SPACING = Dali::Toolkit::TextEditor::Property::LINE_SPACING,
66 INPUT_LINE_SPACING = Dali::Toolkit::TextEditor::Property::INPUT_LINE_SPACING,
67 UNDERLINE = Dali::Toolkit::TextEditor::Property::UNDERLINE,
68 INPUT_UNDERLINE = Dali::Toolkit::TextEditor::Property::INPUT_UNDERLINE,
69 SHADOW = Dali::Toolkit::TextEditor::Property::SHADOW,
70 INPUT_SHADOW = Dali::Toolkit::TextEditor::Property::INPUT_SHADOW,
71 EMBOSS = Dali::Toolkit::TextEditor::Property::EMBOSS,
72 INPUT_EMBOSS = Dali::Toolkit::TextEditor::Property::INPUT_EMBOSS,
73 OUTLINE = Dali::Toolkit::TextEditor::Property::OUTLINE,
74 INPUT_OUTLINE = Dali::Toolkit::TextEditor::Property::INPUT_OUTLINE,
75 SMOOTH_SCROLL = Dali::Toolkit::TextEditor::Property::SMOOTH_SCROLL,
76 SMOOTH_SCROLL_DURATION = Dali::Toolkit::TextEditor::Property::SMOOTH_SCROLL_DURATION,
77 ENABLE_SCROLL_BAR = Dali::Toolkit::TextEditor::Property::ENABLE_SCROLL_BAR,
78 SCROLL_BAR_SHOW_DURATION = Dali::Toolkit::TextEditor::Property::SCROLL_BAR_SHOW_DURATION,
79 SCROLL_BAR_FADE_DURATION = Dali::Toolkit::TextEditor::Property::SCROLL_BAR_FADE_DURATION,
80 PIXEL_SIZE = Dali::Toolkit::TextEditor::Property::PIXEL_SIZE,
81 LINE_COUNT = Dali::Toolkit::TextEditor::Property::LINE_COUNT,
82 ENABLE_SELECTION = Dali::Toolkit::TextEditor::Property::ENABLE_SELECTION,
83 PLACEHOLDER = Dali::Toolkit::TextEditor::Property::PLACEHOLDER,
84 LINE_WRAP_MODE = Dali::Toolkit::TextEditor::Property::LINE_WRAP_MODE,
87 * @brief The text to display when the TextEditor is empty and inactive.
88 * @details Name "placeholderText", type Property::STRING.
93 * @brief The placeholder-text color.
94 * @details Name "placeholderTextColor", type Property::VECTOR4.
96 PLACEHOLDER_TEXT_COLOR,
99 * @brief Enables Text selection using Shift key.
100 * @details Name "enableShiftSelection", type Property::BOOLEAN.
102 ENABLE_SHIFT_SELECTION,
105 * @brief Enables the grab handles for text selection.
106 * @details Name "enableGrabHandle", type Property::BOOLEAN.
107 * @note The default value is true, which means the grab handles are enabled by default.
112 * @brief Modifies the default text alignment to match the direction of the system language.
113 * @details Name "matchSystemLanguageDirection", type (Property::BOOLEAN), Read/Write
114 * @note The default value is false
116 MATCH_SYSTEM_LANGUAGE_DIRECTION,
119 * @brief The type or rendering e.g. bitmap-based.
120 * @details Name "renderingBackend", type Property::INTEGER.
125 * @brief The maximum number of characters that can be inserted.
126 * @details Name "maxLength", type Property::INTEGER.
131 * @brief The selected text start position.
132 * @details Name "selectedTextStart", type Property::INTEGER.
137 * @brief The selected text range end position.
138 * @details Name "selectedTextEnd", type Property::INTEGER.
143 * @brief The horizontal scroll position in pixels.
144 * @details Name "horizontalScrollPosition", type Property::FLOAT.
146 HORIZONTAL_SCROLL_POSITION,
149 * @brief The vertical scroll position in pixels.
150 * @details Name "verticalScrollPosition", type Property::FLOAT.
152 VERTICAL_SCROLL_POSITION,
155 * @brief The Editable state of control.
156 * @details Name "enableEditing", type Property::BOOLEAN.
161 * @brief The selected text in UTF-8 format.
162 * @details Name "selectedText", type Property::STRING.
163 * @note This property is read-only.
168 * @brief The font size scale.
169 * @details name "fontSizeScale", type Property::FLOAT.
170 * @note The default value is 1.0 which does nothing.
171 * The given font size scale value is used for multiplying the specified font size before querying fonts.
173 * e.g. The rendering results of both cases are same.
174 * - fontSize: 15pt, fontSizeScale: 1.0
175 * - fontSize: 10pt, fontSizeScale: 1.5
180 * @brief The position for primary cursor.
181 * @details Name "primaryCursorPosition", type Property::INTEGER.
183 PRIMARY_CURSOR_POSITION,
186 * @brief The color of the grab color.
187 * @details Name "grabHandleColor", type Property::VECTOR4.
192 * @brief Enables the grab handle popup for text selection.
193 * @details Name "enableGrabHandlePopup", type Property::BOOLEAN.
194 * @note The default value is true, which means the grab handle popup is enabled by default.
196 ENABLE_GRAB_HANDLE_POPUP,
199 * @brief The settings to relating to the System's Input Method, Key and Value.
200 * @details Name "inputMethodSettings", type Property::MAP.
202 * @note VARIATION key can be changed depending on PANEL_LAYOUT.
203 * For example, when PANEL_LAYOUT key is InputMethod::PanelLayout::NORMAL,
204 * then VARIATION would be among NORMAL, WITH_FILENAME, and WITH_PERSON_NAME in Dali::InputMethod::NormalLayout.
205 * For more information, see Dali::InputMethod::Category.
209 * Property::Map propertyMap;
210 * InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER;
211 * InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD;
212 * InputMethod::ButtonAction::Type buttonAction = InputMethod::ButtonAction::GO;
213 * int inputVariation = 1;
214 * propertyMap["PANEL_LAYOUT"] = panelLayout;
215 * propertyMap["AUTO_CAPITALIZE"] = autoCapital;
216 * propertyMap["BUTTON_ACTION"] = buttonAction;
217 * propertyMap["VARIATION"] = inputVariation;
219 * editor.SetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS, propertyMap);
222 INPUT_METHOD_SETTINGS,
225 } // namespace Property
228 * @brief Return the input method context of TextEditor.
230 * @param[in] textEditor The instance of TextEditor.
231 * @return InputMethodContext instance.
233 DALI_TOOLKIT_API InputMethodContext GetInputMethodContext(TextEditor textEditor);
236 * @brief Max Characters Exceed signal type.
238 using MaxLengthReachedSignalType = Signal<void(TextEditor)>;
241 * @brief This signal is emitted when inserted text exceeds the maximum character limit.
243 * A callback of the following type may be connected:
245 * void YourCallbackName( TextEditor textEditor );
247 * @param[in] textEditor The instance of TextEditor.
248 * @return The signal to connect to
250 DALI_TOOLKIT_API MaxLengthReachedSignalType& MaxLengthReachedSignal(TextEditor textEditor);
253 * @brief Anchor clicked signal type.
256 * - const char* : href of clicked anchor.
257 * - uint32_t : length of href.
259 using AnchorClickedSignalType = Signal<void(TextEditor, const char*, uint32_t)>;
262 * @brief This signal is emitted when the anchor is clicked.
264 * A callback of the following type may be connected:
266 * void YourCallbackName(TextEditor textEditor, const char* href, uint32_t hrefLength);
268 * @param[in] textEditor The instance of TextEditor.
269 * @return The signal to connect to.
271 DALI_TOOLKIT_API AnchorClickedSignalType& AnchorClickedSignal(TextEditor textEditor);
274 * @brief Select the whole text of TextEditor.
276 * @param[in] textEditor The instance of TextEditor.
278 DALI_TOOLKIT_API void SelectWholeText(TextEditor textEditor);
281 * @brief Unselect the whole text of TextEditor.
283 * @param[in] textEditor The instance of TextEditor.
285 DALI_TOOLKIT_API void SelectNone(TextEditor textEditor);
288 * @brief Scroll the TextEditor by specific amount.
290 * @param[in] textEditor The instance of TextEditor.
291 * @param[in] scroll amount (in pixels) of scrolling in horizontal & vectical directions.
293 DALI_TOOLKIT_API void ScrollBy(TextEditor textEditor, Vector2 scroll);
295 } // namespace DevelTextEditor
297 } // namespace Toolkit
301 #endif // DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H