-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuPaging.cpp
More file actions
46 lines (34 loc) · 1.2 KB
/
Copy pathMenuPaging.cpp
File metadata and controls
46 lines (34 loc) · 1.2 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
//
// Created by codexzier on 03.05.26.
//
#include "MenuPaging.h"
#include <string>
#include "GC9A01_LTSM.hpp"
#include "fonts_LTSM/FontArialBold_LTSM.hpp" // 16x16 pixels
void MenuPaging::setPage(int pageNumber) {
char buffer[12];
sprintf(buffer, "%d", pageNumber);
_tft->setTextColor(_colorText, _tft->C_BLACK);
_tft->setCursor(_positionX + 10, _positionY + 4);
_tft->print(buffer);
}
void MenuPaging::setPageAndPageMax(int pageNumber, int pageMax) {
setPage(pageNumber);
char buffer[12];
sprintf(buffer, "%d", pageMax);
_tft->setTextColor(_colorText, _tft->C_BLACK);
_tft->setCursor(_positionX + 45, _positionY + 4);
_tft->print(buffer);
}
void MenuPaging::drawFrameAndPage(int pageNumber, int pageMax) {
// if (pageNumber == _lastSetPageNumber && pageMax == _lastSetPageMax) {
// return;
// }
_lastSetPageNumber = pageNumber;
_lastSetPageMax = pageMax;
_tft->setFont(FontArialBold);
const int width = 70;
_tft->drawRoundRect(_positionX, _positionY, width, 24, _cornerRadius, _colorOff);
_tft->drawLine(_positionX + 34, _positionY, _positionX + 34, _positionY + 22, _colorOff);
setPageAndPageMax(pageNumber, pageMax);
}