[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cash2ecash] branch master updated: started gui layout
From: |
gnunet |
Subject: |
[cash2ecash] branch master updated: started gui layout |
Date: |
Fri, 27 Dec 2024 21:17:35 +0100 |
This is an automated email from the git hooks/post-receive script.
manuel-geissbuehler pushed a commit to branch master
in repository cash2ecash.
The following commit(s) were added to refs/heads/master by this push:
new 6401802 started gui layout
6401802 is described below
commit 6401802dc7c452bc71f9170edf0159760d88d578
Author: Manuel Geissbühler <manuel@debian>
AuthorDate: Fri Dec 27 21:17:18 2024 +0100
started gui layout
---
src/gui/screen.hpp | 61 +++++++++++++++++++++++++++++++++++++++++++++-
src/gui/screenWelcomme.hpp | 2 +-
2 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/src/gui/screen.hpp b/src/gui/screen.hpp
index 4f9d1dd..56b38f7 100644
--- a/src/gui/screen.hpp
+++ b/src/gui/screen.hpp
@@ -2,17 +2,76 @@
#define SCREEN_H
#include "lvgl.h"
#include <cstdint>
+#include <src/core/lv_obj.h>
+#include <src/core/lv_obj_pos.h>
+#include <src/core/lv_obj_style_gen.h>
+#include <src/layouts/grid/lv_grid.h>
+#include <src/layouts/lv_layout.h>
+#include <src/widgets/label/lv_label.h>
+
+
+#define TIMELINE_COLUMN_WIDTH_PCT LV_PCT(20)
+#define BUTTONS_COLUMN_WIDTH_PCT LV_PCT(24)
+#define MIDDLE_COLUMN_WIDTH_PCT
\
+ (LV_PCT(100) - TIMELINE_COLUMN_WIDTH_PCT - BUTTONS_COLUMN_WIDTH_PCT)
+
+
+#define INSTRUCTIONS_ROW_HEIGHT_PCT LV_PCT(28)
+#define BOTTOM_ROW_HEIGHT_PCT (LV_PCT(100) - INSTRUCTIONS_ROW_HEIGHT_PCT)
+
+
class Screen {
- private:
+ private:
+ int32_t columnDesc[4] = {TIMELINE_COLUMN_WIDTH_PCT, MIDDLE_COLUMN_WIDTH_PCT,
BUTTONS_COLUMN_WIDTH_PCT, LV_GRID_TEMPLATE_LAST};
+ int32_t rowDesc[7] = {INSTRUCTIONS_ROW_HEIGHT_PCT, BOTTOM_ROW_HEIGHT_PCT,
LV_GRID_TEMPLATE_LAST};
+
+
protected:
uint16_t width, height;
lv_obj_t *screenPointer;
+ lv_obj_t *timelineContainer;
+ lv_obj_t *instructionsContainer;
+ lv_obj_t *buttonsContainer;
+ lv_obj_t *mainContentContainer;
+
public:
Screen(uint16_t width, uint16_t height) : width(width), height(height)
{
screenPointer = lv_obj_create(NULL);
+
+ //Set the Layout of the screen to Grid
+ lv_obj_set_style_grid_column_dsc_array(screenPointer, columnDesc, 0);
+ lv_obj_set_style_grid_row_dsc_array(screenPointer, rowDesc, 0);
+ lv_obj_set_layout(screenPointer, LV_LAYOUT_GRID);
+
+ //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, 0, 1,
LV_GRID_ALIGN_START, 1, 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, 0, 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, 0, 1,
LV_GRID_ALIGN_START, 0, 2);
+ label = lv_label_create(mainContentContainer);
+ lv_label_set_text(label, "mainContenContainer");
+
}
lv_obj_t *getScreen(){
diff --git a/src/gui/screenWelcomme.hpp b/src/gui/screenWelcomme.hpp
index c94a622..f66ba09 100644
--- a/src/gui/screenWelcomme.hpp
+++ b/src/gui/screenWelcomme.hpp
@@ -29,7 +29,7 @@ private:
lv_obj_t * btn = lv_btn_create(screenPointer); /*Add a button the
current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its
position*/
- lv_obj_set_size(btn, lv_pct(20), lv_pct(20));
/*Set its size*/
+ lv_obj_set_size(btn, lv_pct(9), lv_pct(15));
/*Set its size*/
lv_obj_add_event_cb(btn, this->btn_event_cb, LV_EVENT_ALL, NULL);
/*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn); /*Add a label to the
button*/
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cash2ecash] branch master updated: started gui layout,
gnunet <=