-
Notifications
You must be signed in to change notification settings - Fork 0
/
wgnavscreens.h
56 lines (54 loc) · 1.31 KB
/
wgnavscreens.h
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
53
54
55
56
#ifndef WGNAVSCREENS_H
#define WGNAVSCREENS_H
#include "widget.h"
#include "AsciiLib.h"
#include "project.h"
#define WGNAVSCREENS_MAX_NUM_CHARS 2
typedef enum
{
WGNAVSCREENS_TYPE_MOVE_NEXT,
WGNAVSCREENS_TYPE_MOVE_PREV,
WGNAVSCREENS_TYPE_MOVE_FIRST,
WGNAVSCREENS_TYPE_MOVE_LAST
}
WGNAVSCREENS_TYPE;
class Display;
class wgNavScreens : public Widget
{
public:
wgNavScreens(WGNAVSCREENS_TYPE type, uint16_t x, uint16_t y,uint16_t h, uint16_t w):_type(type), Widget(x,y,h,w)
{
_color = COLOR_RED;
switch (_type) {
case WGNAVSCREENS_TYPE_MOVE_FIRST:
GetASCIICode(&_buffer[0],'<');
GetASCIICode(&_buffer[1],'<');
_numChars = 2;
break;
case WGNAVSCREENS_TYPE_MOVE_LAST:
GetASCIICode(&_buffer[0],'>');
GetASCIICode(&_buffer[1],'>');
_numChars = 2;
break;
case WGNAVSCREENS_TYPE_MOVE_NEXT:
GetASCIICode(&_buffer[0],'>');
_numChars = 1;
break;
case WGNAVSCREENS_TYPE_MOVE_PREV:
GetASCIICode(&_buffer[0],'<');
_numChars = 1;
break;
default:
break;
}
}
virtual void setValue(Emitter* emitter,uint32_t val) {}
virtual uint32_t getValueWhenClicked(uint16_t ax, uint16_t ay);
virtual uint16_t getPixel(int xcoord, int ycoord);
protected:
unsigned char _buffer[16*WGNAVSCREENS_MAX_NUM_CHARS];
uint8_t _numChars;
WGNAVSCREENS_TYPE _type;
uint16_t _color;
};
#endif // WGNAVSCREENS_H