• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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_CUSTOMIZATION,
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 { MAX, MIN, NORMAL, LAST_CHILD_HEIGHT, MATCH_CHILDREN, MAX_X, MAX_Y };
156 
157 enum class MainSwiperSize { MAX, MAX_X, MAX_Y, MIN, AUTO };
158 
159 enum class PositionType {
160     PTRELATIVE = 0,
161     PTFIXED,
162     PTABSOLUTE,
163     PTOFFSET,        // percentage layout based on RELATIVE
164     PTSEMI_RELATIVE, // absolute offset based on RELATIVE
165 };
166 
167 enum class TextAlign {
168     LEFT,
169     RIGHT,
170     CENTER,
171     /*
172         render the text to fit the size of the text container by adding space
173     */
174     JUSTIFY,
175     /*
176         align the text from the start of the text container
177 
178         For Direction.ltr, from left side
179         For Direction.rtl, from right side
180     */
181     START,
182     /*
183         align the text from the end of the text container
184 
185         For Direction.ltr, from right side
186         For Direction.rtl, from left side
187     */
188     END,
189 };
190 
191 enum class WhiteSpace {
192     NORMAL,
193     PRE,
194     PRE_WRAP,
195     NOWRAP,
196     PRE_LINE,
197     INHERIT,
198 };
199 
200 enum class TextOverflow {
201     NONE,
202     CLIP,
203     ELLIPSIS,
204     MARQUEE,
205 };
206 
207 enum class TextDirection {
208     LTR,
209     RTL,
210     INHERIT,
211     AUTO,
212 };
213 
214 enum class TextDecoration {
215     NONE,
216     UNDERLINE,
217     OVERLINE,
218     LINE_THROUGH,
219     INHERIT,
220 };
221 
222 enum class TextHeightAdaptivePolicy {
223     MAX_LINES_FIRST,
224     MIN_FONT_SIZE_FIRST,
225     LAYOUT_CONSTRAINT_FIRST,
226 };
227 
228 enum class MarqueeDirection {
229     LEFT,
230     RIGHT,
231 };
232 
233 enum class ImageRepeat {
234     NO_REPEAT = 0,
235     REPEAT_X,
236     REPEAT_Y,
237     REPEAT,
238 };
239 
240 enum class ImageFit {
241     FILL,
242     CONTAIN,
243     COVER,
244     FITWIDTH,
245     FITHEIGHT,
246     NONE,
247     SCALE_DOWN,
248     TOP_LEFT,
249 };
250 
251 enum class ImageRenderMode {
252     ORIGINAL = 0,
253     TEMPLATE,
254 };
255 
256 enum class ImageInterpolation {
257     NONE = 0,
258     LOW,
259     MEDIUM,
260     HIGH,
261 };
262 
263 enum class EdgeEffect {
264     SPRING = 0,
265     FADE,
266     NONE,
267 };
268 
269 enum class BorderStyle {
270     SOLID,
271     DASHED,
272     DOTTED,
273     NONE,
274 };
275 
276 enum class BorderImageRepeat {
277     SPACE,
278     STRETCH,
279     REPEAT,
280     ROUND,
281 };
282 
283 enum class BorderImageDirection {
284     LEFT,
285     RIGHT,
286     TOP,
287     BOTTOM,
288 };
289 
290 enum class SrcType {
291     UNSUPPORTED = -1,
292     FILE = 0,
293     ASSET,
294     NETWORK,
295     MEMORY,
296     BASE64,
297     INTERNAL, // internal cached file resource
298     RESOURCE,
299     DATA_ABILITY,
300     DATA_ABILITY_DECODED,
301     RESOURCE_ID, // default resource which src is internal resource id
302     PIXMAP,
303 };
304 
305 enum class WrapAlignment {
306     START,
307     CENTER,
308     END,
309     SPACE_AROUND,
310     SPACE_BETWEEN,
311     STRETCH,
312     SPACE_EVENLY,
313     BASELINE,
314 };
315 
316 enum class WrapDirection {
317     HORIZONTAL,
318     VERTICAL,
319     HORIZONTAL_REVERSE,
320     VERTICAL_REVERSE,
321 };
322 
323 enum class FlexWrap {
324     NO_WRAP,
325     WRAP,
326     WRAP_REVERSE,
327 };
328 
329 enum class KeyDirection {
330     UP = 0,
331     DOWN,
332     LEFT,
333     RIGHT,
334 };
335 
336 const ImageRepeat IMAGE_REPEATS[] = {
337     ImageRepeat::REPEAT,
338     ImageRepeat::REPEAT_X,
339     ImageRepeat::REPEAT_Y,
340     ImageRepeat::NO_REPEAT,
341 };
342 
343 enum class WindowModal : int32_t {
344     NORMAL = 0,
345     SEMI_MODAL = 1,
346     SEMI_MODAL_FULL_SCREEN = 2,
347     DIALOG_MODAL = 3,
348     CONTAINER_MODAL = 4,
349     FIRST_VALUE = NORMAL,
350     LAST_VALUE = CONTAINER_MODAL,
351 };
352 
353 enum class WindowMode : uint32_t {
354     WINDOW_MODE_UNDEFINED = 0,
355     WINDOW_MODE_FULLSCREEN = 1,
356     WINDOW_MODE_SPLIT_PRIMARY = 100,
357     WINDOW_MODE_SPLIT_SECONDARY,
358     WINDOW_MODE_FLOATING,
359     WINDOW_MODE_PIP
360 };
361 
362 enum class WindowType : uint32_t {
363     WINDOW_TYPE_UNDEFINED = 0,
364     WINDOW_TYPE_APP_BASE = 1,
365     WINDOW_TYPE_APP_END = 1003,
366     WINDOW_TYPE_FLOAT = 2106,
367 };
368 
369 enum class PanelType {
370     MINI_BAR,
371     FOLDABLE_BAR,
372     TEMP_DISPLAY,
373     CUSTOM,
374 };
375 
376 enum class PanelMode {
377     MINI,
378     HALF,
379     FULL,
380     AUTO,
381     CUSTOM,
382 };
383 
384 enum class ColorScheme : int32_t {
385     SCHEME_LIGHT = 0,
386     SCHEME_TRANSPARENT = 1,
387     SCHEME_DARK = 2,
388     FIRST_VALUE = SCHEME_LIGHT,
389     LAST_VALUE = SCHEME_DARK,
390 };
391 
392 enum class RenderStatus : int32_t {
393     UNKNOWN = -1,
394     DEFAULT = 0,
395     ACTIVITY = 1,
396     FOCUS = 2,
397     BLUR = 3,
398     DISABLE = 4,
399     WAITING = 5,
400 };
401 
402 enum class BadgePosition {
403     RIGHT_TOP,
404     RIGHT,
405     LEFT,
406 };
407 
408 enum class QrcodeType {
409     RECT,
410     CIRCLE,
411 };
412 
413 enum class AnimationCurve {
414     FRICTION,
415     STANDARD,
416 };
417 
418 enum class WindowBlurStyle {
419     STYLE_BACKGROUND_SMALL_LIGHT = 100,
420     STYLE_BACKGROUND_MEDIUM_LIGHT = 101,
421     STYLE_BACKGROUND_LARGE_LIGHT = 102,
422     STYLE_BACKGROUND_XLARGE_LIGHT = 103,
423     STYLE_BACKGROUND_SMALL_DARK = 104,
424     STYLE_BACKGROUND_MEDIUM_DARK = 105,
425     STYLE_BACKGROUND_LARGE_DARK = 106,
426     STYLE_BACKGROUND_XLARGE_DARK = 107,
427 };
428 
429 enum class DisplayType { NO_SETTING = 0, FLEX, GRID, NONE, BLOCK, INLINE, INLINE_BLOCK, INLINE_FLEX };
430 
431 enum class VisibilityType {
432     NO_SETTING = 0,
433     VISIBLE,
434     HIDDEN,
435 };
436 
437 enum class RefreshType {
438     AUTO,
439     PULL_DOWN,
440 };
441 
442 enum class TabBarMode {
443     FIXED,
444     SCROLLABLE,
445     FIXED_START,
446 };
447 
448 enum class ShowInNavigationBar {
449     SHOW = 0,
450     POPUP,
451 };
452 
453 enum class HorizontalAlign {
454     START = 1,
455     CENTER,
456     END,
457 };
458 
459 enum class VerticalAlign {
460     TOP = 1,
461     CENTER,
462     BOTTOM,
463     BASELINE,
464     NONE,
465 };
466 
467 enum class BarPosition {
468     START,
469     END,
470 };
471 
472 enum class CalendarType {
473     NORMAL = 0,
474     SIMPLE,
475 };
476 
477 enum class SideBarContainerType { EMBED, OVERLAY, AUTO };
478 
479 enum class SideBarPosition { START, END };
480 
481 enum class SideBarStatus {
482     SHOW,
483     HIDDEN,
484     CHANGING,
485     AUTO,
486 };
487 
488 enum class HitTestMode {
489     /**
490      *  Both self and children respond to the hit test for touch events,
491      *  but block hit test of the other nodes which is masked by this node.
492      */
493     HTMDEFAULT = 0,
494 
495     /**
496      * Self respond to the hit test for touch events,
497      * but block hit test of children and other nodes which is masked by this node.
498      */
499     HTMBLOCK,
500 
501     /**
502      * Self and child respond to the hit test for touch events,
503      * and allow hit test of other nodes which is masked by this node.
504      */
505     HTMTRANSPARENT,
506 
507     /**
508      * Self not respond to the hit test for touch events,
509      * but children respond to the hit test for touch events.
510      */
511     HTMNONE
512 };
513 
514 enum class CopyOptions {
515     None = 0,
516     InApp,
517     Local,
518     Distributed,
519 };
520 
521 enum class VisibleType {
522     VISIBLE,
523     INVISIBLE,
524     GONE,
525 };
526 
527 enum class ShapeMode {
528     /*
529      * unspecified, follow theme.
530      */
531     DEFAULT = 0,
532     /*
533      * rect scrollbar.
534      */
535     RECT,
536     /*
537      * round scrollbar.
538      */
539     ROUND,
540 };
541 
542 enum class DisplayMode {
543     /*
544      * do not display scrollbar.
545      */
546     OFF = 0,
547     /*
548      * display scrollbar on demand.
549      */
550     AUTO,
551     /*
552      * always display scrollbar.
553      */
554     ON,
555 };
556 
557 enum class PositionMode {
558     /*
559      * display scrollbar on right.
560      */
561     RIGHT = 0,
562     /*
563      * display scrollbar on left.
564      */
565     LEFT,
566     /*
567      * display scrollbar on bottom.
568      */
569     BOTTOM,
570 };
571 
572 enum class XComponentType { SURFACE = 0, COMPONENT, TEXTURE };
573 
574 inline constexpr uint32_t STATE_NORMAL = 0;
575 inline constexpr uint32_t STATE_PRESSED = 1;
576 inline constexpr uint32_t STATE_FOCUS = 1 << 1;
577 inline constexpr uint32_t STATE_CHECKED = 1 << 2;
578 inline constexpr uint32_t STATE_DISABLED = 1 << 3;
579 inline constexpr uint32_t STATE_WAITING = 1 << 4;
580 inline constexpr uint32_t STATE_HOVERED = 1 << 5;
581 inline constexpr uint32_t STATE_ACTIVE = 1 << 6;
582 
583 enum class TabBarStyle {
584     NOSTYLE = 0,
585     SUBTABBATSTYLE,
586     BOTTOMTABBATSTYLE,
587 };
588 
589 enum class ModifierKey {
590     CTRL = 0,
591     SHIFT = 1,
592     ALT = 2,
593 };
594 
595 enum class FunctionKey {
596     ESC = 0,
597     F1 = 1,
598     F2 = 2,
599     F3 = 3,
600     F4 = 4,
601     F5 = 5,
602     F6 = 6,
603     F7 = 7,
604     F8 = 8,
605     F9 = 9,
606     F10 = 10,
607     F11 = 11,
608     F12 = 12,
609 };
610 
611 enum class ObscuredReasons {
612     PLACEHOLDER = 0,
613 };
614 
615 enum class MaximizeMode : uint32_t {
616     MODE_AVOID_SYSTEM_BAR,
617     MODE_FULL_FILL,
618     MODE_RECOVER,
619 };
620 
621 enum class RenderFit : int32_t {
622     CENTER = 0,
623     TOP,
624     BOTTOM,
625     LEFT,
626     RIGHT,
627     TOP_LEFT,
628     TOP_RIGHT,
629     BOTTOM_LEFT,
630     BOTTOM_RIGHT,
631     RESIZE_FILL,
632     RESIZE_CONTAIN,
633     RESIZE_CONTAIN_TOP_LEFT,
634     RESIZE_CONTAIN_BOTTOM_RIGHT,
635     RESIZE_COVER,
636     RESIZE_COVER_TOP_LEFT,
637     RESIZE_COVER_BOTTOM_RIGHT,
638 };
639 
640 } // namespace OHOS::Ace
641 
642 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_LAYOUT_CONSTANTS_H
643