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 enum class ButtonStyleMode { NORMAL, EMPHASIZE, TEXT }; 41 42 enum class ControlSize { SMALL, NORMAL }; 43 44 // Flex Styles 45 enum class FlexDirection { 46 ROW = 0, 47 COLUMN, 48 ROW_REVERSE, 49 COLUMN_REVERSE, 50 }; 51 52 enum class FlexAlign { 53 AUTO, 54 55 // align to the start of the axis, can be both used in MainAxisAlign and CrossAxisAlign. 56 FLEX_START, 57 58 // align to the center of the axis, can be both used in MainAxisAlign and CrossAxisAlign. 59 CENTER, 60 61 // align to the end of the axis, can be both used in MainAxisAlign and CrossAxisAlign. 62 FLEX_END, 63 64 // stretch the cross size, only used in CrossAxisAlign. 65 STRETCH, 66 67 // adjust the cross position according to the textBaseline, only used in CrossAxisAlign. 68 BASELINE, 69 70 // align the children on both ends, only used in MainAxisAlign. 71 SPACE_BETWEEN, 72 73 // align the child with equivalent space, only used in MainAxisAlign. 74 SPACE_AROUND, 75 76 // align the child with space evenly, only used in MainAxisAlign. 77 SPACE_EVENLY, 78 79 // User-defined space, only used in MainAxisAlign. 80 SPACE_CUSTOMIZATION, 81 }; 82 83 enum class MainAxisSize { 84 // default setting, fill the max size of the layout param. Only under MAX, mainAxisAlign and FlexItem are valid 85 MAX, 86 87 // make the size of row/column as large as its children's size. 88 MIN, 89 }; 90 91 enum class CrossAxisSize { 92 // fill the max size of the layout param in cross size of row/column. 93 MAX, 94 95 // make the cross size of row/column as large as its children's size. 96 MIN, 97 }; 98 99 enum class FlexLayoutMode { 100 // If children do not contains flex weight, use this mode. It is the default mode. 101 FLEX_ITEM_MODE, 102 103 // If all the children contains flex weight, use this mode. 104 FLEX_WEIGHT_MODE, 105 }; 106 107 // Box Style 108 enum class BoxFlex { 109 // width and height do not extend to box's parent 110 FLEX_NO, 111 112 // width extends to box's parent, height does not extend to box's parent 113 FLEX_X, 114 115 // height extends to box's parent, width does not extend to box's parent 116 FLEX_Y, 117 118 // width and height extend to box's parent 119 FLEX_XY, 120 }; 121 122 enum class BoxSizing { 123 // The width and height properties includes only the content. Border and padding are not included. 124 CONTENT_BOX, 125 126 // The width and height properties includes content, padding and border. 127 BORDER_BOX, 128 }; 129 130 // Stack Styles 131 enum class StackFit { 132 // keep the child component's size as it is. 133 KEEP, 134 135 // keep the child component's size as the parent's. 136 STRETCH, 137 138 // use parent's layoutParam to layout the child 139 INHERIT, 140 141 // use first child's size as layoutPram max size. 142 FIRST_CHILD, 143 }; 144 145 enum class Overflow { 146 // when the size overflows, clip the exceeding. 147 CLIP, 148 149 // when the size overflows, observe the exceeding. 150 OBSERVABLE, 151 152 // when the size overflows, scroll the exceeding. 153 SCROLL, 154 155 // force clip the exceeding. 156 FORCE_CLIP, 157 }; 158 159 enum class MainStackSize { MAX, MIN, NORMAL, LAST_CHILD_HEIGHT, MATCH_CHILDREN, MAX_X, MAX_Y }; 160 161 enum class MainSwiperSize { MAX, MAX_X, MAX_Y, MIN, AUTO }; 162 163 enum class PositionType { 164 PTRELATIVE = 0, 165 PTFIXED, 166 PTABSOLUTE, 167 PTOFFSET, // percentage layout based on RELATIVE 168 PTSEMI_RELATIVE, // absolute offset based on RELATIVE 169 }; 170 171 enum class TextAlign { 172 LEFT = 4, 173 RIGHT = 5, 174 CENTER = 1, 175 /* 176 render the text to fit the size of the text container by adding space 177 */ 178 JUSTIFY = 3, 179 /* 180 align the text from the start of the text container 181 182 For Direction.ltr, from left side 183 For Direction.rtl, from right side 184 */ 185 START = 0, 186 /* 187 align the text from the end of the text container 188 189 For Direction.ltr, from right side 190 For Direction.rtl, from left side 191 */ 192 END = 2, 193 }; 194 195 enum class TextDataDetectType { 196 PHONE_NUMBER = 0, 197 URL, 198 EMAIL, 199 ADDRESS, 200 }; 201 202 enum class WhiteSpace { 203 NORMAL, 204 PRE, 205 PRE_WRAP, 206 NOWRAP, 207 PRE_LINE, 208 INHERIT, 209 }; 210 211 enum class TextOverflow { 212 NONE, 213 CLIP, 214 ELLIPSIS, 215 MARQUEE, 216 }; 217 218 // overflow-x: visible|hidden|scroll|auto|no-display|no-content; 219 enum class TextFieldOverflowX { 220 VISIBLE, 221 HIDDEN, 222 SCROLL, 223 AUTO, 224 NO_DISPLAY, 225 NO_CONTENT, 226 }; 227 228 enum class TextDirection { 229 LTR, 230 RTL, 231 INHERIT, 232 AUTO, 233 }; 234 235 enum class TextDecoration { 236 NONE, 237 UNDERLINE, 238 OVERLINE, 239 LINE_THROUGH, 240 INHERIT, 241 }; 242 243 enum class TextDecorationStyle { 244 SOLID, 245 DOUBLE, 246 DOTTED, 247 DASHED, 248 WAVY, 249 INITIAL, 250 INHERIT, 251 }; 252 253 enum class TextHeightAdaptivePolicy { 254 MAX_LINES_FIRST, 255 MIN_FONT_SIZE_FIRST, 256 LAYOUT_CONSTRAINT_FIRST, 257 }; 258 259 enum class MarqueeDirection { 260 LEFT, 261 RIGHT, 262 }; 263 264 enum class ImageRepeat { 265 NO_REPEAT = 0, 266 REPEAT_X, 267 REPEAT_Y, 268 REPEAT, 269 }; 270 271 enum class ImageFit { 272 FILL, 273 CONTAIN, 274 COVER, 275 FITWIDTH, 276 FITHEIGHT, 277 NONE, 278 SCALE_DOWN, 279 TOP_LEFT, 280 }; 281 282 enum class ImageRenderMode { 283 ORIGINAL = 0, 284 TEMPLATE, 285 }; 286 287 enum class ImageInterpolation { 288 NONE = 0, 289 LOW, 290 MEDIUM, 291 HIGH, 292 }; 293 294 enum class EdgeEffect { 295 SPRING = 0, 296 FADE, 297 NONE, 298 }; 299 300 enum class BorderStyle { 301 SOLID, 302 DASHED, 303 DOTTED, 304 NONE, 305 }; 306 307 enum class BorderImageRepeat { 308 SPACE, 309 STRETCH, 310 REPEAT, 311 ROUND, 312 }; 313 314 enum class BorderImageDirection { 315 LEFT, 316 RIGHT, 317 TOP, 318 BOTTOM, 319 }; 320 321 enum class TimePickerFormat { 322 HOUR_MINUTE, 323 HOUR_MINUTE_SECOND 324 }; 325 326 enum class SrcType { 327 UNSUPPORTED = -1, 328 FILE = 0, 329 ASSET, 330 NETWORK, 331 MEMORY, 332 BASE64, 333 INTERNAL, // internal cached file resource 334 RESOURCE, 335 DATA_ABILITY, 336 DATA_ABILITY_DECODED, 337 RESOURCE_ID, // default resource which src is internal resource id 338 PIXMAP, 339 ASTC, 340 }; 341 342 enum class WrapAlignment { 343 START, 344 CENTER, 345 END, 346 SPACE_AROUND, 347 SPACE_BETWEEN, 348 STRETCH, 349 SPACE_EVENLY, 350 BASELINE, 351 }; 352 353 enum class WrapDirection { 354 HORIZONTAL, 355 VERTICAL, 356 HORIZONTAL_REVERSE, 357 VERTICAL_REVERSE, 358 }; 359 360 enum class FlexWrap { 361 NO_WRAP, 362 WRAP, 363 WRAP_REVERSE, 364 }; 365 366 enum class KeyDirection { 367 UP = 0, 368 DOWN, 369 LEFT, 370 RIGHT, 371 }; 372 373 enum class PixelRoundPolicy { 374 FORCE_CEIL_START = 1, 375 FORCE_FLOOR_START = 1 << 1, 376 FORCE_CEIL_TOP = 1 << 2, 377 FORCE_FLOOR_TOP = 1 << 3, 378 FORCE_CEIL_END = 1 << 4, 379 FORCE_FLOOR_END = 1 << 5, 380 FORCE_CEIL_BOTTOM = 1 << 6, 381 FORCE_FLOOR_BOTTOM = 1 << 7, 382 }; 383 384 enum class PixelRoundCalcPolicy { 385 NO_FORCE_ROUND = 0, 386 FORCE_CEIL = 1, 387 FORCE_FLOOR = 2, 388 }; 389 390 const ImageRepeat IMAGE_REPEATS[] = { 391 ImageRepeat::REPEAT, 392 ImageRepeat::REPEAT_X, 393 ImageRepeat::REPEAT_Y, 394 ImageRepeat::NO_REPEAT, 395 }; 396 397 enum class WindowModal : int32_t { 398 NORMAL = 0, 399 SEMI_MODAL = 1, 400 SEMI_MODAL_FULL_SCREEN = 2, 401 DIALOG_MODAL = 3, 402 CONTAINER_MODAL = 4, 403 FIRST_VALUE = NORMAL, 404 LAST_VALUE = CONTAINER_MODAL, 405 }; 406 407 enum class WindowMode : uint32_t { 408 WINDOW_MODE_UNDEFINED = 0, 409 WINDOW_MODE_FULLSCREEN = 1, 410 WINDOW_MODE_SPLIT_PRIMARY = 100, 411 WINDOW_MODE_SPLIT_SECONDARY, 412 WINDOW_MODE_FLOATING, 413 WINDOW_MODE_PIP 414 }; 415 416 enum class WindowType : uint32_t { 417 WINDOW_TYPE_UNDEFINED = 0, 418 WINDOW_TYPE_APP_BASE = 1, 419 WINDOW_TYPE_APP_END = 1003, 420 WINDOW_TYPE_FLOAT = 2106, 421 }; 422 423 enum class PanelType { 424 MINI_BAR, 425 FOLDABLE_BAR, 426 TEMP_DISPLAY, 427 CUSTOM, 428 }; 429 430 enum class PanelMode { 431 MINI, 432 HALF, 433 FULL, 434 AUTO, 435 CUSTOM, 436 }; 437 438 enum class ColorScheme : int32_t { 439 SCHEME_LIGHT = 0, 440 SCHEME_TRANSPARENT = 1, 441 SCHEME_DARK = 2, 442 FIRST_VALUE = SCHEME_LIGHT, 443 LAST_VALUE = SCHEME_DARK, 444 }; 445 446 enum class RenderStatus : int32_t { 447 UNKNOWN = -1, 448 DEFAULT = 0, 449 ACTIVITY = 1, 450 FOCUS = 2, 451 BLUR = 3, 452 DISABLE = 4, 453 WAITING = 5, 454 }; 455 456 enum class BadgePosition { 457 RIGHT_TOP, 458 RIGHT, 459 LEFT, 460 }; 461 462 enum class QrcodeType { 463 RECT, 464 CIRCLE, 465 }; 466 467 enum class AnimationCurve { 468 FRICTION, 469 STANDARD, 470 }; 471 472 enum class WindowBlurStyle { 473 STYLE_BACKGROUND_SMALL_LIGHT = 100, 474 STYLE_BACKGROUND_MEDIUM_LIGHT = 101, 475 STYLE_BACKGROUND_LARGE_LIGHT = 102, 476 STYLE_BACKGROUND_XLARGE_LIGHT = 103, 477 STYLE_BACKGROUND_SMALL_DARK = 104, 478 STYLE_BACKGROUND_MEDIUM_DARK = 105, 479 STYLE_BACKGROUND_LARGE_DARK = 106, 480 STYLE_BACKGROUND_XLARGE_DARK = 107, 481 }; 482 483 enum class DisplayType { NO_SETTING = 0, FLEX, GRID, NONE, BLOCK, INLINE, INLINE_BLOCK, INLINE_FLEX }; 484 485 enum class VisibilityType { 486 NO_SETTING = 0, 487 VISIBLE, 488 HIDDEN, 489 }; 490 491 enum class RefreshType { 492 AUTO, 493 PULL_DOWN, 494 }; 495 496 enum class TabBarMode { 497 FIXED, 498 SCROLLABLE, 499 FIXED_START, 500 }; 501 502 enum class ShowInNavigationBar { 503 SHOW = 0, 504 POPUP, 505 }; 506 507 enum class HorizontalAlign { 508 START = 1, 509 CENTER, 510 END, 511 }; 512 513 enum class VerticalAlign { 514 TOP = 1, 515 CENTER, 516 BOTTOM, 517 BASELINE, 518 NONE, 519 }; 520 521 enum class BarPosition { 522 START, 523 END, 524 }; 525 526 enum class CalendarType { 527 NORMAL = 0, 528 SIMPLE, 529 }; 530 531 enum class SideBarContainerType { EMBED, OVERLAY, AUTO }; 532 533 enum class SideBarPosition { START, END }; 534 535 enum class SideBarStatus { 536 SHOW, 537 HIDDEN, 538 CHANGING, 539 AUTO, 540 }; 541 542 enum class HitTestMode { 543 /** 544 * Both self and children respond to the hit test for touch events, 545 * but block hit test of the other nodes which is masked by this node. 546 */ 547 HTMDEFAULT = 0, 548 549 /** 550 * Self respond to the hit test for touch events, 551 * but block hit test of children and other nodes which is masked by this node. 552 */ 553 HTMBLOCK, 554 555 /** 556 * Self and child respond to the hit test for touch events, 557 * and allow hit test of other nodes which is masked by this node. 558 */ 559 HTMTRANSPARENT, 560 561 /** 562 * Self not respond to the hit test for touch events, 563 * but children respond to the hit test for touch events. 564 */ 565 HTMNONE 566 }; 567 568 enum class CopyOptions { 569 None = 0, 570 InApp, 571 Local, 572 Distributed, 573 }; 574 575 enum class VisibleType { 576 VISIBLE = 0, 577 INVISIBLE, 578 GONE, 579 }; 580 581 enum class ShapeMode { 582 /* 583 * unspecified, follow theme. 584 */ 585 DEFAULT = 0, 586 /* 587 * rect scrollbar. 588 */ 589 RECT, 590 /* 591 * round scrollbar. 592 */ 593 ROUND, 594 }; 595 596 enum class DisplayMode { 597 /* 598 * do not display scrollbar. 599 */ 600 OFF = 0, 601 /* 602 * display scrollbar on demand. 603 */ 604 AUTO, 605 /* 606 * always display scrollbar. 607 */ 608 ON, 609 }; 610 611 enum class PositionMode { 612 /* 613 * display scrollbar on right. 614 */ 615 RIGHT = 0, 616 /* 617 * display scrollbar on left. 618 */ 619 LEFT, 620 /* 621 * display scrollbar on bottom. 622 */ 623 BOTTOM, 624 }; 625 626 enum class XComponentType { UNKNOWN = -1, SURFACE = 0, COMPONENT, TEXTURE, NODE }; 627 628 enum class WebType { SURFACE = 0, TEXTURE }; 629 630 inline constexpr uint32_t STATE_NORMAL = 0; 631 inline constexpr uint32_t STATE_PRESSED = 1; 632 inline constexpr uint32_t STATE_FOCUS = 1 << 1; 633 inline constexpr uint32_t STATE_CHECKED = 1 << 2; 634 inline constexpr uint32_t STATE_DISABLED = 1 << 3; 635 inline constexpr uint32_t STATE_WAITING = 1 << 4; 636 inline constexpr uint32_t STATE_HOVERED = 1 << 5; 637 inline constexpr uint32_t STATE_ACTIVE = 1 << 6; 638 639 enum class TabBarStyle { 640 NOSTYLE = 0, 641 SUBTABBATSTYLE, 642 BOTTOMTABBATSTYLE, 643 }; 644 645 enum class GestureJudgeResult { 646 CONTINUE = 0, 647 REJECT = 1, 648 }; 649 650 enum class GestureTypeName { 651 UNKNOWN = -1, 652 TAP_GESTURE = 0, 653 LONG_PRESS_GESTURE = 1, 654 PAN_GESTURE = 2, 655 PINCH_GESTURE = 3, 656 SWIPE_GESTURE = 4, 657 ROTATION_GESTURE = 5, 658 DRAG = 6, 659 CLICK = 7, 660 BOXSELECT = 8, 661 WEBSCROLL = 9, 662 }; 663 664 enum class ModifierKey { 665 CTRL = 0, 666 SHIFT = 1, 667 ALT = 2, 668 }; 669 670 enum class FunctionKey { 671 ESC = 0, 672 F1 = 1, 673 F2 = 2, 674 F3 = 3, 675 F4 = 4, 676 F5 = 5, 677 F6 = 6, 678 F7 = 7, 679 F8 = 8, 680 F9 = 9, 681 F10 = 10, 682 F11 = 11, 683 F12 = 12, 684 }; 685 686 enum class ObscuredReasons { 687 PLACEHOLDER = 0, 688 }; 689 690 enum class MaximizeMode : uint32_t { 691 MODE_AVOID_SYSTEM_BAR, 692 MODE_FULL_FILL, 693 MODE_RECOVER, 694 }; 695 696 enum class RenderFit : int32_t { 697 CENTER = 0, 698 TOP, 699 BOTTOM, 700 LEFT, 701 RIGHT, 702 TOP_LEFT, 703 TOP_RIGHT, 704 BOTTOM_LEFT, 705 BOTTOM_RIGHT, 706 RESIZE_FILL, 707 RESIZE_CONTAIN, 708 RESIZE_CONTAIN_TOP_LEFT, 709 RESIZE_CONTAIN_BOTTOM_RIGHT, 710 RESIZE_COVER, 711 RESIZE_COVER_TOP_LEFT, 712 RESIZE_COVER_BOTTOM_RIGHT, 713 }; 714 715 enum class KeyBoardAvoidMode : int32_t { 716 OFFSET = 0, 717 RESIZE, 718 }; 719 720 enum class SwipeActionState : uint32_t { 721 COLLAPSED = 0, 722 EXPANDED, 723 ACTIONING, 724 }; 725 /** 726 * souce is Rosen::Orientation 727 */ 728 enum class Orientation : uint32_t { 729 BEGIN = 0, 730 UNSPECIFIED = BEGIN, 731 VERTICAL = 1, 732 HORIZONTAL = 2, 733 REVERSE_VERTICAL = 3, 734 REVERSE_HORIZONTAL = 4, 735 SENSOR = 5, 736 SENSOR_VERTICAL = 6, 737 SENSOR_HORIZONTAL = 7, 738 AUTO_ROTATION_RESTRICTED = 8, 739 AUTO_ROTATION_PORTRAIT_RESTRICTED = 9, 740 AUTO_ROTATION_LANDSCAPE_RESTRICTED = 10, 741 LOCKED = 11, 742 END = LOCKED, 743 }; 744 745 enum class NodeRenderType : uint32_t { 746 RENDER_TYPE_DISPLAY = 0, 747 RENDER_TYPE_TEXTURE, 748 }; 749 } // namespace OHOS::Ace 750 751 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_LAYOUT_CONSTANTS_H 752