Skip to content

Commit

Permalink
add gen.c/h files
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Dec 19, 2024
1 parent b5b616c commit 9a02a0d
Show file tree
Hide file tree
Showing 33 changed files with 744 additions and 96 deletions.
2 changes: 1 addition & 1 deletion examples/components/buttons/button_default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
</styles>

<view extends="lv_button" styles="main pr:pressed">
<h3 text="$button_label" align="center"/>
<h3 heading_text="$button_label" align="center"/>
</view>
</component>
56 changes: 56 additions & 0 deletions examples/components/buttons/button_default_gen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

#include "button_default_gen.h"
#include "ui.h"

lv_obj_t * button_default_create(lv_obj_t * parent, const char * button_label)
{
LV_TRACE_OBJ_CREATE("begin");

static lv_style_t style_main;

static lv_style_t style_pr;

static bool style_main_inited = false;

if(!style_main_inited) {


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

lv_style_set_pad_hor(&style_main, 24);

lv_style_set_pad_ver(&style_main, 12);

lv_style_set_border_width(&style_main, 0);

lv_style_set_radius(&style_main, 12);

lv_style_set_shadow_width(&style_main, 0);


lv_style_init(&style_pr);
lv_style_set_bg_color(&style_pr, lv_color_hex(0x333333));

lv_style_set_shadow_width(&style_pr, 20);

lv_style_set_shadow_color(&style_pr, lv_color_hex(0x000000));

lv_style_set_shadow_opa(&style_pr, 40);


style_main_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_set_align(h3, LV_ALIGN_CENTER);


LV_TRACE_OBJ_CREATE("finished");

return obj;
}
11 changes: 11 additions & 0 deletions examples/components/buttons/button_default_gen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#ifndef BUTTON_DEFAULT_H
#define BUTTON_DEFAULT_H

#include "lvgl/lvgl.h"



lv_obj_t * button_default_create(lv_obj_t * parent, const char * button_label);

#endif /*BUTTON_DEFAULT_H*/
2 changes: 1 addition & 1 deletion examples/components/buttons/button_error.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
</styles>

<view extends="lv_button" styles="main pr:pressed">
<h3 text="$button_label" align="center"/>
<h3 heading_text="$button_label" align="center"/>
</view>
</component>
56 changes: 56 additions & 0 deletions examples/components/buttons/button_error_gen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

#include "button_error_gen.h"
#include "ui.h"

lv_obj_t * button_error_create(lv_obj_t * parent, const char * button_label)
{
LV_TRACE_OBJ_CREATE("begin");

static lv_style_t style_main;

static lv_style_t style_pr;

static bool style_main_inited = false;

if(!style_main_inited) {


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

lv_style_set_pad_hor(&style_main, 24);

lv_style_set_pad_ver(&style_main, 12);

lv_style_set_border_width(&style_main, 0);

lv_style_set_radius(&style_main, 12);

lv_style_set_shadow_width(&style_main, 0);


lv_style_init(&style_pr);
lv_style_set_bg_color(&style_pr, lv_color_hex(0xfc5f38));

lv_style_set_shadow_width(&style_pr, 20);

lv_style_set_shadow_color(&style_pr, lv_color_hex(0x000000));

lv_style_set_shadow_opa(&style_pr, 40);


style_main_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_set_align(h3, LV_ALIGN_CENTER);


LV_TRACE_OBJ_CREATE("finished");

return obj;
}
11 changes: 11 additions & 0 deletions examples/components/buttons/button_error_gen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#ifndef BUTTON_ERROR_H
#define BUTTON_ERROR_H

#include "lvgl/lvgl.h"



lv_obj_t * button_error_create(lv_obj_t * parent, const char * button_label);

#endif /*BUTTON_ERROR_H*/
2 changes: 1 addition & 1 deletion examples/components/buttons/button_warning.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
</styles>

<view extends="lv_button" styles="main">
<h3 text="$button_label" align="center"/>
<h3 heading_text="$button_label" align="center"/>
</view>
</component>
58 changes: 58 additions & 0 deletions examples/components/buttons/button_warning_gen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

#include "button_warning_gen.h"
#include "ui.h"

lv_obj_t * button_warning_create(lv_obj_t * parent, const char * button_label)
{
LV_TRACE_OBJ_CREATE("begin");

static lv_style_t style_main;

static lv_style_t style_pr;

static bool style_main_inited = false;

if(!style_main_inited) {


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

lv_style_set_pad_hor(&style_main, 24);

lv_style_set_pad_ver(&style_main, 12);

lv_style_set_border_width(&style_main, 0);

lv_style_set_radius(&style_main, 12);

lv_style_set_shadow_width(&style_main, 0);

lv_style_set_text_color(&style_main, lv_color_hex(0x111111));


lv_style_init(&style_pr);
lv_style_set_bg_color(&style_pr, lv_color_hex(0xf9ca4e));

lv_style_set_shadow_width(&style_pr, 20);

lv_style_set_shadow_color(&style_pr, lv_color_hex(0x000000));

lv_style_set_shadow_opa(&style_pr, 40);


style_main_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_set_align(h3, LV_ALIGN_CENTER);


LV_TRACE_OBJ_CREATE("finished");

return obj;
}
11 changes: 11 additions & 0 deletions examples/components/buttons/button_warning_gen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#ifndef BUTTON_WARNING_H
#define BUTTON_WARNING_H

#include "lvgl/lvgl.h"



lv_obj_t * button_warning_create(lv_obj_t * parent, const char * button_label);

#endif /*BUTTON_WARNING_H*/
4 changes: 2 additions & 2 deletions examples/components/headings/h1.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<component>
<api>
<prop name="text" type="string" default="Label"/>
<prop name="heading_text" type="string" default="Label"/>
</api>

<styles>
<style name="main" text_font="inter_xl"/>
</styles>

<view extends="lv_label" styles="main" text="$text">
<view extends="lv_label" styles="main" text="$heading_text">
</view>
</component>
35 changes: 35 additions & 0 deletions examples/components/headings/h1_gen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

#include "h1_gen.h"
#include "ui.h"

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

static lv_style_t style_main;



static bool style_main_inited = false;

if(!style_main_inited) {


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


style_main_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_TRACE_OBJ_CREATE("finished");

return obj;
}
11 changes: 11 additions & 0 deletions examples/components/headings/h1_gen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#ifndef H1_H
#define H1_H

#include "lvgl/lvgl.h"



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

#endif /*H1_H*/
4 changes: 2 additions & 2 deletions examples/components/headings/h2.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<component>
<api>
<prop name="text" type="string" default="Label"/>
<prop name="heading_text" type="string" default="Label"/>
</api>

<styles>
<style name="main" text_font="inter_md"/>
</styles>

<view extends="lv_label" styles="main" text="$text">
<view extends="lv_label" styles="main" text="$heading_text">
</view>
</component>
35 changes: 35 additions & 0 deletions examples/components/headings/h2_gen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

#include "h2_gen.h"
#include "ui.h"

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

static lv_style_t style_main;



static bool style_main_inited = false;

if(!style_main_inited) {


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


style_main_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_TRACE_OBJ_CREATE("finished");

return obj;
}
11 changes: 11 additions & 0 deletions examples/components/headings/h2_gen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#ifndef H2_H
#define H2_H

#include "lvgl/lvgl.h"



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

#endif /*H2_H*/
4 changes: 2 additions & 2 deletions examples/components/headings/h3.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<component>
<api>
<prop name="text" type="string" default="Label"/>
<prop name="heading_text" type="string" default="Label"/>
</api>

<styles>
<style name="main" text_font="inter_sm"/>
</styles>

<view extends="lv_label" styles="main" text="$text">
<view extends="lv_label" styles="main" text="$heading_text">
</view>
</component>
Loading

0 comments on commit 9a02a0d

Please sign in to comment.