commit e4cff15aad5dd6d4d3906dddd65397a8cee569f8
parent 5e00a452a0959139842b49ada1ceaa7d0de7f853
Author: Manuel Geissbühler <manuel@debian>
Date: Fri, 27 Dec 2024 22:29:03 +0100
debugging
Diffstat:
1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/src/gui/screen.hpp b/src/gui/screen.hpp
@@ -8,7 +8,10 @@
#include <src/layouts/grid/lv_grid.h>
#include <src/layouts/lv_layout.h>
#include <src/misc/lv_area.h>
+#include <src/misc/lv_color.h>
+#include <src/widgets/button/lv_button.h>
#include <src/widgets/label/lv_label.h>
+#include <vector>
//TODO, fix not working makros
#define TIMELINE_COLUMN_WIDTH_PCT LV_PCT(20)
@@ -40,6 +43,9 @@ class Screen {
lv_obj_t *buttonsContainer;
lv_obj_t *mainContentContainer;
+ //array for buttons
+ std::vector<lv_obj_t*> buttons;
+
public:
Screen(uint16_t width, uint16_t height) : width(width), height(height)
{
@@ -50,31 +56,51 @@ class Screen {
lv_obj_set_grid_dsc_array(screenPointer, columnDesc, rowDesc);
lv_obj_set_layout(screenPointer, LV_LAYOUT_GRID);
+ //set padding to 0
+ lv_obj_set_style_pad_column(screenPointer, 0, 0);
+ lv_obj_set_style_pad_row(screenPointer, 0, 0);
+
//Add empty widdgets to the Grid Layout as containers to be filled by child classes
- lv_obj_t *label;
timelineContainer = lv_obj_create(screenPointer);
lv_obj_set_size(timelineContainer, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_set_grid_cell(timelineContainer, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 0, 2);
- label = lv_label_create(timelineContainer);
- lv_label_set_text(label, "timelineContainer");
instructionsContainer = lv_obj_create(screenPointer);
lv_obj_set_size(instructionsContainer, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_set_grid_cell(instructionsContainer, LV_GRID_ALIGN_START, 1, 1, LV_GRID_ALIGN_START, 0, 1);
- label = lv_label_create(instructionsContainer);
- lv_label_set_text(label, "instructionsContainer");
buttonsContainer = lv_obj_create(screenPointer);
lv_obj_set_size(buttonsContainer, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_set_grid_cell(buttonsContainer, LV_GRID_ALIGN_START, 2, 1, LV_GRID_ALIGN_START, 0, 2);
- label = lv_label_create(buttonsContainer);
- lv_label_set_text(label, "buttonsContainer");
mainContentContainer = lv_obj_create(screenPointer);
- lv_obj_set_size(mainContentContainer, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
+
lv_obj_set_grid_cell(mainContentContainer, LV_GRID_ALIGN_START, 1, 1, LV_GRID_ALIGN_START, 1, 1);
- label = lv_label_create(mainContentContainer);
- lv_label_set_text(label, "mainContenContainer");
+ lv_obj_set_size(mainContentContainer, lv_pct(100), lv_pct(100));
+ lv_color_t color;
+ color.blue = 0;
+ color.green = 100;
+ color.red = 0;
+ lv_obj_set_style_bg_color(mainContentContainer, color, 0);
+
+
+
+ //add 3 buttons for testing purposes
+ lv_obj_t *button;
+ lv_obj_t *label;
+ int i;
+ for (i=0; i<3; i++) {
+ button = lv_button_create(buttonsContainer);
+ buttons.push_back(button);
+ label = lv_label_create(button);
+ lv_label_set_text_fmt(button, "button %d", i);
+ lv_obj_center(button);
+ }
+
+ //add the buttons to the layout
+ for (lv_obj_t* x : buttons) {
+ break;
+ }
}