1 /*
2 * Copyright (c) 2021-2025 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 #include <string>
21
22 #include "ui/properties/flex.h"
23
24 #include "base/utils/linear_map.h"
25 #include "base/utils/utils.h"
26 #include "ui/view/components/tabs/tabs_constants.h"
27
28 namespace OHOS::Ace {
29
30 enum class LineCap {
31 BUTT,
32 ROUND,
33 SQUARE,
34 };
35
36 enum class ButtonType {
37 NORMAL,
38 CAPSULE,
39 CIRCLE,
40 TEXT,
41 ARC,
42 DOWNLOAD,
43 ICON,
44 CUSTOM,
45 ROUNDED_RECTANGLE,
46 };
47
48 enum class ToolBarItemPlacement {
49 TOP_BAR_LEADING,
50 TOP_BAR_TRAILING
51 };
52
53 enum class RectWidthStyle {
54 TIGHT,
55 MAX,
56 };
57
58 enum class RectHeightStyle {
59 TIGHT,
60 MAX,
61 INCLUDE_LINE_SPACE_MIDDLE,
62 INCLUDE_LINE_SPACE_TOP,
63 INCLUDE_LINE_SPACE_BOTTOM,
64 STRUT,
65 };
66
67 // Type of hover mode area.
68 enum class HoverModeAreaType {
69 TOP_SCREEN = 0,
70 BOTTOM_SCREEN = 1,
71 };
72
73 enum class AccessibilityRoleType {
74 ACTION_SHEET = 0,
75 ALERT_DIALOG = 1,
76 INDEXER_COMPONENT = 2,
77 BADGE_COMPONENT = 3,
78 BLANK = 4,
79 BUTTON = 5,
80 BACK_BUTTON = 6,
81 SHEET_DRAG_BAR = 7,
82 CALENDAR_PICKER = 8,
83 CALENDAR = 9,
84 CANVAS = 10,
85 CANVAS_GRADIENT = 11,
86 CANVAS_PATTERN = 12,
87 CHECKBOX = 13,
88 CHECKBOX_GROUP = 14,
89 CIRCLE = 15,
90 COLUMN_SPLIT = 16,
91 COLUMN = 17,
92 CANVAS_RENDERING_CONTEXT_2D = 18,
93 CHART = 19,
94 COUNTER = 20,
95 CONTAINER_MODAL = 21,
96 DATA_PANEL = 22,
97 DATE_PICKER = 23,
98 DIALOG = 24,
99 DIVIDER = 25,
100 DRAG_BAR = 26,
101 EFFECT_COMPONENT = 27,
102 ELLIPSE = 28,
103 FLEX = 29,
104 FLOW_ITEM = 30,
105 FORM_COMPONENT = 31,
106 FORM_LINK = 32,
107 GAUGE = 33,
108 GRID = 34,
109 GRID_COL = 35,
110 GRID_CONTAINER = 36,
111 GRID_ITEM = 37,
112 GRID_ROW = 38,
113 HYPERLINK = 39,
114 IMAGE = 40,
115 IMAGE_ANIMATOR = 41,
116 ROLE_IMAGE_BITMAP = 42,
117 IMAGE_DATA = 43,
118 IMAGE_SPAN = 44,
119 LABEL = 45,
120 LINE = 46,
121 LIST = 47,
122 LIST_ITEM = 48,
123 LIST_ITEM_GROUP = 49,
124 LOADING_PROGRESS = 50,
125 MARQUEE = 51,
126 MATRIX2D = 52,
127 MENU = 53,
128 MENU_ITEM = 54,
129 MENU_ITEM_GROUP = 55,
130 NAV_DESTINATION = 56,
131 NAV_ROUTER = 57,
132 NAVIGATION = 58,
133 NAVIGATION_BAR = 59,
134 NAVIGATION_MENU = 60,
135 NAVIGATOR = 61,
136 OFFSCREEN_CANVAS = 62,
137 OFFSCREEN_CANVAS_RENDERING_CONTEXT2D = 63,
138 OPTION = 64,
139 PANEL = 65,
140 PAPER_PAGE = 66,
141 PATH = 67,
142 PATH2D = 68,
143 PATTERN_LOCK = 69,
144 PICKER = 70,
145 PICKER_VIEW = 71,
146 PLUGIN_COMPONENT = 72,
147 POLYGON = 73,
148 POLYLINE = 74,
149 POPUP = 75,
150 PROGRESS = 76,
151 QRCODE = 77,
152 RADIO = 78,
153 RATING = 79,
154 RECT = 80,
155 REFRESH = 81,
156 RELATIVE_CONTAINER = 82,
157 REMOTE_WINDOW = 83,
158 RICH_EDITOR = 84,
159 RICH_TEXT = 85,
160 ROLE_PAGER = 86,
161 ROW = 87,
162 ROW_SPLIT = 88,
163 SCROLL = 89,
164 SCROLL_BAR = 90,
165 SEARCH = 91,
166 SEARCH_FIELD = 92,
167 SELECT = 93,
168 SHAPE = 94,
169 SIDEBAR_CONTAINER = 95,
170 SLIDER = 96,
171 SPAN = 97,
172 STACK = 98,
173 STEPPER = 99,
174 STEPPER_ITEM = 100,
175 SWIPER = 101,
176 SWIPER_INDICATOR = 102,
177 SWITCH = 103,
178 SYMBOL_GLYPH = 104,
179 TAB_CONTENT = 105,
180 TAB_BAR = 106,
181 TABS = 107,
182 TEXT = 108,
183 TEXT_CLOCK = 109,
184 TEXT_ENTRY = 110,
185 TEXT_INPUT = 111,
186 TEXT_PICKER = 112,
187 TEXT_TIMER = 113,
188 TEXT_AREA = 114,
189 TEXT_FIELD = 115,
190 TIME_PICKER = 116,
191 TITLE_BAR = 117,
192 TOGGLER = 118,
193 UI_EXTENSION_COMPONENT = 119,
194 VIDEO = 120,
195 WATER_FLOW = 121,
196 WEB = 122,
197 XCOMPONENT = 123,
198 ROLE_NONE = 124,
199 };
200
201 enum class AccessibilitySamePageMode {
202 SEMI_SILENT = 0,
203 FULL_SILENT = 1,
204 };
205
206 enum class FocusDrawLevel {
207 SELF = 0,
208 TOP = 1,
209 };
210
211 enum class ButtonStyleMode { NORMAL, EMPHASIZE, TEXT };
212
213 enum class ControlSize { SMALL, NORMAL };
214
215 enum class ButtonRole { NORMAL, ERROR };
216
217 // Flex Styles
218 enum class FlexDirection {
219 ROW = 0,
220 COLUMN,
221 ROW_REVERSE,
222 COLUMN_REVERSE,
223 };
224
225 enum class MainAxisSize {
226 // default setting, fill the max size of the layout param. Only under MAX, mainAxisAlign and FlexItem are valid
227 MAX,
228
229 // make the size of row/column as large as its children's size.
230 MIN,
231 };
232
233 enum class CrossAxisSize {
234 // fill the max size of the layout param in cross size of row/column.
235 MAX,
236
237 // make the cross size of row/column as large as its children's size.
238 MIN,
239 };
240
241 enum class FlexLayoutMode {
242 // If children do not contains flex weight, use this mode. It is the default mode.
243 FLEX_ITEM_MODE,
244
245 // If all the children contains flex weight, use this mode.
246 FLEX_WEIGHT_MODE,
247 };
248
249 // Box Style
250 enum class BoxFlex {
251 // width and height do not extend to box's parent
252 FLEX_NO,
253
254 // width extends to box's parent, height does not extend to box's parent
255 FLEX_X,
256
257 // height extends to box's parent, width does not extend to box's parent
258 FLEX_Y,
259
260 // width and height extend to box's parent
261 FLEX_XY,
262 };
263
264 enum class BoxSizing {
265 // The width and height properties includes only the content. Border and padding are not included.
266 CONTENT_BOX,
267
268 // The width and height properties includes content, padding and border.
269 BORDER_BOX,
270 };
271
272 // Stack Styles
273 enum class StackFit {
274 // keep the child component's size as it is.
275 KEEP,
276
277 // keep the child component's size as the parent's.
278 STRETCH,
279
280 // use parent's layoutParam to layout the child
281 INHERIT,
282
283 // use first child's size as layoutPram max size.
284 FIRST_CHILD,
285 };
286
287 enum class Overflow {
288 // when the size overflows, clip the exceeding.
289 CLIP,
290
291 // when the size overflows, observe the exceeding.
292 OBSERVABLE,
293
294 // when the size overflows, scroll the exceeding.
295 SCROLL,
296
297 // force clip the exceeding.
298 FORCE_CLIP,
299 };
300
301 enum class MainStackSize { MAX, MIN, NORMAL, LAST_CHILD_HEIGHT, MATCH_CHILDREN, MAX_X, MAX_Y };
302
303 enum class MainSwiperSize { MAX, MAX_X, MAX_Y, MIN, AUTO };
304
305 enum class PositionType {
306 PTRELATIVE = 0,
307 PTFIXED,
308 PTABSOLUTE,
309 PTOFFSET, // percentage layout based on RELATIVE
310 PTSEMI_RELATIVE, // absolute offset based on RELATIVE
311 };
312
313 enum class TextAlign {
314 LEFT = 4,
315 RIGHT = 5,
316 CENTER = 1,
317 /*
318 render the text to fit the size of the text container by adding space
319 */
320 JUSTIFY = 3,
321 /*
322 align the text from the start of the text container
323
324 For Direction.ltr, from left side
325 For Direction.rtl, from right side
326 */
327 START = 0,
328 /*
329 align the text from the end of the text container
330
331 For Direction.ltr, from right side
332 For Direction.rtl, from left side
333 */
334 END = 2,
335 };
336
337 enum class TextVerticalAlign {
338 BASELINE = 0,
339 BOTTOM = 1,
340 CENTER = 2,
341 TOP = 3,
342 };
343
344 namespace StringUtils {
ToString(const TextAlign & textAlign)345 inline std::string ToString(const TextAlign& textAlign)
346 {
347 static const LinearEnumMapNode<TextAlign, std::string> table[] = {
348 { TextAlign::START, "START" },
349 { TextAlign::CENTER, "CENTER" },
350 { TextAlign::END, "END" },
351 { TextAlign::JUSTIFY, "JUSTIFY" },
352 { TextAlign::LEFT, "LEFT" },
353 { TextAlign::RIGHT, "RIGHT" },
354 };
355 auto iter = BinarySearchFindIndex(table, ArraySize(table), textAlign);
356 return iter != -1 ? table[iter].value : "";
357 }
358
ToString(const TextVerticalAlign & textVerticalAlign)359 inline std::string ToString(const TextVerticalAlign& textVerticalAlign)
360 {
361 static const LinearEnumMapNode<TextVerticalAlign, std::string> table[] = {
362 { TextVerticalAlign::BASELINE, "BASELINE" },
363 { TextVerticalAlign::BOTTOM, "BOTTOM" },
364 { TextVerticalAlign::CENTER, "CENTER" },
365 { TextVerticalAlign::TOP, "TOP" },
366 };
367 auto iter = BinarySearchFindIndex(table, ArraySize(table), textVerticalAlign);
368 return iter != -1 ? table[iter].value : "";
369 }
370 } // namespace StringUtils
371
372 enum class TextMarqueeState {
373 START = 0,
374 BOUNCE,
375 FINISH,
376 };
377
378 enum class MarqueeStartPolicy {
379 DEFAULT = 0,
380 ON_FOCUS,
381 };
382
383 enum class TextDataDetectType {
384 INVALID = -1,
385 PHONE_NUMBER = 0,
386 URL,
387 EMAIL,
388 ADDRESS,
389 DATE_TIME,
390 ASK_CELIA, // ask Celia tag, not a valid ai entity
391 };
392
393 enum class LineBreakStrategy {
394 GREEDY = 0,
395 HIGH_QUALITY,
396 BALANCED,
397 };
398
399 enum class WhiteSpace {
400 NORMAL,
401 PRE,
402 PRE_WRAP,
403 NOWRAP,
404 PRE_LINE,
405 INHERIT,
406 };
407
408 enum class TextOverflow {
409 NONE,
410 CLIP,
411 ELLIPSIS,
412 MARQUEE,
413 DEFAULT,
414 };
415
416 enum class OverflowMode {
417 CLIP,
418 SCROLL,
419 };
420
421 enum class TextSelectableMode {
422 SELECTABLE_UNFOCUSABLE = 0,
423 SELECTABLE_FOCUSABLE,
424 UNSELECTABLE,
425 };
426
427 namespace StringUtils {
ToString(const TextSelectableMode & textSelectableMode)428 inline std::string ToString(const TextSelectableMode& textSelectableMode)
429 {
430 static const LinearEnumMapNode<TextSelectableMode, std::string> table[] = {
431 { TextSelectableMode::SELECTABLE_UNFOCUSABLE, "SELECTABLE_UNFOCUSABLE" },
432 { TextSelectableMode::SELECTABLE_FOCUSABLE, "SELECTABLE_FOCUSABLE" },
433 { TextSelectableMode::UNSELECTABLE, "UNSELECTABLE" }
434 };
435 auto iter = BinarySearchFindIndex(table, ArraySize(table), textSelectableMode);
436 return iter != -1 ? table[iter].value : "";
437 }
438 } // namespace StringUtils
439
440 namespace StringUtils {
ToString(const TextOverflow & textOverflow)441 inline std::string ToString(const TextOverflow& textOverflow)
442 {
443 static const LinearEnumMapNode<TextOverflow, std::string> table[] = {
444 { TextOverflow::NONE, "NONE" },
445 { TextOverflow::CLIP, "CLIP" },
446 { TextOverflow::ELLIPSIS, "ELLIPSIS" },
447 { TextOverflow::MARQUEE, "MARQUEE" },
448 };
449 auto iter = BinarySearchFindIndex(table, ArraySize(table), textOverflow);
450 return iter != -1 ? table[iter].value : "";
451 }
452 } // namespace StringUtils
453
454 // overflow-x: visible|hidden|scroll|auto|no-display|no-content;
455 enum class TextFieldOverflowX {
456 VISIBLE,
457 HIDDEN,
458 SCROLL,
459 AUTO,
460 NO_DISPLAY,
461 NO_CONTENT,
462 };
463
464 enum class TextDirection {
465 LTR,
466 RTL,
467 INHERIT,
468 AUTO,
469 };
470
471 enum class TextDecoration {
472 NONE,
473 UNDERLINE,
474 OVERLINE,
475 LINE_THROUGH,
476 INHERIT,
477 };
478
479 namespace StringUtils {
ToString(const TextDecoration & textDecoration)480 inline std::string ToString(const TextDecoration& textDecoration)
481 {
482 static const LinearEnumMapNode<TextDecoration, std::string> table[] = {
483 { TextDecoration::NONE, "NONE" },
484 { TextDecoration::UNDERLINE, "UNDERLINE" },
485 { TextDecoration::OVERLINE, "OVERLINE" },
486 { TextDecoration::LINE_THROUGH, "LINE_THROUGH" },
487 { TextDecoration::INHERIT, "INHERIT" },
488 };
489 auto iter = BinarySearchFindIndex(table, ArraySize(table), textDecoration);
490 return iter != -1 ? table[iter].value : "";
491 }
492 } // namespace StringUtils
493
494 enum class TextDecorationStyle {
495 SOLID,
496 DOUBLE,
497 DOTTED,
498 DASHED,
499 WAVY,
500 INITIAL,
501 INHERIT,
502 };
503
504 namespace StringUtils {
ToString(const TextDecorationStyle & textDecorationStyle)505 inline std::string ToString(const TextDecorationStyle& textDecorationStyle)
506 {
507 static const LinearEnumMapNode<TextDecorationStyle, std::string> table[] = {
508 { TextDecorationStyle::SOLID, "SOLID" },
509 { TextDecorationStyle::DOUBLE, "DOUBLE" },
510 { TextDecorationStyle::DOTTED, "DOTTED" },
511 { TextDecorationStyle::DASHED, "DASHED" },
512 { TextDecorationStyle::WAVY, "WAVY" },
513 { TextDecorationStyle::INITIAL, "INITIAL" },
514 { TextDecorationStyle::INHERIT, "INHERIT" }
515 };
516 auto iter = BinarySearchFindIndex(table, ArraySize(table), textDecorationStyle);
517 return iter != -1 ? table[iter].value : "";
518 }
519 } // namespace StringUtils
520
521 enum class TextHeightAdaptivePolicy {
522 MAX_LINES_FIRST,
523 MIN_FONT_SIZE_FIRST,
524 LAYOUT_CONSTRAINT_FIRST,
525 };
526
527 enum class TextEffectStrategy {
528 NONE = 0,
529 FLIP,
530 };
531
532 enum class MarqueeDirection {
533 LEFT,
534 RIGHT,
535 DEFAULT,
536 DEFAULT_REVERSE,
537 };
538
539 enum class ImageRepeat {
540 NO_REPEAT = 0,
541 REPEAT_X,
542 REPEAT_Y,
543 REPEAT,
544 };
545
546 enum class ImageFit {
547 FILL,
548 CONTAIN,
549 COVER,
550 FITWIDTH,
551 FITHEIGHT,
552 NONE,
553 SCALE_DOWN,
554 TOP_LEFT,
555 TOP,
556 TOP_END,
557 START,
558 CENTER,
559 END,
560 BOTTOM_START,
561 BOTTOM,
562 BOTTOM_END,
563 COVER_TOP_LEFT,
564 MATRIX,
565 };
566
567 enum class KeyboardAppearance {
568 NONE_IMMERSIVE = 0,
569 IMMERSIVE = 1,
570 LIGHT_IMMERSIVE = 2,
571 DARK_IMMERSIVE = 3
572 };
573
574 enum class TextChangeReason {
575 UNKNOWN = 0,
576 INPUT = 1,
577 PASTE = 2,
578 CUT = 3,
579 DRAG = 4,
580 AUTO_FILL = 5,
581 AI_WRITE = 6,
582 REDO = 7,
583 UNDO = 8,
584 CONTROLLER = 9,
585 ACCESSIBILITY = 10,
586 COLLABORATION = 11,
587 STYLUS = 12
588 };
589
590 namespace StringUtils {
ToString(const ImageFit & imageFit)591 inline std::string ToString(const ImageFit& imageFit)
592 {
593 static const LinearEnumMapNode<ImageFit, std::string> table[] = {
594 { ImageFit::FILL, "FILL" },
595 { ImageFit::CONTAIN, "CONTAIN" },
596 { ImageFit::COVER, "COVER" },
597 { ImageFit::FITWIDTH, "FITWIDTH" },
598 { ImageFit::FITHEIGHT, "FITHEIGHT" },
599 { ImageFit::NONE, "NONE" },
600 { ImageFit::SCALE_DOWN, "SCALE_DOWN" },
601 { ImageFit::TOP_LEFT, "TOP_LEFT" },
602 { ImageFit::TOP, "TOP" },
603 { ImageFit::TOP_END, "TOP_END" },
604 { ImageFit::START, "START" },
605 { ImageFit::CENTER, "CENTER" },
606 { ImageFit::END, "END" },
607 { ImageFit::BOTTOM_START, "BOTTOM_START" },
608 { ImageFit::BOTTOM, "BOTTOM" },
609 { ImageFit::BOTTOM_END, "BOTTOM_END" },
610 };
611 auto iter = BinarySearchFindIndex(table, ArraySize(table), imageFit);
612 return iter != -1 ? table[iter].value : "";
613 }
614 } // namespace StringUtils
615
616 enum class DynamicRangeMode {
617 HIGH = 0,
618 CONSTRAINT,
619 STANDARD,
620 };
621
622 enum class AIImageQuality {
623 NONE = 0,
624 LOW,
625 NORMAL,
626 HIGH,
627 };
628
629 enum class ImageRotateOrientation {
630 AUTO = 0,
631 UP = 1,
632 RIGHT = 2,
633 DOWN = 3,
634 LEFT = 4,
635 UP_MIRRORED = 5, // Reflected across x-axis
636 RIGHT_MIRRORED = 6, // Reflected across x-axis, Rotated 90 CW
637 DOWN_MIRRORED = 7, // Reflected across y-axis
638 LEFT_MIRRORED = 8, // Reflected across x-axis, Rotated 90 CCW
639 };
640
641 enum class OrientationFit {
642 NONE = 0,
643 VERTICAL_FLIP = 1,
644 HORIZONTAL_FLIP = 2
645 };
646
647 enum class ImageRenderMode {
648 ORIGINAL = 0,
649 TEMPLATE,
650 };
651
652 enum class ImageInterpolation {
653 NONE = 0,
654 LOW,
655 MEDIUM,
656 HIGH,
657 };
658
659 enum class EdgeEffect {
660 SPRING = 0,
661 FADE,
662 NONE,
663 };
664
665 enum class EffectEdge {
666 START = 1,
667 END = 2,
668 ALL = 3,
669 };
670
671 enum class FocusWrapMode {
672 DEFAULT = 0,
673 WRAP_WITH_ARROW,
674 };
675
676 enum class BorderStyle {
677 SOLID,
678 DASHED,
679 DOTTED,
680 NONE,
681 };
682
683 enum class BorderImageRepeat {
684 SPACE,
685 STRETCH,
686 REPEAT,
687 ROUND,
688 };
689
690 enum class BorderImageDirection {
691 LEFT,
692 RIGHT,
693 TOP,
694 BOTTOM,
695 START,
696 END,
697 };
698
699 enum class TimePickerFormat { HOUR_MINUTE, HOUR_MINUTE_SECOND };
700
701 enum class SrcType {
702 UNSUPPORTED = -1,
703 FILE = 0,
704 ASSET,
705 NETWORK,
706 MEMORY,
707 BASE64,
708 INTERNAL, // internal cached file resource
709 RESOURCE,
710 DATA_ABILITY,
711 DATA_ABILITY_DECODED,
712 RESOURCE_ID, // default resource which src is internal resource id
713 PIXMAP,
714 ASTC,
715 };
716
717 enum class WrapAlignment {
718 START,
719 CENTER,
720 END,
721 SPACE_AROUND,
722 SPACE_BETWEEN,
723 STRETCH,
724 SPACE_EVENLY,
725 BASELINE,
726 };
727
728 enum class WrapDirection {
729 HORIZONTAL,
730 VERTICAL,
731 HORIZONTAL_REVERSE,
732 VERTICAL_REVERSE,
733 };
734
735 enum class FlexWrap {
736 NO_WRAP,
737 WRAP,
738 WRAP_REVERSE,
739 };
740
741 enum class KeyDirection {
742 UP = 0,
743 DOWN,
744 LEFT,
745 RIGHT,
746 };
747
748 enum class PixelRoundPolicy {
749 ALL_FORCE_ROUND = 0,
750 FORCE_CEIL_START = 1,
751 FORCE_FLOOR_START = 1 << 1,
752 NO_FORCE_ROUND_START = 1 << 2,
753 FORCE_CEIL_TOP = 1 << 3,
754 FORCE_FLOOR_TOP = 1 << 4,
755 NO_FORCE_ROUND_TOP = 1 << 5,
756 FORCE_CEIL_END = 1 << 6,
757 FORCE_FLOOR_END = 1 << 7,
758 NO_FORCE_ROUND_END = 1 << 8,
759 FORCE_CEIL_BOTTOM = 1 << 9,
760 FORCE_FLOOR_BOTTOM = 1 << 10,
761 NO_FORCE_ROUND_BOTTOM = 1 << 11,
762 };
763
764 enum class PixelRoundCalcPolicy {
765 NO_FORCE_ROUND = 0,
766 FORCE_CEIL = 1,
767 FORCE_FLOOR = 2,
768 };
769
770 enum class PixelRoundMode {
771 PIXEL_ROUND_ON_LAYOUT_FINISH = 0,
772 PIXEL_ROUND_AFTER_MEASURE = 1,
773 };
774
775 enum class LayoutCalPolicy {
776 NO_MATCH = 0,
777 MATCH_PARENT = 1,
778 WRAP_CONTENT = 2,
779 FIX_AT_IDEAL_SIZE = 3,
780 };
781
782 const ImageRepeat IMAGE_REPEATS[] = {
783 ImageRepeat::REPEAT,
784 ImageRepeat::REPEAT_X,
785 ImageRepeat::REPEAT_Y,
786 ImageRepeat::NO_REPEAT,
787 };
788
789 enum class WindowModal : int32_t {
790 NORMAL = 0,
791 SEMI_MODAL = 1,
792 SEMI_MODAL_FULL_SCREEN = 2,
793 DIALOG_MODAL = 3,
794 CONTAINER_MODAL = 4,
795 FIRST_VALUE = NORMAL,
796 LAST_VALUE = CONTAINER_MODAL,
797 };
798
799 enum class WindowMode : uint32_t {
800 WINDOW_MODE_UNDEFINED = 0,
801 WINDOW_MODE_FULLSCREEN = 1,
802 WINDOW_MODE_SPLIT_PRIMARY = 100,
803 WINDOW_MODE_SPLIT_SECONDARY,
804 WINDOW_MODE_FLOATING,
805 WINDOW_MODE_PIP
806 };
807
808 enum class WindowType : uint32_t {
809 WINDOW_TYPE_UNDEFINED = 0,
810 WINDOW_TYPE_APP_BASE = 1,
811 WINDOW_TYPE_APP_END = 1003,
812 WINDOW_TYPE_FLOAT = 2106,
813 };
814
815 enum class PanelType {
816 MINI_BAR,
817 FOLDABLE_BAR,
818 TEMP_DISPLAY,
819 CUSTOM,
820 };
821
822 enum class PanelMode {
823 MINI,
824 HALF,
825 FULL,
826 AUTO,
827 CUSTOM,
828 };
829
830 enum class ColorScheme : int32_t {
831 SCHEME_LIGHT = 0,
832 SCHEME_TRANSPARENT = 1,
833 SCHEME_DARK = 2,
834 FIRST_VALUE = SCHEME_LIGHT,
835 LAST_VALUE = SCHEME_DARK,
836 };
837
838 enum class RenderStatus : int32_t {
839 UNKNOWN = -1,
840 DEFAULT = 0,
841 ACTIVITY = 1,
842 FOCUS = 2,
843 BLUR = 3,
844 DISABLE = 4,
845 WAITING = 5,
846 };
847
848 enum class BadgePosition {
849 RIGHT_TOP,
850 RIGHT,
851 LEFT,
852 };
853
854 enum class QrcodeType {
855 RECT,
856 CIRCLE,
857 };
858
859 enum class AnimationCurve {
860 FRICTION,
861 STANDARD,
862 };
863
864 enum class WindowBlurStyle {
865 STYLE_BACKGROUND_SMALL_LIGHT = 100,
866 STYLE_BACKGROUND_MEDIUM_LIGHT = 101,
867 STYLE_BACKGROUND_LARGE_LIGHT = 102,
868 STYLE_BACKGROUND_XLARGE_LIGHT = 103,
869 STYLE_BACKGROUND_SMALL_DARK = 104,
870 STYLE_BACKGROUND_MEDIUM_DARK = 105,
871 STYLE_BACKGROUND_LARGE_DARK = 106,
872 STYLE_BACKGROUND_XLARGE_DARK = 107,
873 };
874
875 enum class DisplayType { NO_SETTING = 0, FLEX, GRID, NONE, BLOCK, INLINE, INLINE_BLOCK, INLINE_FLEX };
876
877 enum class VisibilityType {
878 NO_SETTING = 0,
879 VISIBLE,
880 HIDDEN,
881 };
882
883 enum class RefreshType {
884 AUTO,
885 PULL_DOWN,
886 };
887
888 enum class TabAnimateMode {
889 CONTENT_FIRST = 0,
890 ACTION_FIRST,
891 NO_ANIMATION,
892 CONTENT_FIRST_WITH_JUMP,
893 ACTION_FIRST_WITH_JUMP,
894 MAX_VALUE,
895 };
896
897 enum class ShowInNavigationBar {
898 SHOW = 0,
899 POPUP,
900 };
901
902 enum class HorizontalAlign {
903 START = 1,
904 CENTER,
905 END,
906 };
907
908 enum class VerticalAlign {
909 TOP = 1,
910 CENTER,
911 BOTTOM,
912 BASELINE,
913 FOLLOW_PARAGRAPH,
914 NONE,
915 };
916
917 enum class SwiperDynamicSyncSceneType {
918 GESTURE = 0,
919 ANIMATE,
920 };
921
922 enum class MarqueeDynamicSyncSceneType {
923 ANIMATE = 1,
924 };
925
926 namespace StringUtils {
ToString(const VerticalAlign & verticalAlign)927 inline std::string ToString(const VerticalAlign& verticalAlign)
928 {
929 static const LinearEnumMapNode<VerticalAlign, std::string> table[] = {
930 { VerticalAlign::TOP, "TOP" },
931 { VerticalAlign::CENTER, "CENTER" },
932 { VerticalAlign::BOTTOM, "BOTTOM" },
933 { VerticalAlign::BASELINE, "BASELINE" },
934 { VerticalAlign::NONE, "NONE" },
935 };
936 auto iter = BinarySearchFindIndex(table, ArraySize(table), verticalAlign);
937 return iter != -1 ? table[iter].value : "";
938 }
939 } // namespace StringUtils
940
941 enum class CalendarType {
942 NORMAL = 0,
943 SIMPLE,
944 };
945
946 enum class SideBarContainerType { EMBED, OVERLAY, AUTO };
947
948 enum class SideBarPosition { START, END };
949
950 enum class SideBarStatus {
951 SHOW,
952 HIDDEN,
953 CHANGING,
954 AUTO,
955 };
956
957 enum class HitTestMode {
958 /**
959 * Both self and children respond to the hit test for touch events,
960 * but block hit test of the other nodes which is masked by this node.
961 */
962 HTMDEFAULT = 0,
963
964 /**
965 * Self respond to the hit test for touch events,
966 * but block hit test of children and other nodes which is masked by this node.
967 */
968 HTMBLOCK,
969
970 /**
971 * Self and child respond to the hit test for touch events,
972 * and allow hit test of other nodes which is masked by this node.
973 */
974 HTMTRANSPARENT,
975
976 /**
977 * Self not respond to the hit test for touch events,
978 * but children respond to the hit test for touch events.
979 */
980 HTMNONE
981 };
982
983 enum class CopyOptions {
984 None = 0,
985 InApp,
986 Local,
987 Distributed,
988 };
989
990 namespace StringUtils {
ToString(const CopyOptions & copyOptions)991 inline std::string ToString(const CopyOptions& copyOptions)
992 {
993 static const LinearEnumMapNode<CopyOptions, std::string> table[] = {
994 { CopyOptions::None, "None" },
995 { CopyOptions::InApp, "InApp" },
996 { CopyOptions::Local, "Local" },
997 { CopyOptions::Distributed, "Distributed" },
998 };
999 auto iter = BinarySearchFindIndex(table, ArraySize(table), copyOptions);
1000 return iter != -1 ? table[iter].value : "";
1001 }
1002 } // namespace StringUtils
1003
1004 enum class VisibleType {
1005 VISIBLE = 0,
1006 INVISIBLE,
1007 GONE,
1008 };
1009
1010 enum class ShapeMode {
1011 /*
1012 * unspecified, follow theme.
1013 */
1014 DEFAULT = 0,
1015 /*
1016 * rect scrollbar.
1017 */
1018 RECT,
1019 /*
1020 * round scrollbar.
1021 */
1022 ROUND,
1023 };
1024
1025 enum class DisplayMode {
1026 /*
1027 * do not display scrollbar.
1028 */
1029 OFF = 0,
1030 /*
1031 * display scrollbar on demand.
1032 */
1033 AUTO,
1034 /*
1035 * always display scrollbar.
1036 */
1037 ON,
1038 };
1039
1040 enum class PositionMode {
1041 /*
1042 * display scrollbar on right.
1043 */
1044 RIGHT = 0,
1045 /*
1046 * display scrollbar on left.
1047 */
1048 LEFT,
1049 /*
1050 * display scrollbar on bottom.
1051 */
1052 BOTTOM,
1053 };
1054
1055 enum class XComponentType {
1056 UNKNOWN = -1,
1057 SURFACE = 0,
1058 COMPONENT,
1059 TEXTURE,
1060 NODE,
1061 };
1062
1063 enum class XComponentNodeType {
1064 UNKNOWN = -1,
1065 TYPE_NODE = 0,
1066 DECLARATIVE_NODE,
1067 CNODE,
1068 };
1069
1070 enum class RenderMode { ASYNC_RENDER = 0, SYNC_RENDER };
1071
1072 inline constexpr uint32_t STATE_NORMAL = 0;
1073 inline constexpr uint32_t STATE_PRESSED = 1;
1074 inline constexpr uint32_t STATE_FOCUS = 1 << 1;
1075 inline constexpr uint32_t STATE_CHECKED = 1 << 2;
1076 inline constexpr uint32_t STATE_DISABLED = 1 << 3;
1077 inline constexpr uint32_t STATE_WAITING = 1 << 4;
1078 inline constexpr uint32_t STATE_HOVERED = 1 << 5;
1079 inline constexpr uint32_t STATE_ACTIVE = 1 << 6;
1080
1081 enum class TabBarStyle {
1082 NOSTYLE = 0,
1083 SUBTABBATSTYLE,
1084 BOTTOMTABBATSTYLE,
1085 };
1086
1087 enum class GestureJudgeResult {
1088 CONTINUE = 0,
1089 REJECT = 1,
1090 };
1091
1092 enum class GestureTypeName {
1093 UNKNOWN = -1,
1094 TAP_GESTURE = 0,
1095 LONG_PRESS_GESTURE = 1,
1096 PAN_GESTURE = 2,
1097 PINCH_GESTURE = 3,
1098 SWIPE_GESTURE = 4,
1099 ROTATION_GESTURE = 5,
1100 DRAG = 6,
1101 CLICK = 7,
1102 BOXSELECT = 8,
1103 WEBSCROLL = 9,
1104 TEXTFIELD_BOXSELECT = 10,
1105 CONTEXT_MENU_HOVER = 11,
1106 };
1107
1108 enum class ModifierKey {
1109 CTRL = 0,
1110 SHIFT = 1,
1111 ALT = 2,
1112 };
1113
1114 enum class FunctionKey {
1115 ESC = 0,
1116 F1 = 1,
1117 F2 = 2,
1118 F3 = 3,
1119 F4 = 4,
1120 F5 = 5,
1121 F6 = 6,
1122 F7 = 7,
1123 F8 = 8,
1124 F9 = 9,
1125 F10 = 10,
1126 F11 = 11,
1127 F12 = 12,
1128 TAB = 13,
1129 DPAD_UP = 14,
1130 DPAD_DOWN = 15,
1131 DPAD_LEFT = 16,
1132 DPAD_RIGHT = 17,
1133 };
1134
1135 enum class ObscuredReasons {
1136 PLACEHOLDER = 0,
1137 };
1138
1139 enum class MaximizeMode : uint32_t {
1140 MODE_AVOID_SYSTEM_BAR,
1141 MODE_FULL_FILL,
1142 MODE_RECOVER,
1143 };
1144
1145 enum class RenderFit : int32_t {
1146 CENTER = 0,
1147 TOP,
1148 BOTTOM,
1149 LEFT,
1150 RIGHT,
1151 TOP_LEFT,
1152 TOP_RIGHT,
1153 BOTTOM_LEFT,
1154 BOTTOM_RIGHT,
1155 RESIZE_FILL,
1156 RESIZE_CONTAIN,
1157 RESIZE_CONTAIN_TOP_LEFT,
1158 RESIZE_CONTAIN_BOTTOM_RIGHT,
1159 RESIZE_COVER,
1160 RESIZE_COVER_TOP_LEFT,
1161 RESIZE_COVER_BOTTOM_RIGHT,
1162 };
1163
1164 enum class KeyBoardAvoidMode : int32_t {
1165 OFFSET = 0,
1166 RESIZE = 1,
1167 OFFSET_WITH_CARET = 2,
1168 RESIZE_WITH_CARET = 3,
1169 NONE = 4,
1170 };
1171
1172 enum class SwipeActionState : uint32_t {
1173 COLLAPSED = 0,
1174 EXPANDED,
1175 ACTIONING,
1176 };
1177 /**
1178 * souce is Rosen::Orientation
1179 */
1180 enum class Orientation : uint32_t {
1181 BEGIN = 0,
1182 UNSPECIFIED = BEGIN,
1183 VERTICAL = 1,
1184 HORIZONTAL = 2,
1185 REVERSE_VERTICAL = 3,
1186 REVERSE_HORIZONTAL = 4,
1187 SENSOR = 5,
1188 SENSOR_VERTICAL = 6,
1189 SENSOR_HORIZONTAL = 7,
1190 AUTO_ROTATION_RESTRICTED = 8,
1191 AUTO_ROTATION_PORTRAIT_RESTRICTED = 9,
1192 AUTO_ROTATION_LANDSCAPE_RESTRICTED = 10,
1193 LOCKED = 11,
1194 FOLLOW_RECENT = 12,
1195 AUTO_ROTATION_UNSPECIFIED = 13,
1196 USER_ROTATION_PORTRAIT = 14,
1197 USER_ROTATION_LANDSCAPE = 15,
1198 USER_ROTATION_PORTRAIT_INVERTED = 16,
1199 USER_ROTATION_LANDSCAPE_INVERTED = 17,
1200 FOLLOW_DESKTOP = 18,
1201 END = FOLLOW_DESKTOP,
1202 };
1203
1204 enum class SystemBarType : uint32_t {
1205 STATUS = 1,
1206 NAVIGATION = 2,
1207 NAVIGATION_INDICATOR = 4,
1208 };
1209
1210 enum class NodeRenderType : uint32_t {
1211 RENDER_TYPE_DISPLAY = 0,
1212 RENDER_TYPE_TEXTURE,
1213 };
1214
1215 enum class MarqueeUpdateStrategy : uint32_t {
1216 DEFAULT = 0,
1217 PRESERVE_POSITION,
1218 };
1219
1220 enum class EdgeType {
1221 MARGIN,
1222 PADDING,
1223 SAFE_AREA_PADDING,
1224 };
1225
1226 enum class SafeAreaSyncType : uint32_t {
1227 SYNC_TYPE_NONE = 0,
1228 SYNC_TYPE_KEYBOARD,
1229 SYNC_TYPE_AVOID_AREA,
1230 SYNC_TYPE_WINDOW_IGNORE
1231 };
1232
1233 enum class SwiperAnimationMode {
1234 NO_ANIMATION = 0,
1235 DEFAULT_ANIMATION,
1236 FAST_ANIMATION,
1237 MAX_VALUE,
1238 };
1239
1240 enum class DividerMode {
1241 FLOATING_ABOVE_MENU = 0,
1242 EMBEDDED_IN_MENU = 1,
1243 };
1244
1245 enum class LayoutType : int32_t {
1246 NONE = 0,
1247 MEASURE_FOR_IGNORE = 1,
1248 LAYOUT_FOR_IGNORE = 2
1249 };
1250 } // namespace OHOS::Ace
1251
1252 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_LAYOUT_CONSTANTS_H
1253