docs: update API comments

This commit is contained in:
Gabor Kiss-Vamosi
2023-12-13 21:23:08 +01:00
parent 636aba8c34
commit d5daccdd48
116 changed files with 1283 additions and 1918 deletions

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_USE_BTN && LV_BUILD_EXAMPLES
#if LV_USE_BUTTON && LV_BUILD_EXAMPLES
static void event_handler(lv_event_t * e)
{

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_USE_BTN && LV_BUILD_EXAMPLES
#if LV_USE_BUTTON && LV_BUILD_EXAMPLES
/**
* Style a button from scratch

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_BUILD_EXAMPLES && LV_USE_BTN
#if LV_BUILD_EXAMPLES && LV_USE_BUTTON
/**
* Create a style transition on a button to act like a gum when clicked

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES
#if LV_USE_BUTTONMATRIX && LV_BUILD_EXAMPLES
static void event_handler(lv_event_t * e)
{

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES
#if LV_USE_BUTTONMATRIX && LV_BUILD_EXAMPLES
static void event_cb(lv_event_t * e)
{

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES
#if LV_USE_BUTTONMATRIX && LV_BUILD_EXAMPLES
static void event_cb(lv_event_t * e)
{

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_USE_IMG && LV_BUILD_EXAMPLES
#if LV_USE_IMAGE && LV_BUILD_EXAMPLES
void lv_example_image_1(void)
{

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_USE_IMG && LV_USE_SLIDER && LV_BUILD_EXAMPLES
#if LV_USE_IMAGE && LV_USE_SLIDER && LV_BUILD_EXAMPLES
static lv_obj_t * create_slider(lv_color_t color);
static void slider_event_cb(lv_event_t * e);

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_USE_IMG && LV_BUILD_EXAMPLES
#if LV_USE_IMAGE && LV_BUILD_EXAMPLES
static void set_angle(void * img, int32_t v)
{

View File

@@ -1,5 +1,5 @@
#include "../../lv_examples.h"
#if LV_USE_IMG && LV_BUILD_EXAMPLES
#if LV_USE_IMAGE && LV_BUILD_EXAMPLES
static void ofs_y_anim(void * img, int32_t v)
{

View File

@@ -0,0 +1,7 @@
Simple Image button
-------------------
.. lv_example:: widgets/imagebutton/lv_example_imagebutton_1
:language: c

View File

@@ -1,11 +1,11 @@
#include "../../lv_examples.h"
#if LV_USE_IMGBTN && LV_BUILD_EXAMPLES
#if LV_USE_IMAGEBUTTON && LV_BUILD_EXAMPLES
void lv_example_imgbtn_1(void)
void lv_example_imagebutton_1(void)
{
LV_IMAGE_DECLARE(imgbtn_left);
LV_IMAGE_DECLARE(imgbtn_right);
LV_IMAGE_DECLARE(imgbtn_mid);
LV_IMAGE_DECLARE(imagebutton_left);
LV_IMAGE_DECLARE(imagebutton_right);
LV_IMAGE_DECLARE(imagebutton_mid);
/*Create a transition animation on width transformation and recolor.*/
static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_IMAGE_RECOLOR_OPA, 0};
@@ -25,15 +25,16 @@ void lv_example_imgbtn_1(void)
lv_style_set_transform_width(&style_pr, 20);
/*Create an image button*/
lv_obj_t * imgbtn1 = lv_imgbtn_create(lv_screen_active());
lv_imgbtn_set_src(imgbtn1, LV_IMGBTN_STATE_RELEASED, &imgbtn_left, &imgbtn_mid, &imgbtn_right);
lv_obj_add_style(imgbtn1, &style_def, 0);
lv_obj_add_style(imgbtn1, &style_pr, LV_STATE_PRESSED);
lv_obj_t * imagebutton1 = lv_imagebutton_create(lv_screen_active());
lv_imagebutton_set_src(imagebutton1, LV_IMAGEBUTTON_STATE_RELEASED, &imagebutton_left, &imagebutton_mid,
&imagebutton_right);
lv_obj_add_style(imagebutton1, &style_def, 0);
lv_obj_add_style(imagebutton1, &style_pr, LV_STATE_PRESSED);
lv_obj_align(imgbtn1, LV_ALIGN_CENTER, 0, 0);
lv_obj_align(imagebutton1, LV_ALIGN_CENTER, 0, 0);
/*Create a label on the image button*/
lv_obj_t * label = lv_label_create(imgbtn1);
lv_obj_t * label = lv_label_create(imagebutton1);
lv_label_set_text(label, "Button");
lv_obj_align(label, LV_ALIGN_CENTER, 0, -4);
}

