-
Notifications
You must be signed in to change notification settings - Fork 3
/
xxxxscreen.cpp--
101 lines (81 loc) · 2.72 KB
/
xxxxscreen.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
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
#include "checkscreen.h"
#include "marlinui.h"
#include "resources.h"
#include "multilang.h"
#include "theme.h"
#include "screentask.h"
#include <lvgl>
#include <ui_api.h>
#include "lvslot.hpp"
using std::placeholders::_1;
CheckScreen::CheckScreen()
{
}
//bool CheckScreen::beforeShow()
//{
//}
//void CheckScreen::afterHide()
//{
//}
void CheckScreen::onLangChanged()
{
}
void CheckScreen::onThemeChanged()
{
}
bool CheckScreen::initScreen()
{
//初始化挤出界面
const int16_t screenWidth = width();
const int16_t screenHeight = height();
const int16_t screendpi = dpi();
const int16_t safeMargin = 6;
const int16_t spacing = 6;
const int16_t titleBarHeight = 32;
const int16_t stateBarHeight = 26;
const int16_t fontSize = 16;
const int16_t iconSize = 24;
LVObject * reference = nullptr; //布局参考对象
{
//标题栏
LVObject * titleBar = new LVObject(this,nullptr);
titleBar->setStyle(THEME_STYLE_GET(Theme_Screen_TitleBar));
titleBar->setSize(screenWidth,titleBarHeight);
titleBar->align(LV_ALIGN_IN_TOP_LEFT);
reference = titleBar;
//标题返回按钮
LVButton * butBack = new LVButton(titleBar,nullptr);
butBack->setSize(titleBarHeight,titleBarHeight);
butBack->setStyle(LV_BTN_STYLE_REL,THEME_STYLE_GET(Theme_Screen_ButtonBack));
butBack->setStyle(LV_BTN_STYLE_PR,THEME_STYLE_GET(Theme_Screen_ButtonBack));
butBack->align(LV_ALIGN_IN_LEFT_MID,safeMargin,0);
butBack->setAction(LV_BTN_ACTION_CLICK,onButBackHomeClicked);
LVImage * imgBack = new LVImage(butBack,nullptr);
imgBack->setSrc(&back_24);
//标题
LVLabel* labTitle = new LVLabel(titleBar,nullptr);
labTitle->setText("开关检测");
labTitle->align(butBack,LV_ALIGN_OUT_RIGHT_MID);
}
{
//功能区域
LVObject * butArea = new LVObject(this,nullptr);
butArea->align(LV_ALIGN_IN_TOP_LEFT,0,titleBarHeight);
butArea->setSize(screenWidth,screenHeight - titleBarHeight - stateBarHeight);
butArea->setStyle(THEME_STYLE_GET(Theme_screen_ButtonArea));
}
{
//状态栏
LVObject * stateBar = new LVObject(this,nullptr);
stateBar->setSize(screenWidth,stateBarHeight);
stateBar->align(LV_ALIGN_IN_BOTTOM_LEFT,0,0);
//状态栏样式
stateBar->setStyle(THEME_STYLE_GET(Theme_Screen_StateBar));
//状态栏信息
LVLabel * stateMesg = new LVLabel(stateBar,nullptr);
stateMesg->align(LV_ALIGN_IN_LEFT_MID,safeMargin,0);
stateMesg->setText("状态每秒刷新"); //"Connected!"
stateMesg->align(LV_ALIGN_IN_LEFT_MID,safeMargin,0);
}
return true;
}