Skip to content

Commit

Permalink
feat: Add new test files
Browse files Browse the repository at this point in the history
  • Loading branch information
richardgazdik committed Dec 11, 2024
1 parent 060aadf commit 9ea2732
Show file tree
Hide file tree
Showing 36 changed files with 100 additions and 116 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</consts>

<styles>
<style name="main" bg_color="#dark_color" border_width="2" radius="100"/>
<style name="main" bg_color="#dark_color" border_width="2" border_color="0x555555" radius="100"/>
</styles>

<view extends="lv_button" styles="main">
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</api>

<styles>
<style name="main" bg_color="0xff9900" border_width="2" radius="100"/>
<style name="main" bg_color="0xffbb44" border_width="2" border_color="0x555555" radius="100"/>
</styles>

<view extends="lv_button" styles="main">
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 6 additions & 11 deletions examples/components/home.xml → components/home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,17 @@

<view extends="lv_obj" styles="main">
<lv_obj styles="cont left_cont">
<slider_box width="190"/>
<slider_box width="190"/>
<slider_box width="190"/>
<slider_box width="190"/>
<slider_box width="190"/>
<slider_box width="190"/>
<slider_box width="150"/>
</lv_obj>

<lv_obj styles="cont right_cont" flex_grow="1">
<button_default text="First button"/>
<button_default text="Second button"/>
<dark_slider width="100" height="15" color="0xff0000" send_draw_task_events="true"/>
<button_warning text="First button"/>
<button_warning text="Second button"/>
<button_error text="First button"/>
<button_error text="Second button"/>
<dark_slider width="100" height="15" color="0xff0000"/>
<button_warning text="Third button"/>
<button_warning text="Forth button"/>
<button_error text="Fifth button"/>
<button_error text="Sixth button"/>
</lv_obj>
</view>
</component>
14 changes: 14 additions & 0 deletions example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<component>

<api>
<prop name="text" type="string" default="Button"/>
</api>

<styles>
<style name="main" bg_color="0xff3322" border_width="2" border_color="0x555555" radius="100"/>
</styles>

<view extends="lv_button" styles="main">
<h2 text="$text" align="center"/>
</view>
</component>
File renamed without changes.
41 changes: 0 additions & 41 deletions examples/example.c

This file was deleted.

Binary file removed examples/widgets/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<style name="main"
bg_color="0x333333" bg_opa="255"
border_width="2" border_color="0xaaaaaa"
radius="10"
radius="100"
width="120"
height="16"
pad_all="4"/>
Expand All @@ -18,7 +18,6 @@
bg_color="0x0000ff" bg_opa="255"
radius="100"/>
</styles>

<view extends="lv_slider"
styles="main light_knob:knob blue_indicator:indicator"
align="center" value="30" range="20 40" send_draw_task_events="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,43 +70,54 @@ static void dark_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * o
LV_UNUSED(class_p);
LV_TRACE_OBJ_CREATE("begin");

static lv_style_t style_main;

static lv_style_t style_light_knob;
static lv_style_t style_blue_indicator;

static lv_style_t style_main;
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(0x333333));
lv_style_set_bg_color(&style_main, lv_color_hex(0x333333));
lv_style_set_bg_opa(&style_main, 255);
lv_style_set_border_width(&style_main, 2);
lv_style_set_border_color(&style_main, lv_color_hex(0xaaaaaa));
lv_style_set_radius(&style_main, 100);
lv_style_set_width(&style_main, 120);
lv_style_set_height(&style_main, 16);
lv_style_set_pad_all(&style_main, 4);
style_main_inited = true;
}

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

static lv_style_t style_light_knob;
static bool style_light_knob_inited = false;

if(!style_light_knob_inited) {
lv_style_init(&style_light_knob);
lv_style_set_bg_color(&style_light_knob, lv_color_hex(0xeeeeee));
lv_style_set_bg_color(&style_light_knob, lv_color_hex(0xeeeeee));
lv_style_set_bg_opa(&style_light_knob, 255);
lv_style_set_border_width(&style_light_knob, 2);
lv_style_set_radius(&style_light_knob, 100);
lv_style_set_border_color(&style_light_knob, lv_color_hex(0xaaaaaa));
lv_style_set_pad_all(&style_light_knob, 5);
style_light_knob_inited = true;
}

lv_obj_add_style(obj, &style_light_knob, LV_PART_KNOB | LV_STATE_DEFAULT);

static lv_style_t style_blue_indicator;
static bool style_blue_indicator_inited = false;

if(!style_blue_indicator_inited) {
lv_style_init(&style_blue_indicator);
lv_style_set_bg_color(&style_blue_indicator, lv_color_hex(0x0000ff));
lv_style_set_bg_color(&style_blue_indicator, lv_color_hex(0x0000ff));
lv_style_set_bg_opa(&style_blue_indicator, 255);
lv_style_set_radius(&style_blue_indicator, 100);

style_main_inited = true;
style_blue_indicator_inited = true;
}

