[dali_1.4.26] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / docs / content / programming-guide / text-editor.md
1 <!--
2 /**-->
3
4 # Text Editor {#text-editor}
5
6 ## Overview
7
8 The Dali::Toolkit::TextEditor is a control which provides a multi-line editable text.
9
10 ### Basic usage
11
12 Add the text-editor to the stage.
13
14 ~~~{.cpp}
15 // C++
16
17 TextEditor editor = TextEditor::New();
18
19 Stage::GetCurrent().Add( editor );
20 ~~~
21
22 When the TextEditor is tapped, it will automatically gain the keyboard focus. Key events will then result in text being inserted.
23 After text has been entered, it can be retrieved from the TEXT property.
24
25 ~~~{.cpp}
26 // C++
27
28 Property::Value editorText = editor.GetProperty( TextEditor::Property::TEXT );
29 std::cout << "Received text: " << editorText.Get< std::string >() << std::endl;
30 ~~~
31
32 ### Font Selection
33
34 By default TextEditor will automatically select a suitable font from the platform. However, a different font could be selected. See the [Font Selection](@ref font-selection) section for more details.
35
36 ### Mark-up Style
37
38 Mark-up tags can be used to change the style of the text. See the [Mark-up Style](@ref markup-style) section for more details.
39
40 ### Input Style
41
42 The input style can be changed through the control properties.See the [Input Style](@ref input-style) section for more details.
43
44 ### Text Alignment
45
46 TextEditor displays a multi-line of text, which will scroll if there is not enough room for the text displayed.
47 If there is enough room, then the text can be aligned horizontally to the beginning, end, or center of the available area:
48
49 ~~~{.cpp}
50 // C++
51
52 editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "BEGIN" ); // "CENTER" or "END"
53 ~~~
54
55 ### Copy and Paste  (Selection)
56
57 Text can be selected by a long press or double tapping it. See the [Copy and Paste](@ref copy-n-paste) section for more details.
58
59 ### TextEditor Decorations
60
61 #### Color
62
63 To change the color of the text, the recommended way is to use the TEXT_COLOR property.
64
65 ~~~{.cpp}
66 // C++
67 editor.SetProperty( TextEditor::Property::TEXT_COLOR, Color::CYAN );
68 ~~~
69
70 ### TextEditor Properties
71
72  Name (JSON)                       |  Name (C++)                          |  Type        | Writable     | Animatable
73 -----------------------------------|--------------------------------------|--------------|--------------|-----------
74  renderingBackend                  | RENDERING_BACKEND                    |  INTEGER     | O            | X
75  text                              | TEXT                                 |  STRING      | O            | X
76  textColor                         | TEXT_COLOR                           |  VECTOR4     | O            | X
77  fontFamily                        | FONT_FAMILY                          |  STRING      | O            | X
78  fontStyle                         | FONT_STYLE                           |  STRING      | O            | X
79  pointSize                         | POINT_SIZE                           |  FLOAT       | O            | X
80  horizontalAlignment               | HORIZONTAL_ALIGNMENT                 |  STRING      | O            | X
81  verticalAlignment                 | VERTICAL_ALIGNMENT                   |  STRING      | O            | X
82  scrollThreshold                   | SCROLL_THRESHOLD                     |  FLOAT       | O            | X
83  scrollSpeed                       | SCROLL_SPEED                         |  FLOAT       | O            | X
84  primaryCursorColor                | PRIMARY_CURSOR_COLOR                 |  VECTOR4     | O            | X
85  secondaryCursorColor              | SECONDARY_CURSOR_COLOR               |  VECTOR4     | O            | X
86  enableCursorBlink                 | ENABLE_CURSOR_BLINK                  |  BOOLEAN     | O            | X
87  cursorBlinkInterval               | CURSOR_BLINK_INTERVAL                |  FLOAT       | O            | X
88  cursorBlinkDuration               | CURSOR_BLINK_DURATION                |  FLOAT       | O            | X
89  cursorWidth                       | CURSOR_WIDTH                         |  INTEGER     | O            | X
90  grabHandleImage                   | GRAB_HANDLE_IMAGE                    |  STRING      | O            | X
91  grabHandlePressedImage            | GRAB_HANDLE_PRESSED_IMAGE            |  STRING      | O            | X
92  selectionHandleImageLeft          | SELECTION_HANDLE_IMAGE_LEFT          |  STRING      | O            | X
93  selectionHandleImageRight         | SELECTION_HANDLE_IMAGE_RIGHT         |  STRING      | O            | X
94  selectionHandlePressedImageLeft   | SELECTION_HANDLE_PRESSED_IMAGE_LEFT  |  STRING      | O            | X
95  selectionHandlePressedImageRight  | SELECTION_HANDLE_PRESSED_IMAGE_RIGHT |  STRING      | O            | X
96  selectionHandleMarkerImageLeft    | SELECTION_HANDLE_MARKER_IMAGE_LEFT   |  MAP         | O            | X
97  selectionHandleMarkerImageRight   | SELECTION_HANDLE_MARKER_IMAGE_RIGHT  |  MAP         | O            | X
98  selectionHighlightColor           | SELECTION_HIGHLIGHT_COLOR            |  VECTOR4     | O            | X
99  decorationBoundingBox             | DECORATION_BOUNDING_BOX              |  RECTANGLE   | O            | X
100  enableMarkup                      | ENABLE_MARKUP                        |  BOOLEAN     | O            | X
101  inputColor                        | INPUT_COLOR                          |  VECTOR4     | O            | X
102  inputFontFamily                   | INPUT_FONT_FAMILY                    |  STRING      | O            | X
103  inputFontStyle                    | INPUT_FONT_STYLE                     |  STRING      | O            | X
104  inputPointSize                    | INPUT_POINT_SIZE                     |  FLOAT       | O            | X
105  lineSpacing                       | LINE_SPACING                         |  FLOAT       | O            | X
106  inputLineSpacing                  | INPUT_LINE_SPACING                   |  FLOAT       | O            | X
107  underline                         | UNDERLINE                            |  STRING      | O            | X
108  inputUnderline                    | INPUT_UNDERLINE                      |  STRING      | O            | X
109  shadow                            | SHADOW                               |  STRING      | O            | X
110  inputShadow                       | INPUT_SHADOW                         |  STRING      | O            | X
111  emboss                            | EMBOSS                               |  STRING      | O            | X
112  inputEmboss                       | INPUT_EMBOSS                         |  STRING      | O            | X
113  outline                           | OUTLINE                              |  STRING      | O            | X
114  inputOutline                      | INPUT_OUTLINE                        |  STRING      | O            | X
115
116
117 */