-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathView.h
More file actions
52 lines (37 loc) · 911 Bytes
/
Copy pathView.h
File metadata and controls
52 lines (37 loc) · 911 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
46
47
48
49
50
51
52
//
// Created by Leon Boshuizen on 10/11/2021.
//
#ifndef TOUCHCONTROLLER_VIEW_H
#define TOUCHCONTROLLER_VIEW_H
#include "Gui.h"
class View {
private:
Drawable **_controls;
size_t _cnt;
bool in_touch = false;
public:
explicit View(Drawable *c[], size_t l): _controls(c), _cnt(l){};
void draw(const LcdScreen &scr) const {
for(uint i=0; i<_cnt; i++ ){
auto c = _controls[i];
if( c->IsVisible()) {
c->draw(scr);
}
}
}
void touch(const Point &p){
if( in_touch ) return;
in_touch = true;
for(auto i=0; i<_cnt;i++){
_controls[i]->touch_start(p);
}
}
void touch_done(){
if( !in_touch) return;
in_touch = false;
for(auto i=0; i<_cnt;i++){
_controls[i]->touch_end();
}
}
};
#endif //TOUCHCONTROLLER_VIEW_H