OHOS::UISwipeView

    Graphic

    Description:

    Represents a swipe view.

    Each swipe view consists of multiple child views, which can be navigated through swiping. The child views can be either horizontal or vertical.

    Since:

    1.0

    Version:

    1.0

    Summary

    Public Member Functions

    Public Member Function Name

    Description

    (uint8_t direction=HORIZONTAL)

     

    A constructor used to create a instance.

    ~UISwipeView ()

    virtual 

    A destructor used to delete the instance.

    GetViewType () const override

    UIViewType 

    Obtains the component type.

    (uint8_t direction)

    void 

    Sets the dragging direction.

    GetDirection () const

    uint8_t 

    Obtains the dragging direction.

    (UIView view) override

    void 

    Adds a view.

    (UIView prevView, insertView) override

    void 

    Inserts a view.

    Remove ( view) override

    virtual void 

    Deletes a view.

    SetCurrentPage (uint16_t , bool needAnimator=false)

    void 

    Sets the index for the current tab.

    GetCurrentPage () const

    uint16_t 

    Obtains the current tab index.

    () const

    UIView  

    Obtains the current view.

    (uint16_t size)

    void 

    Sets a blank size, as defined in DEFAULT_BLANK_SIZE.

    (const DragEvent &event) override

    bool 

    revice drag event, Switch to specified view when drag

    (const DragEvent &event) override

    bool 

    Called when the view stops dragging.

    (uint16_t time)

    void 

    Sets the time for the page being animated. The page will go beyond the blank during this time.

    (bool loop)

    void 

    Sets whether the swipe view supports a cycle swipe.

    GetViewByIndex (uint16_t ) const

    UIView  

    Obtains a view based on its index.

    ()

    OnSwipeListener

    Obtains the listener set for swipe events.

    (OnSwipeListener onSwipeListener)

    void 

    Sets the listener that contains a callback to be invoked upon a swipe event.

    ()

     

    A constructor used to create a UIAbstractScroll instance.

    ()

    virtual 

    A destructor used to delete the UIAbstractScroll instance.

    () const

    uint8_t 

    Obtains the scroll direction.

    SetScrollBlankSize (uint16_t size)

    void 

    Sets the blank size for this scroll view.

    (uint16_t distance)

    void 

    Sets the maximum scroll distance after a finger lifts the screen.

    SetReboundSize (uint16_t size)

    void 

    Sets the rebound size, which is the distance a knob moves after being released when it reaches the end of a scrollbar.

    () const

    uint16_t 

    Obtains the maximum scroll distance after a finger lifts the screen.

    SetDragFunc (EasingFunc func)

    void 

    Sets the easing function that specifies a scroll animation after a finger lifts the screen.

    (bool throwDrag)

    void 

    Sets whether to continue scrolling after a finger lifts the screen.

    SetDragACCLevel (uint16_t value)

    void 

    Sets the drag acceleration.

    () const

    uint8_t 

    Obtains the drag acceleration.

    SetSwipeACCLevel (uint16_t value)

    void 

    Sets the compensation distance after a finger lifts the screen.

    () const

    uint8_t 

    Obtains the compensation distance after a finger lifts the screen.

    UIViewGroup ()

     

    A default constructor used to create a instance.

    ~UIViewGroup ()

    virtual 

    A destructor used to delete the instance.

    GetViewType () const override

    UIViewType 

    Obtains the view type.

    ()

    virtual void 

    Removes all child views.

    GetTargetView (const &point, UIView *last) override

    virtual void 

    Obtains the target child view that is visible and can respond to touch events based on given coordinates.

    () const

    UIView  

    Obtains the first child view in this view group.

    () const

    UIView  

    Obtains the last child view in this view group.

    (bool flag)

    void 

    Sets whether this view group is intercepted upon touch events.

    GetChildById (const char id) const override

     

    Obtains the target child view with a specified ID.

    SetAutoSize (bool state)

    void 

    Sets whether the size of this view group is adaptive to that of all child views.

    ()

     

    UIView (const char id)

     

    A constructor used to create an instance.

    ~UIView ()

    virtual 

    A destructor used to delete the instance.

    OnPreDraw (const &invalidatedArea)

    virtual bool 

    Called before a view is drawn. This function is used to check whether the parent view of this view needs to be redrawn so as to optimize the drawing process.

    OnDraw (const &invalidatedArea)

    virtual void 

    Called when a view is drawn.

    OnPostDraw (const &invalidatedArea)

    virtual void 

    Called after a view is drawn.

    ReMeasure ()

    virtual void 

    Remeasures the view size.

    ()

    void 

    Refreshes the invalidated area of the view.

    InvalidateRect (const &invalidatedArea)

    void 

    Refreshes a view in a specified invalidated area.

    OnLongPressEvent (const &event)

    virtual bool 

    Called when the view is long pressed.

    OnDragStartEvent (const &event)

    virtual bool 

    Called when the view starts to drag.

    OnClickEvent (const &event)

    virtual void 

    Called when the view is clicked.

    OnPressEvent (const &event)

    virtual void 

    Called when the view is pressed.

    OnReleaseEvent (const &event)

    virtual void 

    Called when the view is released.

    OnCancelEvent (const &event)

    virtual void 

    Called when a click event on the view is canceled.

    SetOnDragListener ( onDragListener)

    void 

    Sets a drag event listener for the view.

    GetOnDragListener ()

    Obtains the drag event listener for the view.

    SetOnClickListener ( onClickListener)

    void 

    Sets a click event listener for the view.

    GetOnClickListener ()

    Obtains the click event listener for the view.

    SetOnLongPressListener ( onLongPressListener)

    void 

    Sets a long-press event listener for the view.

    GetOnLongPressListener ()

    Obtains the long-press event listener for the view.

    SetOnTouchListener ( onTouchListener)

    void 

    Sets a touch event listener for the view.

    GetTouchListener ()

    Obtains the touch event listener for the view.

    SetParent ( parent)

    void 

    Sets the parent view for the view.

    GetParent () const

     

    Obtains the parent view of the view.

    SetNextSibling ( sibling)

    void 

    Sets the next sibling view for the view.

    GetNextSibling () const

     

    Obtains the next sibling view of the view.

    SetVisible (bool visible)

    virtual void 

    Sets whether the view is visible.

    () const

    bool 

    Checks whether the view is visible.

    SetTouchable (bool touch)

    void 

    Sets whether the view is touchable.

    () const

    bool 

    Checks whether the view is touchable.

    SetDraggable (bool draggable)

    void 

    Sets whether the view is draggable.

    () const

    bool 

    Checks whether the view is draggable.

    SetDragParentInstead (bool dragParentInstead)

    void 

    Sets whether to transfer the drag event to the parent view for processing when the view is being dragged.

    () const

    bool 

    Obtains whether the view transfers a drag event to the parent view for processing.

    GetRect () const

     

    Obtains the absolute rectangle area of the view. When the view has deformation such as rotation, the rectangle area is the intersection set of the absolute rectangle area and deformation matrix.

    GetVisibleRect () const

     

    Obtains the visible absolute rectangle area of the view.

    GetMaskedRect () const

     

    Obtains the valid absolute rectangle area of the view. The valid area refers to the area where the view can be displayed. Generally, the valid area is the same as the visible view area, but they may be different in the grid layout.

    GetOrigRect () const

     

    Obtains the absolute rectangle area of the view.

    GetContentRect ()

    virtual  

    Obtains the content of the absolute rectangle area of the view. This area excludes padding.

    GetRelativeRect () const

     

    Obtains the rectangular area of the view relative to the parent view, that is, the rectangular area relative to the coordinates of the parent view.

    ResizeVisibleArea (int16_t x, int16_t y, int16_t width, int16_t height)

    void 

    Adjusts the size of the visible area. This operation may affect the final display size.

    (int16_t width)

    virtual void 

    Sets the width for the view.

    GetWidth ()

    virtual int16_t 

    Obtains the width for the view.

    (int16_t height)

    virtual void 

    Sets the height for the view.

    GetHeight ()

    virtual int16_t 

    Obtains the height for the view.

    (int16_t width, int16_t height)

    virtual void 

    Adjusts the size of the view.

    SetX (int16_t x)

    virtual void 

    Sets the x-coordinate for the view.

    () const

    int16_t 

    Obtains the x-coordinate for the view.

    virtual void 

    Sets the y-coordinate for the view.

    GetY () const

    int16_t 

    Obtains the y-coordinate for the view.

    (int16_t x, int16_t y)

    virtual void 

    Sets the position for the view.

    SetPosition (int16_t x, int16_t y, int16_t width, int16_t height)

    virtual void 

    Adjusts the position and size of the view.

    () const

    bool 

    Checks whether the view is a container view.

    SetIntercept (bool isIntercept)

    void 

    Sets whether to intercept the drag event. If intercepted, the view does not transfer the drag event to the parent view after local processing.

    (const TransformMap &transMap)

    void 

    Sets the affine transformation matrix.

    ()

    TransformMap

    Obtains an affine transformation matrix.

    (const char id)

    void 

    Sets the view ID.

    GetViewId () const

    const char  

    Obtains the view ID.

    (int16_t index)

    void 

    Sets the view index.

    () const

    int16_t 

    Obtains the view index.

    LayoutChildren (bool neeInvalidate=false)

    virtual void 

    Lays out all child views according to the preset arrangement mode.

    (int16_t xOffSet=0, int16_t yOffset=0)

    void 

    Lays out the view in the center of the parent view.

    LayoutLeftOfParent (int16_t offset=0)

    void 

    Lays out the view on the left of the parent view.

    (int16_t offset=0)

    void 

    Lays out the view on the right of the parent view.

    LayoutTopOfParent (int16_t offset=0)

    void 

    Lays out the view on the top of the parent view.

    (int16_t offset=0)

    void 

    Lays out the view on the bottom of the parent view.

    AlignLeftToSibling (const char id, int16_t offset=0)

    void 

    Aligns the view with the left of a sibling view.

    (const char id, int16_t offset=0)

    void 

    Aligns the view with the right of a sibling view.

    AlignTopToSibling (const char id, int16_t offset=0)

    void 

    Aligns the view with the top of a sibling view.

    (const char id, int16_t offset=0)

    void 

    Aligns the view with the bottom of a sibling view.

    AlignHorCenterToSibling (const char id, int16_t offset=0)

    void 

    Aligns the view with the center of a sibling view in the x-axis.

    (const char id, int16_t offset=0)

    void 

    Aligns the view with the center of a sibling view in the y-axis.

    LayoutLeftToSibling (const char id, int16_t offset=0)

    void 

    Lays out the view on the left of a sibling view.

    (const char id, int16_t offset=0)

    void 

    Lays out the view on the right of a sibling view.

    LayoutTopToSibling (const char id, int16_t offset=0)

    void 

    Lays out the view on the above of a sibling view.

    (const char id, int16_t offset=0)

    void 

    Lays out the view on the below of a sibling view.

    SetStyle ( &style)

    virtual void 

    Sets the view style.

    SetStyle (uint8_t key, int64_t value)

    virtual void 

    Sets a style.

    (uint8_t key) const

    virtual int64_t 

    Obtains the value of a style.

    GetStyleConst () const

    const & 

    Obtains the view style. This function applies to scenarios where the style does not need to be modified, which saves memory.

    operator new (size_t size)

    void  

    Overrides the new function.

    (void p)

    void 

    Overrides the delete function.

    Protected Member Functions

    Protected Member Function Name

    Description

    (int16_t xOffset, int16_t yOffset) override

    void 

    Moves the position of all child views.

    GetAllChildRelativeRect () const

     

    Obtains the rectangle area of a new view group after being adaptive to the size of all child views.

    OnChildChanged ()

    virtual void 

    Performs operations needed after a child view is added or removed.

    Additional Inherited Members

    Additional Inherited Member Name

    Description

    childrenHead

    Indicates the pointer to the first child view of this view group.

    Indicates the pointer to the last child view of this view group.

    childrenNum

    Represents the number of child views.

    Specifies the sliding state of this view group.

    disallowIntercept

    Specifies whether this view group is intercepted upon touch events.

    Specifies whether the size of this view group is adaptive to that of all child views.