diff --git a/examples/components/buttons/button_default.xml b/examples/components/buttons/button_default.xml index 96b683c..ffc6ad1 100644 --- a/examples/components/buttons/button_default.xml +++ b/examples/components/buttons/button_default.xml @@ -21,6 +21,6 @@ -

+

diff --git a/examples/components/buttons/button_default_gen.c b/examples/components/buttons/button_default_gen.c new file mode 100644 index 0000000..d7c143a --- /dev/null +++ b/examples/components/buttons/button_default_gen.c @@ -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; +} \ No newline at end of file diff --git a/examples/components/buttons/button_default_gen.h b/examples/components/buttons/button_default_gen.h new file mode 100644 index 0000000..ad4a48b --- /dev/null +++ b/examples/components/buttons/button_default_gen.h @@ -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*/ \ No newline at end of file diff --git a/examples/components/buttons/button_error.xml b/examples/components/buttons/button_error.xml index fd79f02..95d7d30 100644 --- a/examples/components/buttons/button_error.xml +++ b/examples/components/buttons/button_error.xml @@ -22,6 +22,6 @@ -

+

diff --git a/examples/components/buttons/button_error_gen.c b/examples/components/buttons/button_error_gen.c new file mode 100644 index 0000000..853b89e --- /dev/null +++ b/examples/components/buttons/button_error_gen.c @@ -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; +} \ No newline at end of file diff --git a/examples/components/buttons/button_error_gen.h b/examples/components/buttons/button_error_gen.h new file mode 100644 index 0000000..7b1b2b1 --- /dev/null +++ b/examples/components/buttons/button_error_gen.h @@ -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*/ \ No newline at end of file diff --git a/examples/components/buttons/button_warning.xml b/examples/components/buttons/button_warning.xml index 1b4ea8b..c0fc578 100644 --- a/examples/components/buttons/button_warning.xml +++ b/examples/components/buttons/button_warning.xml @@ -23,6 +23,6 @@ -

+

diff --git a/examples/components/buttons/button_warning_gen.c b/examples/components/buttons/button_warning_gen.c new file mode 100644 index 0000000..97b3b3d --- /dev/null +++ b/examples/components/buttons/button_warning_gen.c @@ -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; +} \ No newline at end of file diff --git a/examples/components/buttons/button_warning_gen.h b/examples/components/buttons/button_warning_gen.h new file mode 100644 index 0000000..6d434b2 --- /dev/null +++ b/examples/components/buttons/button_warning_gen.h @@ -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*/ \ No newline at end of file diff --git a/examples/components/headings/h1.xml b/examples/components/headings/h1.xml index 255790a..f6c82da 100644 --- a/examples/components/headings/h1.xml +++ b/examples/components/headings/h1.xml @@ -1,12 +1,12 @@ - +