• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_LAYOUT_CONSTANTS_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_LAYOUT_CONSTANTS_H
18 
19 #include <cstdint>
20 
21 namespace OHOS::Ace {
22 
23 enum class LineCap {
24     BUTT,
25     ROUND,
26     SQUARE,
27 };
28 
29 enum class ButtonType {
30     NORMAL,
31     CAPSULE,
32     CIRCLE,
33     TEXT,
34     ARC,
35     DOWNLOAD,
36     ICON,
37     CUSTOM,
38 };
39 
40 // Flex Styles
41 enum class FlexDirection {
42     ROW = 0,
43     COLUMN,
44     ROW_REVERSE,
45     COLUMN_REVERSE,
46 };
47 
48 enum class FlexAlign {
49     AUTO,
50 
51     // align to the start of the axis, can be both used in MainAxisAlign and CrossAxisAlign.
52     FLEX_START,
53 
54     // align to the center of the axis, can be both used in MainAxisAlign and CrossAxisAlign.
55     CENTER,
56 
57     // align to the end of the axis, can be both used in MainAxisAlign and CrossAxisAlign.
58     FLEX_END,
59 
60     // stretch the cross size, only used in CrossAxisAlign.
61     STRETCH,
62 
63     // adjust the cross position according to the textBaseline, only used in CrossAxisAlign.
64     BASELINE,
65 
66     // align the children on both ends, only used in MainAxisAlign.
67     SPACE_BETWEEN,
68 
69     // align the child with equivalent space, only used in MainAxisAlign.
70     SPACE_AROUND,
71 
72     // align the child with space evenly, only used in MainAxisAlign.
73     SPACE_EVENLY,
74 
75     // User-defined space, only used in MainAxisAlign.
76     SPACE_CUSOMIZATION,
77 };
78 
79 enum class MainAxisSize {
80     // default setting, fill the max size of the layout param. Only under MAX, mainAxisAlign and FlexItem are valid
81     MAX,
82 
83     // make the size of row/column as large as its children's size.
84     MIN,
85 };
86 
87 enum class CrossAxisSize {
88     // fill the max size of the layout param in cross size of row/column.
89     MAX,
90 
91     // make the cross size of row/column as large as its children's size.
92     MIN,
93 };
94 
95 enum class FlexLayoutMode {
96     // If children do not contains flex weight, use this mode. It is the default mode.
97     FLEX_ITEM_MODE,
98 
99     // If all the children contains flex weight, use this mode.
100     FLEX_WEIGHT_MODE,
101 };
102 
103 // Box Style
104 enum class BoxFlex {
105     // width and height do not extend to box's parent
106     FLEX_NO,
107 
108     // width extends to box's parent, height does not extend to box's parent
109     FLEX_X,
110 
111     // height extends to box's parent, width does not extend to box's parent
112     FLEX_Y,
113 
114     // width and height extend to box's parent
115     FLEX_XY,
116 };
117 
118 enum class BoxSizing {
119     // The width and height properties includes only the content. Border and padding are not included.
120     CONTENT_BOX,
121 
122     // The width and height properties includes content, padding and border.
123     BORDER_BOX,
124 };
125 
126 // Stack Styles
127 enum class StackFit {
128     // keep the child component's size as it is.
129     KEEP,
130 
131     // keep the child component's size as the parent's.
132     STRETCH,
133 
134     // use parent's layoutParam to layout the child
135     INHERIT,
136 
137     // use first child's size as layoutPram max size.
138     FIRST_CHILD,
139 };
140 
141 enum class Overflow {
142     // when the size overflows, clip the exceeding.
143     CLIP,
144 
145     // when the size overflows, observe the exceeding.
146     OBSERVABLE,
147 
148     // when the size overflows, scroll the exceeding.
149     SCROLL,
150 
151     // force clip the exceeding.
152     FORCE_CLIP,
153 };
154 
155 enum class MainStackSize {
156     MAX,
157     MIN,
158     NORMAL,
159     LAST_CHILD_HEIGHT,
160     MATCH_CHILDREN,
161     MAX_X,
162     MAX_Y
163 };
164 
165 enum class MainSwiperSize {
166     MAX,
167     MAX_X,
168     MAX_Y,
169     MIN,
170     AUTO
171 };
172 
173 enum class PositionType {
174     RELATIVE = 0,
175     FIXED,
176     ABSOLUTE,
177     OFFSET, // percetage layout based on RELATIVE
178     SEMI_RELATIVE, // absolute offset based on RELATIVE
179 };
180 
181 enum class TextAlign {
182     LEFT,
183     RIGHT,
184     CENTER,
185     /*
186         render the text to fit the size of the text container by adding space
187     */
188     JUSTIFY,
189     /*
190         align the text from the start of the text container
191 
192         For Direction.ltr, from left side
193         For Direction.rtl, from right side
194     */
195     START,
196     /*
197         align the text from the end of the text container
198 
199         For Direction.ltr, from right side
200         For Direction.rtl, from left side
201     */
202     END,
203 };
204 
205 
206 enum class WhiteSpace {
207     NORMAL,
208     PRE,
209     PRE_WRAP,
210     NOWRAP,
211     PRE_LINE,
212     INHERIT,
213 };
214 
215 enum class TextOverflow {
216     CLIP,
217     ELLIPSIS,
218     NONE,
219 };
220 
221 enum class TextDirection {
222     LTR,
223     RTL,
224     INHERIT,
225     AUTO,
226 };
227 
228 enum class TextDecoration {
229     NONE,
230     UNDERLINE,
231     OVERLINE,
232     LINE_THROUGH,
233     INHERIT,
234 };
235 
236 enum class MarqueeDirection {
237     LEFT,
238     RIGHT,
239 };
240 
241 enum class ImageRepeat {
242     NOREPEAT = 0,
243     REPEATX,
244     REPEATY,
245     REPEAT,
246 };
247 
248 enum class ImageFit {
249     FILL,
250     CONTAIN,
251     COVER,
252     FITWIDTH,
253     FITHEIGHT,
254     NONE,
255     SCALEDOWN,
256 };
257 
258 enum class ImageRenderMode {
259     ORIGINAL = 0,
260     TEMPLATE,
261 };
262 
263 enum class ImageInterpolation {
264     NONE = 0,
265     LOW,
266     MEDIUM,
267     HIGH,
268 };
269 
270 enum class EdgeEffect {
271     SPRING = 0,
272     FADE,
273     NONE,
274 };
275 
276 enum class BorderStyle {
277     SOLID,
278     DASHED,
279     DOTTED,
280     NONE,
281 };
282 
283 enum class BorderImageRepeat {
284     SPACE,
285     STRETCH,
286     REPEAT,
287     ROUND,
288 };
289 
290 enum class BorderImageDirection {
291     TOP,
292     LEFT,
293     RIGHT,
294     BOTTOM,
295 };
296 
297 enum class SrcType {
298     UNSUPPORTED = -1,
299     FILE = 0,
300     ASSET,
301     NETWORK,
302     MEMORY,
303     BASE64,
304     INTERNAL, // internal cached file resource
305     RESOURCE,
306     DATA_ABILITY,
307     DATA_ABILITY_DECODED,
308     RESOURCE_ID, // default resource which src is internal resource id
309     PIXMAP,
310 };
311 
312 enum class WrapAlignment {
313     START,
314     CENTER,
315     END,
316     SPACE_AROUND,
317     SPACE_BETWEEN,
318     STRETCH,
319     SPACE_EVENLY,
320     BASELINE,
321 };
322 
323 enum class WrapDirection {
324     HORIZONTAL,
325     VERTICAL,
326     HORIZONTAL_REVERSE,
327     VERTICAL_REVERSE,
328 };
329 
330 enum class FlexWrap {
331     NO_WRAP,
332     WRAP,
333     WRAP_REVERSE,
334 };
335 
336 enum class KeyDirection {
337     UP = 0,
338     DOWN,
339     LEFT,
340     RIGHT,
341 };
342 
343 const ImageRepeat IMAGE_REPEATS[] = {
344     ImageRepeat::REPEAT,
345     ImageRepeat::REPEATX,
346     ImageRepeat::REPEATY,
347     ImageRepeat::NOREPEAT,
348 };
349 
350 enum class WindowModal : int32_t {
351     NORMAL = 0,
352     SEMI_MODAL = 1,
353     SEMI_MODAL_FULL_SCREEN = 2,
354     DIALOG_MODAL = 3,
355     CONTAINER_MODAL = 4,
356     FIRST_VALUE = NORMAL,
357     LAST_VALUE = CONTAINER_MODAL,
358 };
359 
360 enum class WindowMode : uint32_t {
361     WINDOW_MODE_UNDEFINED = 0,
362     WINDOW_MODE_FULLSCREEN = 1,
363     WINDOW_MODE_SPLIT_PRIMARY = 100,
364     WINDOW_MODE_SPLIT_SECONDARY,
365     WINDOW_MODE_FLOATING,
366     WINDOW_MODE_PIP
367 };
368 
369 enum class PanelType {
370     MINI_BAR,
371     FOLDABLE_BAR,
372     TEMP_DISPLAY,
373 };
374 
375 enum class PanelMode {
376     MINI,
377     HALF,
378     FULL,
379     AUTO,
380 };
381 
382 enum class ColorScheme : int32_t {
383     SCHEME_LIGHT = 0,
384     SCHEME_TRANSPARENT = 1,
385     SCHEME_DARK = 2,
386     FIRST_VALUE = SCHEME_LIGHT,
387     LAST_VALUE = SCHEME_DARK,
388 };
389 
390 enum class RenderStatus : int32_t {
391     UNKNOWN = -1,
392     DEFAULT = 0,
393     ACTIVITY = 1,
394     FOCUS = 2,
395     BLUR = 3,
396     DISABLE = 4,
397     WAITING = 5,
398 };
399 
400 enum class BadgePosition {
401     RIGHT_TOP,
402     RIGHT,
403     LEFT,
404 };
405 
406 enum class QrcodeType {
407     RECT,
408     CIRCLE,
409 };
410 
411 enum class AnimationCurve {
412     FRICTION,
413     STANDARD,
414 };
415 
416 enum class WindowBlurStyle {
417     STYLE_BACKGROUND_SMALL_LIGHT = 100,
418     STYLE_BACKGROUND_MEDIUM_LIGHT = 101,
419     STYLE_BACKGROUND_LARGE_LIGHT = 102,
420     STYLE_BACKGROUND_XLARGE_LIGHT = 103,
421     STYLE_BACKGROUND_SMALL_DARK = 104,
422     STYLE_BACKGROUND_MEDIUM_DARK = 105,
423     STYLE_BACKGROUND_LARGE_DARK = 106,
424     STYLE_BACKGROUND_XLARGE_DARK = 107,
425 };
426 
427 enum class DisplayType {
428     NO_SETTING = 0,
429     FLEX,
430     GRID,
431     NONE,
432 };
433 
434 enum class VisibilityType {
435     NO_SETTING = 0,
436     VISIBLE,
437     HIDDEN,
438 };
439 
440 enum class RefreshType {
441     AUTO,
442     PULL_DOWN,
443 };
444 
445 enum class TabBarMode {
446     FIXED,
447     SCROLLABEL,
448     FIXED_START,
449 };
450 
451 enum class ShowInNavigationBar {
452     SHOW = 0,
453     POPUP,
454 };
455 
456 enum class HorizontalAlign {
457     START = 1,
458     CENTER,
459     END,
460 };
461 
462 enum class VerticalAlign {
463     TOP = 1,
464     CENTER,
465     BOTTOM,
466     BASELINE,
467     NONE,
468 };
469 
470 enum class BarPosition {
471     START,
472     END,
473 };
474 
475 enum class CalendarType {
476     NORMAL = 0,
477     SIMPLE,
478 };
479 
480 enum class SideBarContainerType {
481     EMBED,
482     OVERLAY
483 };
484 
485 inline constexpr uint32_t STATE_NORMAL = 0;
486 inline constexpr uint32_t STATE_PRESSED = 1;
487 inline constexpr uint32_t STATE_FOCUS = 1 << 1;
488 inline constexpr uint32_t STATE_CHECKED = 1 << 2;
489 inline constexpr uint32_t STATE_DISABLED = 1 << 3;
490 inline constexpr uint32_t STATE_WAITING = 1 << 4;
491 inline constexpr uint32_t STATE_HOVERED = 1 << 5;
492 inline constexpr uint32_t STATE_ACTIVE = 1 << 6;
493 
494 } // namespace OHOS::Ace
495 
496 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_LAYOUT_CONSTANTS_H
497