1a3e0fd82Sopenharmony_ci/* 2a3e0fd82Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3a3e0fd82Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4a3e0fd82Sopenharmony_ci * you may not use this file except in compliance with the License. 5a3e0fd82Sopenharmony_ci * You may obtain a copy of the License at 6a3e0fd82Sopenharmony_ci * 7a3e0fd82Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8a3e0fd82Sopenharmony_ci * 9a3e0fd82Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10a3e0fd82Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11a3e0fd82Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12a3e0fd82Sopenharmony_ci * See the License for the specific language governing permissions and 13a3e0fd82Sopenharmony_ci * limitations under the License. 14a3e0fd82Sopenharmony_ci */ 15a3e0fd82Sopenharmony_ci 16a3e0fd82Sopenharmony_ci/** 17a3e0fd82Sopenharmony_ci * @addtogroup UI_Components 18a3e0fd82Sopenharmony_ci * @{ 19a3e0fd82Sopenharmony_ci * 20a3e0fd82Sopenharmony_ci * @brief Defines UI components such as buttons, texts, images, lists, and progress bars. 21a3e0fd82Sopenharmony_ci * 22a3e0fd82Sopenharmony_ci * @since 1.0 23a3e0fd82Sopenharmony_ci * @version 1.0 24a3e0fd82Sopenharmony_ci */ 25a3e0fd82Sopenharmony_ci 26a3e0fd82Sopenharmony_ci/** 27a3e0fd82Sopenharmony_ci * @file ui_view.h 28a3e0fd82Sopenharmony_ci * 29a3e0fd82Sopenharmony_ci * @brief Declares the base class of a view, providing basic view attributes and operations. All views are derived 30a3e0fd82Sopenharmony_ci * from this class. 31a3e0fd82Sopenharmony_ci * 32a3e0fd82Sopenharmony_ci * @since 1.0 33a3e0fd82Sopenharmony_ci * @version 1.0 34a3e0fd82Sopenharmony_ci */ 35a3e0fd82Sopenharmony_ci 36a3e0fd82Sopenharmony_ci#ifndef GRAPHIC_LITE_UI_VIEW_H 37a3e0fd82Sopenharmony_ci#define GRAPHIC_LITE_UI_VIEW_H 38a3e0fd82Sopenharmony_ci 39a3e0fd82Sopenharmony_ci#include "events/cancel_event.h" 40a3e0fd82Sopenharmony_ci#include "events/click_event.h" 41a3e0fd82Sopenharmony_ci#include "events/drag_event.h" 42a3e0fd82Sopenharmony_ci#include "events/event.h" 43a3e0fd82Sopenharmony_ci#include "events/long_press_event.h" 44a3e0fd82Sopenharmony_ci#include "events/press_event.h" 45a3e0fd82Sopenharmony_ci#include "events/release_event.h" 46a3e0fd82Sopenharmony_ci#if ENABLE_ROTATE_INPUT 47a3e0fd82Sopenharmony_ci#include "events/rotate_event.h" 48a3e0fd82Sopenharmony_ci#endif 49a3e0fd82Sopenharmony_ci#include "gfx_utils/color.h" 50a3e0fd82Sopenharmony_ci#include "gfx_utils/geometry2d.h" 51a3e0fd82Sopenharmony_ci#include "gfx_utils/graphic_buffer.h" 52a3e0fd82Sopenharmony_ci#include "gfx_utils/graphic_log.h" 53a3e0fd82Sopenharmony_ci#include "gfx_utils/heap_base.h" 54a3e0fd82Sopenharmony_ci#include "gfx_utils/image_info.h" 55a3e0fd82Sopenharmony_ci#include "gfx_utils/style.h" 56a3e0fd82Sopenharmony_ci#include "gfx_utils/transform.h" 57a3e0fd82Sopenharmony_ci 58a3e0fd82Sopenharmony_cinamespace OHOS { 59a3e0fd82Sopenharmony_ci/* Enumerates view types. */ 60a3e0fd82Sopenharmony_cienum UIViewType : uint8_t { 61a3e0fd82Sopenharmony_ci UI_ROOT_VIEW = 0, 62a3e0fd82Sopenharmony_ci UI_VIEW_GROUP, 63a3e0fd82Sopenharmony_ci UI_LABEL, 64a3e0fd82Sopenharmony_ci UI_ARC_LABEL, 65a3e0fd82Sopenharmony_ci UI_EDIT_TEXT, 66a3e0fd82Sopenharmony_ci UI_LABEL_BUTTON, 67a3e0fd82Sopenharmony_ci UI_CHECK_BOX, 68a3e0fd82Sopenharmony_ci UI_TOGGLE_BUTTON, 69a3e0fd82Sopenharmony_ci UI_RADIO_BUTTON, 70a3e0fd82Sopenharmony_ci UI_IMAGE_VIEW, 71a3e0fd82Sopenharmony_ci UI_BOX_PROGRESS, 72a3e0fd82Sopenharmony_ci UI_SLIDER, 73a3e0fd82Sopenharmony_ci UI_CIRCLE_PROGRESS, 74a3e0fd82Sopenharmony_ci UI_SCROLL_VIEW, 75a3e0fd82Sopenharmony_ci UI_LIST, 76a3e0fd82Sopenharmony_ci UI_DIGITAL_CLOCK, 77a3e0fd82Sopenharmony_ci UI_ANALOG_CLOCK, 78a3e0fd82Sopenharmony_ci UI_PICKER, 79a3e0fd82Sopenharmony_ci UI_SWIPE_VIEW, 80a3e0fd82Sopenharmony_ci UI_TIME_PICKER, 81a3e0fd82Sopenharmony_ci UI_ABSTRACT_CLOCK, 82a3e0fd82Sopenharmony_ci UI_ABSTRACT_PROGRESS, 83a3e0fd82Sopenharmony_ci UI_ABSTRACT_SCROLL, 84a3e0fd82Sopenharmony_ci UI_AXIS, 85a3e0fd82Sopenharmony_ci UI_BUTTON, 86a3e0fd82Sopenharmony_ci UI_CANVAS, 87a3e0fd82Sopenharmony_ci UI_CHART, 88a3e0fd82Sopenharmony_ci UI_IMAGE_ANIMATOR_VIEW, 89a3e0fd82Sopenharmony_ci UI_REPEAT_BUTTON, 90a3e0fd82Sopenharmony_ci UI_TEXTURE_MAPPER, 91a3e0fd82Sopenharmony_ci UI_DIALOG, 92a3e0fd82Sopenharmony_ci UI_QRCODE, 93a3e0fd82Sopenharmony_ci UI_NUMBER_MAX 94a3e0fd82Sopenharmony_ci}; 95a3e0fd82Sopenharmony_ci 96a3e0fd82Sopenharmony_ci#if ENABLE_DEBUG 97a3e0fd82Sopenharmony_ciconst char* const VIEW_TYPE_STRING[UI_NUMBER_MAX] = { 98a3e0fd82Sopenharmony_ci "RootView", "UIViewGroup", "UILabel", "UIArcLabel", 99a3e0fd82Sopenharmony_ci "UIEditText", "UILabelButton", "UICheckBox", "UIToggleButton", 100a3e0fd82Sopenharmony_ci "UIRadioButton", "UIImageView", "UIBoxProgress", "UISlider", 101a3e0fd82Sopenharmony_ci "UICircleProgress", "UIScrollView", "UIList", "UIDigitalClock", 102a3e0fd82Sopenharmony_ci "UIAnalogClock", "UIPicker", "UISwipeView", "UITimePicker", 103a3e0fd82Sopenharmony_ci "UIAbstractClock", "UIAbstractProgress", "UIAbstractScroll", "UIAxis", 104a3e0fd82Sopenharmony_ci "UIButton", "UICanvas", "UIChart", "UIImageAnimatorView", 105a3e0fd82Sopenharmony_ci "UIRepeatButton", "UITextureMapper", "UIDialog", "UIQrcode", 106a3e0fd82Sopenharmony_ci}; 107a3e0fd82Sopenharmony_ci#endif // ENABLE_DEBUG 108a3e0fd82Sopenharmony_ci 109a3e0fd82Sopenharmony_ci/** 110a3e0fd82Sopenharmony_ci * @brief Defines the base class of a view, providing basic view attributes and operations. All views are derived 111a3e0fd82Sopenharmony_ci * from this class. 112a3e0fd82Sopenharmony_ci * 113a3e0fd82Sopenharmony_ci * @since 1.0 114a3e0fd82Sopenharmony_ci * @version 1.0 115a3e0fd82Sopenharmony_ci */ 116a3e0fd82Sopenharmony_ciclass UIView : public HeapBase { 117a3e0fd82Sopenharmony_cipublic: 118a3e0fd82Sopenharmony_ci /** 119a3e0fd82Sopenharmony_ci * @brief Defines a click event listener. You need to register this listener with the view to listen to 120a3e0fd82Sopenharmony_ci * click events. 121a3e0fd82Sopenharmony_ci * 122a3e0fd82Sopenharmony_ci * @since 1.0 123a3e0fd82Sopenharmony_ci * @version 1.0 124a3e0fd82Sopenharmony_ci */ 125a3e0fd82Sopenharmony_ci class OnClickListener : public HeapBase { 126a3e0fd82Sopenharmony_ci public: 127a3e0fd82Sopenharmony_ci /** 128a3e0fd82Sopenharmony_ci * @brief Called when a view is clicked. 129a3e0fd82Sopenharmony_ci * @param view Indicates the view clicked. 130a3e0fd82Sopenharmony_ci * @param event Indicates the click event. 131a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 132a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 133a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 134a3e0fd82Sopenharmony_ci * @since 1.0 135a3e0fd82Sopenharmony_ci * @version 1.0 136a3e0fd82Sopenharmony_ci */ 137a3e0fd82Sopenharmony_ci virtual bool OnClick(UIView& view, const ClickEvent& event) 138a3e0fd82Sopenharmony_ci { 139a3e0fd82Sopenharmony_ci return false; 140a3e0fd82Sopenharmony_ci } 141a3e0fd82Sopenharmony_ci 142a3e0fd82Sopenharmony_ci /** 143a3e0fd82Sopenharmony_ci * @brief A destructor used to delete the <b>OnClickListener</b> instance. 144a3e0fd82Sopenharmony_ci * @since 1.0 145a3e0fd82Sopenharmony_ci * @version 1.0 146a3e0fd82Sopenharmony_ci */ 147a3e0fd82Sopenharmony_ci virtual ~OnClickListener() {} 148a3e0fd82Sopenharmony_ci }; 149a3e0fd82Sopenharmony_ci 150a3e0fd82Sopenharmony_ci /** 151a3e0fd82Sopenharmony_ci * @brief Defines a long-press event listener. You need to register this listener with the view to listen to 152a3e0fd82Sopenharmony_ci * long-press events. 153a3e0fd82Sopenharmony_ci * 154a3e0fd82Sopenharmony_ci * @since 1.0 155a3e0fd82Sopenharmony_ci * @version 1.0 156a3e0fd82Sopenharmony_ci */ 157a3e0fd82Sopenharmony_ci class OnLongPressListener : public HeapBase { 158a3e0fd82Sopenharmony_ci public: 159a3e0fd82Sopenharmony_ci /** 160a3e0fd82Sopenharmony_ci * @brief Called when a view is long pressed. 161a3e0fd82Sopenharmony_ci * @param view Indicates the view long pressed. 162a3e0fd82Sopenharmony_ci * @param event Indicates the long-press event. 163a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 164a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 165a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 166a3e0fd82Sopenharmony_ci * @since 1.0 167a3e0fd82Sopenharmony_ci * @version 1.0 168a3e0fd82Sopenharmony_ci */ 169a3e0fd82Sopenharmony_ci virtual bool OnLongPress(UIView& view, const LongPressEvent& event) 170a3e0fd82Sopenharmony_ci { 171a3e0fd82Sopenharmony_ci return false; 172a3e0fd82Sopenharmony_ci } 173a3e0fd82Sopenharmony_ci 174a3e0fd82Sopenharmony_ci /** 175a3e0fd82Sopenharmony_ci * @brief A destructor used to delete the <b>OnLongPressListener</b> instance. 176a3e0fd82Sopenharmony_ci * @since 1.0 177a3e0fd82Sopenharmony_ci * @version 1.0 178a3e0fd82Sopenharmony_ci */ 179a3e0fd82Sopenharmony_ci virtual ~OnLongPressListener() {} 180a3e0fd82Sopenharmony_ci }; 181a3e0fd82Sopenharmony_ci 182a3e0fd82Sopenharmony_ci /** 183a3e0fd82Sopenharmony_ci * @brief Defines a drag event listener. You need to register this listener with the view to listen to drag events. 184a3e0fd82Sopenharmony_ci * 185a3e0fd82Sopenharmony_ci * @since 1.0 186a3e0fd82Sopenharmony_ci * @version 1.0 187a3e0fd82Sopenharmony_ci */ 188a3e0fd82Sopenharmony_ci class OnDragListener : public HeapBase { 189a3e0fd82Sopenharmony_ci public: 190a3e0fd82Sopenharmony_ci /** 191a3e0fd82Sopenharmony_ci * @brief Called when a view starts to drag. 192a3e0fd82Sopenharmony_ci * @param view Indicates the view dragged. 193a3e0fd82Sopenharmony_ci * @param event Indicates the drag event. 194a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 195a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 196a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 197a3e0fd82Sopenharmony_ci * @since 1.0 198a3e0fd82Sopenharmony_ci * @version 1.0 199a3e0fd82Sopenharmony_ci */ 200a3e0fd82Sopenharmony_ci virtual bool OnDragStart(UIView& view, const DragEvent& event) 201a3e0fd82Sopenharmony_ci { 202a3e0fd82Sopenharmony_ci return false; 203a3e0fd82Sopenharmony_ci } 204a3e0fd82Sopenharmony_ci 205a3e0fd82Sopenharmony_ci /** 206a3e0fd82Sopenharmony_ci * @brief Called when a view is being dragged. 207a3e0fd82Sopenharmony_ci * @param view Indicates the view dragged. 208a3e0fd82Sopenharmony_ci * @param event Indicates the drag event. 209a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 210a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 211a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 212a3e0fd82Sopenharmony_ci * @since 1.0 213a3e0fd82Sopenharmony_ci * @version 1.0 214a3e0fd82Sopenharmony_ci */ 215a3e0fd82Sopenharmony_ci virtual bool OnDrag(UIView& view, const DragEvent& event) 216a3e0fd82Sopenharmony_ci { 217a3e0fd82Sopenharmony_ci return false; 218a3e0fd82Sopenharmony_ci } 219a3e0fd82Sopenharmony_ci 220a3e0fd82Sopenharmony_ci /** 221a3e0fd82Sopenharmony_ci * @brief Called when a view stops dragging. 222a3e0fd82Sopenharmony_ci * @param view Indicates the view dragged. 223a3e0fd82Sopenharmony_ci * @param event Indicates the drag event. 224a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 225a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 226a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 227a3e0fd82Sopenharmony_ci * @since 1.0 228a3e0fd82Sopenharmony_ci * @version 1.0 229a3e0fd82Sopenharmony_ci */ 230a3e0fd82Sopenharmony_ci virtual bool OnDragEnd(UIView& view, const DragEvent& event) 231a3e0fd82Sopenharmony_ci { 232a3e0fd82Sopenharmony_ci return false; 233a3e0fd82Sopenharmony_ci } 234a3e0fd82Sopenharmony_ci 235a3e0fd82Sopenharmony_ci /** 236a3e0fd82Sopenharmony_ci * @brief A destructor used to delete the <b>OnDragListener</b> instance. 237a3e0fd82Sopenharmony_ci * @since 1.0 238a3e0fd82Sopenharmony_ci * @version 1.0 239a3e0fd82Sopenharmony_ci */ 240a3e0fd82Sopenharmony_ci virtual ~OnDragListener() {} 241a3e0fd82Sopenharmony_ci }; 242a3e0fd82Sopenharmony_ci 243a3e0fd82Sopenharmony_ci /** 244a3e0fd82Sopenharmony_ci * @brief Defines a touch event listener. You need to register this listener with the view to listen to touch 245a3e0fd82Sopenharmony_ci * events. 246a3e0fd82Sopenharmony_ci * 247a3e0fd82Sopenharmony_ci * @since 1.0 248a3e0fd82Sopenharmony_ci * @version 1.0 249a3e0fd82Sopenharmony_ci */ 250a3e0fd82Sopenharmony_ci class OnTouchListener : public HeapBase { 251a3e0fd82Sopenharmony_ci public: 252a3e0fd82Sopenharmony_ci /** 253a3e0fd82Sopenharmony_ci * @brief Called when a view is pressed. 254a3e0fd82Sopenharmony_ci * @param view Indicates the view pressed. 255a3e0fd82Sopenharmony_ci * @param event Indicates the press event. 256a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 257a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 258a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 259a3e0fd82Sopenharmony_ci * @since 1.0 260a3e0fd82Sopenharmony_ci * @version 1.0 261a3e0fd82Sopenharmony_ci */ 262a3e0fd82Sopenharmony_ci virtual bool OnPress(UIView& view, const PressEvent& event) 263a3e0fd82Sopenharmony_ci { 264a3e0fd82Sopenharmony_ci return false; 265a3e0fd82Sopenharmony_ci } 266a3e0fd82Sopenharmony_ci 267a3e0fd82Sopenharmony_ci /** 268a3e0fd82Sopenharmony_ci * @brief Called when a view is released. 269a3e0fd82Sopenharmony_ci * @param view Indicates the view released. 270a3e0fd82Sopenharmony_ci * @param event Indicates the release event. 271a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 272a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 273a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 274a3e0fd82Sopenharmony_ci * @since 1.0 275a3e0fd82Sopenharmony_ci * @version 1.0 276a3e0fd82Sopenharmony_ci */ 277a3e0fd82Sopenharmony_ci virtual bool OnRelease(UIView& view, const ReleaseEvent& event) 278a3e0fd82Sopenharmony_ci { 279a3e0fd82Sopenharmony_ci return false; 280a3e0fd82Sopenharmony_ci } 281a3e0fd82Sopenharmony_ci 282a3e0fd82Sopenharmony_ci /** 283a3e0fd82Sopenharmony_ci * @brief Called when a click event on a view is canceled. 284a3e0fd82Sopenharmony_ci * @param view Indicates the view on which a click event is canceled. 285a3e0fd82Sopenharmony_ci * @param event Indicates the cancel event. 286a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 287a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 288a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 289a3e0fd82Sopenharmony_ci * @since 1.0 290a3e0fd82Sopenharmony_ci * @version 1.0 291a3e0fd82Sopenharmony_ci */ 292a3e0fd82Sopenharmony_ci virtual bool OnCancel(UIView& view, const CancelEvent& event) 293a3e0fd82Sopenharmony_ci { 294a3e0fd82Sopenharmony_ci return false; 295a3e0fd82Sopenharmony_ci } 296a3e0fd82Sopenharmony_ci 297a3e0fd82Sopenharmony_ci /** 298a3e0fd82Sopenharmony_ci * @brief A destructor used to delete the <b>OnTouchListener</b> instance. 299a3e0fd82Sopenharmony_ci * @since 1.0 300a3e0fd82Sopenharmony_ci * @version 1.0 301a3e0fd82Sopenharmony_ci */ 302a3e0fd82Sopenharmony_ci virtual ~OnTouchListener() {} 303a3e0fd82Sopenharmony_ci }; 304a3e0fd82Sopenharmony_ci 305a3e0fd82Sopenharmony_ci#if ENABLE_ROTATE_INPUT 306a3e0fd82Sopenharmony_ci /** 307a3e0fd82Sopenharmony_ci * @brief Defines a rotation event listener. 308a3e0fd82Sopenharmony_ci * You need to register this listener with the view to listen for rotation events. 309a3e0fd82Sopenharmony_ci * @since 5.0 310a3e0fd82Sopenharmony_ci * @version 3.0 311a3e0fd82Sopenharmony_ci */ 312a3e0fd82Sopenharmony_ci class OnRotateListener : public HeapBase { 313a3e0fd82Sopenharmony_ci public: 314a3e0fd82Sopenharmony_ci /** 315a3e0fd82Sopenharmony_ci * @brief Called when the view starts to rotate. 316a3e0fd82Sopenharmony_ci * @param view Indicates the view that responds to the rotation event. 317a3e0fd82Sopenharmony_ci * @param event Indicates the rotation event. 318a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the rotation event is consumed; returns <b>false</b> otherwise. 319a3e0fd82Sopenharmony_ci * @since 6 320a3e0fd82Sopenharmony_ci */ 321a3e0fd82Sopenharmony_ci virtual bool OnRotateStart(UIView& view, const RotateEvent& event) 322a3e0fd82Sopenharmony_ci { 323a3e0fd82Sopenharmony_ci return false; 324a3e0fd82Sopenharmony_ci } 325a3e0fd82Sopenharmony_ci 326a3e0fd82Sopenharmony_ci /** 327a3e0fd82Sopenharmony_ci * @brief Called when a rotation event occurs on a view. 328a3e0fd82Sopenharmony_ci * @param view Indicates the view that responds to the rotation event. 329a3e0fd82Sopenharmony_ci * @param event Indicates the rotation event. 330a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the rotation event is consumed; returns <b>false</b> otherwise. 331a3e0fd82Sopenharmony_ci * @since 5.0 332a3e0fd82Sopenharmony_ci * @version 3.0 333a3e0fd82Sopenharmony_ci */ 334a3e0fd82Sopenharmony_ci virtual bool OnRotate(UIView& view, const RotateEvent& event) 335a3e0fd82Sopenharmony_ci { 336a3e0fd82Sopenharmony_ci return false; 337a3e0fd82Sopenharmony_ci } 338a3e0fd82Sopenharmony_ci 339a3e0fd82Sopenharmony_ci /** 340a3e0fd82Sopenharmony_ci * @brief Called when the view stops rotating. 341a3e0fd82Sopenharmony_ci * @param view Indicates the view that responds to the rotation event. 342a3e0fd82Sopenharmony_ci * @param event Indicates the rotation event. 343a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the rotation event is consumed; returns <b>false</b> otherwise. 344a3e0fd82Sopenharmony_ci * @since 6 345a3e0fd82Sopenharmony_ci */ 346a3e0fd82Sopenharmony_ci virtual bool OnRotateEnd(UIView& view, const RotateEvent& event) 347a3e0fd82Sopenharmony_ci { 348a3e0fd82Sopenharmony_ci return false; 349a3e0fd82Sopenharmony_ci } 350a3e0fd82Sopenharmony_ci 351a3e0fd82Sopenharmony_ci /** 352a3e0fd82Sopenharmony_ci * @brief A destructor used to delete an <b>OnRotateListener</b> instance. 353a3e0fd82Sopenharmony_ci * @since 5.0 354a3e0fd82Sopenharmony_ci * @version 3.0 355a3e0fd82Sopenharmony_ci */ 356a3e0fd82Sopenharmony_ci virtual ~OnRotateListener() {} 357a3e0fd82Sopenharmony_ci }; 358a3e0fd82Sopenharmony_ci 359a3e0fd82Sopenharmony_ci /** 360a3e0fd82Sopenharmony_ci * @brief Called when the view starts to rotate. 361a3e0fd82Sopenharmony_ci * @param event Indicates the rotation event. 362a3e0fd82Sopenharmony_ci * @since 6 363a3e0fd82Sopenharmony_ci */ 364a3e0fd82Sopenharmony_ci virtual bool OnRotateStartEvent(const RotateEvent& event); 365a3e0fd82Sopenharmony_ci 366a3e0fd82Sopenharmony_ci /** 367a3e0fd82Sopenharmony_ci * @brief Called when a rotation event occurs on the view. 368a3e0fd82Sopenharmony_ci * @param event Indicates the rotation event. 369a3e0fd82Sopenharmony_ci * @since 5.0 370a3e0fd82Sopenharmony_ci * @version 3.0 371a3e0fd82Sopenharmony_ci */ 372a3e0fd82Sopenharmony_ci virtual bool OnRotateEvent(const RotateEvent& event); 373a3e0fd82Sopenharmony_ci 374a3e0fd82Sopenharmony_ci /** 375a3e0fd82Sopenharmony_ci * @brief Called when the view stops rotating. 376a3e0fd82Sopenharmony_ci * @param event Indicates the rotation event. 377a3e0fd82Sopenharmony_ci * @since 6 378a3e0fd82Sopenharmony_ci */ 379a3e0fd82Sopenharmony_ci virtual bool OnRotateEndEvent(const RotateEvent& event); 380a3e0fd82Sopenharmony_ci 381a3e0fd82Sopenharmony_ci /** 382a3e0fd82Sopenharmony_ci * @brief Sets a rotation event listener for the view. 383a3e0fd82Sopenharmony_ci * @param onRotateListener Indicates the pointer to the rotation event listener to set. 384a3e0fd82Sopenharmony_ci * @since 5.0 385a3e0fd82Sopenharmony_ci * @version 3.0 386a3e0fd82Sopenharmony_ci */ 387a3e0fd82Sopenharmony_ci void SetOnRotateListener(OnRotateListener* onRotateListener); 388a3e0fd82Sopenharmony_ci 389a3e0fd82Sopenharmony_ci /** 390a3e0fd82Sopenharmony_ci * @brief Obtains the rotation event listener for the view. 391a3e0fd82Sopenharmony_ci * @return Returns the rotation event listener. 392a3e0fd82Sopenharmony_ci * @since 5.0 393a3e0fd82Sopenharmony_ci * @version 3.0 394a3e0fd82Sopenharmony_ci */ 395a3e0fd82Sopenharmony_ci OnRotateListener*& GetOnRotateListener() 396a3e0fd82Sopenharmony_ci { 397a3e0fd82Sopenharmony_ci return onRotateListener_; 398a3e0fd82Sopenharmony_ci } 399a3e0fd82Sopenharmony_ci#endif 400a3e0fd82Sopenharmony_ci 401a3e0fd82Sopenharmony_ci /** 402a3e0fd82Sopenharmony_ci * @brief Stores extra information about a <b>UIView</b> instance. 403a3e0fd82Sopenharmony_ci * @param elementPtr Indicates the void pointer to the extra information about the <b>UIView</b> instance. 404a3e0fd82Sopenharmony_ci * @since 5.0 405a3e0fd82Sopenharmony_ci * @version 3.0 406a3e0fd82Sopenharmony_ci */ 407a3e0fd82Sopenharmony_ci struct ViewExtraMsg { 408a3e0fd82Sopenharmony_ci void* elementPtr; 409a3e0fd82Sopenharmony_ci }; 410a3e0fd82Sopenharmony_ci 411a3e0fd82Sopenharmony_ci /** 412a3e0fd82Sopenharmony_ci * @brief A default constructor used to create an <b>UIView</b> instance. 413a3e0fd82Sopenharmony_ci * @since 1.0 414a3e0fd82Sopenharmony_ci * @version 1.0 415a3e0fd82Sopenharmony_ci */ 416a3e0fd82Sopenharmony_ci UIView(); 417a3e0fd82Sopenharmony_ci 418a3e0fd82Sopenharmony_ci /** 419a3e0fd82Sopenharmony_ci * @brief A constructor used to create an <b>UIView</b> instance. 420a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the view ID. 421a3e0fd82Sopenharmony_ci * @since 1.0 422a3e0fd82Sopenharmony_ci * @version 1.0 423a3e0fd82Sopenharmony_ci */ 424a3e0fd82Sopenharmony_ci explicit UIView(const char* id) : UIView() 425a3e0fd82Sopenharmony_ci { 426a3e0fd82Sopenharmony_ci id_ = id; 427a3e0fd82Sopenharmony_ci } 428a3e0fd82Sopenharmony_ci 429a3e0fd82Sopenharmony_ci /** 430a3e0fd82Sopenharmony_ci * @brief A destructor used to delete the <b>UIView</b> instance. 431a3e0fd82Sopenharmony_ci * @since 1.0 432a3e0fd82Sopenharmony_ci * @version 1.0 433a3e0fd82Sopenharmony_ci */ 434a3e0fd82Sopenharmony_ci virtual ~UIView(); 435a3e0fd82Sopenharmony_ci 436a3e0fd82Sopenharmony_ci /** 437a3e0fd82Sopenharmony_ci * @brief Called before a view is drawn. This function is used to check whether the invalidated area 438a3e0fd82Sopenharmony_ci * can be fully cover by this view so as to optimize the drawing process. 439a3e0fd82Sopenharmony_ci * @param invalidatedArea Indicates the area to judge and returns the covered area when partly coverd. 440a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the invalidated area is fully covered; returns <b>false</b> otherwise. 441a3e0fd82Sopenharmony_ci * @since 1.0 442a3e0fd82Sopenharmony_ci * @version 1.0 443a3e0fd82Sopenharmony_ci */ 444a3e0fd82Sopenharmony_ci virtual bool OnPreDraw(Rect& invalidatedArea) const; 445a3e0fd82Sopenharmony_ci 446a3e0fd82Sopenharmony_ci /** 447a3e0fd82Sopenharmony_ci * @brief Called when a view is drawn. 448a3e0fd82Sopenharmony_ci * @param invalidatedArea Indicates the area to draw. 449a3e0fd82Sopenharmony_ci * @since 1.0 450a3e0fd82Sopenharmony_ci * @version 1.0 451a3e0fd82Sopenharmony_ci */ 452a3e0fd82Sopenharmony_ci virtual void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea); 453a3e0fd82Sopenharmony_ci 454a3e0fd82Sopenharmony_ci /** 455a3e0fd82Sopenharmony_ci * @brief Called after a view is drawn. 456a3e0fd82Sopenharmony_ci * @param invalidatedArea Indicates the area in which the view is drawn. 457a3e0fd82Sopenharmony_ci * @since 1.0 458a3e0fd82Sopenharmony_ci * @version 1.0 459a3e0fd82Sopenharmony_ci */ 460a3e0fd82Sopenharmony_ci virtual void OnPostDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea); 461a3e0fd82Sopenharmony_ci 462a3e0fd82Sopenharmony_ci /** 463a3e0fd82Sopenharmony_ci * @brief Remeasures the view size. 464a3e0fd82Sopenharmony_ci * @since 1.0 465a3e0fd82Sopenharmony_ci * @version 1.0 466a3e0fd82Sopenharmony_ci */ 467a3e0fd82Sopenharmony_ci virtual void ReMeasure() {} 468a3e0fd82Sopenharmony_ci 469a3e0fd82Sopenharmony_ci /** 470a3e0fd82Sopenharmony_ci * @brief Refreshes the invalidated area of the view. 471a3e0fd82Sopenharmony_ci * @since 1.0 472a3e0fd82Sopenharmony_ci * @version 1.0 473a3e0fd82Sopenharmony_ci */ 474a3e0fd82Sopenharmony_ci void Invalidate(); 475a3e0fd82Sopenharmony_ci 476a3e0fd82Sopenharmony_ci /** 477a3e0fd82Sopenharmony_ci * @brief Refreshes a view in a specified invalidated area. 478a3e0fd82Sopenharmony_ci * @param invalidatedArea Indicates the area to refresh. 479a3e0fd82Sopenharmony_ci * @since 1.0 480a3e0fd82Sopenharmony_ci * @version 1.0 481a3e0fd82Sopenharmony_ci */ 482a3e0fd82Sopenharmony_ci void InvalidateRect(const Rect& invalidatedArea, UIView* view = nullptr); 483a3e0fd82Sopenharmony_ci 484a3e0fd82Sopenharmony_ci /** 485a3e0fd82Sopenharmony_ci * @brief Called when the view is long pressed. 486a3e0fd82Sopenharmony_ci * @param event Indicates the long-press event. 487a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 488a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 489a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 490a3e0fd82Sopenharmony_ci * @since 1.0 491a3e0fd82Sopenharmony_ci * @version 1.0 492a3e0fd82Sopenharmony_ci */ 493a3e0fd82Sopenharmony_ci virtual bool OnLongPressEvent(const LongPressEvent& event); 494a3e0fd82Sopenharmony_ci 495a3e0fd82Sopenharmony_ci /** 496a3e0fd82Sopenharmony_ci * @brief Called when the view starts to drag. 497a3e0fd82Sopenharmony_ci * @param event Indicates the drag event. 498a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 499a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 500a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 501a3e0fd82Sopenharmony_ci * @since 1.0 502a3e0fd82Sopenharmony_ci * @version 1.0 503a3e0fd82Sopenharmony_ci */ 504a3e0fd82Sopenharmony_ci virtual bool OnDragStartEvent(const DragEvent& event); 505a3e0fd82Sopenharmony_ci 506a3e0fd82Sopenharmony_ci /** 507a3e0fd82Sopenharmony_ci * @brief Called when the view is being dragged. 508a3e0fd82Sopenharmony_ci * @param event Indicates the drag event. 509a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 510a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 511a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 512a3e0fd82Sopenharmony_ci * @since 1.0 513a3e0fd82Sopenharmony_ci * @version 1.0 514a3e0fd82Sopenharmony_ci */ 515a3e0fd82Sopenharmony_ci virtual bool OnDragEvent(const DragEvent& event); 516a3e0fd82Sopenharmony_ci 517a3e0fd82Sopenharmony_ci /** 518a3e0fd82Sopenharmony_ci * @brief Called when the view stops dragging. 519a3e0fd82Sopenharmony_ci * @param event Indicates the drag event. 520a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 521a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 522a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 523a3e0fd82Sopenharmony_ci * @since 1.0 524a3e0fd82Sopenharmony_ci * @version 1.0 525a3e0fd82Sopenharmony_ci */ 526a3e0fd82Sopenharmony_ci virtual bool OnDragEndEvent(const DragEvent& event); 527a3e0fd82Sopenharmony_ci 528a3e0fd82Sopenharmony_ci /** 529a3e0fd82Sopenharmony_ci * @brief Called when the view is clicked. 530a3e0fd82Sopenharmony_ci * @param event Indicates the click event. 531a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 532a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 533a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 534a3e0fd82Sopenharmony_ci * @since 1.0 535a3e0fd82Sopenharmony_ci * @version 1.0 536a3e0fd82Sopenharmony_ci */ 537a3e0fd82Sopenharmony_ci virtual bool OnClickEvent(const ClickEvent& event); 538a3e0fd82Sopenharmony_ci 539a3e0fd82Sopenharmony_ci /** 540a3e0fd82Sopenharmony_ci * @brief Called when the view is pressed. 541a3e0fd82Sopenharmony_ci * @param event Indicates the press event. 542a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 543a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 544a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 545a3e0fd82Sopenharmony_ci * @since 1.0 546a3e0fd82Sopenharmony_ci * @version 1.0 547a3e0fd82Sopenharmony_ci */ 548a3e0fd82Sopenharmony_ci virtual bool OnPressEvent(const PressEvent& event); 549a3e0fd82Sopenharmony_ci 550a3e0fd82Sopenharmony_ci /** 551a3e0fd82Sopenharmony_ci * @brief Called when the view is released. 552a3e0fd82Sopenharmony_ci * @param event Indicates the release event. 553a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 554a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 555a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 556a3e0fd82Sopenharmony_ci * @since 1.0 557a3e0fd82Sopenharmony_ci * @version 1.0 558a3e0fd82Sopenharmony_ci */ 559a3e0fd82Sopenharmony_ci virtual bool OnReleaseEvent(const ReleaseEvent& event); 560a3e0fd82Sopenharmony_ci 561a3e0fd82Sopenharmony_ci /** 562a3e0fd82Sopenharmony_ci * @brief Called when a click event on the view is canceled. 563a3e0fd82Sopenharmony_ci * @param event Indicates the cancel event. 564a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the event is consumed; returns <b>false</b> otherwise. 565a3e0fd82Sopenharmony_ci * (If an event is consumed, it is not transferred to the parent view. If an event is not consumed, 566a3e0fd82Sopenharmony_ci * it is transferred to the parent view after local processing is complete.) 567a3e0fd82Sopenharmony_ci * @since 1.0 568a3e0fd82Sopenharmony_ci * @version 1.0 569a3e0fd82Sopenharmony_ci */ 570a3e0fd82Sopenharmony_ci virtual bool OnCancelEvent(const CancelEvent& event); 571a3e0fd82Sopenharmony_ci 572a3e0fd82Sopenharmony_ci /** 573a3e0fd82Sopenharmony_ci * @brief Sets a drag event listener for the view. 574a3e0fd82Sopenharmony_ci * @param onDragListener Indicates the pointer to the drag event listener to set. 575a3e0fd82Sopenharmony_ci * @since 1.0 576a3e0fd82Sopenharmony_ci * @version 1.0 577a3e0fd82Sopenharmony_ci */ 578a3e0fd82Sopenharmony_ci void SetOnDragListener(OnDragListener* onDragListener); 579a3e0fd82Sopenharmony_ci 580a3e0fd82Sopenharmony_ci /** 581a3e0fd82Sopenharmony_ci * @brief Obtains the drag event listener for the view. 582a3e0fd82Sopenharmony_ci * @return Returns the drag event listener. 583a3e0fd82Sopenharmony_ci * @since 1.0 584a3e0fd82Sopenharmony_ci * @version 1.0 585a3e0fd82Sopenharmony_ci */ 586a3e0fd82Sopenharmony_ci OnDragListener*& GetOnDragListener(); 587a3e0fd82Sopenharmony_ci 588a3e0fd82Sopenharmony_ci /** 589a3e0fd82Sopenharmony_ci * @brief Sets a click event listener for the view. 590a3e0fd82Sopenharmony_ci * @param onClickListener Indicates the pointer to the click event listener to set. 591a3e0fd82Sopenharmony_ci * @since 1.0 592a3e0fd82Sopenharmony_ci * @version 1.0 593a3e0fd82Sopenharmony_ci */ 594a3e0fd82Sopenharmony_ci void SetOnClickListener(OnClickListener* onClickListener); 595a3e0fd82Sopenharmony_ci 596a3e0fd82Sopenharmony_ci /** 597a3e0fd82Sopenharmony_ci * @brief Obtains the click event listener for the view. 598a3e0fd82Sopenharmony_ci * @return Returns the click event listener. 599a3e0fd82Sopenharmony_ci * @since 1.0 600a3e0fd82Sopenharmony_ci * @version 1.0 601a3e0fd82Sopenharmony_ci */ 602a3e0fd82Sopenharmony_ci OnClickListener*& GetOnClickListener(); 603a3e0fd82Sopenharmony_ci 604a3e0fd82Sopenharmony_ci /** 605a3e0fd82Sopenharmony_ci * @brief Sets a long-press event listener for the view. 606a3e0fd82Sopenharmony_ci * @param onLongPressListener Indicates the pointer to the long-press event listener to set. 607a3e0fd82Sopenharmony_ci * @since 1.0 608a3e0fd82Sopenharmony_ci * @version 1.0 609a3e0fd82Sopenharmony_ci */ 610a3e0fd82Sopenharmony_ci void SetOnLongPressListener(OnLongPressListener* onLongPressListener); 611a3e0fd82Sopenharmony_ci 612a3e0fd82Sopenharmony_ci /** 613a3e0fd82Sopenharmony_ci * @brief Obtains the long-press event listener for the view. 614a3e0fd82Sopenharmony_ci * @return Returns the long-press event listener. 615a3e0fd82Sopenharmony_ci * @since 1.0 616a3e0fd82Sopenharmony_ci * @version 1.0 617a3e0fd82Sopenharmony_ci */ 618a3e0fd82Sopenharmony_ci OnLongPressListener*& GetOnLongPressListener(); 619a3e0fd82Sopenharmony_ci 620a3e0fd82Sopenharmony_ci /** 621a3e0fd82Sopenharmony_ci * @brief Sets a touch event listener for the view. 622a3e0fd82Sopenharmony_ci * @param onTouchListener Indicates the pointer to the touch event listener to set. 623a3e0fd82Sopenharmony_ci * @since 1.0 624a3e0fd82Sopenharmony_ci * @version 1.0 625a3e0fd82Sopenharmony_ci */ 626a3e0fd82Sopenharmony_ci void SetOnTouchListener(OnTouchListener* onTouchListener); 627a3e0fd82Sopenharmony_ci 628a3e0fd82Sopenharmony_ci /** 629a3e0fd82Sopenharmony_ci * @brief Obtains the touch event listener for the view. 630a3e0fd82Sopenharmony_ci * @return Returns the touch event listener. 631a3e0fd82Sopenharmony_ci * @since 1.0 632a3e0fd82Sopenharmony_ci * @version 1.0 633a3e0fd82Sopenharmony_ci */ 634a3e0fd82Sopenharmony_ci OnTouchListener*& GetTouchListener(); 635a3e0fd82Sopenharmony_ci 636a3e0fd82Sopenharmony_ci /** 637a3e0fd82Sopenharmony_ci * @brief Obtains the top-level view based on specified coordinates. 638a3e0fd82Sopenharmony_ci * @param point Indicates the coordinates to specify. 639a3e0fd82Sopenharmony_ci * @param last Indicates the double pointer to the view that contains the specified coordinates. 640a3e0fd82Sopenharmony_ci * @since 1.0 641a3e0fd82Sopenharmony_ci * @version 1.0 642a3e0fd82Sopenharmony_ci */ 643a3e0fd82Sopenharmony_ci virtual void GetTargetView(const Point& point, UIView** last); 644a3e0fd82Sopenharmony_ci 645a3e0fd82Sopenharmony_ci /** 646a3e0fd82Sopenharmony_ci * @brief Obtains the current view and target view based on specified coordinates. The obtained current view must 647a3e0fd82Sopenharmony_ci * include the specified coordinates and is a visible top view that can respond to touch events, and the 648a3e0fd82Sopenharmony_ci * obtained target view must be the top view that includes the specified coordinates. 649a3e0fd82Sopenharmony_ci * @param point Indicates the specified coordinates. 650a3e0fd82Sopenharmony_ci * @param current Indicates the double pointer to the current view to obtain. 651a3e0fd82Sopenharmony_ci * <b>nullptr</b> indicates that the target view fails to be obtained. 652a3e0fd82Sopenharmony_ci * @param target Indicates the double pointer to the target view to obtain. 653a3e0fd82Sopenharmony_ci * <b>nullptr</b> indicates that the target view fails to be obtained. 654a3e0fd82Sopenharmony_ci * @since 5.0 655a3e0fd82Sopenharmony_ci * @version 3.0 656a3e0fd82Sopenharmony_ci */ 657a3e0fd82Sopenharmony_ci virtual void GetTargetView(const Point& point, UIView** current, UIView** target); 658a3e0fd82Sopenharmony_ci 659a3e0fd82Sopenharmony_ci /** 660a3e0fd82Sopenharmony_ci * @brief Sets the parent view for the view. 661a3e0fd82Sopenharmony_ci * @param parent Indicates the pointer to the parent view to set. 662a3e0fd82Sopenharmony_ci * @since 1.0 663a3e0fd82Sopenharmony_ci * @version 1.0 664a3e0fd82Sopenharmony_ci */ 665a3e0fd82Sopenharmony_ci void SetParent(UIView* parent); 666a3e0fd82Sopenharmony_ci 667a3e0fd82Sopenharmony_ci /** 668a3e0fd82Sopenharmony_ci * @brief Obtains the parent view of the view. 669a3e0fd82Sopenharmony_ci * @return Returns the pointer to the parent view. 670a3e0fd82Sopenharmony_ci * @since 1.0 671a3e0fd82Sopenharmony_ci * @version 1.0 672a3e0fd82Sopenharmony_ci */ 673a3e0fd82Sopenharmony_ci UIView* GetParent() const; 674a3e0fd82Sopenharmony_ci 675a3e0fd82Sopenharmony_ci /** 676a3e0fd82Sopenharmony_ci * @brief Sets the next sibling view for the view. 677a3e0fd82Sopenharmony_ci * @param sibling Indicates the pointer to the next sibling view to set. 678a3e0fd82Sopenharmony_ci * @since 1.0 679a3e0fd82Sopenharmony_ci * @version 1.0 680a3e0fd82Sopenharmony_ci */ 681a3e0fd82Sopenharmony_ci void SetNextSibling(UIView* sibling); 682a3e0fd82Sopenharmony_ci 683a3e0fd82Sopenharmony_ci /** 684a3e0fd82Sopenharmony_ci * @brief Obtains the next sibling view of the view. 685a3e0fd82Sopenharmony_ci * @return Returns the pointer to the next sibling view. 686a3e0fd82Sopenharmony_ci * @since 1.0 687a3e0fd82Sopenharmony_ci * @version 1.0 688a3e0fd82Sopenharmony_ci */ 689a3e0fd82Sopenharmony_ci UIView* GetNextSibling() const; 690a3e0fd82Sopenharmony_ci 691a3e0fd82Sopenharmony_ci /** 692a3e0fd82Sopenharmony_ci * @brief Sets whether the view is visible. 693a3e0fd82Sopenharmony_ci * @param visible Specifies whether to set the view visible. Value <b>true</b> means to set the view visible, 694a3e0fd82Sopenharmony_ci * and <b>false</b> means the opposite. 695a3e0fd82Sopenharmony_ci * @since 1.0 696a3e0fd82Sopenharmony_ci * @version 1.0 697a3e0fd82Sopenharmony_ci */ 698a3e0fd82Sopenharmony_ci virtual void SetVisible(bool visible); 699a3e0fd82Sopenharmony_ci 700a3e0fd82Sopenharmony_ci /** 701a3e0fd82Sopenharmony_ci * @brief Checks whether the view is visible. 702a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the view is visible; returns <b>false</b> otherwise. 703a3e0fd82Sopenharmony_ci * @since 1.0 704a3e0fd82Sopenharmony_ci * @version 1.0 705a3e0fd82Sopenharmony_ci */ 706a3e0fd82Sopenharmony_ci bool IsVisible() const; 707a3e0fd82Sopenharmony_ci 708a3e0fd82Sopenharmony_ci /** 709a3e0fd82Sopenharmony_ci * @brief Sets whether the view is touchable. 710a3e0fd82Sopenharmony_ci * @param touchable Specifies whether to set the view touchable. Value <b>true</b> means to set the view touchable, 711a3e0fd82Sopenharmony_ci * and <b>false</b> means the opposite. 712a3e0fd82Sopenharmony_ci * @since 1.0 713a3e0fd82Sopenharmony_ci * @version 1.0 714a3e0fd82Sopenharmony_ci */ 715a3e0fd82Sopenharmony_ci void SetTouchable(bool touch); 716a3e0fd82Sopenharmony_ci 717a3e0fd82Sopenharmony_ci /** 718a3e0fd82Sopenharmony_ci * @brief Checks whether the view is touchable. 719a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the view is touchable; returns <b>false</b> otherwise. 720a3e0fd82Sopenharmony_ci * @since 1.0 721a3e0fd82Sopenharmony_ci * @version 1.0 722a3e0fd82Sopenharmony_ci */ 723a3e0fd82Sopenharmony_ci bool IsTouchable() const; 724a3e0fd82Sopenharmony_ci 725a3e0fd82Sopenharmony_ci /** 726a3e0fd82Sopenharmony_ci * @brief Sets whether the view is draggable. 727a3e0fd82Sopenharmony_ci * @param draggable Specifies whether to set the view draggable. Value <b>true</b> means to set the view draggable, 728a3e0fd82Sopenharmony_ci * and <b>false</b> means the opposite. 729a3e0fd82Sopenharmony_ci * @since 1.0 730a3e0fd82Sopenharmony_ci * @version 1.0 731a3e0fd82Sopenharmony_ci */ 732a3e0fd82Sopenharmony_ci void SetDraggable(bool draggable); 733a3e0fd82Sopenharmony_ci 734a3e0fd82Sopenharmony_ci /** 735a3e0fd82Sopenharmony_ci * @brief Checks whether the view is draggable. 736a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the view is draggable; returns <b>false</b> otherwise. 737a3e0fd82Sopenharmony_ci * @since 1.0 738a3e0fd82Sopenharmony_ci * @version 1.0 739a3e0fd82Sopenharmony_ci */ 740a3e0fd82Sopenharmony_ci bool IsDraggable() const; 741a3e0fd82Sopenharmony_ci 742a3e0fd82Sopenharmony_ci /** 743a3e0fd82Sopenharmony_ci * @brief Sets whether to transfer the drag event to the parent view for processing when the view is being dragged. 744a3e0fd82Sopenharmony_ci * @param dragParentInstead Specifies whether to transfer the event to the parent view for processing. 745a3e0fd82Sopenharmony_ci * Value <b>true</b> means to transfer the event to the parent view for processing, 746a3e0fd82Sopenharmony_ci * and <b>false</b> means the opposite. 747a3e0fd82Sopenharmony_ci * @since 1.0 748a3e0fd82Sopenharmony_ci * @version 1.0 749a3e0fd82Sopenharmony_ci */ 750a3e0fd82Sopenharmony_ci void SetDragParentInstead(bool dragParentInstead); 751a3e0fd82Sopenharmony_ci 752a3e0fd82Sopenharmony_ci /** 753a3e0fd82Sopenharmony_ci * @brief Obtains whether the view transfers a drag event to the parent view for processing. 754a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the view transfers the event to the parent view for processing; 755a3e0fd82Sopenharmony_ci * returns <b>false</b> otherwise. 756a3e0fd82Sopenharmony_ci * @since 1.0 757a3e0fd82Sopenharmony_ci * @version 1.0 758a3e0fd82Sopenharmony_ci */ 759a3e0fd82Sopenharmony_ci bool IsDragParentInstead() const; 760a3e0fd82Sopenharmony_ci 761a3e0fd82Sopenharmony_ci /** 762a3e0fd82Sopenharmony_ci * @brief Obtains the absolute rectangle area of the view. When the view has deformation such as rotation, 763a3e0fd82Sopenharmony_ci * the rectangle area is the intersection set of the absolute rectangle area and deformation matrix. 764a3e0fd82Sopenharmony_ci * @return Returns the absolute rectangle area. 765a3e0fd82Sopenharmony_ci * @since 1.0 766a3e0fd82Sopenharmony_ci * @version 1.0 767a3e0fd82Sopenharmony_ci */ 768a3e0fd82Sopenharmony_ci Rect GetRect() const; 769a3e0fd82Sopenharmony_ci 770a3e0fd82Sopenharmony_ci /** 771a3e0fd82Sopenharmony_ci * @brief Obtains the visible absolute rectangle area of the view. 772a3e0fd82Sopenharmony_ci * @return Returns the visible absolute rectangle area. 773a3e0fd82Sopenharmony_ci * @since 1.0 774a3e0fd82Sopenharmony_ci * @version 1.0 775a3e0fd82Sopenharmony_ci */ 776a3e0fd82Sopenharmony_ci Rect GetVisibleRect() const; 777a3e0fd82Sopenharmony_ci 778a3e0fd82Sopenharmony_ci /** 779a3e0fd82Sopenharmony_ci * @brief Obtains the valid absolute rectangle area of the view. The valid area refers to the area where the view 780a3e0fd82Sopenharmony_ci * can be displayed. Generally, the valid area is the same as the visible view area, but they may be 781a3e0fd82Sopenharmony_ci * different in the grid layout. 782a3e0fd82Sopenharmony_ci * @return Returns the valid absolute rectangle area. 783a3e0fd82Sopenharmony_ci * @since 1.0 784a3e0fd82Sopenharmony_ci * @version 1.0 785a3e0fd82Sopenharmony_ci */ 786a3e0fd82Sopenharmony_ci Rect GetMaskedRect() const; 787a3e0fd82Sopenharmony_ci 788a3e0fd82Sopenharmony_ci /** 789a3e0fd82Sopenharmony_ci * @brief Obtains the absolute rectangle area of the view. 790a3e0fd82Sopenharmony_ci * @return Returns the absolute rectangle area. 791a3e0fd82Sopenharmony_ci * @since 1.0 792a3e0fd82Sopenharmony_ci * @version 1.0 793a3e0fd82Sopenharmony_ci */ 794a3e0fd82Sopenharmony_ci Rect GetOrigRect() const; 795a3e0fd82Sopenharmony_ci 796a3e0fd82Sopenharmony_ci /** 797a3e0fd82Sopenharmony_ci * @brief Obtains the content of the absolute rectangle area of the view. This area excludes padding. 798a3e0fd82Sopenharmony_ci * @return Returns the content of the absolute rectangle area. 799a3e0fd82Sopenharmony_ci * @since 1.0 800a3e0fd82Sopenharmony_ci * @version 1.0 801a3e0fd82Sopenharmony_ci */ 802a3e0fd82Sopenharmony_ci virtual Rect GetContentRect(); 803a3e0fd82Sopenharmony_ci 804a3e0fd82Sopenharmony_ci virtual Rect GetOrigContentRect(); 805a3e0fd82Sopenharmony_ci 806a3e0fd82Sopenharmony_ci /** 807a3e0fd82Sopenharmony_ci * @brief Obtains the rectangular area of the view relative to the parent view, that is, the rectangular area 808a3e0fd82Sopenharmony_ci * relative to the coordinates of the parent view. 809a3e0fd82Sopenharmony_ci * @return Returns the rectangle area relative to the parent view. 810a3e0fd82Sopenharmony_ci * @since 1.0 811a3e0fd82Sopenharmony_ci * @version 1.0 812a3e0fd82Sopenharmony_ci */ 813a3e0fd82Sopenharmony_ci Rect GetRelativeRect() const; 814a3e0fd82Sopenharmony_ci 815a3e0fd82Sopenharmony_ci /** 816a3e0fd82Sopenharmony_ci * @brief Adjusts the size of the visible area. This operation may affect the final display size. 817a3e0fd82Sopenharmony_ci * @param x Indicates the new x-coordinate. 818a3e0fd82Sopenharmony_ci * @param y Indicates the new y-coordinate. 819a3e0fd82Sopenharmony_ci * @param width Indicates the new width. 820a3e0fd82Sopenharmony_ci * @param height Indicates the new height. 821a3e0fd82Sopenharmony_ci * @since 1.0 822a3e0fd82Sopenharmony_ci * @version 1.0 823a3e0fd82Sopenharmony_ci */ 824a3e0fd82Sopenharmony_ci void ResizeVisibleArea(int16_t x, int16_t y, int16_t width, int16_t height); 825a3e0fd82Sopenharmony_ci 826a3e0fd82Sopenharmony_ci /** 827a3e0fd82Sopenharmony_ci * @brief Sets the width for the view. 828a3e0fd82Sopenharmony_ci * @param width Indicates the width to set. 829a3e0fd82Sopenharmony_ci * @since 1.0 830a3e0fd82Sopenharmony_ci * @version 1.0 831a3e0fd82Sopenharmony_ci */ 832a3e0fd82Sopenharmony_ci virtual void SetWidth(int16_t width); 833a3e0fd82Sopenharmony_ci 834a3e0fd82Sopenharmony_ci /** 835a3e0fd82Sopenharmony_ci * @brief Sets a percentage that represents the proportion of the view's width to the parent view's width. 836a3e0fd82Sopenharmony_ci * @param widthPercent Indicates the percentage to set, the decimal form of which ranges from 0 to 1. 837a3e0fd82Sopenharmony_ci * @since 5.0 838a3e0fd82Sopenharmony_ci * @version 3.0 839a3e0fd82Sopenharmony_ci */ 840a3e0fd82Sopenharmony_ci virtual void SetWidthPercent(float widthPercent); 841a3e0fd82Sopenharmony_ci 842a3e0fd82Sopenharmony_ci /** 843a3e0fd82Sopenharmony_ci * @brief Obtains the width for the view. 844a3e0fd82Sopenharmony_ci * @return Returns the view width. 845a3e0fd82Sopenharmony_ci * @since 1.0 846a3e0fd82Sopenharmony_ci * @version 1.0 847a3e0fd82Sopenharmony_ci */ 848a3e0fd82Sopenharmony_ci virtual int16_t GetWidth(); 849a3e0fd82Sopenharmony_ci 850a3e0fd82Sopenharmony_ci /** 851a3e0fd82Sopenharmony_ci * @brief Sets the height for the view. 852a3e0fd82Sopenharmony_ci * @param height Indicates the height to set. 853a3e0fd82Sopenharmony_ci * @since 1.0 854a3e0fd82Sopenharmony_ci * @version 1.0 855a3e0fd82Sopenharmony_ci */ 856a3e0fd82Sopenharmony_ci virtual void SetHeight(int16_t height); 857a3e0fd82Sopenharmony_ci 858a3e0fd82Sopenharmony_ci /** 859a3e0fd82Sopenharmony_ci * @brief Sets a percentage that represents the proportion of the view's hieght to the parent view's hieght. 860a3e0fd82Sopenharmony_ci * @param widthPercent Indicates the percentage to set, the decimal form of which ranges from 0 to 1. 861a3e0fd82Sopenharmony_ci * @since 5.0 862a3e0fd82Sopenharmony_ci * @version 3.0 863a3e0fd82Sopenharmony_ci */ 864a3e0fd82Sopenharmony_ci virtual void SetHeightPercent(float heightPercent); 865a3e0fd82Sopenharmony_ci 866a3e0fd82Sopenharmony_ci /** 867a3e0fd82Sopenharmony_ci * @brief Obtains the height for the view. 868a3e0fd82Sopenharmony_ci * @return Returns the view height. 869a3e0fd82Sopenharmony_ci * @since 1.0 870a3e0fd82Sopenharmony_ci * @version 1.0 871a3e0fd82Sopenharmony_ci */ 872a3e0fd82Sopenharmony_ci virtual int16_t GetHeight(); 873a3e0fd82Sopenharmony_ci 874a3e0fd82Sopenharmony_ci /** 875a3e0fd82Sopenharmony_ci * @brief Adjusts the size of the view. 876a3e0fd82Sopenharmony_ci * @param width Indicates the new width. 877a3e0fd82Sopenharmony_ci * @param height Indicates the new height. 878a3e0fd82Sopenharmony_ci * @since 1.0 879a3e0fd82Sopenharmony_ci * @version 1.0 880a3e0fd82Sopenharmony_ci */ 881a3e0fd82Sopenharmony_ci virtual void Resize(int16_t width, int16_t height); 882a3e0fd82Sopenharmony_ci 883a3e0fd82Sopenharmony_ci /** 884a3e0fd82Sopenharmony_ci * @brief Adjusts the size of the view based on specified percentages. 885a3e0fd82Sopenharmony_ci * @param widthPercent Indicates the percentage that represents the proportion of the view's width 886a3e0fd82Sopenharmony_ci * to the parent view's width to set, the decimal form of which ranges from 0 to 1. 887a3e0fd82Sopenharmony_ci * @param heightPercent Indicates the percentage that represents the proportion of the view's height 888a3e0fd82Sopenharmony_ci * to the parent view's height to set, the decimal form of which ranges from 0 to 1. 889a3e0fd82Sopenharmony_ci * @since 5.0 890a3e0fd82Sopenharmony_ci * @version 3.0 891a3e0fd82Sopenharmony_ci */ 892a3e0fd82Sopenharmony_ci virtual void ResizePercent(float widthPercent, float heightPercent); 893a3e0fd82Sopenharmony_ci 894a3e0fd82Sopenharmony_ci /** 895a3e0fd82Sopenharmony_ci * @brief Sets the x-coordinate for the view. 896a3e0fd82Sopenharmony_ci * @param x Indicates the x-coordinate to set. 897a3e0fd82Sopenharmony_ci * @since 1.0 898a3e0fd82Sopenharmony_ci * @version 1.0 899a3e0fd82Sopenharmony_ci */ 900a3e0fd82Sopenharmony_ci virtual void SetX(int16_t x); 901a3e0fd82Sopenharmony_ci 902a3e0fd82Sopenharmony_ci /** 903a3e0fd82Sopenharmony_ci * @brief Sets a percentage that represents the proportion of the view's x-coordinate 904a3e0fd82Sopenharmony_ci * to the parent view's x-coordinate. 905a3e0fd82Sopenharmony_ci * @param xPercent Indicates the percentage to set, the decimal form of which ranges from 0 to 1. 906a3e0fd82Sopenharmony_ci * @since 5.0 907a3e0fd82Sopenharmony_ci * @version 3.0 908a3e0fd82Sopenharmony_ci */ 909a3e0fd82Sopenharmony_ci virtual void SetXPercent(float xPercent); 910a3e0fd82Sopenharmony_ci 911a3e0fd82Sopenharmony_ci /** 912a3e0fd82Sopenharmony_ci * @brief Obtains the x-coordinate for the view. 913a3e0fd82Sopenharmony_ci * @return Returns the x-coordinate. 914a3e0fd82Sopenharmony_ci * @since 1.0 915a3e0fd82Sopenharmony_ci * @version 1.0 916a3e0fd82Sopenharmony_ci */ 917a3e0fd82Sopenharmony_ci int16_t GetX() const; 918a3e0fd82Sopenharmony_ci 919a3e0fd82Sopenharmony_ci /** 920a3e0fd82Sopenharmony_ci * @brief Sets the y-coordinate for the view. 921a3e0fd82Sopenharmony_ci * @param y Indicates the y-coordinate to set. 922a3e0fd82Sopenharmony_ci * @since 1.0 923a3e0fd82Sopenharmony_ci * @version 1.0 924a3e0fd82Sopenharmony_ci */ 925a3e0fd82Sopenharmony_ci virtual void SetY(int16_t y); 926a3e0fd82Sopenharmony_ci 927a3e0fd82Sopenharmony_ci /** 928a3e0fd82Sopenharmony_ci * @brief Sets a percentage that represents the proportion of the view's y-coordinate 929a3e0fd82Sopenharmony_ci * to the parent view's y-coordinate. 930a3e0fd82Sopenharmony_ci * @param yPercent Indicates the percentage to set, the decimal form of which ranges from 0 to 1. 931a3e0fd82Sopenharmony_ci * @since 5.0 932a3e0fd82Sopenharmony_ci * @version 3.0 933a3e0fd82Sopenharmony_ci */ 934a3e0fd82Sopenharmony_ci virtual void SetYPercent(float yPercent); 935a3e0fd82Sopenharmony_ci 936a3e0fd82Sopenharmony_ci /** 937a3e0fd82Sopenharmony_ci * @brief Obtains the y-coordinate for the view. 938a3e0fd82Sopenharmony_ci * @return Returns the y-coordinate. 939a3e0fd82Sopenharmony_ci * @since 1.0 940a3e0fd82Sopenharmony_ci * @version 1.0 941a3e0fd82Sopenharmony_ci */ 942a3e0fd82Sopenharmony_ci int16_t GetY() const; 943a3e0fd82Sopenharmony_ci 944a3e0fd82Sopenharmony_ci /** 945a3e0fd82Sopenharmony_ci * @brief 获取组件设置margin属性后margin的宽度,包括组件宽度加marginLeft 加 marginRight. 946a3e0fd82Sopenharmony_ci * @return margin的宽度 947a3e0fd82Sopenharmony_ci * @since 6 948a3e0fd82Sopenharmony_ci */ 949a3e0fd82Sopenharmony_ci int16_t GetWidthWithMargin(); 950a3e0fd82Sopenharmony_ci 951a3e0fd82Sopenharmony_ci /** 952a3e0fd82Sopenharmony_ci * @brief 获取组件设置margin属性后margin的高度度,包括组件宽度加marginTop 加 marginBottom. 953a3e0fd82Sopenharmony_ci * @return margin的高度 954a3e0fd82Sopenharmony_ci * @since 6 955a3e0fd82Sopenharmony_ci */ 956a3e0fd82Sopenharmony_ci int16_t GetHeightWithMargin(); 957a3e0fd82Sopenharmony_ci 958a3e0fd82Sopenharmony_ci /** 959a3e0fd82Sopenharmony_ci * @brief Sets the position for the view. 960a3e0fd82Sopenharmony_ci * @param x Indicates the x-coordinate to set. 961a3e0fd82Sopenharmony_ci * @param y Indicates the y-coordinate to set. 962a3e0fd82Sopenharmony_ci * @since 1.0 963a3e0fd82Sopenharmony_ci * @version 1.0 964a3e0fd82Sopenharmony_ci */ 965a3e0fd82Sopenharmony_ci virtual void SetPosition(int16_t x, int16_t y); 966a3e0fd82Sopenharmony_ci 967a3e0fd82Sopenharmony_ci /** 968a3e0fd82Sopenharmony_ci * @brief Sets the position percentages for the view. 969a3e0fd82Sopenharmony_ci * @param xPercent Indicates the percentage that represents the proportion of the view's x-coordinate 970a3e0fd82Sopenharmony_ci * to the parent view's x-coordinate to set, the decimal form of which ranges from 0 to 1. 971a3e0fd82Sopenharmony_ci * @param yPercent Indicates the percentage that represents the proportion of the view's y-coordinate 972a3e0fd82Sopenharmony_ci * to the parent view's y-coordinate to set, the decimal form of which ranges from 0 to 1. 973a3e0fd82Sopenharmony_ci * @since 5.0 974a3e0fd82Sopenharmony_ci * @version 3.0 975a3e0fd82Sopenharmony_ci */ 976a3e0fd82Sopenharmony_ci virtual void SetPositionPercent(float xPercent, float yPercent); 977a3e0fd82Sopenharmony_ci 978a3e0fd82Sopenharmony_ci /** 979a3e0fd82Sopenharmony_ci * @brief Adjusts the position and size of the view. 980a3e0fd82Sopenharmony_ci * @param x Indicates the new x-coordinate. 981a3e0fd82Sopenharmony_ci * @param y Indicates the new y-coordinate. 982a3e0fd82Sopenharmony_ci * @param width Indicates the new width. 983a3e0fd82Sopenharmony_ci * @param height Indicates the new height. 984a3e0fd82Sopenharmony_ci * @since 1.0 985a3e0fd82Sopenharmony_ci * @version 1.0 986a3e0fd82Sopenharmony_ci */ 987a3e0fd82Sopenharmony_ci virtual void SetPosition(int16_t x, int16_t y, int16_t width, int16_t height); 988a3e0fd82Sopenharmony_ci 989a3e0fd82Sopenharmony_ci /** 990a3e0fd82Sopenharmony_ci * @brief Sets the position and size percentages for the view. 991a3e0fd82Sopenharmony_ci * @param xPercent Indicates the percentage that represents the proportion of the view's x-coordinate 992a3e0fd82Sopenharmony_ci * to the parent view's x-coordinate to set, the decimal form of which ranges from 0 to 1. 993a3e0fd82Sopenharmony_ci * @param yPercent Indicates the percentage that represents the proportion of the view's y-coordinate 994a3e0fd82Sopenharmony_ci * to the parent view's y-coordinate, the decimal form of which ranges from 0 to 1. 995a3e0fd82Sopenharmony_ci * @param widthPercent Indicates the percentage that represents the proportion of the view's width 996a3e0fd82Sopenharmony_ci * to the parent view's width, the decimal form of which ranges from 0 to 1. 997a3e0fd82Sopenharmony_ci * @param heightPercent Indicates the percentage that represents the proportion of the view's height 998a3e0fd82Sopenharmony_ci * to the parent view's height, the decimal form of which ranges from 0 to 1. 999a3e0fd82Sopenharmony_ci * @since 5.0 1000a3e0fd82Sopenharmony_ci * @version 3.0 1001a3e0fd82Sopenharmony_ci */ 1002a3e0fd82Sopenharmony_ci virtual void SetPositionPercent(float xPercent, float yPercent, float widthPercent, float heightPercent); 1003a3e0fd82Sopenharmony_ci 1004a3e0fd82Sopenharmony_ci /** 1005a3e0fd82Sopenharmony_ci * @brief Checks whether the view is a container view. 1006a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if the view is a container view; returns <b>false</b> otherwise. 1007a3e0fd82Sopenharmony_ci * @since 1.0 1008a3e0fd82Sopenharmony_ci * @version 1.0 1009a3e0fd82Sopenharmony_ci */ 1010a3e0fd82Sopenharmony_ci bool IsViewGroup() const; 1011a3e0fd82Sopenharmony_ci 1012a3e0fd82Sopenharmony_ci /** 1013a3e0fd82Sopenharmony_ci * @brief Sets whether to intercept the input event. If intercepted, the view does not transfer the input event to 1014a3e0fd82Sopenharmony_ci * the parent view after local processing. 1015a3e0fd82Sopenharmony_ci * @param isIntercept Specifies whether to intercept the input event. Value <b>true</b> means to intercept the input 1016a3e0fd82Sopenharmony_ci * event, and <b>false</b> means the opposite. 1017a3e0fd82Sopenharmony_ci * @since 1.0 1018a3e0fd82Sopenharmony_ci * @version 1.0 1019a3e0fd82Sopenharmony_ci */ 1020a3e0fd82Sopenharmony_ci void SetIntercept(bool isIntercept); 1021a3e0fd82Sopenharmony_ci 1022a3e0fd82Sopenharmony_ci /** 1023a3e0fd82Sopenharmony_ci * @brief Gets whether to intercept the input event. If intercepted, the view does not transfer the input event to 1024a3e0fd82Sopenharmony_ci * the parent view after local processing. 1025a3e0fd82Sopenharmony_ci * @return Returns <b>true</b> if intercept the input event, and <b>false</b> means the opposite. 1026a3e0fd82Sopenharmony_ci * @since 1.0 1027a3e0fd82Sopenharmony_ci * @version 1.0 1028a3e0fd82Sopenharmony_ci */ 1029a3e0fd82Sopenharmony_ci bool IsIntercept(); 1030a3e0fd82Sopenharmony_ci 1031a3e0fd82Sopenharmony_ci /** 1032a3e0fd82Sopenharmony_ci * @brief Sets the affine transformation matrix. 1033a3e0fd82Sopenharmony_ci * @param transMap Indicates the transformation matrix. 1034a3e0fd82Sopenharmony_ci * @since 1.0 1035a3e0fd82Sopenharmony_ci * @version 1.0 1036a3e0fd82Sopenharmony_ci */ 1037a3e0fd82Sopenharmony_ci void SetTransformMap(const TransformMap& transMap); 1038a3e0fd82Sopenharmony_ci 1039a3e0fd82Sopenharmony_ci /** 1040a3e0fd82Sopenharmony_ci * @brief Obtains an affine transformation matrix. 1041a3e0fd82Sopenharmony_ci * @return Returns the transform matrix. 1042a3e0fd82Sopenharmony_ci * @since 1.0 1043a3e0fd82Sopenharmony_ci * @version 1.0 1044a3e0fd82Sopenharmony_ci */ 1045a3e0fd82Sopenharmony_ci TransformMap& GetTransformMap(); 1046a3e0fd82Sopenharmony_ci 1047a3e0fd82Sopenharmony_ci /** 1048a3e0fd82Sopenharmony_ci * @brief Obtains the child view of a specified ID. 1049a3e0fd82Sopenharmony_ci * @return Returns the pointer to the child view. 1050a3e0fd82Sopenharmony_ci * @since 1.0 1051a3e0fd82Sopenharmony_ci * @version 1.0 1052a3e0fd82Sopenharmony_ci */ 1053a3e0fd82Sopenharmony_ci virtual UIView* GetChildById(const char* id) const; 1054a3e0fd82Sopenharmony_ci 1055a3e0fd82Sopenharmony_ci /** 1056a3e0fd82Sopenharmony_ci * @brief Sets the view ID. 1057a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the view ID. 1058a3e0fd82Sopenharmony_ci * @since 1.0 1059a3e0fd82Sopenharmony_ci * @version 1.0 1060a3e0fd82Sopenharmony_ci */ 1061a3e0fd82Sopenharmony_ci void SetViewId(const char* id); 1062a3e0fd82Sopenharmony_ci 1063a3e0fd82Sopenharmony_ci /** 1064a3e0fd82Sopenharmony_ci * @brief Obtains the view ID. 1065a3e0fd82Sopenharmony_ci * @return Returns the pointer to the view ID. 1066a3e0fd82Sopenharmony_ci * @since 1.0 1067a3e0fd82Sopenharmony_ci * @version 1.0 1068a3e0fd82Sopenharmony_ci */ 1069a3e0fd82Sopenharmony_ci const char* GetViewId() const; 1070a3e0fd82Sopenharmony_ci 1071a3e0fd82Sopenharmony_ci /** 1072a3e0fd82Sopenharmony_ci * @brief Sets the view index. 1073a3e0fd82Sopenharmony_ci * @param index Indicates the view index to set. 1074a3e0fd82Sopenharmony_ci * @since 1.0 1075a3e0fd82Sopenharmony_ci * @version 1.0 1076a3e0fd82Sopenharmony_ci */ 1077a3e0fd82Sopenharmony_ci void SetViewIndex(int16_t index); 1078a3e0fd82Sopenharmony_ci 1079a3e0fd82Sopenharmony_ci /** 1080a3e0fd82Sopenharmony_ci * @brief Obtains the view index. 1081a3e0fd82Sopenharmony_ci * @return Returns the view index. 1082a3e0fd82Sopenharmony_ci * @since 1.0 1083a3e0fd82Sopenharmony_ci * @version 1.0 1084a3e0fd82Sopenharmony_ci */ 1085a3e0fd82Sopenharmony_ci int16_t GetViewIndex() const; 1086a3e0fd82Sopenharmony_ci 1087a3e0fd82Sopenharmony_ci /** 1088a3e0fd82Sopenharmony_ci * @brief Obtains the view type. 1089a3e0fd82Sopenharmony_ci * @return Returns the view type. 1090a3e0fd82Sopenharmony_ci * @since 1.0 1091a3e0fd82Sopenharmony_ci * @version 1.0 1092a3e0fd82Sopenharmony_ci */ 1093a3e0fd82Sopenharmony_ci virtual UIViewType GetViewType() const; 1094a3e0fd82Sopenharmony_ci 1095a3e0fd82Sopenharmony_ci /** 1096a3e0fd82Sopenharmony_ci * @brief Lays out all child views according to the preset arrangement mode. 1097a3e0fd82Sopenharmony_ci * @param needInvalidate Specifies whether to refresh the invalidated area after the layout is complete. 1098a3e0fd82Sopenharmony_ci * Value <b>true</b> means to refresh the invalidated area after the layout is complete, 1099a3e0fd82Sopenharmony_ci * and <b>false</b> means the opposite. 1100a3e0fd82Sopenharmony_ci * @since 1.0 1101a3e0fd82Sopenharmony_ci * @version 1.0 1102a3e0fd82Sopenharmony_ci */ 1103a3e0fd82Sopenharmony_ci virtual void LayoutChildren(bool neeInvalidate = false) {} 1104a3e0fd82Sopenharmony_ci 1105a3e0fd82Sopenharmony_ci /** 1106a3e0fd82Sopenharmony_ci * @brief Lays out the view in the center of the parent view. 1107a3e0fd82Sopenharmony_ci * @param xOffset Indicates the offset added to the x-axis after the view is placed. A positive number indicates 1108a3e0fd82Sopenharmony_ci * the offset to the right, and a negative number indicates the offset to the left. 1109a3e0fd82Sopenharmony_ci * @param yOffset Indicates the offset added to the y-axis after the view is placed. A positive number indicates 1110a3e0fd82Sopenharmony_ci * the offset to the bottom, and a negative number indicates the offset to the top. 1111a3e0fd82Sopenharmony_ci * @since 1.0 1112a3e0fd82Sopenharmony_ci * @version 1.0 1113a3e0fd82Sopenharmony_ci */ 1114a3e0fd82Sopenharmony_ci void LayoutCenterOfParent(int16_t xOffSet = 0, int16_t yOffset = 0); 1115a3e0fd82Sopenharmony_ci 1116a3e0fd82Sopenharmony_ci /** 1117a3e0fd82Sopenharmony_ci * @brief Lays out the view on the left of the parent view. 1118a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the x-axis after the view is placed. A positive number indicates 1119a3e0fd82Sopenharmony_ci * the offset to the right, and a negative number indicates the offset to the left. 1120a3e0fd82Sopenharmony_ci * @since 1.0 1121a3e0fd82Sopenharmony_ci * @version 1.0 1122a3e0fd82Sopenharmony_ci */ 1123a3e0fd82Sopenharmony_ci void LayoutLeftOfParent(int16_t offset = 0); 1124a3e0fd82Sopenharmony_ci 1125a3e0fd82Sopenharmony_ci /** 1126a3e0fd82Sopenharmony_ci * @brief Lays out the view on the right of the parent view. 1127a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the x-axis after the view is placed. A positive number indicates 1128a3e0fd82Sopenharmony_ci * the offset to the left, and a negative number indicates the offset to the right. 1129a3e0fd82Sopenharmony_ci * @since 1.0 1130a3e0fd82Sopenharmony_ci * @version 1.0 1131a3e0fd82Sopenharmony_ci */ 1132a3e0fd82Sopenharmony_ci void LayoutRightOfParent(int16_t offset = 0); 1133a3e0fd82Sopenharmony_ci 1134a3e0fd82Sopenharmony_ci /** 1135a3e0fd82Sopenharmony_ci * @brief Lays out the view on the top of the parent view. 1136a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the y-axis after the view is placed. A positive number indicates 1137a3e0fd82Sopenharmony_ci * the offset to the bottom, and a negative number indicates the offset to the top. 1138a3e0fd82Sopenharmony_ci * @since 1.0 1139a3e0fd82Sopenharmony_ci * @version 1.0 1140a3e0fd82Sopenharmony_ci */ 1141a3e0fd82Sopenharmony_ci void LayoutTopOfParent(int16_t offset = 0); 1142a3e0fd82Sopenharmony_ci 1143a3e0fd82Sopenharmony_ci /** 1144a3e0fd82Sopenharmony_ci * @brief Lays out the view on the bottom of the parent view. 1145a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the y-axis after the view is placed. A positive number indicates 1146a3e0fd82Sopenharmony_ci * the offset to the top, and a negative number indicates the offset to the bottom. 1147a3e0fd82Sopenharmony_ci * @since 1.0 1148a3e0fd82Sopenharmony_ci * @version 1.0 1149a3e0fd82Sopenharmony_ci */ 1150a3e0fd82Sopenharmony_ci void LayoutBottomOfParent(int16_t offset = 0); 1151a3e0fd82Sopenharmony_ci 1152a3e0fd82Sopenharmony_ci /** 1153a3e0fd82Sopenharmony_ci * @brief Aligns the view with the left of a sibling view. 1154a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1155a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the x-axis after the view is placed. A positive number indicates 1156a3e0fd82Sopenharmony_ci * the offset to the right, and a negative number indicates the offset to the left. 1157a3e0fd82Sopenharmony_ci * @since 1.0 1158a3e0fd82Sopenharmony_ci * @version 1.0 1159a3e0fd82Sopenharmony_ci */ 1160a3e0fd82Sopenharmony_ci void AlignLeftToSibling(const char* id, int16_t offset = 0); 1161a3e0fd82Sopenharmony_ci 1162a3e0fd82Sopenharmony_ci /** 1163a3e0fd82Sopenharmony_ci * @brief Aligns the view with the right of a sibling view. 1164a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1165a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the x-axis after the view is placed. A positive number indicates 1166a3e0fd82Sopenharmony_ci * the offset to the left, and a negative number indicates the offset to the right. 1167a3e0fd82Sopenharmony_ci * @since 1.0 1168a3e0fd82Sopenharmony_ci * @version 1.0 1169a3e0fd82Sopenharmony_ci */ 1170a3e0fd82Sopenharmony_ci void AlignRightToSibling(const char* id, int16_t offset = 0); 1171a3e0fd82Sopenharmony_ci 1172a3e0fd82Sopenharmony_ci /** 1173a3e0fd82Sopenharmony_ci * @brief Aligns the view with the top of a sibling view. 1174a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1175a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the y-axis after the view is placed. A positive number indicates 1176a3e0fd82Sopenharmony_ci * the offset to the bottom, and a negative number indicates the offset to the top. 1177a3e0fd82Sopenharmony_ci * @since 1.0 1178a3e0fd82Sopenharmony_ci * @version 1.0 1179a3e0fd82Sopenharmony_ci */ 1180a3e0fd82Sopenharmony_ci void AlignTopToSibling(const char* id, int16_t offset = 0); 1181a3e0fd82Sopenharmony_ci 1182a3e0fd82Sopenharmony_ci /** 1183a3e0fd82Sopenharmony_ci * @brief Aligns the view with the bottom of a sibling view. 1184a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1185a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the y-axis after the view is placed. A positive number indicates 1186a3e0fd82Sopenharmony_ci * the offset to the top, and a negative number indicates the offset to the bottom. 1187a3e0fd82Sopenharmony_ci * @since 1.0 1188a3e0fd82Sopenharmony_ci * @version 1.0 1189a3e0fd82Sopenharmony_ci */ 1190a3e0fd82Sopenharmony_ci void AlignBottomToSibling(const char* id, int16_t offset = 0); 1191a3e0fd82Sopenharmony_ci 1192a3e0fd82Sopenharmony_ci /** 1193a3e0fd82Sopenharmony_ci * @brief Aligns the view with the center of a sibling view in the x-axis. 1194a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1195a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the x-axis after the view is placed. A positive number indicates 1196a3e0fd82Sopenharmony_ci * the offset to the right, and a negative number indicates the offset to the left. 1197a3e0fd82Sopenharmony_ci * @since 1.0 1198a3e0fd82Sopenharmony_ci * @version 1.0 1199a3e0fd82Sopenharmony_ci */ 1200a3e0fd82Sopenharmony_ci void AlignHorCenterToSibling(const char* id, int16_t offset = 0); 1201a3e0fd82Sopenharmony_ci 1202a3e0fd82Sopenharmony_ci /** 1203a3e0fd82Sopenharmony_ci * @brief Aligns the view with the center of a sibling view in the y-axis. 1204a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1205a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the y-axis after the view is placed. A positive number indicates 1206a3e0fd82Sopenharmony_ci * the offset to the bottom, and a negative number indicates the offset to the top. 1207a3e0fd82Sopenharmony_ci * @since 1.0 1208a3e0fd82Sopenharmony_ci * @version 1.0 1209a3e0fd82Sopenharmony_ci */ 1210a3e0fd82Sopenharmony_ci void AlignVerCenterToSibling(const char* id, int16_t offset = 0); 1211a3e0fd82Sopenharmony_ci 1212a3e0fd82Sopenharmony_ci /** 1213a3e0fd82Sopenharmony_ci * @brief Lays out the view on the left of a sibling view. 1214a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1215a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the x-axis after the view is placed. A positive number indicates 1216a3e0fd82Sopenharmony_ci * the offset to the left, and a negative number indicates the offset to the right. 1217a3e0fd82Sopenharmony_ci * @since 1.0 1218a3e0fd82Sopenharmony_ci * @version 1.0 1219a3e0fd82Sopenharmony_ci */ 1220a3e0fd82Sopenharmony_ci void LayoutLeftToSibling(const char* id, int16_t offset = 0); 1221a3e0fd82Sopenharmony_ci 1222a3e0fd82Sopenharmony_ci /** 1223a3e0fd82Sopenharmony_ci * @brief Lays out the view on the right of a sibling view. 1224a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1225a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the x-axis after the view is placed. A positive number indicates 1226a3e0fd82Sopenharmony_ci * the offset to the right, and a negative number indicates the offset to the left. 1227a3e0fd82Sopenharmony_ci * @since 1.0 1228a3e0fd82Sopenharmony_ci * @version 1.0 1229a3e0fd82Sopenharmony_ci */ 1230a3e0fd82Sopenharmony_ci void LayoutRightToSibling(const char* id, int16_t offset = 0); 1231a3e0fd82Sopenharmony_ci 1232a3e0fd82Sopenharmony_ci /** 1233a3e0fd82Sopenharmony_ci * @brief Lays out the view on the above of a sibling view. 1234a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1235a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the y-axis after the view is placed. A positive number indicates 1236a3e0fd82Sopenharmony_ci * the offset to the top, and a negative number indicates the offset to the bottom. 1237a3e0fd82Sopenharmony_ci * @since 1.0 1238a3e0fd82Sopenharmony_ci * @version 1.0 1239a3e0fd82Sopenharmony_ci */ 1240a3e0fd82Sopenharmony_ci void LayoutTopToSibling(const char* id, int16_t offset = 0); 1241a3e0fd82Sopenharmony_ci 1242a3e0fd82Sopenharmony_ci /** 1243a3e0fd82Sopenharmony_ci * @brief Lays out the view on the below of a sibling view. 1244a3e0fd82Sopenharmony_ci * @param id Indicates the pointer to the ID of the sibling view. 1245a3e0fd82Sopenharmony_ci * @param offset Indicates the offset added to the y-axis after the view is placed. A positive number indicates 1246a3e0fd82Sopenharmony_ci * the offset to the bottom, and a negative number indicates the offset to the top. 1247a3e0fd82Sopenharmony_ci * @since 1.0 1248a3e0fd82Sopenharmony_ci * @version 1.0 1249a3e0fd82Sopenharmony_ci */ 1250a3e0fd82Sopenharmony_ci void LayoutBottomToSibling(const char* id, int16_t offset = 0); 1251a3e0fd82Sopenharmony_ci 1252a3e0fd82Sopenharmony_ci /** 1253a3e0fd82Sopenharmony_ci * @brief Sets the view style. 1254a3e0fd82Sopenharmony_ci * @param style Indicates the view style. 1255a3e0fd82Sopenharmony_ci * @since 1.0 1256a3e0fd82Sopenharmony_ci * @version 1.0 1257a3e0fd82Sopenharmony_ci */ 1258a3e0fd82Sopenharmony_ci virtual void SetStyle(Style& style); 1259a3e0fd82Sopenharmony_ci 1260a3e0fd82Sopenharmony_ci /** 1261a3e0fd82Sopenharmony_ci * @brief Sets a style. 1262a3e0fd82Sopenharmony_ci * 1263a3e0fd82Sopenharmony_ci * @param key Indicates the key of the style to set. 1264a3e0fd82Sopenharmony_ci * @param value Indicates the value matching the key. 1265a3e0fd82Sopenharmony_ci * @since 1.0 1266a3e0fd82Sopenharmony_ci * @version 1.0 1267a3e0fd82Sopenharmony_ci */ 1268a3e0fd82Sopenharmony_ci virtual void SetStyle(uint8_t key, int64_t value); 1269a3e0fd82Sopenharmony_ci 1270a3e0fd82Sopenharmony_ci /** 1271a3e0fd82Sopenharmony_ci * @brief Obtains the value of a style. 1272a3e0fd82Sopenharmony_ci * 1273a3e0fd82Sopenharmony_ci * @param key Indicates the key of the style. 1274a3e0fd82Sopenharmony_ci * @return Returns the value of the style. 1275a3e0fd82Sopenharmony_ci * @since 1.0 1276a3e0fd82Sopenharmony_ci * @version 1.0 1277a3e0fd82Sopenharmony_ci */ 1278a3e0fd82Sopenharmony_ci virtual int64_t GetStyle(uint8_t key) const; 1279a3e0fd82Sopenharmony_ci 1280a3e0fd82Sopenharmony_ci /** 1281a3e0fd82Sopenharmony_ci * @brief Obtains the view style. This function applies to scenarios where the style does not need to be modified, 1282a3e0fd82Sopenharmony_ci * which saves memory. 1283a3e0fd82Sopenharmony_ci * @return Returns the view style. 1284a3e0fd82Sopenharmony_ci * @since 1.0 1285a3e0fd82Sopenharmony_ci * @version 1.0 1286a3e0fd82Sopenharmony_ci */ 1287a3e0fd82Sopenharmony_ci const Style& GetStyleConst() const; 1288a3e0fd82Sopenharmony_ci 1289a3e0fd82Sopenharmony_ci /** 1290a3e0fd82Sopenharmony_ci * @brief Sets the opacity for the view. 1291a3e0fd82Sopenharmony_ci * 1292a3e0fd82Sopenharmony_ci * @param opaScale Indicates the opacity to set. 1293a3e0fd82Sopenharmony_ci * @since 1.0 1294a3e0fd82Sopenharmony_ci * @version 1.0 1295a3e0fd82Sopenharmony_ci */ 1296a3e0fd82Sopenharmony_ci void SetOpaScale(uint8_t opaScale); 1297a3e0fd82Sopenharmony_ci 1298a3e0fd82Sopenharmony_ci /** 1299a3e0fd82Sopenharmony_ci * @brief Obtains the view opacity. 1300a3e0fd82Sopenharmony_ci * 1301a3e0fd82Sopenharmony_ci * @return Returns the view opacity. 1302a3e0fd82Sopenharmony_ci * @since 1.0 1303a3e0fd82Sopenharmony_ci * @version 1.0 1304a3e0fd82Sopenharmony_ci */ 1305a3e0fd82Sopenharmony_ci uint8_t GetOpaScale() const; 1306a3e0fd82Sopenharmony_ci 1307a3e0fd82Sopenharmony_ci /** 1308a3e0fd82Sopenharmony_ci * @brief Obtains the extra message about a <b>UIView</b> instance. This field is ignored by the graphics 1309a3e0fd82Sopenharmony_ci * framework and can be anything you set. 1310a3e0fd82Sopenharmony_ci * 1311a3e0fd82Sopenharmony_ci * @return Returns the pointer to the extra message about the <b>UIView</b> instance. 1312a3e0fd82Sopenharmony_ci * @since 5.0 1313a3e0fd82Sopenharmony_ci * @version 3.0 1314a3e0fd82Sopenharmony_ci */ 1315a3e0fd82Sopenharmony_ci ViewExtraMsg* GetExtraMsg(); 1316a3e0fd82Sopenharmony_ci 1317a3e0fd82Sopenharmony_ci /** 1318a3e0fd82Sopenharmony_ci * @brief Sets the extra message about a <b>UIView</b> instance. This field is ignored by the graphics 1319a3e0fd82Sopenharmony_ci * framework and can be anything you set. 1320a3e0fd82Sopenharmony_ci * 1321a3e0fd82Sopenharmony_ci * @param extraMsg Indicates the extra message to set. 1322a3e0fd82Sopenharmony_ci * @since 5.0 1323a3e0fd82Sopenharmony_ci * @version 3.0 1324a3e0fd82Sopenharmony_ci */ 1325a3e0fd82Sopenharmony_ci void SetExtraMsg(ViewExtraMsg* extraMsg); 1326a3e0fd82Sopenharmony_ci 1327a3e0fd82Sopenharmony_ci /** 1328a3e0fd82Sopenharmony_ci * @brief Rotates the view in 2d. 1329a3e0fd82Sopenharmony_ci * @param angle Indicates the rotation angle. 1330a3e0fd82Sopenharmony_ci * @param pivot Indicates the coordinates of the rotation pivot. 1331a3e0fd82Sopenharmony_ci * @since 5.0 1332a3e0fd82Sopenharmony_ci * @version 3.0 1333a3e0fd82Sopenharmony_ci */ 1334a3e0fd82Sopenharmony_ci void Rotate(int16_t angle, const Vector2<float>& pivot); 1335a3e0fd82Sopenharmony_ci 1336a3e0fd82Sopenharmony_ci /** 1337a3e0fd82Sopenharmony_ci * @brief Rotates the view in 3d. 1338a3e0fd82Sopenharmony_ci * @param angle Indicates the rotation angle. 1339a3e0fd82Sopenharmony_ci * @param pivotStart Indicates the coordinates of the rotation start pivot. 1340a3e0fd82Sopenharmony_ci * @param pivotEnd Indicates the coordinates of the rotation end pivot. 1341a3e0fd82Sopenharmony_ci * @since 5.0 1342a3e0fd82Sopenharmony_ci * @version 3.0 1343a3e0fd82Sopenharmony_ci */ 1344a3e0fd82Sopenharmony_ci void Rotate(int16_t angle, const Vector3<float>& pivotStart, const Vector3<float>& pivotEnd); 1345a3e0fd82Sopenharmony_ci 1346a3e0fd82Sopenharmony_ci /** 1347a3e0fd82Sopenharmony_ci * @brief Scales the view in 2d. 1348a3e0fd82Sopenharmony_ci * 1349a3e0fd82Sopenharmony_ci * @param scale Indicates the scale factor on x- and y- axes. 1350a3e0fd82Sopenharmony_ci * @param pivot Indicates the scaling pivot. 1351a3e0fd82Sopenharmony_ci * @since 5.0 1352a3e0fd82Sopenharmony_ci * @version 3.0 1353a3e0fd82Sopenharmony_ci */ 1354a3e0fd82Sopenharmony_ci void Scale(const Vector2<float>& scale, const Vector2<float>& pivot); 1355a3e0fd82Sopenharmony_ci 1356a3e0fd82Sopenharmony_ci /** 1357a3e0fd82Sopenharmony_ci * @brief Scales the view in 3d. 1358a3e0fd82Sopenharmony_ci * 1359a3e0fd82Sopenharmony_ci * @param scale Indicates the scale factor on x- and y- axes. 1360a3e0fd82Sopenharmony_ci * @param pivot Indicates the scaling pivot. 1361a3e0fd82Sopenharmony_ci * @since 5.0 1362a3e0fd82Sopenharmony_ci * @version 3.0 1363a3e0fd82Sopenharmony_ci */ 1364a3e0fd82Sopenharmony_ci void Scale(const Vector3<float>& scale, const Vector3<float>& pivot); 1365a3e0fd82Sopenharmony_ci 1366a3e0fd82Sopenharmony_ci /** 1367a3e0fd82Sopenharmony_ci * @brief Shears the view in 3d. 1368a3e0fd82Sopenharmony_ci * 1369a3e0fd82Sopenharmony_ci * @param shearX Indicates the shear parameters around x- axes, 1370a3e0fd82Sopenharmony_ci * which means many it shears in y and z direction(current invalid). 1371a3e0fd82Sopenharmony_ci * @param shearY Indicates the shear parameters around y- axes, 1372a3e0fd82Sopenharmony_ci * which means many it shears in x and z direction(current invalid). 1373a3e0fd82Sopenharmony_ci * @param shaerZ Indicates the shear parameters around z- axes, 1374a3e0fd82Sopenharmony_ci * which means many it shears in x and y. 1375a3e0fd82Sopenharmony_ci * @since 5.0 1376a3e0fd82Sopenharmony_ci * @version 3.0 1377a3e0fd82Sopenharmony_ci */ 1378a3e0fd82Sopenharmony_ci void Shear(const Vector2<float>& shearX, const Vector2<float>& shearY, const Vector2<float>& shearZ); 1379a3e0fd82Sopenharmony_ci 1380a3e0fd82Sopenharmony_ci void Translate(const Vector2<int16_t>& trans); 1381a3e0fd82Sopenharmony_ci 1382a3e0fd82Sopenharmony_ci void Translate(const Vector3<int16_t>& trans); 1383a3e0fd82Sopenharmony_ci 1384a3e0fd82Sopenharmony_ci bool IsTransInvalid(); 1385a3e0fd82Sopenharmony_ci 1386a3e0fd82Sopenharmony_ci void SetCameraDistance(int16_t distance); 1387a3e0fd82Sopenharmony_ci 1388a3e0fd82Sopenharmony_ci void SetCameraPosition(const Vector2<float>& position); 1389a3e0fd82Sopenharmony_ci 1390a3e0fd82Sopenharmony_ci void ResetTransParameter(); 1391a3e0fd82Sopenharmony_ci 1392a3e0fd82Sopenharmony_ci#if ENABLE_ROTATE_INPUT 1393a3e0fd82Sopenharmony_ci /** 1394a3e0fd82Sopenharmony_ci * @brief Requests the focus on the view. 1395a3e0fd82Sopenharmony_ci * 1396a3e0fd82Sopenharmony_ci * @since 5.0 1397a3e0fd82Sopenharmony_ci * @version 3.0 1398a3e0fd82Sopenharmony_ci */ 1399a3e0fd82Sopenharmony_ci virtual void RequestFocus(); 1400a3e0fd82Sopenharmony_ci 1401a3e0fd82Sopenharmony_ci /** 1402a3e0fd82Sopenharmony_ci * @brief Clears the focus on the view. 1403a3e0fd82Sopenharmony_ci * 1404a3e0fd82Sopenharmony_ci * @since 5.0 1405a3e0fd82Sopenharmony_ci * @version 3.0 1406a3e0fd82Sopenharmony_ci */ 1407a3e0fd82Sopenharmony_ci virtual void ClearFocus(); 1408a3e0fd82Sopenharmony_ci#endif 1409a3e0fd82Sopenharmony_ci#if ENABLE_FOCUS_MANAGER 1410a3e0fd82Sopenharmony_ci /** 1411a3e0fd82Sopenharmony_ci * @brief 设置视图是否可获焦. 1412a3e0fd82Sopenharmony_ci * 1413a3e0fd82Sopenharmony_ci * @param focusable 是否可获焦. 1414a3e0fd82Sopenharmony_ci * @since 5.0 1415a3e0fd82Sopenharmony_ci * @version 3.0 1416a3e0fd82Sopenharmony_ci */ 1417a3e0fd82Sopenharmony_ci void SetFocusable(bool focusable); 1418a3e0fd82Sopenharmony_ci 1419a3e0fd82Sopenharmony_ci /** 1420a3e0fd82Sopenharmony_ci * @brief 获取视图是否可获焦. 1421a3e0fd82Sopenharmony_ci * 1422a3e0fd82Sopenharmony_ci * @return 是否可获焦. 1423a3e0fd82Sopenharmony_ci * @since 5.0 1424a3e0fd82Sopenharmony_ci * @version 3.0 1425a3e0fd82Sopenharmony_ci */ 1426a3e0fd82Sopenharmony_ci bool IsFocusable() const; 1427a3e0fd82Sopenharmony_ci 1428a3e0fd82Sopenharmony_ci /** 1429a3e0fd82Sopenharmony_ci * @brief 组件获焦响应 1430a3e0fd82Sopenharmony_ci * 1431a3e0fd82Sopenharmony_ci * @since 5.0 1432a3e0fd82Sopenharmony_ci * @version 3.0 1433a3e0fd82Sopenharmony_ci */ 1434a3e0fd82Sopenharmony_ci virtual void Focus(); 1435a3e0fd82Sopenharmony_ci 1436a3e0fd82Sopenharmony_ci /** 1437a3e0fd82Sopenharmony_ci * @brief 组件失焦响应 1438a3e0fd82Sopenharmony_ci * 1439a3e0fd82Sopenharmony_ci * @since 5.0 1440a3e0fd82Sopenharmony_ci * @version 3.0 1441a3e0fd82Sopenharmony_ci */ 1442a3e0fd82Sopenharmony_ci virtual void Blur(); 1443a3e0fd82Sopenharmony_ci 1444a3e0fd82Sopenharmony_ci /** 1445a3e0fd82Sopenharmony_ci * @brief 焦点改变事件监听类,开发者需要向视图组件注册该类实现事件的监听. 1446a3e0fd82Sopenharmony_ci * 1447a3e0fd82Sopenharmony_ci * @since 5.0 1448a3e0fd82Sopenharmony_ci * @version 3.0 1449a3e0fd82Sopenharmony_ci */ 1450a3e0fd82Sopenharmony_ci class OnFocusListener : public HeapBase { 1451a3e0fd82Sopenharmony_ci public: 1452a3e0fd82Sopenharmony_ci /** 1453a3e0fd82Sopenharmony_ci * @brief 回调函数,视图获焦时触发. 1454a3e0fd82Sopenharmony_ci * @param view 获焦的视图 1455a3e0fd82Sopenharmony_ci * @since 5.0 1456a3e0fd82Sopenharmony_ci * @version 3.0 1457a3e0fd82Sopenharmony_ci */ 1458a3e0fd82Sopenharmony_ci virtual bool OnFocus(UIView& view) 1459a3e0fd82Sopenharmony_ci { 1460a3e0fd82Sopenharmony_ci return false; 1461a3e0fd82Sopenharmony_ci } 1462a3e0fd82Sopenharmony_ci 1463a3e0fd82Sopenharmony_ci /** 1464a3e0fd82Sopenharmony_ci * @brief 回调函数,视图失焦时触发. 1465a3e0fd82Sopenharmony_ci * @param view 失焦的视图 1466a3e0fd82Sopenharmony_ci * @since 5.0 1467a3e0fd82Sopenharmony_ci * @version 3.0 1468a3e0fd82Sopenharmony_ci */ 1469a3e0fd82Sopenharmony_ci virtual bool OnBlur(UIView& view) 1470a3e0fd82Sopenharmony_ci { 1471a3e0fd82Sopenharmony_ci return false; 1472a3e0fd82Sopenharmony_ci } 1473a3e0fd82Sopenharmony_ci 1474a3e0fd82Sopenharmony_ci /** 1475a3e0fd82Sopenharmony_ci * @brief 析构函数. 1476a3e0fd82Sopenharmony_ci * @since 5.0 1477a3e0fd82Sopenharmony_ci * @version 3.0 1478a3e0fd82Sopenharmony_ci */ 1479a3e0fd82Sopenharmony_ci virtual ~OnFocusListener() {} 1480a3e0fd82Sopenharmony_ci }; 1481a3e0fd82Sopenharmony_ci 1482a3e0fd82Sopenharmony_ci /** 1483a3e0fd82Sopenharmony_ci * @brief 设置当前视图焦点改变事件监听者. 1484a3e0fd82Sopenharmony_ci * @param onFocusListener 焦点改变事件监听者. 1485a3e0fd82Sopenharmony_ci * @since 5.0 1486a3e0fd82Sopenharmony_ci * @version 3.0 1487a3e0fd82Sopenharmony_ci */ 1488a3e0fd82Sopenharmony_ci void SetOnFocusListener(OnFocusListener* onFocusListener); 1489a3e0fd82Sopenharmony_ci 1490a3e0fd82Sopenharmony_ci /** 1491a3e0fd82Sopenharmony_ci * @brief 获取当前视图焦点改变事件监听者. 1492a3e0fd82Sopenharmony_ci * @return 焦点改变事件监听者. 1493a3e0fd82Sopenharmony_ci * @since 5.0 1494a3e0fd82Sopenharmony_ci * @version 3.0 1495a3e0fd82Sopenharmony_ci */ 1496a3e0fd82Sopenharmony_ci OnFocusListener* GetOnFocusListener() const; 1497a3e0fd82Sopenharmony_ci#endif 1498a3e0fd82Sopenharmony_ci 1499a3e0fd82Sopenharmony_ci /** 1500a3e0fd82Sopenharmony_ci * @brief 获取当前视图的bitmap截图.请注意该接口会申请内存,请在需要释放时使用{@link ImageCacheFree()}接口. 1501a3e0fd82Sopenharmony_ci * @param info bitmap存储对象,获取的截图将被存到该引用中. 1502a3e0fd82Sopenharmony_ci * @param colorMode 截图格式,默认状态下为带透明度的ARGB8888. 1503a3e0fd82Sopenharmony_ci * @return bitmap是否获取成功. 1504a3e0fd82Sopenharmony_ci * @since 5.0 1505a3e0fd82Sopenharmony_ci * @version 3.0 1506a3e0fd82Sopenharmony_ci */ 1507a3e0fd82Sopenharmony_ci bool GetBitmap(ImageInfo& bitmap, ColorMode colorMode = ARGB8888); 1508a3e0fd82Sopenharmony_ci 1509a3e0fd82Sopenharmony_ci bool IsOnViewTree(); 1510a3e0fd82Sopenharmony_ci 1511a3e0fd82Sopenharmony_ci /** 1512a3e0fd82Sopenharmony_ci * @brief Set view zIndex order 1513a3e0fd82Sopenharmony_ci * @param zIndex specifies the stack order of an view. The default is zero. 1514a3e0fd82Sopenharmony_ci * The greater order is in front of the lower order. 1515a3e0fd82Sopenharmony_ci */ 1516a3e0fd82Sopenharmony_ci void SetZIndex(int16_t zIndex); 1517a3e0fd82Sopenharmony_ci 1518a3e0fd82Sopenharmony_ci /** 1519a3e0fd82Sopenharmony_ci * @brief Get zIndex value of the view 1520a3e0fd82Sopenharmony_ci * @return the zIndex order value 1521a3e0fd82Sopenharmony_ci */ 1522a3e0fd82Sopenharmony_ci int16_t GetZIndex(); 1523a3e0fd82Sopenharmony_ci 1524a3e0fd82Sopenharmony_ci /** 1525a3e0fd82Sopenharmony_ci * @brief Sets the next render sibling view for the view. 1526a3e0fd82Sopenharmony_ci * @param sibling Indicates the pointer to the next render sibling view to set. 1527a3e0fd82Sopenharmony_ci */ 1528a3e0fd82Sopenharmony_ci void SetNextRenderSibling(UIView* renderSibling); 1529a3e0fd82Sopenharmony_ci 1530a3e0fd82Sopenharmony_ci /** 1531a3e0fd82Sopenharmony_ci * @brief Obtains the next render sibling view of the view. 1532a3e0fd82Sopenharmony_ci * @return Returns the pointer to the next render sibling view. 1533a3e0fd82Sopenharmony_ci */ 1534a3e0fd82Sopenharmony_ci UIView* GetNextRenderSibling() const; 1535a3e0fd82Sopenharmony_ci 1536a3e0fd82Sopenharmony_ciprotected: 1537a3e0fd82Sopenharmony_ci bool touchable_ : 1; 1538a3e0fd82Sopenharmony_ci bool visible_ : 1; 1539a3e0fd82Sopenharmony_ci bool draggable_ : 1; 1540a3e0fd82Sopenharmony_ci bool dragParentInstead_ : 1; 1541a3e0fd82Sopenharmony_ci bool isViewGroup_ : 1; 1542a3e0fd82Sopenharmony_ci bool needRedraw_ : 1; 1543a3e0fd82Sopenharmony_ci bool styleAllocFlag_ : 1; 1544a3e0fd82Sopenharmony_ci bool isIntercept_ : 1; 1545a3e0fd82Sopenharmony_ci#if ENABLE_FOCUS_MANAGER 1546a3e0fd82Sopenharmony_ci bool focusable_ : 1; 1547a3e0fd82Sopenharmony_ci#endif 1548a3e0fd82Sopenharmony_ci uint8_t opaScale_; 1549a3e0fd82Sopenharmony_ci int16_t index_; 1550a3e0fd82Sopenharmony_ci int16_t zIndex_; 1551a3e0fd82Sopenharmony_ci const char* id_; 1552a3e0fd82Sopenharmony_ci UIView* parent_; 1553a3e0fd82Sopenharmony_ci UIView* nextSibling_; 1554a3e0fd82Sopenharmony_ci UIView* nextRenderSibling_; 1555a3e0fd82Sopenharmony_ci Style* style_; 1556a3e0fd82Sopenharmony_ci TransformMap* transMap_; 1557a3e0fd82Sopenharmony_ci OnClickListener* onClickListener_; 1558a3e0fd82Sopenharmony_ci OnLongPressListener* onLongPressListener_; 1559a3e0fd82Sopenharmony_ci OnDragListener* onDragListener_; 1560a3e0fd82Sopenharmony_ci OnTouchListener* onTouchListener_; 1561a3e0fd82Sopenharmony_ci#if ENABLE_FOCUS_MANAGER 1562a3e0fd82Sopenharmony_ci OnFocusListener* onFocusListener_; 1563a3e0fd82Sopenharmony_ci#endif 1564a3e0fd82Sopenharmony_ci#if ENABLE_ROTATE_INPUT 1565a3e0fd82Sopenharmony_ci OnRotateListener* onRotateListener_; 1566a3e0fd82Sopenharmony_ci#endif 1567a3e0fd82Sopenharmony_ci ViewExtraMsg* viewExtraMsg_; 1568a3e0fd82Sopenharmony_ci 1569a3e0fd82Sopenharmony_ci uint8_t GetMixOpaScale() const; 1570a3e0fd82Sopenharmony_ci bool IsInvalid(float percent); 1571a3e0fd82Sopenharmony_ci void DrawViewBounds(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea); 1572a3e0fd82Sopenharmony_ci void UpdateRectInfo(uint8_t key, const Rect& rect); 1573a3e0fd82Sopenharmony_ci 1574a3e0fd82Sopenharmony_ciprivate: 1575a3e0fd82Sopenharmony_ci Rect rect_; 1576a3e0fd82Sopenharmony_ci Rect* visibleRect_; 1577a3e0fd82Sopenharmony_ci void SetupThemeStyles(); 1578a3e0fd82Sopenharmony_ci}; 1579a3e0fd82Sopenharmony_ci} // namespace OHOS 1580a3e0fd82Sopenharmony_ci#endif // GRAPHIC_LITE_UI_VIEW_H 1581