Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Jan 9, 2025
1 parent 503fb8e commit 839a3d3
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 70 deletions.
13 changes: 3 additions & 10 deletions examples/components/buttons/button_default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@

<styles>
<style name="main"
bg_color="0x222222"
pad_hor="24" pad_ver="12"
border_width="0"
radius="12"
shadow_width="0"
/>
bg_color="0x222222" bg_opa="255" width="content" height="content" radius="12" pad_hor="24" pad_ver="12"
shadow_width="0"/>
<style name="pr"
bg_color="0x333333"
shadow_width="20"
shadow_color="0x000000"
shadow_opa="40"
bg_color="0x333333" bg_opa="255" width="content" height="content" radius="12" shadow_width="20" shadow_color="0x000000" shadow_opa="102" shadow_offset_x="0" shadow_offset_y="4" pad_hor="24" pad_ver="12"
/>
</styles>

Expand Down
16 changes: 13 additions & 3 deletions examples/components/buttons/button_default_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,27 @@ lv_obj_t * button_default_create(lv_obj_t * parent, const char * button_label)

lv_style_init(&style_main);
lv_style_set_bg_color(&style_main, lv_color_hex(0x222222));
lv_style_set_bg_opa(&style_main, 255);
lv_style_set_width(&style_main, LV_SIZE_CONTENT);
lv_style_set_height(&style_main, LV_SIZE_CONTENT);
lv_style_set_radius(&style_main, 12);
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_bg_opa(&style_pr, 255);
lv_style_set_width(&style_pr, LV_SIZE_CONTENT);
lv_style_set_height(&style_pr, LV_SIZE_CONTENT);
lv_style_set_radius(&style_pr, 12);
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);
lv_style_set_shadow_opa(&style_pr, 102);
lv_style_set_shadow_offset_x(&style_pr, 0);
lv_style_set_shadow_offset_y(&style_pr, 4);
lv_style_set_pad_hor(&style_pr, 24);
lv_style_set_pad_ver(&style_pr, 12);

style_inited = true;
}
Expand Down
11 changes: 2 additions & 9 deletions examples/components/buttons/button_error.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@

<styles>
<style name="main"
bg_color="0xf03c0f"
pad_hor="24" pad_ver="12"
border_width="0"
radius="12"
shadow_width="0"
bg_color="0xf03c0f" bg_opa="255" width="content" height="content" radius="12" pad_hor="24" pad_ver="12" shadow_width="0"
/>

<style name="pr"
bg_color="0xfc5f38"
shadow_width="20"
shadow_color="0x000000"
shadow_opa="40"
bg_color="0xfc5f38" bg_opa="255" width="content" height="content" radius="12" shadow_width="20" shadow_color="0x000000" shadow_opa="102" shadow_offset_x="0" shadow_offset_y="4" pad_hor="24" pad_ver="12"
/>
</styles>

Expand Down
16 changes: 13 additions & 3 deletions examples/components/buttons/button_error_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,27 @@ lv_obj_t * button_error_create(lv_obj_t * parent, const char * button_label)

lv_style_init(&style_main);
lv_style_set_bg_color(&style_main, lv_color_hex(0xf03c0f));
lv_style_set_bg_opa(&style_main, 255);
lv_style_set_width(&style_main, LV_SIZE_CONTENT);
lv_style_set_height(&style_main, LV_SIZE_CONTENT);
lv_style_set_radius(&style_main, 12);
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_bg_opa(&style_pr, 255);
lv_style_set_width(&style_pr, LV_SIZE_CONTENT);
lv_style_set_height(&style_pr, LV_SIZE_CONTENT);
lv_style_set_radius(&style_pr, 12);
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);
lv_style_set_shadow_opa(&style_pr, 102);
lv_style_set_shadow_offset_x(&style_pr, 0);
lv_style_set_shadow_offset_y(&style_pr, 4);
lv_style_set_pad_hor(&style_pr, 24);
lv_style_set_pad_ver(&style_pr, 12);

style_inited = true;
}
Expand Down
12 changes: 2 additions & 10 deletions examples/components/buttons/button_warning.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,11 @@

<styles>
<style name="main"
bg_color="0xf0b005"
pad_hor="24" pad_ver="12"
border_width="0"
radius="12"
shadow_width="0"
text_color="0x111111"
bg_color="0xf0b005" bg_opa="255" width="content" height="content" radius="12" pad_hor="24" pad_ver="12" shadow_width="0"
/>

<style name="pr"
bg_color="0xf9ca4e"
shadow_width="20"
shadow_color="0x000000"
shadow_opa="40"
bg_color="0xf9ca4e" bg_opa="255" width="content" height="content" radius="12" shadow_width="20" shadow_color="0x000000" shadow_opa="102" shadow_offset_x="0" shadow_offset_y="4" pad_hor="24" pad_ver="12"
/>
</styles>

Expand Down
17 changes: 13 additions & 4 deletions examples/components/buttons/button_warning_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,27 @@ lv_obj_t * button_warning_create(lv_obj_t * parent, const char * button_label)

