forked from paulh002/sdrberry
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui_top_bar.cpp
More file actions
50 lines (42 loc) · 1.37 KB
/
gui_top_bar.cpp
File metadata and controls
50 lines (42 loc) · 1.37 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
#include <unistd.h>
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
#include <stdint.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctime>
#include <string>
#include "lvgl/lvgl.h"
#include "gui_top_bar.h"
lv_obj_t* bg_top;
lv_obj_t* label_status;
lv_obj_t* label_date_time;
void setup_top_bar(lv_obj_t* scr)
{
static lv_style_t top_style;
lv_style_init(&top_style);
lv_style_set_radius(&top_style, 0);
lv_style_set_bg_color(&top_style, lv_palette_main(LV_PALETTE_INDIGO));
bg_top = lv_obj_create(scr);
lv_obj_add_style(bg_top, &top_style, 0);
lv_obj_set_size(bg_top, LV_HOR_RES, topHeight);
lv_obj_clear_flag(bg_top, LV_OBJ_FLAG_SCROLLABLE);
label_status = lv_label_create(bg_top);
//lv_label_set_long_mode(label_status, LV_LABEL_LONG_SCROLL);
//lv_obj_set_width(label_status, LV_HOR_RES - 20);
//lv_label_set_text(label_status, "Labelx");
lv_obj_align(label_status, LV_ALIGN_CENTER, -220, 0);
label_date_time = lv_label_create(bg_top);
//lv_label_set_long_mode(label_date_time, LV_LABEL_LONG_SCROLL);
//lv_obj_set_width(label_date_time, LV_HOR_RES - 20);
//lv_label_set_text(label_date_time, "Label");
lv_obj_align(label_date_time, LV_ALIGN_CENTER, 270, 8);
}
void set_time_label()
{
std::time_t result = std::time(nullptr);
std::string s = std::asctime(std::localtime(&result));
lv_label_set_text(label_date_time, s.c_str());
}