Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_pager.h
1/* Copyright (C) 2017 - 2024, Thornwave Labs Inc - All Rights Reserved.
2 * Unauthorized copying of this file, via any medium is strictly prohibited.
3 * Proprietary and confidential.
4 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
5*/
6
7#ifndef _DS_PAGER_H
8#define _DS_PAGER_H
9
10
11#include <ds_view.h>
12#include <ds_timer.h>
13
14
15class DsPager: public DsView
16{
17public:
18 DsPager(DsView* parent, const DsPoint &pos, const DsSize &size, const DsOrientation &orientation = DS_HORIZONTAL);
19
20 void insertPage(DsView* page, size_t pos = -1);
21 void removePage(size_t pos);
22
23 void update(void);
24
25private:
26 typedef struct link_s
27 {
28 DsView* page;
29 struct link_s* next;
30 }link_t;
31
32 DsOrientation mOrientation;
33 int32_t mDimension;
34
35 link_t mLinks[16];
36 link_t* mFreeLinks;
37
38 link_t* mPageListHead;
39 size_t mPageCount;
40
41
42 int32_t mScrollPosition; //in pixels
43
44 int32_t mSnapStepCount;
45 int32_t mSnapStep;
46 int32_t mSnapStart;
47 int32_t mSnapEnd;
48
49
50 bool mIsTouchActive;
51 uint32_t mTouchPos;
52 uint32_t mScrollOffsetBase;
53
54 DsTimer mTimer;
55
56 void onPaintOver(DsRenderer &renderer) override final;
57 bool onTouch(const DsTouchEvent &event) override final;
58
59 void snapScroll(void);
60
61
62 link_t* removeLink(size_t pos);
63 void insertLink(link_t* link, size_t pos = -1);
64 link_t* allocLink(void);
65 void freeLink(link_t* link);
66};
67
68#endif
DsOrientation is a class representing the orientation (horizontal or vertical).
Definition ds_types.h:57
Definition ds_pager.h:16
DsPoint is a class that represents the X and Y 2D coordinates of a point as integer numbers.
Definition ds_geometry.h:24
DsRenderer is a class that implements all the drawing operations.
Definition ds_renderer.h:42
DsSize is class that represents the 2D size of a graphic object (width, height) as integer values.
Definition ds_geometry.h:780
Definition ds_os.h:67
DsView is a base class that represents any view on the screen.
Definition ds_view.h:40
#define DS_HORIZONTAL
Macro defining a DsOrientation class initialized to DsOrientation::HORIZONTAL.
Definition ds_types.h:45
This structure implements a touch event.
Definition ds_event.h:25