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_swipe_view.h
28a3e0fd82Sopenharmony_ci *
29a3e0fd82Sopenharmony_ci * @brief Defines the attributes and common functions of a swipe view.
30a3e0fd82Sopenharmony_ci *
31a3e0fd82Sopenharmony_ci * Each swipe view consists of multiple child views, which can be navigated through swiping. The child views can be
32a3e0fd82Sopenharmony_ci * either horizontal or vertical.
33a3e0fd82Sopenharmony_ci *
34a3e0fd82Sopenharmony_ci * @since 1.0
35a3e0fd82Sopenharmony_ci * @version 1.0
36a3e0fd82Sopenharmony_ci */
37a3e0fd82Sopenharmony_ci
38a3e0fd82Sopenharmony_ci#ifndef GRAPHIC_LITE_UI_SWIPE_VIEW_H
39a3e0fd82Sopenharmony_ci#define GRAPHIC_LITE_UI_SWIPE_VIEW_H
40a3e0fd82Sopenharmony_ci
41a3e0fd82Sopenharmony_ci#include "animator/animator.h"
42a3e0fd82Sopenharmony_ci#include "components/ui_abstract_scroll.h"
43a3e0fd82Sopenharmony_ci
44a3e0fd82Sopenharmony_cinamespace OHOS {
45a3e0fd82Sopenharmony_ci/**
46a3e0fd82Sopenharmony_ci * @brief Represents a swipe view.
47a3e0fd82Sopenharmony_ci *
48a3e0fd82Sopenharmony_ci * Each swipe view consists of multiple child views, which can be navigated through swiping. The child views can be
49a3e0fd82Sopenharmony_ci * either horizontal or vertical.
50a3e0fd82Sopenharmony_ci *
51a3e0fd82Sopenharmony_ci * @see UIAbstractScroll
52a3e0fd82Sopenharmony_ci * @since 1.0
53a3e0fd82Sopenharmony_ci * @version 1.0
54a3e0fd82Sopenharmony_ci */
55a3e0fd82Sopenharmony_ciclass UISwipeView : public UIAbstractScroll {
56a3e0fd82Sopenharmony_cipublic:
57a3e0fd82Sopenharmony_ci    /**
58a3e0fd82Sopenharmony_ci     * @brief Represents a listener for changes of the swipe view.
59a3e0fd82Sopenharmony_ci     *
60a3e0fd82Sopenharmony_ci     * This is an inner class of <b>UISwipeView</b>. It contains a callback function to be invoked when the swipe view
61a3e0fd82Sopenharmony_ci     * state changes.
62a3e0fd82Sopenharmony_ci     *
63a3e0fd82Sopenharmony_ci     * @since 1.0
64a3e0fd82Sopenharmony_ci     * @version 1.0
65a3e0fd82Sopenharmony_ci     */
66a3e0fd82Sopenharmony_ci    class OnSwipeListener : public HeapBase {
67a3e0fd82Sopenharmony_ci    public:
68a3e0fd82Sopenharmony_ci        virtual void OnSwipe(UISwipeView& view) = 0;
69a3e0fd82Sopenharmony_ci        virtual ~OnSwipeListener() {}
70a3e0fd82Sopenharmony_ci    };
71a3e0fd82Sopenharmony_ci
72a3e0fd82Sopenharmony_ci    enum AlignMode : uint8_t { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT };
73a3e0fd82Sopenharmony_ci
74a3e0fd82Sopenharmony_ci    /**
75a3e0fd82Sopenharmony_ci     * @brief A constructor used to create a <b>UISwipeView</b> instance.
76a3e0fd82Sopenharmony_ci     *
77a3e0fd82Sopenharmony_ci     * @since 1.0
78a3e0fd82Sopenharmony_ci     * @version 1.0
79a3e0fd82Sopenharmony_ci     */
80a3e0fd82Sopenharmony_ci    UISwipeView(uint8_t direction = HORIZONTAL);
81a3e0fd82Sopenharmony_ci
82a3e0fd82Sopenharmony_ci    /**
83a3e0fd82Sopenharmony_ci     * @brief A destructor used to delete the <b>UISwipeView</b> instance.
84a3e0fd82Sopenharmony_ci     *
85a3e0fd82Sopenharmony_ci     * @since 1.0
86a3e0fd82Sopenharmony_ci     * @version 1.0
87a3e0fd82Sopenharmony_ci     */
88a3e0fd82Sopenharmony_ci    virtual ~UISwipeView();
89a3e0fd82Sopenharmony_ci
90a3e0fd82Sopenharmony_ci    /**
91a3e0fd82Sopenharmony_ci     * @brief Obtains the component type.
92a3e0fd82Sopenharmony_ci     *
93a3e0fd82Sopenharmony_ci     * @return Returns the component type, as defined in {@link UIViewType}.
94a3e0fd82Sopenharmony_ci     * @since 1.0
95a3e0fd82Sopenharmony_ci     * @version 1.0
96a3e0fd82Sopenharmony_ci     */
97a3e0fd82Sopenharmony_ci    UIViewType GetViewType() const override
98a3e0fd82Sopenharmony_ci    {
99a3e0fd82Sopenharmony_ci        return UI_SWIPE_VIEW;
100a3e0fd82Sopenharmony_ci    }
101a3e0fd82Sopenharmony_ci
102a3e0fd82Sopenharmony_ci    /**
103a3e0fd82Sopenharmony_ci     * @brief Sets the dragging direction.
104a3e0fd82Sopenharmony_ci     *
105a3e0fd82Sopenharmony_ci     * @param direction Indicates the dragging direction, either {@link HORIZONTAL} or {@link VERTICAL}.
106a3e0fd82Sopenharmony_ci     * @since 1.0
107a3e0fd82Sopenharmony_ci     * @version 1.0
108a3e0fd82Sopenharmony_ci     */
109a3e0fd82Sopenharmony_ci    void SetDirection(uint8_t direction)
110a3e0fd82Sopenharmony_ci    {
111a3e0fd82Sopenharmony_ci        direction_ = direction;
112a3e0fd82Sopenharmony_ci    }
113a3e0fd82Sopenharmony_ci
114a3e0fd82Sopenharmony_ci    /**
115a3e0fd82Sopenharmony_ci     * @brief Obtains the dragging direction.
116a3e0fd82Sopenharmony_ci     *
117a3e0fd82Sopenharmony_ci     * @return Returns the dragging direction.
118a3e0fd82Sopenharmony_ci     * @since 1.0
119a3e0fd82Sopenharmony_ci     * @version 1.0
120a3e0fd82Sopenharmony_ci     */
121a3e0fd82Sopenharmony_ci    uint8_t GetDirection() const
122a3e0fd82Sopenharmony_ci    {
123a3e0fd82Sopenharmony_ci        return direction_;
124a3e0fd82Sopenharmony_ci    }
125a3e0fd82Sopenharmony_ci
126a3e0fd82Sopenharmony_ci    /**
127a3e0fd82Sopenharmony_ci     * @brief Adds a view.
128a3e0fd82Sopenharmony_ci     *
129a3e0fd82Sopenharmony_ci     * @param view Indicates the view to add.
130a3e0fd82Sopenharmony_ci     * @since 1.0
131a3e0fd82Sopenharmony_ci     * @version 1.0
132a3e0fd82Sopenharmony_ci     */
133a3e0fd82Sopenharmony_ci    void Add(UIView* view) override;
134a3e0fd82Sopenharmony_ci
135a3e0fd82Sopenharmony_ci    /**
136a3e0fd82Sopenharmony_ci     * @brief Inserts a view.
137a3e0fd82Sopenharmony_ci     *
138a3e0fd82Sopenharmony_ci     * @param prevView Indicates the previous view.
139a3e0fd82Sopenharmony_ci     * @param insertView Indicates the view to insert.
140a3e0fd82Sopenharmony_ci     * @since 1.0
141a3e0fd82Sopenharmony_ci     * @version 1.0
142a3e0fd82Sopenharmony_ci     */
143a3e0fd82Sopenharmony_ci    void Insert(UIView* prevView, UIView* insertView) override;
144a3e0fd82Sopenharmony_ci
145a3e0fd82Sopenharmony_ci    /**
146a3e0fd82Sopenharmony_ci     * @brief Deletes a view.
147a3e0fd82Sopenharmony_ci     *
148a3e0fd82Sopenharmony_ci     * @param view Indicates the view to delete.
149a3e0fd82Sopenharmony_ci     * @since 1.0
150a3e0fd82Sopenharmony_ci     * @version 1.0
151a3e0fd82Sopenharmony_ci     */
152a3e0fd82Sopenharmony_ci    void Remove(UIView* view) override;
153a3e0fd82Sopenharmony_ci
154a3e0fd82Sopenharmony_ci    /**
155a3e0fd82Sopenharmony_ci     * @brief Sets the index for the current tab.
156a3e0fd82Sopenharmony_ci     *
157a3e0fd82Sopenharmony_ci     * @param index Indicates the index of a view.
158a3e0fd82Sopenharmony_ci     * @param needAnimator Specifies whether a flip animation is needed. <b>false</b> (default value) indicates a flip
159a3e0fd82Sopenharmony_ci     * animation is not needed, and <b>true</b> indicates the opposite case.
160a3e0fd82Sopenharmony_ci     * @since 1.0
161a3e0fd82Sopenharmony_ci     * @version 1.0
162a3e0fd82Sopenharmony_ci     */
163a3e0fd82Sopenharmony_ci    void SetCurrentPage(uint16_t index, bool needAnimator = false);
164a3e0fd82Sopenharmony_ci
165a3e0fd82Sopenharmony_ci    /**
166a3e0fd82Sopenharmony_ci     * @brief Obtains the current tab index.
167a3e0fd82Sopenharmony_ci     *
168a3e0fd82Sopenharmony_ci     * @return Returns the current tab index.
169a3e0fd82Sopenharmony_ci     * @since 1.0
170a3e0fd82Sopenharmony_ci     * @version 1.0
171a3e0fd82Sopenharmony_ci     */
172a3e0fd82Sopenharmony_ci    uint16_t GetCurrentPage() const
173a3e0fd82Sopenharmony_ci    {
174a3e0fd82Sopenharmony_ci        return curIndex_;
175a3e0fd82Sopenharmony_ci    }
176a3e0fd82Sopenharmony_ci
177a3e0fd82Sopenharmony_ci    /**
178a3e0fd82Sopenharmony_ci     * @brief Obtains the current view.
179a3e0fd82Sopenharmony_ci     *
180a3e0fd82Sopenharmony_ci     * @return Returns the current view.
181a3e0fd82Sopenharmony_ci     * @since 1.0
182a3e0fd82Sopenharmony_ci     * @version 1.0
183a3e0fd82Sopenharmony_ci     */
184a3e0fd82Sopenharmony_ci    UIView* GetCurrentView() const
185a3e0fd82Sopenharmony_ci    {
186a3e0fd82Sopenharmony_ci        return curView_;
187a3e0fd82Sopenharmony_ci    }
188a3e0fd82Sopenharmony_ci
189a3e0fd82Sopenharmony_ci    /**
190a3e0fd82Sopenharmony_ci     * @brief Sets a blank size, as defined in {@link DEFAULT_BLANK_SIZE}
191a3e0fd82Sopenharmony_ci     *
192a3e0fd82Sopenharmony_ci     * @param size Indicates the blank size to set.
193a3e0fd82Sopenharmony_ci     * @since 1.0
194a3e0fd82Sopenharmony_ci     * @version 1.0
195a3e0fd82Sopenharmony_ci     */
196a3e0fd82Sopenharmony_ci    void SetBlankSize(uint16_t size)
197a3e0fd82Sopenharmony_ci    {
198a3e0fd82Sopenharmony_ci        blankSize_ = size;
199a3e0fd82Sopenharmony_ci    }
200a3e0fd82Sopenharmony_ci
201a3e0fd82Sopenharmony_ci    /**
202a3e0fd82Sopenharmony_ci     * @fn void OnDragEvent(const DragEvent& event) override
203a3e0fd82Sopenharmony_ci     *
204a3e0fd82Sopenharmony_ci     * @brief revice drag event, Switch to specified view when drag
205a3e0fd82Sopenharmony_ci     *
206a3e0fd82Sopenharmony_ci     * @param event The drag event
207a3e0fd82Sopenharmony_ci     */
208a3e0fd82Sopenharmony_ci    bool OnDragEvent(const DragEvent& event) override;
209a3e0fd82Sopenharmony_ci
210a3e0fd82Sopenharmony_ci    bool OnDragEndEvent(const DragEvent& event) override;
211a3e0fd82Sopenharmony_ci
212a3e0fd82Sopenharmony_ci#if defined(ENABLE_ROTATE_INPUT) && ENABLE_ROTATE_INPUT
213a3e0fd82Sopenharmony_ci    bool OnRotateEvent(const RotateEvent& event) override;
214a3e0fd82Sopenharmony_ci
215a3e0fd82Sopenharmony_ci    bool OnRotateEndEvent(const RotateEvent& event) override;
216a3e0fd82Sopenharmony_ci#endif
217a3e0fd82Sopenharmony_ci
218a3e0fd82Sopenharmony_ci    /**
219a3e0fd82Sopenharmony_ci     * @brief Sets the time for the page being animated. The page will go beyond the blank during this time.
220a3e0fd82Sopenharmony_ci     *
221a3e0fd82Sopenharmony_ci     * @param time Indicates the time of the page being animated.
222a3e0fd82Sopenharmony_ci     * @since 1.0
223a3e0fd82Sopenharmony_ci     * @version 1.0
224a3e0fd82Sopenharmony_ci     */
225a3e0fd82Sopenharmony_ci    void SetAnimatorTime(uint16_t time);
226a3e0fd82Sopenharmony_ci
227a3e0fd82Sopenharmony_ci    /**
228a3e0fd82Sopenharmony_ci     * @brief Sets whether the swipe view supports a cycle swipe.
229a3e0fd82Sopenharmony_ci     *
230a3e0fd82Sopenharmony_ci     * @param loop Indicates the cycle swipe flag. <b>true</b> indicates the cycle swipe is supported, and <b>false</b>
231a3e0fd82Sopenharmony_ci     * indicates the opposite case.
232a3e0fd82Sopenharmony_ci     * @since 1.0
233a3e0fd82Sopenharmony_ci     * @version 1.0
234a3e0fd82Sopenharmony_ci     */
235a3e0fd82Sopenharmony_ci    void SetLoopState(bool loop)
236a3e0fd82Sopenharmony_ci    {
237a3e0fd82Sopenharmony_ci        loop_ = loop;
238a3e0fd82Sopenharmony_ci    }
239a3e0fd82Sopenharmony_ci
240a3e0fd82Sopenharmony_ci    /**
241a3e0fd82Sopenharmony_ci     * @brief Obtains a view based on its index.
242a3e0fd82Sopenharmony_ci     *
243a3e0fd82Sopenharmony_ci     * @param Indicates the index of a view.
244a3e0fd82Sopenharmony_ci     * @return Returns the view.
245a3e0fd82Sopenharmony_ci     * @since 1.0
246a3e0fd82Sopenharmony_ci     * @version 1.0
247a3e0fd82Sopenharmony_ci     */
248a3e0fd82Sopenharmony_ci    UIView* GetViewByIndex(uint16_t index) const;
249a3e0fd82Sopenharmony_ci
250a3e0fd82Sopenharmony_ci    /**
251a3e0fd82Sopenharmony_ci     * @brief Obtains the listener set for swipe events.
252a3e0fd82Sopenharmony_ci     *
253a3e0fd82Sopenharmony_ci     * @return Returns the swipe event listener.
254a3e0fd82Sopenharmony_ci     * @since 1.0
255a3e0fd82Sopenharmony_ci     * @version 1.0
256a3e0fd82Sopenharmony_ci     */
257a3e0fd82Sopenharmony_ci    OnSwipeListener*& GetOnSwipeListener()
258a3e0fd82Sopenharmony_ci    {
259a3e0fd82Sopenharmony_ci        return swipeListener_;
260a3e0fd82Sopenharmony_ci    }
261a3e0fd82Sopenharmony_ci
262a3e0fd82Sopenharmony_ci    /**
263a3e0fd82Sopenharmony_ci     * @brief Sets the listener that contains a callback to be invoked upon a swipe event.
264a3e0fd82Sopenharmony_ci     *
265a3e0fd82Sopenharmony_ci     * @param onSwipeListener Indicates the listener to set.
266a3e0fd82Sopenharmony_ci     * @since 1.0
267a3e0fd82Sopenharmony_ci     * @version 1.0
268a3e0fd82Sopenharmony_ci     */
269a3e0fd82Sopenharmony_ci    void SetOnSwipeListener(OnSwipeListener* onSwipeListener)
270a3e0fd82Sopenharmony_ci    {
271a3e0fd82Sopenharmony_ci        swipeListener_ = onSwipeListener;
272a3e0fd82Sopenharmony_ci    }
273a3e0fd82Sopenharmony_ci
274a3e0fd82Sopenharmony_ci    /**
275a3e0fd82Sopenharmony_ci     * @brief Sets the alignment mode for child components of <b>UISwipeView</b>.
276a3e0fd82Sopenharmony_ci     *
277a3e0fd82Sopenharmony_ci     * @param alignMode Indicates the alignment mode to set, as enumerated in {@link AlignMode}.
278a3e0fd82Sopenharmony_ci     * The default value is <b>ALIGN_CENTER</b>.
279a3e0fd82Sopenharmony_ci     * @since 1.0
280a3e0fd82Sopenharmony_ci     * @version 1.0
281a3e0fd82Sopenharmony_ci     */
282a3e0fd82Sopenharmony_ci    void SetAlignMode(AlignMode alignMode = ALIGN_CENTER)
283a3e0fd82Sopenharmony_ci    {
284a3e0fd82Sopenharmony_ci        alignMode_ = alignMode;
285a3e0fd82Sopenharmony_ci    }
286a3e0fd82Sopenharmony_ci
287a3e0fd82Sopenharmony_ci    /**
288a3e0fd82Sopenharmony_ci     * @brief Obtains the alignment mode of child components of <b>UISwipeView</b>.
289a3e0fd82Sopenharmony_ci     *
290a3e0fd82Sopenharmony_ci     * @return Returns the alignment mode. For details, see {@link AlignMode}.
291a3e0fd82Sopenharmony_ci     * @since 1.0
292a3e0fd82Sopenharmony_ci     * @version 1.0
293a3e0fd82Sopenharmony_ci     */
294a3e0fd82Sopenharmony_ci    AlignMode GetAlignMode()
295a3e0fd82Sopenharmony_ci    {
296a3e0fd82Sopenharmony_ci        return alignMode_;
297a3e0fd82Sopenharmony_ci    }
298a3e0fd82Sopenharmony_ci
299a3e0fd82Sopenharmony_ci    /**
300a3e0fd82Sopenharmony_ci     * @brief Indicates the horizontal direction.
301a3e0fd82Sopenharmony_ci     *
302a3e0fd82Sopenharmony_ci     * @since 1.0
303a3e0fd82Sopenharmony_ci     * @version 1.0
304a3e0fd82Sopenharmony_ci     */
305a3e0fd82Sopenharmony_ci    static constexpr uint8_t HORIZONTAL = 0;
306a3e0fd82Sopenharmony_ci
307a3e0fd82Sopenharmony_ci    /**
308a3e0fd82Sopenharmony_ci     * @brief Indicates the vertical direction.
309a3e0fd82Sopenharmony_ci     *
310a3e0fd82Sopenharmony_ci     * @since 1.0
311a3e0fd82Sopenharmony_ci     * @version 1.0
312a3e0fd82Sopenharmony_ci     */
313a3e0fd82Sopenharmony_ci    static constexpr uint8_t VERTICAL = 1;
314a3e0fd82Sopenharmony_ci
315a3e0fd82Sopenharmony_ci    void SetXScrollBarVisible(bool visible) = delete;
316a3e0fd82Sopenharmony_ci
317a3e0fd82Sopenharmony_ci    void SetYScrollBarVisible(bool visible) = delete;
318a3e0fd82Sopenharmony_ci
319a3e0fd82Sopenharmony_ci    void SetScrollBarSide(uint8_t side) = delete;
320a3e0fd82Sopenharmony_ci
321a3e0fd82Sopenharmony_ci    void SetScrollBarCenter(Point center) = delete;
322a3e0fd82Sopenharmony_ci
323a3e0fd82Sopenharmony_ciprotected:
324a3e0fd82Sopenharmony_ci    bool DragXInner(int16_t distance) override;
325a3e0fd82Sopenharmony_ci    bool DragYInner(int16_t distance) override;
326a3e0fd82Sopenharmony_ci    void SortChild();
327a3e0fd82Sopenharmony_ci    void StopAnimator() override;
328a3e0fd82Sopenharmony_ci    virtual void SwitchToPage(int16_t dst, bool needAnimator = true);
329a3e0fd82Sopenharmony_ci    void MoveChildByOffset(int16_t xOffset, int16_t yOffset) override;
330a3e0fd82Sopenharmony_ci    void MoveHeadOrTailChild();
331a3e0fd82Sopenharmony_ci
332a3e0fd82Sopenharmony_ci    /**
333a3e0fd82Sopenharmony_ci     * @brief Indicates that the animation duration is 12 ticks.
334a3e0fd82Sopenharmony_ci     *
335a3e0fd82Sopenharmony_ci     * @since 1.0
336a3e0fd82Sopenharmony_ci     * @version 1.0
337a3e0fd82Sopenharmony_ci     */
338a3e0fd82Sopenharmony_ci    constexpr static uint16_t ANIMATOR_TIME = 12;
339a3e0fd82Sopenharmony_ci
340a3e0fd82Sopenharmony_ci    /**
341a3e0fd82Sopenharmony_ci     * @brief Indicates the maximum distance of an invalid dragging. Dragging is not triggered if the distance is less
342a3e0fd82Sopenharmony_ci     * than this value.
343a3e0fd82Sopenharmony_ci     *
344a3e0fd82Sopenharmony_ci     * @since 1.0
345a3e0fd82Sopenharmony_ci     * @version 1.0
346a3e0fd82Sopenharmony_ci     */
347a3e0fd82Sopenharmony_ci    constexpr static uint16_t STOP_DISTANCE = 5;
348a3e0fd82Sopenharmony_ci
349a3e0fd82Sopenharmony_ci    /**
350a3e0fd82Sopenharmony_ci     * @brief Indicates the maximum distance between the first and the last tab when the current view is not in a cycle
351a3e0fd82Sopenharmony_ci     * swipe mode. The page can be rebound after the setting.
352a3e0fd82Sopenharmony_ci     *
353a3e0fd82Sopenharmony_ci     * @since 1.0
354a3e0fd82Sopenharmony_ci     * @version 1.0
355a3e0fd82Sopenharmony_ci     */
356a3e0fd82Sopenharmony_ci    constexpr static uint16_t DEFAULT_BLANK_SIZE = 30;
357a3e0fd82Sopenharmony_ci    uint16_t tickTime_;
358a3e0fd82Sopenharmony_ci    OnSwipeListener* swipeListener_;
359a3e0fd82Sopenharmony_ci    uint16_t curIndex_;
360a3e0fd82Sopenharmony_ci    uint16_t blankSize_;
361a3e0fd82Sopenharmony_ci    UIView* curView_;
362a3e0fd82Sopenharmony_ci    AlignMode alignMode_ = ALIGN_CENTER;
363a3e0fd82Sopenharmony_ci    bool loop_;
364a3e0fd82Sopenharmony_ci
365a3e0fd82Sopenharmony_ciprivate:
366a3e0fd82Sopenharmony_ci    void RefreshCurrentViewByPosition(int16_t (UIView::*pfnGetXOrY)() const, int16_t (UIView::*pfnGetWidthOrHeight)());
367a3e0fd82Sopenharmony_ci    void RefreshCurrentViewByThrow(int16_t distance,
368a3e0fd82Sopenharmony_ci                                   uint8_t dragDirection,
369a3e0fd82Sopenharmony_ci                                   int16_t (UIView::*pfnGetXOrY)() const,
370a3e0fd82Sopenharmony_ci                                   int16_t (UIView::*pfnGetWidthOrHeight)());
371a3e0fd82Sopenharmony_ci
372a3e0fd82Sopenharmony_ci    bool IsNeedLoop();
373a3e0fd82Sopenharmony_ci    void MoveFirstChildToLast();
374a3e0fd82Sopenharmony_ci    void MoveLastChildToFirst();
375a3e0fd82Sopenharmony_ci    void CalculateInvalidate();
376a3e0fd82Sopenharmony_ci    void CurrentIndexInc();
377a3e0fd82Sopenharmony_ci    void CurrentIndexDec();
378a3e0fd82Sopenharmony_ci    void Vibrator();
379a3e0fd82Sopenharmony_ci};
380a3e0fd82Sopenharmony_ci} // namespace OHOS
381a3e0fd82Sopenharmony_ci#endif // GRAPHIC_LITE_UI_SWIPE_VIEW_H
382