Support Ellipsis Position Property
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / text / text-enumerations-devel.h
1 #ifndef DALI_TOOLKIT_TEXT_ENUMERATIONS_DEVEL_H
2 #define DALI_TOOLKIT_TEXT_ENUMERATIONS_DEVEL_H
3
4 /*
5  * Copyright (c) 2021 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 namespace Dali
22 {
23 namespace Toolkit
24 {
25 namespace DevelText
26 {
27 namespace TextDirection
28 {
29 enum Type
30 {
31   LEFT_TO_RIGHT,
32   RIGHT_TO_LEFT
33 };
34
35 } // namespace TextDirection
36
37 namespace VerticalLineAlignment
38 {
39 enum Type
40 {
41   TOP,
42   MIDDLE,
43   BOTTOM
44 };
45
46 } // namespace VerticalLineAlignment
47 namespace LineWrap
48 {
49 enum Mode
50 {
51   WORD,
52   CHARACTER,
53   HYPHENATION, // HYPHENATION mode will add hyphen and move part of the word to the next line.
54   MIXED        // MIXEd mode will apply WORD mode, if failed try HYPHENATION mode, if failed try CHARACTER.
55 };
56
57 } // namespace LineWrap
58
59 /**
60  * A enum for defining text layout directions.
61  * It can also be inherited (from a parent) or deduced from the default language script of a locale.
62  * And it can be the direction of the text ifself.
63  */
64 enum class MatchLayoutDirection
65 {
66   INHERIT, // The text layout direction is inherited. If you change the layout direction, it will be aligned with the changed layout direction.
67   LOCALE,  // The text layout direction is determined by the locale of the system language.
68   CONTENTS // The text layout direction is determined by the text itself.
69 };
70
71 /**
72  * @brief Contains types which specify where the text is truncated and replaced by Ellipsis glyph.
73  *
74  * If the text cannot fit into layout size then truncate text and replace it by Ellipsis glyph.
75  *
76  * Ellipsis works after layouting text normally according to LineWrap mode.
77  *
78  * Ellipsis glyph is three dots "...".
79  *
80  * The Ellipsis property should be enabled.
81  *
82  *
83  * Example: "Hello here is test goodbye."
84  *
85  * Assume LineWrap is CHARACTER.
86  *
87  * EllipsisPosition::END type in single line, truncate tail of line then add Ellipsis:
88  * @code
89  * +-----------+
90  * |Hello he...|
91  * +-----------+
92  * @endcode
93  *
94  * EllipsisPosition::END type in multi-lines, truncate tail of the last appeared line then add Ellipsis:
95  * @code
96  * +-----------+
97  * |Hello here |
98  * |is test ...|
99  * +-----------+
100  * @endcode
101  *
102  * EllipsisPosition::START type in single line, truncate head of line then add Ellipsis:
103  * @code
104  * +-----------+
105  * |...goodbye.|
106  * +-----------+
107  * @endcode
108  *
109  * EllipsisPosition::START type in multi-lines, truncate head of the first appeared line then add Ellipsis:
110  * @code
111  * +-----------+
112  * |...test goo|
113  * |dbye.      |
114  * +-----------+
115  * @endcode
116  *
117  * EllipsisPosition::MIDDLE type in single line, truncate middle of line then add Ellipsis:
118  * @code
119  * +-----------+
120  * |Hell...bye.|
121  * +-----------+
122  * @endcode
123  *
124  * EllipsisPosition::MIDDLE type in multi-lines, truncate middle lines. In the end of the last appeared line before removed lines add Ellipsis:
125  * @code
126  * +-----------+
127  * |Hello he...|
128  * |dbye.      |
129  * +-----------+
130  * @endcode
131  *
132  */
133 namespace EllipsisPosition
134 {
135 /**
136  * @brief Enumerations specifying where to position the ellipsis glyph.
137  * @see EllipsisPosition
138  */
139 enum Type
140 {
141   END = 0, ///< END position will truncate tail of text that exceeds the layout size then replace it by Ellipsis glyph in the end of the last appeared line.
142   START,   ///< START position will truncate head of text that exceeds the layout size then replace it by Ellipsis glyph in the start of the first appeared line. In multilines, the lines are removed from top until the text fit into layout height.
143   MIDDLE   ///< MIDDLE position will truncate middle of text that exceeds the layout size then replace it by Ellipsis glyph in the middle of line. In multilines, the lines are removed from middle until the text fit into layout height then add ellipsis glyph in the end of the last line appeared before removed lines.
144 };
145
146 } // namespace EllipsisPosition
147
148 } // namespace DevelText
149
150 } // namespace Toolkit
151
152 } // namespace Dali
153
154 #endif //DALI_TOOLKIT_TEXT_ENUMERATIONS_DEVEL_H