Skip to content

Commit

Permalink
update gen files
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Dec 19, 2024
1 parent f01c8e3 commit bb20b9a
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 72 deletions.
15 changes: 8 additions & 7 deletions examples/components/buttons/button_default_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ lv_obj_t * button_default_create(lv_obj_t * parent, const char * button_label)

static lv_style_t style_pr;

static bool style_main_inited = false;
static bool style_inited = false;

if(!style_inited) {

if(!style_main_inited) {


lv_style_init(&style_main);
lv_style_set_bg_color(&style_main, lv_color_hex(0x222222));

Expand All @@ -39,14 +39,15 @@ lv_obj_t * button_default_create(lv_obj_t * parent, const char * button_label)
lv_style_set_shadow_opa(&style_pr, 40);


style_main_inited = true;
style_inited = true;
}

lv_obj_t * obj = lv_button_create(parent);

lv_obj_add_style(obj, &style_main, LV_STATE_DEFAULT);lv_obj_add_style(obj, &style_pr, LV_STATE_PRESSED);
lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_t * h3 = h3_create(obj, "$button_label");

lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_style(obj, &style_pr, LV_PART_MAIN | LV_STATE_PRESSED);
lv_obj_t * h3 = h3_create(obj, button_label);
lv_obj_set_align(h3, LV_ALIGN_CENTER);


Expand Down
15 changes: 8 additions & 7 deletions examples/components/buttons/button_error_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ lv_obj_t * button_error_create(lv_obj_t * parent, const char * button_label)

static lv_style_t style_pr;

static bool style_main_inited = false;
static bool style_inited = false;

if(!style_inited) {

if(!style_main_inited) {


lv_style_init(&style_main);
lv_style_set_bg_color(&style_main, lv_color_hex(0xf03c0f));

Expand All @@ -39,14 +39,15 @@ lv_obj_t * button_error_create(lv_obj_t * parent, const char * button_label)
lv_style_set_shadow_opa(&style_pr, 40);


style_main_inited = true;
style_inited = true;
}

lv_obj_t * obj = lv_button_create(parent);

lv_obj_add_style(obj, &style_main, LV_STATE_DEFAULT);lv_obj_add_style(obj, &style_pr, LV_STATE_PRESSED);
lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_t * h3 = h3_create(obj, "$button_label");

lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_style(obj, &style_pr, LV_PART_MAIN | LV_STATE_PRESSED);
lv_obj_t * h3 = h3_create(obj, button_label);
lv_obj_set_align(h3, LV_ALIGN_CENTER);


Expand Down
14 changes: 7 additions & 7 deletions examples/components/buttons/button_warning_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ lv_obj_t * button_warning_create(lv_obj_t * parent, const char * button_label)

static lv_style_t style_pr;

static bool style_main_inited = false;
static bool style_inited = false;

if(!style_inited) {

if(!style_main_inited) {


lv_style_init(&style_main);
lv_style_set_bg_color(&style_main, lv_color_hex(0xf0b005));

Expand All @@ -41,14 +41,14 @@ lv_obj_t * button_warning_create(lv_obj_t * parent, const char * button_label)
lv_style_set_shadow_opa(&style_pr, 40);


style_main_inited = true;
style_inited = true;
}

lv_obj_t * obj = lv_button_create(parent);

lv_obj_add_style(obj, &style_main, LV_STATE_DEFAULT);
lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_t * h3 = h3_create(obj, "$button_label");

lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_t * h3 = h3_create(obj, button_label);
lv_obj_set_align(h3, LV_ALIGN_CENTER);


Expand Down
16 changes: 8 additions & 8 deletions examples/components/headings/h1_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@
#include "h1_gen.h"
#include "ui.h"

lv_obj_t * h1_create(lv_obj_t * parent, const char * text)
lv_obj_t * h1_create(lv_obj_t * parent, const char * heading_text)
{
LV_TRACE_OBJ_CREATE("begin");

static lv_style_t style_main;



static bool style_main_inited = false;
static bool style_inited = false;

if(!style_inited) {

if(!style_main_inited) {


lv_style_init(&style_main);
lv_style_set_text_font(&style_main, inter_xl);


style_main_inited = true;
style_inited = true;
}

lv_obj_t * obj = lv_label_create(parent);

lv_obj_add_style(obj, &style_main, LV_STATE_DEFAULT);
lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "text");

lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "heading_text");


LV_TRACE_OBJ_CREATE("finished");
Expand Down
2 changes: 1 addition & 1 deletion examples/components/headings/h1_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@



lv_obj_t * h1_create(lv_obj_t * parent, const char * text);
lv_obj_t * h1_create(lv_obj_t * parent, const char * heading_text);

#endif /*H1_H*/
16 changes: 8 additions & 8 deletions examples/components/headings/h2_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@
#include "h2_gen.h"
#include "ui.h"

lv_obj_t * h2_create(lv_obj_t * parent, const char * text)
lv_obj_t * h2_create(lv_obj_t * parent, const char * heading_text)
{
LV_TRACE_OBJ_CREATE("begin");

static lv_style_t style_main;



static bool style_main_inited = false;
static bool style_inited = false;

if(!style_inited) {

if(!style_main_inited) {


lv_style_init(&style_main);
lv_style_set_text_font(&style_main, inter_md);


style_main_inited = true;
style_inited = true;
}

lv_obj_t * obj = lv_label_create(parent);

lv_obj_add_style(obj, &style_main, LV_STATE_DEFAULT);
lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "text");

lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "heading_text");


LV_TRACE_OBJ_CREATE("finished");
Expand Down
2 changes: 1 addition & 1 deletion examples/components/headings/h2_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@



lv_obj_t * h2_create(lv_obj_t * parent, const char * text);
lv_obj_t * h2_create(lv_obj_t * parent, const char * heading_text);

#endif /*H2_H*/
16 changes: 8 additions & 8 deletions examples/components/headings/h3_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@
#include "h3_gen.h"
#include "ui.h"

lv_obj_t * h3_create(lv_obj_t * parent, const char * text)
lv_obj_t * h3_create(lv_obj_t * parent, const char * heading_text)
{
LV_TRACE_OBJ_CREATE("begin");

static lv_style_t style_main;



static bool style_main_inited = false;
static bool style_inited = false;

if(!style_inited) {

if(!style_main_inited) {


lv_style_init(&style_main);
lv_style_set_text_font(&style_main, inter_sm);


style_main_inited = true;
style_inited = true;
}

lv_obj_t * obj = lv_label_create(parent);

lv_obj_add_style(obj, &style_main, LV_STATE_DEFAULT);
lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "text");

lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "heading_text");


LV_TRACE_OBJ_CREATE("finished");
Expand Down
2 changes: 1 addition & 1 deletion examples/components/headings/h3_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@



lv_obj_t * h3_create(lv_obj_t * parent, const char * text);
lv_obj_t * h3_create(lv_obj_t * parent, const char * heading_text);

#endif /*H3_H*/
23 changes: 16 additions & 7 deletions examples/components/home_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ lv_obj_t * home_create(lv_obj_t * parent)
static lv_style_t style_left_cont;
static lv_style_t style_right_cont;

static bool style_main_inited = false;
static bool style_inited = false;

if(!style_inited) {

if(!style_main_inited) {


lv_style_init(&style_main);
lv_style_set_bg_color(&style_main, lv_color_hex(0x111111));

Expand All @@ -32,6 +32,8 @@ static lv_style_t style_right_cont;

lv_style_set_height(&style_main, lv_pct(100));

lv_style_set_pad_all(&style_main, 0);

lv_style_set_pad_column(&style_main, 0);


Expand All @@ -46,6 +48,8 @@ static lv_style_t style_right_cont;

lv_style_set_radius(&style_cont, 0);

lv_style_set_pad_all(&style_cont, 0);

lv_style_set_pad_row(&style_cont, 16);


Expand All @@ -54,6 +58,8 @@ static lv_style_t style_right_cont;

lv_style_set_border_width(&style_left_cont, 0);

lv_style_set_pad_all(&style_left_cont, 16);


lv_style_init(&style_right_cont);
lv_style_set_layout(&style_right_cont, LV_LAYOUT_FLEX);
Expand All @@ -68,14 +74,16 @@ static lv_style_t style_right_cont;

lv_style_set_flex_cross_place(&style_right_cont, LV_FLEX_ALIGN_CENTER);

lv_style_set_pad_all(&style_right_cont, 16);


style_main_inited = true;
style_inited = true;
}

lv_obj_t * obj = lv_obj_create(parent);

lv_obj_add_style(obj, &style_main, LV_STATE_DEFAULT);
lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);

lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_t * lv_obj = lv_obj_create(obj);
lv_obj_add_style(lv_obj, &style_cont, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_style(lv_obj, &style_left_cont, LV_PART_MAIN | LV_STATE_DEFAULT);
Expand All @@ -97,12 +105,13 @@ static lv_style_t style_right_cont;
lv_obj_t * lv_obj_2 = lv_obj_create(obj);
lv_obj_add_style(lv_obj_2, &style_cont, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_style(lv_obj_2, &style_right_cont, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_flex_grow(lv_obj_2, 1);
lv_obj_t * button_default = button_default_create(lv_obj_2, "Ok");
lv_obj_t * button_default_2 = button_default_create(lv_obj_2, "Cancel");
lv_obj_t * dark_slider = dark_slider_create(lv_obj_2);
lv_obj_set_width(dark_slider, lv_pct(100));
dark_slider_set_color(dark_slider, lv_color_hex(0xf03c0f));
lv_obj_set_send_draw_task_events(dark_slider, true);
lv_obj_update_flag(dark_slider, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS, true);
lv_obj_t * button_warning = button_warning_create(lv_obj_2, "Alert 1");
lv_obj_t * button_warning_2 = button_warning_create(lv_obj_2, "Alert 2");
lv_obj_t * button_error = button_error_create(lv_obj_2, "Error 1");
Expand Down
13 changes: 7 additions & 6 deletions examples/components/scratchpad_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ lv_obj_t * scratchpad_create(lv_obj_t * parent)



static bool style_main_inited = false;
static bool style_inited = false;

if(!style_inited) {

if(!style_main_inited) {



style_main_inited = true;
style_inited = true;
}

lv_obj_t * obj = lv_obj_create(parent);

lv_obj_set_width(obj, lv_pct(100));

lv_obj_set_width(obj, lv_pct(100));
lv_obj_set_height(obj, lv_pct(100));
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN);
lv_obj_t * button_default = button_default_create(obj, "Button");
lv_obj_set_width(button_default, 250);
lv_obj_t * button_default_2 = button_default_create(obj, "Button");
Expand Down
8 changes: 5 additions & 3 deletions examples/example_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/*********************
* INCLUDES
*********************/
#include "example_gen.h"

/*********************
* DEFINES
Expand All @@ -28,9 +29,9 @@
**********************/

/*Fonts*/
lv_font_t inter_sm;
lv_font_t inter_md;
lv_font_t inter_xl;
lv_font_t * inter_sm;
lv_font_t * inter_md;
lv_font_t * inter_xl;

/**********************
* MACROS
Expand All @@ -43,6 +44,7 @@ lv_font_t inter_xl;
void example_init_gen(void)
{
inter_sm = lv_tiny_ttf_create_file("A:/fonts/Inter-SemiBold.ttf", 14);
LV_LOG_USER("inter_sm: %d\n", inter_sm);
inter_md = lv_tiny_ttf_create_file("A:/fonts/Inter-SemiBold.ttf", 18);
inter_xl = lv_tiny_ttf_create_file("A:/fonts/Inter-SemiBold.ttf", 22);
}
Expand Down
Loading

0 comments on commit bb20b9a

Please sign in to comment.