-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWidget.h
More file actions
executable file
·110 lines (93 loc) · 2.13 KB
/
Widget.h
File metadata and controls
executable file
·110 lines (93 loc) · 2.13 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
******************************************************************************
* @file Widget.h
* @author Paolo Sassi
* @date 22 January 2016
* @brief Contains the type definitions and the macros used for the
* screen widgets.
******************************************************************************
*/
#ifndef WIDGET_H_
#define WIDGET_H_
#include "Event.h"
#include "Touch.h"
#include "fonts.h"
/**
* @addtogroup widget
* @{
*/
#define NUMWIDGETS 25
#define BAKCG 0
#define BWATCH 1
#define BSWATCH 2
#define BALARM 3
#define BTIMER 4
#define BPLUS 5
#define BMINUS 6
#define BSTART 7
#define BSET 8
#define BRESUME 9
#define BSTOP 10
#define BRESET 11
#define ALARMEXP 12
#define TIMEREXP 13
#define HRSSTR 14
#define MINSTR 15
#define SECSTR 16
#define TTSSTR 17
#define SEP1STR 18
#define SEP2STR 19
#define TTSSEP 20
#define HRSBKG 21
#define MINBKG 22
#define SECBKG 23
#define TTSBKG 24
#define NOEVENT 0x00
#define WATCHBPRESS 0x01
#define SWATCHBPRESS 0x02
#define ALARMBPRESS 0x04
#define TIMERBPRESS 0x08
#define PLUSBPRESS 0x10
#define MINUSBPRESS 0x20
#define STARTBPRESS 0x40
#define STOPBPRESS 0x80
#define WATCHMODE 0
#define SWATCHMODE 1
#define ALARMMODE 2
#define TIMERMODE 3
typedef enum {
BACKGROUND, ICON, TEXT, IMAGE
} WidgetType;
typedef struct {
unsigned char *image;
} Image;
typedef struct {
unsigned char *iconp;
unsigned char *iconr;
Event onpress;
} Icon;
typedef struct {
sFONT *font;
unsigned short int color;
} Text;
typedef struct {
unsigned short int xl;
unsigned short int yt;
unsigned short int xw;
unsigned short int yh;
WidgetType wt;
void *ws;
} Widget;
#define txtinfo(w) ((Text *)((w)->ws))
#define iconinfo(w) ((Icon *)((w)->ws))
#define imginfo(w) ((Image *)((w)->ws))
/**
* @}
*/
extern Widget MyWatchScr[];
void DrawInit(Widget ws[]);
unsigned char OnTouch(const Widget ws[], TPoint *press);
unsigned char DrawOn(Widget *w);
unsigned char DrawOff(Widget *w);
unsigned char WPrint(Widget *w, char *s);
#endif /* BUTTON_H_ */