-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpDialogs.cpp
67 lines (50 loc) · 1.24 KB
/
expDialogs.cpp
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
#include <myDebug.h>
#include "expDialogs.h"
#include "myLeds.h"
#include "buttons.h"
#include "myTFT.h"
#define MAX_PRINTF_STRING 1024
#define BUTTON_NO 16
#define BUTTON_YES 18
yesNoDialog::yesNoDialog(uint32_t id, const char *name, const char *format, ...) :
expWindow(WIN_FLAG_DELETE_ON_END)
{
m_id = id;
m_name = name;
m_format = format;
m_draw_needed = 1;
va_start(m_params,format);
}
// virtual
void yesNoDialog::begin(bool warm)
{
theButtons.setButtonType(BUTTON_NO, BUTTON_EVENT_CLICK, LED_RED);
theButtons.setButtonType(BUTTON_YES, BUTTON_EVENT_CLICK, LED_GREEN);
showLEDs();
}
// virtual
void yesNoDialog::onButtonEvent(int row, int col, int event)
{
int num = row * NUM_BUTTON_COLS + col;
endModal(num == BUTTON_YES ? 1 : 0);
}
// virtual
void yesNoDialog::updateUI()
{
if (m_draw_needed)
{
m_draw_needed = 0;
mylcd.setFont(Arial_16_Bold);
mylcd.printfv_justified(
60,
100,
360,
260,
LCD_JUST_CENTER,
TFT_WHITE,
TFT_BLACK,
false,
m_format,
m_params);
}
}