lv_obj_add_style(obj, &style_main, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_style(obj, &style_light_knob, LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_add_style(obj, &style_blue_indicator, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_add_flag(obj, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);

lv_obj_add_style(obj, &style_blue_indicator, LV_PART_INDICATOR| LV_STATE_DEFAULT);

dark_slider_t * dark_slider = (dark_slider_t *)obj;


Expand All @@ -133,4 +144,4 @@ static void dark_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
if(res != LV_RESULT_OK) return;

dark_slider_event_hook(e);
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lvgl/src/widgets/slider/lv_slider_private.h" /*The ancestor of dark_slider*/
#include "lvgl/src/widgets/slider/lv_slider_private.h"
#include "dark_slider.h"

/*********************
Expand Down Expand Up @@ -41,4 +41,4 @@ typedef struct {
} /*extern "C"*/
#endif

#endif /*DARK_SLIDER_PRIVATE_H*/
#endif /*DARK_SLIDER_PRIVATE_H*/
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
radius="20"
width="180" height="content"
layout="flex"
flex_flow="column"
flex_cross_place="center" flex_track_place="center"
flex_flow="column" flex_cross_place="center" flex_track_place="center"
pad_row="10"
pad_all="10"/>

Expand All @@ -33,7 +32,7 @@
<lv_button width="30" height="30" styles="button">
<lv_label text="-"/>
</lv_button>
<dark_slider flex_grow="1" color="0xff00ff"/>
<dark_slider flex_grow="1"/>
<lv_button styles="button">
<lv_label text="+"/>
</lv_button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
*********************/
#include "slider_box_private_gen.h"
#include "lvgl/src/core/lv_obj_class_private.h"
#include "../../ui.h"

#include "ui.h"

/*********************
* DEFINES
Expand Down Expand Up @@ -71,60 +70,68 @@ static void slider_box_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob
LV_UNUSED(class_p);
LV_TRACE_OBJ_CREATE("begin");


static lv_style_t style_main;
static lv_style_t style_button;

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(0x666666));
lv_style_set_bg_opa(&style_main, 255);
lv_style_set_border_width(&style_main, 2);
lv_style_set_border_color(&style_main, lv_color_hex(0xaaaaaa));
lv_style_set_radius(&style_main, 20);
lv_style_set_width(&style_main, 180);
lv_style_set_height(&style_main, LV_SIZE_CONTENT);
lv_style_set_layout(&style_main, LV_LAYOUT_FLEX);
lv_style_set_flex_flow(&style_main, LV_FLEX_FLOW_ROW_WRAP);
lv_style_set_flex_cross_place(&style_main, LV_FLEX_ALIGN_CENTER);
lv_style_set_flex_track_place(&style_main, LV_FLEX_ALIGN_CENTER);
lv_style_set_pad_row(&style_main, 10);
lv_style_set_pad_all(&style_main, 10);

lv_style_init(&style_button);
lv_style_set_radius(&style_button, 100);
style_main_inited = true;
lv_style_init(&style_main);
lv_style_set_bg_color(&style_main, lv_color_hex(0x666666));
lv_style_set_bg_opa(&style_main, 255);
lv_style_set_border_width(&style_main, 2);
lv_style_set_border_color(&style_main, lv_color_hex(0xaaaaaa));
lv_style_set_radius(&style_main, 20);
lv_style_set_width(&style_main, 250);
lv_style_set_height(&style_main, 100);
lv_style_set_pad_all(&style_main, 10);
style_main_inited = true;
}

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

slider_box_t * slider_box = (slider_box_t *)obj;
static lv_style_t style_transp_cont;
static bool style_transp_cont_inited = false;

if(!style_transp_cont_inited) {
lv_style_init(&style_transp_cont);
lv_style_set_bg_opa(&style_transp_cont, 0);
lv_style_set_border_width(&style_transp_cont, 2);
style_transp_cont_inited = true;
}

slider_box->lv_button = lv_button_create(obj);
lv_obj_add_style(slider_box->lv_button, &style_button, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_width(slider_box->lv_button, 30);
lv_obj_set_height(slider_box->lv_button, 30);
lv_obj_add_style(obj, &style_transp_cont, LV_PART_MAIN | LV_STATE_DEFAULT);

slider_box->lv_label2 = lv_label_create(slider_box->lv_button);
lv_label_set_text(slider_box->lv_label2, "-");
static lv_style_t style_button;
static bool style_button_inited = false;

if(!style_button_inited) {
lv_style_init(&style_button);
lv_style_set_radius(&style_button, 100);
style_button_inited = true;
}

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

slider_box_t * slider_box = (slider_box_t *)obj;

slider_box->lv_label = lv_label_create(obj);
lv_obj_set_align(slider_box->lv_label, LV_ALIGN_TOP_MID);
lv_label_set_text(slider_box->lv_label, "Title");
lv_obj_set_style_text_color(slider_box->lv_label, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_flex_grow(slider_box->lv_label, 1);
lv_label_set_text(slider_box->lv_label, "$title");
lv_label_set_long_mode(slider_box->lv_label, LV_LABEL_LONG_MODE_SCROLL);
lv_obj_set_style_text_align(slider_box->lv_label, LV_TEXT_ALIGN_CENTER, 0);

slider_box->lv_button2 = lv_button_create(obj);
lv_obj_add_style(slider_box->lv_button2, &style_button, LV_PART_MAIN | LV_STATE_DEFAULT);
slider_box->lv_obj = lv_obj_create(obj);

slider_box->lv_button = lv_button_create(slider_box->lv_obj);

slider_box->lv_label2 = lv_label_create(slider_box->lv_button);
lv_label_set_text(slider_box->lv_label2, "-");

slider_box->lv_button2 = lv_button_create(slider_box->lv_obj);

slider_box->lv_label3 = lv_label_create(slider_box->lv_button2);
lv_label_set_text(slider_box->lv_label3, "+");

slider_box->dark_slider = dark_slider_create(obj);
lv_obj_set_width(slider_box->dark_slider, lv_pct(100));
slider_box->dark_slider = dark_slider_create(slider_box->lv_obj);


slider_box_constructor_hook(obj);

Expand All @@ -149,5 +156,4 @@ static void slider_box_event(const lv_obj_class_t * class_p, lv_event_t * e)
if(res != LV_RESULT_OK) return;

slider_box_event_hook(e);
}

}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9ea2732

Please sign in to comment.