discoverpixy
button.h
Go to the documentation of this file.
1 #ifndef BUTTON_H
2 #define BUTTON_H
3 
9 
15 
16 
17 
18 #include "touch.h"
19 
24 typedef void (*BUTTON_CALLBACK)(void *button);
25 
26 
30 typedef struct {
32  uint16_t bgcolor;
34  uint16_t txtcolor;
35  uint8_t font;
36  const char *text;
38 
39 
40 #define AUTO 0
41 
42 
47 bool gui_button_add(BUTTON_STRUCT* button);
48 
53 void gui_button_remove(BUTTON_STRUCT* button);
54 
59 void gui_button_redraw(BUTTON_STRUCT* button);
60 
61 /*
62 bool guiAddBitmapButton(BITMAPBUTTON_STRUCT* button);
63 void guiRemoveBitmapButton(BITMAPBUTTON_STRUCT* button);
64 void guiRedrawBitmapButton(BITMAPBUTTON_STRUCT* button);
65 */
66 
67 
68 /*
69 typedef struct {
70  TOUCH_AREA_STRUCT base;
71  unsigned int bgcolor;
72  BUTTON_CALLBACK callback; //Callback
73  unsigned char imgwidth;
74  unsigned char imgheight;
75  char* filename;
76 } BITMAPBUTTON_STRUCT;
77 */
78 //Notice that the first 3 Members are Equal, so it's possible to cast it to a BUTTON_STRUCT even if it's a BITMAPBUTTON_STRUCT (when changeing only the first 3 Members).
79 
80 
81 
84 #endif /* BUTTON_H */
const char * text
The label of the button.
Definition: button.h:36
void gui_button_redraw(BUTTON_STRUCT *button)
Definition: button.c:85
Definition: button.h:30
bool gui_button_add(BUTTON_STRUCT *button)
Definition: button.c:62
TOUCH_AREA_STRUCT base
Basic geometry of the button. You only need to set the x1, y1, x2, y2 members of this struct...
Definition: button.h:31
uint8_t font
The number of the font to use.
Definition: button.h:35
Definition: touch.h:50
uint16_t txtcolor
The 16-bit text color.
Definition: button.h:34
void gui_button_remove(BUTTON_STRUCT *button)
Definition: button.c:122
uint16_t bgcolor
The 16-bit background color of the button.
Definition: button.h:32
BUTTON_CALLBACK callback
Callback.
Definition: button.h:33
void(* BUTTON_CALLBACK)(void *button)
Definition: button.h:24