lv_style_init(&style_main);
lv_style_set_bg_color(&style_main, lv_color_hex(0xf0b005));
lv_style_set_bg_opa(&style_main, 255);
lv_style_set_width(&style_main, LV_SIZE_CONTENT);
lv_style_set_height(&style_main, LV_SIZE_CONTENT);
lv_style_set_radius(&style_main, 12);
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_bg_opa(&style_pr, 255);
lv_style_set_width(&style_pr, LV_SIZE_CONTENT);
lv_style_set_height(&style_pr, LV_SIZE_CONTENT);
lv_style_set_radius(&style_pr, 12);
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);
lv_style_set_shadow_opa(&style_pr, 102);
lv_style_set_shadow_offset_x(&style_pr, 0);
lv_style_set_shadow_offset_y(&style_pr, 4);
lv_style_set_pad_hor(&style_pr, 24);
lv_style_set_pad_ver(&style_pr, 12);

style_inited = true;
}
Expand Down
22 changes: 11 additions & 11 deletions examples/components/scratchpad.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

<component>
<consts>
<int name="long" value="250"/>
<int name="long" value="100%"/>
</consts>

<view extends="lv_obj" width="100%" height="100%" flex_flow="column">
<button_default width="#long" button_text="Hello"/>
<button_default width="#long" button_text="Hello"/>
<button_default width="#long" button_text="Hello"/>
<button_error width="#long" button_text="Hello"/>
<button_warning width="#long" button_text="Hello"/>
<button_default width="#long" button_text="Hello"/>
<button_default width="#long" button_text="Hello"/>
<button_default width="#long" button_text="Hello"/>
<button_default width="#long" button_text="Hello"/>
<view extends="lv_obj" width="50%" height="100%" flex_flow="column" style_bg_color="0x114488">
<button_default width="#long" button_label="Hello"/>
<button_default width="#long" button_label="Hello"/>
<button_default width="#long" button_label="Hello"/>
<button_error width="#long" button_label="Hello"/>
<button_warning width="#long" button_label="Hello"/>
<button_default width="#long" button_label="Hello"/>
<button_default width="#long" button_label="Hello"/>
<button_default width="#long" button_label="Hello"/>
<button_default width="#long" button_label="Hello"/>
</view>
</component>
39 changes: 20 additions & 19 deletions examples/components/scratchpad_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,37 @@ lv_obj_t * scratchpad_create(lv_obj_t * parent)

lv_obj_t * lv_obj = lv_obj_create(parent);

lv_obj_set_width(lv_obj, lv_pct(100));
lv_obj_set_width(lv_obj, lv_pct(50));
lv_obj_set_height(lv_obj, lv_pct(100));
lv_obj_set_flex_flow(lv_obj, LV_FLEX_FLOW_COLUMN);
lv_obj_set_style_bg_color(lv_obj, lv_color_hex(0x114488), LV_PART_MAIN | LV_STATE_DEFAULT);

lv_obj_t * button_default_1 = button_default_create(lv_obj, "Button");
lv_obj_set_width(button_default_1, 250);
lv_obj_t * button_default_1 = button_default_create(lv_obj, "Hello");
lv_obj_set_width(button_default_1, lv_pct(100));

lv_obj_t * button_default_2 = button_default_create(lv_obj, "Button");
lv_obj_set_width(button_default_2, 250);
lv_obj_t * button_default_2 = button_default_create(lv_obj, "Hello");
lv_obj_set_width(button_default_2, lv_pct(100));

lv_obj_t * button_default_3 = button_default_create(lv_obj, "Button");
lv_obj_set_width(button_default_3, 250);
lv_obj_t * button_default_3 = button_default_create(lv_obj, "Hello");
lv_obj_set_width(button_default_3, lv_pct(100));

lv_obj_t * button_error_1 = button_error_create(lv_obj, "Button");
lv_obj_set_width(button_error_1, 250);
lv_obj_t * button_error_1 = button_error_create(lv_obj, "Hello");
lv_obj_set_width(button_error_1, lv_pct(100));

lv_obj_t * button_warning_1 = button_warning_create(lv_obj, "Button");
lv_obj_set_width(button_warning_1, 250);
lv_obj_t * button_warning_1 = button_warning_create(lv_obj, "Hello");
lv_obj_set_width(button_warning_1, lv_pct(100));

lv_obj_t * button_default_4 = button_default_create(lv_obj, "Button");
lv_obj_set_width(button_default_4, 250);
lv_obj_t * button_default_4 = button_default_create(lv_obj, "Hello");
lv_obj_set_width(button_default_4, lv_pct(100));

lv_obj_t * button_default_5 = button_default_create(lv_obj, "Button");
lv_obj_set_width(button_default_5, 250);
lv_obj_t * button_default_5 = button_default_create(lv_obj, "Hello");
lv_obj_set_width(button_default_5, lv_pct(100));

lv_obj_t * button_default_6 = button_default_create(lv_obj, "Button");
lv_obj_set_width(button_default_6, 250);
lv_obj_t * button_default_6 = button_default_create(lv_obj, "Hello");
lv_obj_set_width(button_default_6, lv_pct(100));

lv_obj_t * button_default_7 = button_default_create(lv_obj, "Button");
lv_obj_set_width(button_default_7, 250);
lv_obj_t * button_default_7 = button_default_create(lv_obj, "Hello");
lv_obj_set_width(button_default_7, lv_pct(100));



Expand Down
2 changes: 1 addition & 1 deletion examples/components/scratchpad_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C" {
* GLOBAL PROTOTYPES
**********************/

#define SCRATCHPAD_LONG 250
#define SCRATCHPAD_LONG 100%

lv_obj_t * scratchpad_create(lv_obj_t * parent);
/**********************
Expand Down

0 comments on commit 839a3d3

Please sign in to comment.