Skip to content

Commit

Permalink
add the first version of the v0.1 examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Dec 6, 2024
1 parent a1ba02b commit 500f8d6
Show file tree
Hide file tree
Showing 26 changed files with 676 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/components/button_default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component>
<api>
<prop name="text" type="string" default="Muhaha"/>
<prop name="my_width" type="int" default="100"/>
</api>
<styles>
<style name="main" bg_color="0x22222" border_width="2" border_color="0x333333" radius="100"/>
</styles>
<view extends="lv_button" styles="main" width="$my_width">
<h2 text="$text" align="center"/>
</view>
</component>
10 changes: 10 additions & 0 deletions examples/components/button_error.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<component>
<params>
<string name="text"/>
</params>
<styles>
<style name="main" bg_color="0xff3322" text_color="0xffffff" border_color="0x333333" radius="100"/>
</styles>
<view extends="button_default" styles="main" text="$text">
</view>
</component>
10 changes: 10 additions & 0 deletions examples/components/button_warning.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<component>
<params>
<string name="text"/>
</params>
<styles>
<style name="main" bg_color="0xffbb44" text_color="0x000000" border_color="0x333333" radius="100"/>
</styles>
<view extends="button_default" styles="main" text="$text">
</view>
</component>
21 changes: 21 additions & 0 deletions examples/components/dark_slider.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component>
<params>
<string name="text"/>
</params>
<styles>
<style name="main"
bg_color="0x333333" bg_opa="255"
border_width="2" border_color="0xaaaaaa"
radius="100"
width="100"/>
<style name="light_knob"
bg_color="0xeeeeee" bg_opa="255"
border_width="2" border_color="0xaaaaaa" />
<style name="blue_indicator"
bg_color="0x0000ff" bg_opa="255"/>
</styles>
<view extends="lv_slider"
styles="main light_knob:knob blue_indicator:indicator"
align="center">
</view>
</component>
7 changes: 7 additions & 0 deletions examples/components/h1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component>
<styles>
<style name="main" text_font="lv_montserrat_18" />
</styles>
<view extends="lv_label" styles="main">
</view>
</component>
7 changes: 7 additions & 0 deletions examples/components/h2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component>
<styles>
<style name="main" text_font="lv_montserrat_16"/>
</styles>
<view extends="lv_label" styles="main" text="$text">
</view>
</component>
7 changes: 7 additions & 0 deletions examples/components/h3.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component>
<styles>
<style name="main" text_font="lv_montserrat_14" />
</styles>
<view extends="lv_label" styles="main">
</view>
</component>
7 changes: 7 additions & 0 deletions examples/components/row.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component>
<styles>
<style name="main" border_width="2" bg_opa="0" layout="flex" flex_flow="row"/>
</styles>
<view extends="lv_obj" styles="main" flex_flow="row">
</view>
</component>
Binary file added examples/fonts/arial.ttf
Binary file not shown.
11 changes: 11 additions & 0 deletions examples/globals.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<globals>
<images>
<data name="screenshot" src_path="A:/images/lvgl.png" file_format="png"/>
<data name="wink" src_path="A:/images/wink.png" file_format="png"/>
</images>
<fonts>
<tinyttf name="arial_14" src_path="A:/fonts/arial.ttf" size="14"/>
<tinyttf name="arial_18" src_path="A:/fonts/arial.ttf" size="18"/>
<tinyttf name="arial_22" src_path="A:/fonts/arial.ttf" size="22"/>
</fonts>
</globals>
Binary file added examples/images/lvgl.bmp
Binary file not shown.
Binary file added examples/images/lvgl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/wink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions examples/tests/test2.lvml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<tests name="Some name" help="Description about the batch of tests below.">
<test name="test subjects" help="Some description">
<styles>
<style name="black" bg_color="0x000000" />
<style name="white" bg_color="0xFFFFFF" />
<style name="secondary" bg_color="0x2196F3" />
<style name="green" bg_color="0x4CAF50" />
<style name="purple" bg_color="0x800080" width="100"/>
<style name="red" bg_color="0xff0000" width="100"/>
</styles>
<view extends="lv_obj" width="250" height="200" styles="red">
<CustomButton buttontext="Not Red" styles="purple" x="25" y="25"/>
</view>
</test>

