-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistview.h
More file actions
45 lines (34 loc) · 1012 Bytes
/
listview.h
File metadata and controls
45 lines (34 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef LISTVIEW_H
#define LISTVIEW_H
#include "flickable.h"
class ListItem: public Item {
public:
PROPERTY(int, position);
ListItem(int position, float x = 0, float y = 0, float width = 0, float hieght = 0):
Item(nullptr, x, y, width, hieght), position(position) {
}
};
class ListAdaptor {
public:
virtual int count() = 0;
virtual ListItem *itemAt(int position) = 0;
virtual float hieghtForitemAt(int position) = 0;
virtual ~ListAdaptor() { }
};
class ListView: public Flickable
{
public:
PROPERTY(float, spacing) = 0;
PROPERTY(float, padding) = 0;
ListAdaptor *adaptor() { return mAdaptor; }
void setAdaptor(ListAdaptor *);
ListView(Item *parent, float x = 0, float y = 0, float width = 0, float hieght = 0);
virtual void performLayout() override;
virtual void draw(NVGcontext*) override;
protected:
virtual void onScrolled() override;
private:
ListAdaptor *mAdaptor = nullptr;
Item *mContentItem;
};
#endif // LISTVIEW_H