View File

@@ -1,38 +1,38 @@
# Create an image from the png file
try:
with open('../../assets/imgbtn_left.png','rb') as f:
imgbtn_left_data = f.read()
imagebutton_left_data = f.read()
except:
print("Could not find imgbtn_left.png")
print("Could not find imagebutton_left.png")
sys.exit()
imgbtn_left_dsc = lv.image_dsc_t({
'data_size': len(imgbtn_left_data),
'data': imgbtn_left_data
imagebutton_left_dsc = lv.image_dsc_t({
'data_size': len(imagebutton_left_data),
'data': imagebutton_left_data
})
try:
with open('../../assets/imgbtn_mid.png','rb') as f:
imgbtn_mid_data = f.read()
imagebutton_mid_data = f.read()
except:
print("Could not find imgbtn_mid.png")
print("Could not find imagebutton_mid.png")
sys.exit()
imgbtn_mid_dsc = lv.image_dsc_t({
'data_size': len(imgbtn_mid_data),
'data': imgbtn_mid_data
imagebutton_mid_dsc = lv.image_dsc_t({
'data_size': len(imagebutton_mid_data),
'data': imagebutton_mid_data
})
try:
with open('../../assets/imgbtn_right.png','rb') as f:
imgbtn_right_data = f.read()
imagebutton_right_data = f.read()
except:
print("Could not find imgtn_right.png")
sys.exit()
imgbtn_right_dsc = lv.image_dsc_t({
'data_size': len(imgbtn_right_data),
'data': imgbtn_right_data
imagebutton_right_dsc = lv.image_dsc_t({
'data_size': len(imagebutton_right_data),
'data': imagebutton_right_data
})
# Create a transition animation on width transformation and recolor.
@@ -53,15 +53,15 @@ style_pr.set_image_recolor(lv.color_black())
style_pr.set_transform_width(20)
# Create an image button
imgbtn1 = lv.imgbtn(lv.screen_active())
imgbtn1.set_src(lv.imgbtn.STATE.RELEASED, imgbtn_left_dsc, imgbtn_mid_dsc, imgbtn_right_dsc)
imgbtn1.add_style(style_def, 0)
imgbtn1.add_style(style_pr, lv.STATE.PRESSED)
imagebutton1 = lv.imagebutton(lv.screen_active())
imagebutton1.set_src(lv.imagebutton.STATE.RELEASED, imagebutton_left_dsc, imagebutton_mid_dsc, imagebutton_right_dsc)
imagebutton1.add_style(style_def, 0)
imagebutton1.add_style(style_pr, lv.STATE.PRESSED)
imgbtn1.align(lv.ALIGN.CENTER, 0, 0)
imagebutton1.align(lv.ALIGN.CENTER, 0, 0)
# Create a label on the image button
label = lv.label(imgbtn1)
label = lv.label(imagebutton1)
label.set_text("Button")
label.align(lv.ALIGN.CENTER, 0, -4)

View File

@@ -1,7 +0,0 @@
Simple Image button
-------------------
.. lv_example:: widgets/imgbtn/lv_example_imgbtn_1
:language: c

View File

@@ -78,7 +78,7 @@ void lv_example_image_2(void);
void lv_example_image_3(void);
void lv_example_image_4(void);
void lv_example_imgbtn_1(void);
void lv_example_imagebutton_1(void);
void lv_example_keyboard_1(void);
void lv_example_keyboard_2(void);

View File

@@ -40,7 +40,8 @@ void lv_example_scale_3(void)
lv_scale_set_minor_tick_length(scale_line, 5);
lv_scale_set_range(scale_line, 10, 40);
lv_scale_set_round_props(scale_line, 270, 135);
lv_scale_set_angle_range(scale_line, 270);
lv_scale_set_rotation(scale_line, 135);
needle_line = lv_line_create(scale_line);
@@ -76,7 +77,8 @@ void lv_example_scale_3(void)
lv_scale_set_minor_tick_length(scale_img, 5);
lv_scale_set_range(scale_img, 10, 40);
lv_scale_set_round_props(scale_img, 270, 135);
lv_scale_set_angle_range(scale_img, 270);
lv_scale_set_rotation(scale_img, 135);
/* image must point to the right. E.g. -O------>*/
needle_img = lv_img_create(scale_img);