<test name="test in list with different sizes" help="Some description">
<styles>
<style name="black" bg_color="0x000000" />
<style name="white" bg_color="0xFFFFFF" />
<style name="secondary" bg_color="0x2196F3" />
<style name="green" bg_color="0x4CAF50" />
<style name="purple" bg_color="0x800080" width="100"/>
<style name="red" bg_color="0xff0000" width="100"/>
</styles>
<view extends="lv_obj" width="250" height="200" styles="purple">
<CustomButton buttontext="Not Purple" styles="red" x="25" y="25"/>
</view>
</test>

<test name="interactive test" help="Some description">
<styles>
<style name="black" bg_color="0x000000" />
<style name="white" bg_color="0xFFFFFF" />
<style name="secondary" bg_color="0x2196F3" />
<style name="green" bg_color="0x4CAF50" />
<style name="purple" bg_color="0x800080" width="100"/>
<style name="red" bg_color="0xff0000" width="100"/>
</styles>
<view extends="lv_obj" width="250" height="200" styles="secondary">
<my_button x="25" y="25" buttontext="Red" buttonstyle="red"/>
<my_button x="25" y="75" buttontext="Purple" buttonstyle="purple"/>
<my_button x="25" y="125" buttontext="Green" buttonstyle="green"/>
</view>
</test>
</tests>
40 changes: 40 additions & 0 deletions examples/tests/tests.lvml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<tests name="Some name" help="Description about the batch of tests below.">
<test name="basic test" help="Some description">
<consts>
<int name="value" value="30"/>
</consts>

<view>
<sliderbox value="!value" range="20 80"/>
</view>
</test>

<test name="test subjects" help="Some description">
<subjects>
<subject name="value" value="30"/>
</subjects>
<view>
<sliderbox bind_value="value" range="20 80"/>
</view>
</test>

<test name="test in list with different sizes" help="Some description">
<view width="300px" height="600px" style_flex_flow="column">
<sliderbox value="30" range="20 80"/>
<sliderbox value="40" range="20 80" width="100%"/>
<sliderbox value="50" range="20 80" width="200px"/>
<sliderbox value="60" range="20 80" width="100px"/>
</view>
</test>

<test name="interactive test" help="Some description">
<view>
<lv_sliderbox value="30" range="20 80"/>
</view>
<steps>
<click pos="20 30"/>
<wait time="100"/>
<screenshot ref="ref_img1"/>
</steps>
</test>
</tests>
Binary file added examples/widgets/.DS_Store
Binary file not shown.
54 changes: 54 additions & 0 deletions examples/widgets/dark_slider/dark_slider.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* @file dark_slider.c
*
*/

/*********************
* INCLUDES
*********************/
#include "dark_slider_private_gen.h"

/*********************
* DEFINES
*********************/

/**********************
* TYPEDEFS
**********************/

/**********************
* STATIC PROTOTYPES
**********************/

/**********************
* STATIC VARIABLES
**********************/

/**********************
* MACROS
**********************/

/**********************
* GLOBAL FUNCTIONS
**********************/

void dark_slider_constructor_hook(lv_obj_t * obj)
{

}

void dark_slider_destructor_hook(lv_obj_t * obj)
{

}

void dark_slider_event_hook(lv_event_t * e)
{

}



/**********************
* STATIC FUNCTIONS
**********************/
41 changes: 41 additions & 0 deletions examples/widgets/dark_slider/dark_slider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @file dark_slider.h
*
*/

#ifndef DARK_SLIDER_H
#define DARK_SLIDER_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
* INCLUDES
*********************/
#include "lvgl/lvgl.h"
#include "dark_slider_gen.h"

/*********************
* DEFINES
*********************/

/**********************
* TYPEDEFS
**********************/

/**********************
* GLOBAL PROTOTYPES
**********************/



/**********************
* MACROS
**********************/

#ifdef __cplusplus
} /*extern "C"*/
#endif

#endif /*DARK_SLIDER_H*/
22 changes: 22 additions & 0 deletions examples/widgets/dark_slider/dark_slider.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<widget>
<params>
<string name="text"/>
</params>
<styles>
<style name="main"
bg_color="0x333333" bg_opa="255"
border_width="2" border_color="0xaaaaaa"
radius="100"
width="100"
pad_all="3"/>
<style name="light_knob"
bg_color="0xeeeeee" bg_opa="255"
border_width="2" border_color="0xaaaaaa" pad_all="10"/>
<style name="blue_indicator"
bg_color="0x0000ff" bg_opa="255"/>
</styles>
<view extends="lv_slider"
styles="main light_knob:knob blue_indicator:indicator"
align="center">
</view>
</widget>
Loading

0 comments on commit 500f8d6

Please sign in to comment.