• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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     CLIP,
202     ELLIPSIS,
203     NONE,
204 };
205 
206 enum class TextDirection {
207     LTR,
208     RTL,
209     INHERIT,
210     AUTO,
211 };
212 
213 enum class TextDecoration {
214     NONE,
215     UNDERLINE,
216     OVERLINE,
217     LINE_THROUGH,
218     INHERIT,
219 };
220 
221 enum class MarqueeDirection {
222     LEFT,
223     RIGHT,
224 };
225 
226 enum class ImageRepeat {
227     NO_REPEAT = 0,
228     REPEAT_X,
229     REPEAT_Y,
230     REPEAT,
231 };
232 
233 enum class ImageFit {
234     FILL,
235     CONTAIN,
236     COVER,
237     FITWIDTH,
238     FITHEIGHT,
239     NONE,
240     SCALE_DOWN,
241     TOP_LEFT,
242 };
243 
244 enum class ImageRenderMode {
245     ORIGINAL = 0,
246     TEMPLATE,
247 };
248 
249 enum class ImageInterpolation {
250     NONE = 0,
251     LOW,
252     MEDIUM,
253     HIGH,
254 };
255 
256 enum class EdgeEffect {
257     SPRING = 0,
258     FADE,
259     NONE,
260 };
261 
262 enum class BorderStyle {
263     SOLID,
264     DASHED,
265     DOTTED,
266     NONE,
267 };
268 
269 enum class BorderImageRepeat {
270     SPACE,
271     STRETCH,
272     REPEAT,
273     ROUND,
274 };
275 
276 enum class BorderImageDirection {
277     LEFT,
278     RIGHT,
279     TOP,
280     BOTTOM,
281 };
282 
283 enum class SrcType {
284     UNSUPPORTED = -1,
285     FILE = 0,
286     ASSET,
287     NETWORK,
288     MEMORY,
289     BASE64,
290     INTERNAL, // internal cached file resource
291     RESOURCE,
292     DATA_ABILITY,
293     DATA_ABILITY_DECODED,
294     RESOURCE_ID, // default resource which src is internal resource id
295     PIXMAP,
296 };
297 
298 enum class WrapAlignment {
299     START,
300     CENTER,
301     END,
302     SPACE_AROUND,
303     SPACE_BETWEEN,
304     STRETCH,
305     SPACE_EVENLY,
306     BASELINE,
307 };
308 
309 enum class WrapDirection {
310     HORIZONTAL,
311     VERTICAL,
312     HORIZONTAL_REVERSE,
313     VERTICAL_REVERSE,
314 };
315 
316 enum class FlexWrap {
317     NO_WRAP,
318     WRAP,
319     WRAP_REVERSE,
320 };
321 
322 enum class KeyDirection {
323     UP = 0,
324     DOWN,
325     LEFT,
326     RIGHT,
327 };
328 
329 const ImageRepeat IMAGE_REPEATS[] = {
330     ImageRepeat::REPEAT,
331     ImageRepeat::REPEAT_X,
332     ImageRepeat::REPEAT_Y,
333     ImageRepeat::NO_REPEAT,
334 };
335 
336 enum class WindowModal : int32_t {
337     NORMAL = 0,
338     SEMI_MODAL = 1,
339     SEMI_MODAL_FULL_SCREEN = 2,
340     DIALOG_MODAL = 3,
341     CONTAINER_MODAL = 4,
342     FIRST_VALUE = NORMAL,
343     LAST_VALUE = CONTAINER_MODAL,
344 };
345 
346 enum class WindowMode : uint32_t {
347     WINDOW_MODE_UNDEFINED = 0,
348     WINDOW_MODE_FULLSCREEN = 1,
349     WINDOW_MODE_SPLIT_PRIMARY = 100,
350     WINDOW_MODE_SPLIT_SECONDARY,
351     WINDOW_MODE_FLOATING,
352     WINDOW_MODE_PIP
353 };
354 
355 enum class PanelType {
356     MINI_BAR,
357     FOLDABLE_BAR,
358     TEMP_DISPLAY,
359 };
360 
361 enum class PanelMode {
362     MINI,
363     HALF,
364     FULL,
365     AUTO,
366 };
367 
368 enum class ColorScheme : int32_t {
369     SCHEME_LIGHT = 0,
370     SCHEME_TRANSPARENT = 1,
371     SCHEME_DARK = 2,
372     FIRST_VALUE = SCHEME_LIGHT,
373     LAST_VALUE = SCHEME_DARK,
374 };
375 
376 enum class RenderStatus : int32_t {
377     UNKNOWN = -1,
378     DEFAULT = 0,
379     ACTIVITY = 1,
380     FOCUS = 2,
381     BLUR = 3,
382     DISABLE = 4,
383     WAITING = 5,
384 };
385 
386 enum class BadgePosition {
387     RIGHT_TOP,
388     RIGHT,
389     LEFT,
390 };
391 
392 enum class QrcodeType {
393     RECT,
394     CIRCLE,
395 };
396 
397 enum class AnimationCurve {
398     FRICTION,
399     STANDARD,
400 };
401 
402 enum class WindowBlurStyle {
403     STYLE_BACKGROUND_SMALL_LIGHT = 100,
404     STYLE_BACKGROUND_MEDIUM_LIGHT = 101,
405     STYLE_BACKGROUND_LARGE_LIGHT = 102,
406     STYLE_BACKGROUND_XLARGE_LIGHT = 103,
407     STYLE_BACKGROUND_SMALL_DARK = 104,
408     STYLE_BACKGROUND_MEDIUM_DARK = 105,
409     STYLE_BACKGROUND_LARGE_DARK = 106,
410     STYLE_BACKGROUND_XLARGE_DARK = 107,
411 };
412 
413 enum class DisplayType { NO_SETTING = 0, FLEX, GRID, NONE, BLOCK, INLINE, INLINE_BLOCK, INLINE_FLEX };
414 
415 enum class VisibilityType {
416     NO_SETTING = 0,
417     VISIBLE,
418     HIDDEN,
419 };
420 
421 enum class RefreshType {
422     AUTO,
423     PULL_DOWN,
424 };
425 
426 enum class TabBarMode {
427     FIXED,
428     SCROLLABLE,
429     FIXED_START,
430 };
431 
432 enum class ShowInNavigationBar {
433     SHOW = 0,
434     POPUP,
435 };
436 
437 enum class HorizontalAlign {
438     START = 1,
439     CENTER,
440     END,
441 };
442 
443 enum class VerticalAlign {
444     TOP = 1,
445     CENTER,
446     BOTTOM,
447     BASELINE,
448     NONE,
449 };
450 
451 enum class BarPosition {
452     START,
453     END,
454 };
455 
456 enum class CalendarType {
457     NORMAL = 0,
458     SIMPLE,
459 };
460 
461 enum class SideBarContainerType { EMBED, OVERLAY };
462 
463 enum class SideBarPosition { START, END };
464 
465 enum class SideBarStatus {
466     SHOW,
467     HIDDEN,
468     CHANGING,
469     AUTO,
470 };
471 
472 enum class HitTestMode {
473     /**
474      *  Both self and children respond to the hit test for touch events,
475      *  but block hit test of the other nodes which is masked by this node.
476      */
477     HTMDEFAULT = 0,
478 
479     /**
480      * Self respond to the hit test for touch events,
481      * but block hit test of children and other nodes which is masked by this node.
482      */
483     HTMBLOCK,
484 
485     /**
486      * Self and child respond to the hit test for touch events,
487      * and allow hit test of other nodes which is masked by this node.
488      */
489     HTMTRANSPARENT,
490 
491     /**
492      * Self not respond to the hit test for touch events,
493      * but children respond to the hit test for touch events.
494      */
495     HTMNONE
496 };
497 
498 enum class CopyOptions {
499     None = 0,
500     InApp,
501     Local,
502     Distributed,
503 };
504 
505 enum class VisibleType {
506     VISIBLE,
507     INVISIBLE,
508     GONE,
509 };
510 
511 enum class ShapeMode {
512     /*
513      * unspecified, follow theme.
514      */
515     DEFAULT = 0,
516     /*
517      * rect scrollbar.
518      */
519     RECT,
520     /*
521      * round scrollbar.
522      */
523     ROUND,
524 };
525 
526 enum class DisplayMode {
527     /*
528      * do not display scrollbar.
529      */
530     OFF = 0,
531     /*
532      * display scrollbar on demand.
533      */
534     AUTO,
535     /*
536      * always display scrollbar.
537      */
538     ON,
539 };
540 
541 enum class PositionMode {
542     /*
543      * display scrollbar on right.
544      */
545     RIGHT = 0,
546     /*
547      * display scrollbar on left.
548      */
549     LEFT,
550     /*
551      * display scrollbar on bottom.
552      */
553     BOTTOM,
554 };
555 
556 enum class XComponentType { SURFACE = 0, COMPONENT };
557 
558 inline constexpr uint32_t STATE_NORMAL = 0;
559 inline constexpr uint32_t STATE_PRESSED = 1;
560 inline constexpr uint32_t STATE_FOCUS = 1 << 1;
561 inline constexpr uint32_t STATE_CHECKED = 1 << 2;
562 inline constexpr uint32_t STATE_DISABLED = 1 << 3;
563 inline constexpr uint32_t STATE_WAITING = 1 << 4;
564 inline constexpr uint32_t STATE_HOVERED = 1 << 5;
565 inline constexpr uint32_t STATE_ACTIVE = 1 << 6;
566 
567 enum class TabBarStyle {
568     NOSTYLE = 0,
569     SUBTABBATSTYLE,
570     BOTTOMTABBATSTYLE,
571 };
572 
573 } // namespace OHOS::Ace
574 
575 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_LAYOUT_CONSTANTS_H
576