merge master

This commit is contained in:
Gabor Kiss-Vamosi
2020-12-02 11:32:44 +01:00
37 changed files with 3822 additions and 88 deletions
+1 -1
View File
@@ -856,7 +856,7 @@ menu "LVGL configuration"
bool "Support bidirectional texts"
help
Allows mixing Left-to-Right and Right-to-Left texts.
The direction will be processed according to the Unicode Bidirectioanl Algorithm:
The direction will be processed according to the Unicode Bidirectional Algorithm:
https://www.w3.org/International/articles/inline-bidi-markup/uba-basics
choice
+4 -4
View File
@@ -325,9 +325,9 @@ static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * fr
}
/**
* Initialize a 'fs_read_dir_t' variable for directory reading
* Initialize a 'lv_fs_dir_t' variable for directory reading
* @param drv pointer to a driver where this function belongs
* @param rddir_p pointer to a 'fs_read_dir_t' variable
* @param rddir_p pointer to a 'lv_fs_dir_t' variable
* @param path path to a directory
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
@@ -344,7 +344,7 @@ static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *p
* Read the next filename form a directory.
* The name of the directories will begin with '/'
* @param drv pointer to a driver where this function belongs
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
* @param fn pointer to a buffer to store the filename
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
@@ -360,7 +360,7 @@ static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn)
/**
* Close the directory reading
* @param drv pointer to a driver where this function belongs
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p)
+3 -3
View File
@@ -86,7 +86,7 @@ typedef int16_t lv_coord_t;
/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
# define LV_MEM_SIZE (32U * 1024U)
/* Complier prefix for a big array declaration */
/* Compiler prefix for a big array declaration */
# define LV_MEM_ATTR
/* Set an address for the memory pool instead of allocating it as an array.
@@ -131,7 +131,7 @@ typedef int16_t lv_coord_t;
#define LV_INDEV_DEF_DRAG_THROW 10
/* Long press time in milliseconds.
* Time to send `LV_EVENT_LONG_PRESSSED`) */
* Time to send `LV_EVENT_LONG_PRESSED`) */
#define LV_INDEV_DEF_LONG_PRESS_TIME 400
/* Repeated trigger period in long press [ms]
@@ -514,7 +514,7 @@ typedef void * lv_font_user_data_t;
/* Support bidirectional texts.
* Allows mixing Left-to-Right and Right-to-Left texts.
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
* The direction will be processed according to the Unicode Bidirectional Algorithm:
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
+1 -1
View File
@@ -225,4 +225,4 @@ static inline lv_coord_t lv_dpx(lv_coord_t n)
} /* extern "C" */
#endif
#endif /*LV_TEMPL_H*/
#endif /*LV_DISP_H*/
+3 -3
View File
@@ -522,7 +522,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
lv_group_focus_prev(g);
if(indev_reset_check(&i->proc)) return;
}
/*Just send other keys again to the object (e.g. 'A' or `LV_GORUP_KEY_RIGHT)*/
/*Just send other keys again to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT)*/
else {
lv_group_send_data(g, data->key);
if(indev_reset_check(&i->proc)) return;
@@ -815,7 +815,7 @@ static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
}
/**
* Process the pressed state of LV_INDEV_TYPE_POINER input devices
* Process the pressed state of LV_INDEV_TYPE_POINTER input devices
* @param indev pointer to an input device 'proc'
* @return LV_RES_OK: no indev reset required; LV_RES_INV: indev reset is required
*/
@@ -961,7 +961,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
}
/**
* Process the released state of LV_INDEV_TYPE_POINER input devices
* Process the released state of LV_INDEV_TYPE_POINTER input devices
* @param proc pointer to an input device 'proc'
*/
static void indev_proc_release(lv_indev_proc_t * proc)
+1 -1
View File
@@ -428,7 +428,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
{
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return false;
/*Invalidate the object only if it belongs to the curent or previous'*/
/*Invalidate the object only if it belongs to the current or previous'*/
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
lv_disp_t * disp = lv_obj_get_disp(obj_scr);
if(obj_scr == lv_disp_get_scr_act(disp) ||
+7 -7
View File
@@ -44,7 +44,7 @@ static inline size_t get_prop_size(uint8_t prop_id);
static inline size_t get_next_prop_index(uint8_t prop_id, size_t id);
/**********************
* GLOABAL VARIABLES
* GLOBAL VARIABLES
**********************/
/**********************
@@ -340,7 +340,7 @@ uint16_t _lv_style_get_mem_size(const lv_style_t * style)
size_t i = 0;
uint8_t prop_id;
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSEING_PROP) {
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSING_PROP) {
i = get_next_prop_index(prop_id, i);
}
@@ -378,7 +378,7 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
/*Add new property if not exists yet*/
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_style_int_t));
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
uint8_t end_mark_size = sizeof(end_mark);
uint16_t size = _lv_style_get_mem_size(style);
@@ -424,7 +424,7 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
/*Add new property if not exists yet*/
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_color_t));
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
uint8_t end_mark_size = sizeof(end_mark);
uint16_t size = _lv_style_get_mem_size(style);
@@ -471,7 +471,7 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
/*Add new property if not exists yet*/
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_opa_t));
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
uint8_t end_mark_size = sizeof(end_mark);
uint16_t size = _lv_style_get_mem_size(style);
@@ -518,7 +518,7 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
/*Add new property if not exists yet*/
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(const void *));
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
uint8_t end_mark_size = sizeof(end_mark);
uint16_t size = _lv_style_get_mem_size(style);
@@ -1076,7 +1076,7 @@ LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t
}
uint8_t prop_id;
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSEING_PROP) {
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSING_PROP) {
if(prop_id == id_to_find) {
lv_style_attr_t attr_i;
attr_i = get_style_prop_attr(style, i);
+1 -1
View File
@@ -39,7 +39,7 @@ LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE);
#define LV_STYLE_ATTR_NONE 0
#define LV_STYLE_ATTR_INHERIT (1 << 7)
#define _LV_STYLE_CLOSEING_PROP 0xFF
#define _LV_STYLE_CLOSING_PROP 0xFF
#define LV_STYLE_TRANS_NUM_MAX 6
+4 -4
View File
@@ -42,7 +42,7 @@ static void draw_quarter_0(quarter_draw_dsc_t * q);
static void draw_quarter_1(quarter_draw_dsc_t * q);
static void draw_quarter_2(quarter_draw_dsc_t * q);
static void draw_quarter_3(quarter_draw_dsc_t * q);
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t tickness, lv_area_t * res_area);
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area);
/**********************
@@ -386,13 +386,13 @@ static void draw_quarter_3(quarter_draw_dsc_t * q)
}
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t tickness, lv_area_t * res_area)
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area)
{
const uint8_t ps = 8;
const uint8_t pa = 127;
int32_t thick_half = tickness / 2;
uint8_t thick_corr = (tickness & 0x01) ? 0 : 1;
int32_t thick_half = thickness / 2;
uint8_t thick_corr = (thickness & 0x01) ? 0 : 1;
int32_t cir_x;
int32_t cir_y;
+1 -1
View File
@@ -93,4 +93,4 @@ bool lv_img_cf_has_alpha(lv_img_cf_t cf);
} /* extern "C" */
#endif
#endif /*LV_TEMPL_H*/
#endif /*LV_DRAW_IMG_H*/
+7 -7
View File
@@ -17,7 +17,7 @@
/*********************
* DEFINES
*********************/
#define SHADOW_UPSACALE_SHIFT 6
#define SHADOW_UPSCALE_SHIFT 6
#define SHADOW_ENHANCE 1
#define SPLIT_LIMIT 50
@@ -1029,10 +1029,10 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
}
else {
int32_t i;
sh_ups_tmp_buf[0] = (mask_line[0] << SHADOW_UPSACALE_SHIFT) / sw;
sh_ups_tmp_buf[0] = (mask_line[0] << SHADOW_UPSCALE_SHIFT) / sw;
for(i = 1; i < size; i++) {
if(mask_line[i] == mask_line[i - 1]) sh_ups_tmp_buf[i] = sh_ups_tmp_buf[i - 1];
else sh_ups_tmp_buf[i] = (mask_line[i] << SHADOW_UPSACALE_SHIFT) / sw;
else sh_ups_tmp_buf[i] = (mask_line[i] << SHADOW_UPSCALE_SHIFT) / sw;
}
}
@@ -1044,7 +1044,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
int32_t i;
lv_opa_t * res_buf = (lv_opa_t *)sh_buf;
for(i = 0; i < size * size; i++) {
res_buf[i] = (sh_buf[i] >> SHADOW_UPSACALE_SHIFT);
res_buf[i] = (sh_buf[i] >> SHADOW_UPSCALE_SHIFT);
}
return;
}
@@ -1062,10 +1062,10 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
sw += sw_ori & 1;
if(sw > 1) {
uint32_t i;
sh_buf[0] = (sh_buf[0] << SHADOW_UPSACALE_SHIFT) / sw;
sh_buf[0] = (sh_buf[0] << SHADOW_UPSCALE_SHIFT) / sw;
for(i = 1; i < (uint32_t) size * size; i++) {
if(sh_buf[i] == sh_buf[i - 1]) sh_buf[i] = sh_buf[i - 1];
else sh_buf[i] = (sh_buf[i] << SHADOW_UPSACALE_SHIFT) / sw;
else sh_buf[i] = (sh_buf[i] << SHADOW_UPSCALE_SHIFT) / sw;
}
shadow_blur_corner(size, sw, sh_buf);
@@ -1125,7 +1125,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
sh_ups_tmp_buf = &sh_ups_buf[x];
int32_t v = sh_ups_tmp_buf[0] * sw;
for(y = 0; y < size ; y++, sh_ups_tmp_buf += size) {
sh_ups_blur_buf[y] = v < 0 ? 0 : (v >> SHADOW_UPSACALE_SHIFT);
sh_ups_blur_buf[y] = v < 0 ? 0 : (v >> SHADOW_UPSCALE_SHIFT);
/*Forget the top pixel*/
uint32_t top_val;
+6 -6
View File
@@ -423,14 +423,14 @@ void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
dsc->tmp.pivot_y_256 = dsc->cfg.pivot_y * 256;
int32_t angle_low = dsc->cfg.angle / 10;
int32_t angle_hight = angle_low + 1;
int32_t angle_high = angle_low + 1;
int32_t angle_rem = dsc->cfg.angle - (angle_low * 10);
int32_t s1 = _lv_trigo_sin(-angle_low);
int32_t s2 = _lv_trigo_sin(-angle_hight);
int32_t s2 = _lv_trigo_sin(-angle_high);
int32_t c1 = _lv_trigo_sin(-angle_low + 90);
int32_t c2 = _lv_trigo_sin(-angle_hight + 90);
int32_t c2 = _lv_trigo_sin(-angle_high + 90);
dsc->tmp.sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
dsc->tmp.cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
@@ -500,14 +500,14 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
}
int32_t angle_low = angle / 10;
int32_t angle_hight = angle_low + 1;
int32_t angle_high = angle_low + 1;
int32_t angle_rem = angle - (angle_low * 10);
int32_t s1 = _lv_trigo_sin(angle_low);
int32_t s2 = _lv_trigo_sin(angle_hight);
int32_t s2 = _lv_trigo_sin(angle_high);
int32_t c1 = _lv_trigo_sin(angle_low + 90);
int32_t c2 = _lv_trigo_sin(angle_hight + 90);
int32_t c2 = _lv_trigo_sin(angle_high + 90);
int32_t sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
int32_t cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
+3 -3
View File
@@ -3,8 +3,8 @@
*
*/
#ifndef LV_IMG_DEOCER_H
#define LV_IMG_DEOCER_H
#ifndef LV_IMG_DECODER_H
#define LV_IMG_DECODER_H
#ifdef __cplusplus
extern "C" {
@@ -267,4 +267,4 @@ void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_ds
} /* extern "C" */
#endif
#endif /*LV_TEMPL_H*/
#endif /*LV_IMG_DECODER_H*/
+1 -1
View File
@@ -67,7 +67,7 @@ extern "C" {
#endif
#ifndef LV_GPU_NXP_VG_LITE_LOG_ERRORS
/** Enable logging of VG-Lite erors (\see LV_LOG_ERROR) */
/** Enable logging of VG-Lite errors (\see LV_LOG_ERROR) */
#define LV_GPU_NXP_VG_LITE_LOG_ERRORS 1
#endif
+2 -2
View File
@@ -150,9 +150,9 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
}
if(indev->driver.read_cb) {
LV_LOG_TRACE("idnev read started");
LV_LOG_TRACE("indev read started");
cont = indev->driver.read_cb(&indev->driver, data);
LV_LOG_TRACE("idnev read finished");
LV_LOG_TRACE("indev read finished");
}
else {
LV_LOG_WARN("indev function registered");
+1 -1
View File
@@ -59,4 +59,4 @@ lv_res_t lv_async_call(lv_async_cb_t async_xcb, void * user_data);
} /* extern "C" */
#endif
#endif /*LV_TEMPL_H*/
#endif /*LV_ASYNC_H*/
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* @file lv_bifi.h
* @file lv_bidi.h
*
*/
+4 -4
View File
@@ -346,8 +346,8 @@ lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname)
}
/**
* Initialize a 'fs_read_dir_t' variable for directory reading
* @param rddir_p pointer to a 'fs_read_dir_t' variable
* Initialize a 'lv_fs_dir_t' variable for directory reading
* @param rddir_p pointer to a 'lv_fs_dir_t' variable
* @param path path to a directory
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
@@ -385,7 +385,7 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path)
/**
* Read the next filename form a directory.
* The name of the directories will begin with '/'
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
* @param fn pointer to a buffer to store the filename
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
@@ -407,7 +407,7 @@ lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn)
/**
* Close the directory reading
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
* @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p)
+2 -2
View File
@@ -231,7 +231,7 @@ lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname);
/**
* Initialize a 'fs_dir_t' variable for directory reading
* @param rddir_p pointer to a 'fs_read_dir_t' variable
* @param rddir_p pointer to a 'lv_fs_dir_t' variable
* @param path path to a directory
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
@@ -240,7 +240,7 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path);
/**
* Read the next filename form a directory.
* The name of the directories will begin with '/'
* @param rddir_p pointer to an initialized 'fs_rdir_t' variable
* @param rddir_p pointer to an initialized 'fs_dir_t' variable
* @param fn pointer to a buffer to store the filename
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
+2 -2
View File
@@ -391,7 +391,7 @@ lv_coord_t _lv_txt_get_width(const char * txt, uint32_t length, const lv_font_t
/**
* Check next character in a string and decide if the character is part of the command or not
* @param state pointer to a txt_cmd_state_t variable which stores the current state of command
* processing (Initied. to TXT_CMD_STATE_WAIT )
* processing (Inited to TXT_CMD_STATE_WAIT )
* @param c the current character
* @return true: the character is part of a command and should not be written,
* false: the character should be written
@@ -525,7 +525,7 @@ char * _lv_txt_set_text_vfmt(const char * fmt, va_list ap)
#if LV_TXT_ENC == LV_TXT_ENC_UTF8
/*******************************
* UTF-8 ENCODER/DECOER
* UTF-8 ENCODER/DECODER
******************************/
/**
+1 -1
View File
@@ -136,7 +136,7 @@ void _lv_txt_cut(char * txt, uint32_t pos, uint32_t len);
char * _lv_txt_set_text_vfmt(const char * fmt, va_list ap);
/***************************************************************
* GLOBAL FUNCTION POINTERS FOR CAHRACTER ENCODING INTERFACE
* GLOBAL FUNCTION POINTERS FOR CHARACTER ENCODING INTERFACE
***************************************************************/
/**
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -157,7 +157,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color);
* Add a cursor with a given color
* @param chart pointer to chart object
* @param color color of the cursor
* @param dir direction of the cursor. `LV_CHART_CURSOR_RIGHT/LEFT/TOP/DOWN`. OR-ed vaéues are possible
* @param dir direction of the cursor. `LV_CHART_CURSOR_RIGHT/LEFT/TOP/DOWN`. OR-ed values are possible
* @return pointer to the created cursor
*/
lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * chart, lv_color_t color, lv_cursor_direction_t dir);
+223
View File
@@ -0,0 +1,223 @@
/**
* @file lv_cont.h
*
*/
#ifndef LV_CONT_H
#define LV_CONT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_CONT != 0
#include "../lv_core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Container layout options*/
enum {
LV_LAYOUT_OFF = 0, /**< No layout */
LV_LAYOUT_CENTER, /**< Center objects */
/**
* COLUMN:
* - Place the object below each other
* - Keep `pad_top` space on the top
* - Keep `pad_inner` space between the objects
*/
LV_LAYOUT_COLUMN_LEFT, /**< Column left align*/
LV_LAYOUT_COLUMN_MID, /**< Column middle align*/
LV_LAYOUT_COLUMN_RIGHT, /**< Column right align*/
/**
* ROW:
* - Place the object next to each other
* - Keep `pad_left` space on the left
* - Keep `pad_inner` space between the objects
* - If the object which applies the layout has `base_dir == LV_BIDI_DIR_RTL`
* the row will start from the right applying `pad.right` space
*/
LV_LAYOUT_ROW_TOP, /**< Row top align*/
LV_LAYOUT_ROW_MID, /**< Row middle align*/
LV_LAYOUT_ROW_BOTTOM, /**< Row bottom align*/
/**
* PRETTY:
* - Place the object next to each other
* - If there is no more space start a new row
* - Respect `pad_left` and `pad_right` when determining the available space in a row
* - Keep `pad_inner` space between the objects in the same row
* - Keep `pad_inner` space between the objects in rows
* - Divide the remaining horizontal space equally
*/
LV_LAYOUT_PRETTY_TOP, /**< Row top align*/
LV_LAYOUT_PRETTY_MID, /**< Row middle align*/
LV_LAYOUT_PRETTY_BOTTOM, /**< Row bottom align*/
/**
* GRID
* - Place the object next to each other
* - If there is no more space start a new row
* - Respect `pad_left` and `pad_right` when determining the available space in a row
* - Keep `pad_inner` space between the objects in the same row
* - Keep `pad_inner` space between the objects in rows
* - Unlike `PRETTY`, `GRID` always keep `pad_inner` space horizontally between objects
* so it doesn't divide the remaining horizontal space equally
*/
LV_LAYOUT_GRID, /**< Align same-sized object into a grid*/
_LV_LAYOUT_LAST
};
typedef uint8_t lv_layout_t;
/**
* How to resize the container around the children.
*/
enum {
LV_FIT_NONE, /**< Do not change the size automatically*/
LV_FIT_TIGHT, /**< Shrink wrap around the children */
LV_FIT_PARENT, /**< Align the size to the parent's edge*/
LV_FIT_MAX, /**< Align the size to the parent's edge first but if there is an object out of it
then get larger */
_LV_FIT_LAST
};
typedef uint8_t lv_fit_t;
typedef struct {
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
/*New data for this type */
lv_layout_t layout : 4; /*A layout from 'lv_layout_t' enum*/
lv_fit_t fit_left : 2; /*A fit type from `lv_fit_t` enum */
lv_fit_t fit_right : 2; /*A fit type from `lv_fit_t` enum */
lv_fit_t fit_top : 2; /*A fit type from `lv_fit_t` enum */
lv_fit_t fit_bottom : 2; /*A fit type from `lv_fit_t` enum */
} lv_cont_ext_t;
/*Part of the container*/
enum {
LV_CONT_PART_MAIN = LV_OBJ_PART_MAIN,
_LV_CONT_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST,
_LV_CONT_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST,
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a container objects
* @param par pointer to an object, it will be the parent of the new container
* @param copy pointer to a container object, if not NULL then the new object will be copied from it
* @return pointer to the created container
*/
lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set a layout on a container
* @param cont pointer to a container object
* @param layout a layout from 'lv_cont_layout_t'
*/
void lv_cont_set_layout(lv_obj_t * cont, lv_layout_t layout);
/**
* Set the fit policy in all 4 directions separately.
* It tell how to change the container's size automatically.
* @param cont pointer to a container object
* @param left left fit policy from `lv_fit_t`
* @param right right fit policy from `lv_fit_t`
* @param top top fit policy from `lv_fit_t`
* @param bottom bottom fit policy from `lv_fit_t`
*/
void lv_cont_set_fit4(lv_obj_t * cont, lv_fit_t left, lv_fit_t right, lv_fit_t top, lv_fit_t bottom);
/**
* Set the fit policy horizontally and vertically separately.
* It tells how to change the container's size automatically.
* @param cont pointer to a container object
* @param hor horizontal fit policy from `lv_fit_t`
* @param ver vertical fit policy from `lv_fit_t`
*/
static inline void lv_cont_set_fit2(lv_obj_t * cont, lv_fit_t hor, lv_fit_t ver)
{
lv_cont_set_fit4(cont, hor, hor, ver, ver);
}
/**
* Set the fit policy in all 4 direction at once.
* It tells how to change the container's size automatically.
* @param cont pointer to a container object
* @param fit fit policy from `lv_fit_t`
*/
static inline void lv_cont_set_fit(lv_obj_t * cont, lv_fit_t fit)
{
lv_cont_set_fit4(cont, fit, fit, fit, fit);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the layout of a container
* @param cont pointer to container object
* @return the layout from 'lv_cont_layout_t'
*/
lv_layout_t lv_cont_get_layout(const lv_obj_t * cont);
/**
* Get left fit mode of a container
* @param cont pointer to a container object
* @return an element of `lv_fit_t`
*/
lv_fit_t lv_cont_get_fit_left(const lv_obj_t * cont);
/**
* Get right fit mode of a container
* @param cont pointer to a container object
* @return an element of `lv_fit_t`
*/
lv_fit_t lv_cont_get_fit_right(const lv_obj_t * cont);
/**
* Get top fit mode of a container
* @param cont pointer to a container object
* @return an element of `lv_fit_t`
*/
lv_fit_t lv_cont_get_fit_top(const lv_obj_t * cont);
/**
* Get bottom fit mode of a container
* @param cont pointer to a container object
* @return an element of `lv_fit_t`
*/
lv_fit_t lv_cont_get_fit_bottom(const lv_obj_t * cont);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CONT*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_CONT_H*/
+14 -14
View File
@@ -627,16 +627,16 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
if(zoomed_src_w <= 0) return LV_DESIGN_RES_OK;
lv_coord_t zoomed_src_h = (int32_t)((int32_t)ext->h * zoom_final) >> 8;
if(zoomed_src_h <= 0) return LV_DESIGN_RES_OK;
lv_area_t zommed_coords;
lv_obj_get_coords(img, &zommed_coords);
lv_area_t zoomed_coords;
lv_obj_get_coords(img, &zoomed_coords);
zommed_coords.x1 += (int32_t)((int32_t)ext->offset.x * zoom_final) >> 8;
zommed_coords.y1 += (int32_t)((int32_t)ext->offset.y * zoom_final) >> 8;
zommed_coords.x2 = zommed_coords.x1 + ((int32_t)((int32_t)(obj_w - 1) * zoom_final) >> 8);
zommed_coords.y2 = zommed_coords.y1 + ((int32_t)((int32_t)(obj_h - 1) * zoom_final) >> 8);
zoomed_coords.x1 += (int32_t)((int32_t)ext->offset.x * zoom_final) >> 8;
zoomed_coords.y1 += (int32_t)((int32_t)ext->offset.y * zoom_final) >> 8;
zoomed_coords.x2 = zoomed_coords.x1 + ((int32_t)((int32_t)(obj_w - 1) * zoom_final) >> 8);
zoomed_coords.y2 = zoomed_coords.y1 + ((int32_t)((int32_t)(obj_h - 1) * zoom_final) >> 8);
if(zommed_coords.x1 > img->coords.x1) zommed_coords.x1 -= ext->w;
if(zommed_coords.y1 > img->coords.y1) zommed_coords.y1 -= ext->h;
if(zoomed_coords.x1 > img->coords.x1) zoomed_coords.x1 -= ext->w;
if(zoomed_coords.y1 > img->coords.y1) zoomed_coords.y1 -= ext->h;
lv_area_t clip_real;
_lv_img_buf_get_transformed_area(&clip_real, lv_obj_get_width(img), lv_obj_get_height(img), angle_final, zoom_final,
@@ -649,13 +649,13 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
if(_lv_area_intersect(&clip_real, &clip_real, clip_area) == false) return LV_DESIGN_RES_OK;
lv_area_t coords_tmp;
coords_tmp.y1 = zommed_coords.y1;
coords_tmp.y2 = zommed_coords.y1 + ext->h - 1;
coords_tmp.y1 = zoomed_coords.y1;
coords_tmp.y2 = zoomed_coords.y1 + ext->h - 1;
for(; coords_tmp.y1 < zommed_coords.y2; coords_tmp.y1 += zoomed_src_h, coords_tmp.y2 += zoomed_src_h) {
coords_tmp.x1 = zommed_coords.x1;
coords_tmp.x2 = zommed_coords.x1 + ext->w - 1;
for(; coords_tmp.x1 < zommed_coords.x2; coords_tmp.x1 += zoomed_src_w, coords_tmp.x2 += zoomed_src_w) {
for(; coords_tmp.y1 < zoomed_coords.y2; coords_tmp.y1 += zoomed_src_h, coords_tmp.y2 += zoomed_src_h) {
coords_tmp.x1 = zoomed_coords.x1;
coords_tmp.x2 = zoomed_coords.x1 + ext->w - 1;
for(; coords_tmp.x1 < zoomed_coords.x2; coords_tmp.x1 += zoomed_src_w, coords_tmp.x2 += zoomed_src_w) {
lv_draw_img(&coords_tmp, &clip_real, ext->src, &img_dsc);
}
}
+1 -1
View File
@@ -515,7 +515,7 @@ static void refr_img(lv_obj_t * imgbtn)
}
/**
* If `src` is not defined for the current state try to get a state which is related to the curent but has `src`.
* If `src` is not defined for the current state try to get a state which is related to the current but has `src`.
* E.g. if the PRESSED src is not set but the RELEASED does, use the RELEASED.
* @param imgbtn pointer to an image button
* @param state the state to convert
+3 -3
View File
@@ -336,11 +336,11 @@ void lv_label_set_recolor(lv_obj_t * label, bool en)
ext->recolor = en == false ? 0 : 1;
lv_label_refr_text(label); /*Refresh the text because the potential color codes in text needs to
be hided or revealed*/
be hidden or revealed*/
}
/**
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SCROLL_CIRC modes
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SROLL_CIRC modes
* @param label pointer to a label object
* @param anim_speed speed of animation in px/sec unit
*/
@@ -1252,7 +1252,7 @@ static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_
label_draw_dsc.flag = flag;
lv_obj_init_draw_label_dsc(label, LV_LABEL_PART_MAIN, &label_draw_dsc);
/* In SCROLL and SCROLL_CIRC mode the CENTER and RIGHT are pointless so remove them.
/* In SROLL and SROLL_CIRC mode the CENTER and RIGHT are pointless so remove them.
* (In addition they will result misalignment is this case)*/
if((ext->long_mode == LV_LABEL_LONG_SROLL || ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) &&
(ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) {
+1 -1
View File
@@ -168,7 +168,7 @@ void lv_label_set_align(lv_obj_t * label, lv_label_align_t align);
void lv_label_set_recolor(lv_obj_t * label, bool en);
/**
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SCROLL_CIRC modes
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SROLL_CIRC modes
* @param label pointer to a label object
* @param anim_speed speed of animation in px/sec unit
*/
+311
View File
@@ -0,0 +1,311 @@
/**
* @file lv_list.h
*
*/
#ifndef LV_LIST_H
#define LV_LIST_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_LIST != 0
/*Testing of dependencies*/
#if LV_USE_PAGE == 0
#error "lv_list: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#if LV_USE_BTN == 0
#error "lv_list: lv_btn is required. Enable it in lv_conf.h (LV_USE_BTN 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_list: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_page.h"
#include "lv_btn.h"
#include "lv_label.h"
#include "lv_img.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of list*/
typedef struct {
lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */
#if LV_USE_GROUP
lv_obj_t * last_sel_btn; /* The last selected button. It will be reverted when the list is focused again */
#endif
lv_obj_t * act_sel_btn; /* The button is currently being selected*/
} lv_list_ext_t;
/** List styles. */
enum {
LV_LIST_PART_BG = LV_PAGE_PART_BG, /**< List background style */
LV_LIST_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, /**< List scrollbar style. */
LV_LIST_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< List edge flash style. */
_LV_LIST_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
LV_LIST_PART_SCROLLABLE = LV_PAGE_PART_SCROLLABLE, /**< List scrollable area style. */
_LV_LIST_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST,
};
typedef uint8_t lv_list_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a list objects
* @param par pointer to an object, it will be the parent of the new list
* @param copy pointer to a list object, if not NULL then the new object will be copied from it
* @return pointer to the created list
*/
lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param list pointer to an object
*/
void lv_list_clean(lv_obj_t * list);
/*======================
* Add/remove functions
*=====================*/
/**
* Add a list element to the list
* @param list pointer to list object
* @param img_fn file name of an image before the text (NULL if unused)
* @param txt text of the list element (NULL if unused)
* @return pointer to the new list element which can be customized (a button)
*/
lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * txt);
/**
* Remove the index of the button in the list
* @param list pointer to a list object
* @param index pointer to a the button's index in the list, index must be 0 <= index <
* lv_list_ext_t.size
* @return true: successfully deleted
*/
bool lv_list_remove(const lv_obj_t * list, uint16_t index);
/*=====================
* Setter functions
*====================*/
/**
* Make a button selected
* @param list pointer to a list object
* @param btn pointer to a button to select
* NULL to not select any buttons
*/
void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn);
/**
* Set the scroll bar mode of a list
* @param list pointer to a list object
* @param sb_mode the new mode from 'lv_page_sb_mode_t' enum
*/
static inline void lv_list_set_scrollbar_mode(lv_obj_t * list, lv_scrollbar_mode_t mode)
{
lv_page_set_scrollbar_mode(list, mode);
}
/**
* Enable the scroll propagation feature. If enabled then the List will move its parent if there is
* no more space to scroll.
* @param list pointer to a List
* @param en true or false to enable/disable scroll propagation
*/
static inline void lv_list_set_scroll_propagation(lv_obj_t * list, bool en)
{
lv_page_set_scroll_propagation(list, en);
}
/**
* Enable the edge flash effect. (Show an arc when the an edge is reached)
* @param list pointer to a List
* @param en true or false to enable/disable end flash
*/
static inline void lv_list_set_edge_flash(lv_obj_t * list, bool en)
{
lv_page_set_edge_flash(list, en);
}
/**
* Set scroll animation duration on 'list_up()' 'list_down()' 'list_focus()'
* @param list pointer to a list object
* @param anim_time duration of animation [ms]
*/
static inline void lv_list_set_anim_time(lv_obj_t * list, uint16_t anim_time)
{
lv_page_set_anim_time(list, anim_time);
}
/**
* Set layout of a list
* @param list pointer to a list object
* @param layout which layout should be used
*/
void lv_list_set_layout(lv_obj_t * list, lv_layout_t layout);
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a list element
* @param btn pointer to list element
* @return pointer to the text
*/
const char * lv_list_get_btn_text(const lv_obj_t * btn);
/**
* Get the label object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the label from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_label(const lv_obj_t * btn);
/**
* Get the image object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the image from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_img(const lv_obj_t * btn);
/**
* Get the next button from list. (Starts from the bottom button)
* @param list pointer to a list object
* @param prev_btn pointer to button. Search the next after it.
* @return pointer to the next button or NULL when no more buttons
*/
lv_obj_t * lv_list_get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn);
/**
* Get the previous button from list. (Starts from the top button)
* @param list pointer to a list object
* @param prev_btn pointer to button. Search the previous before it.
* @return pointer to the previous button or NULL when no more buttons
*/
lv_obj_t * lv_list_get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn);
/**
* Get the index of the button in the list
* @param list pointer to a list object. If NULL, assumes btn is part of a list.
* @param btn pointer to a list element (button)
* @return the index of the button in the list, or -1 of the button not in this list
*/
int32_t lv_list_get_btn_index(const lv_obj_t * list, const lv_obj_t * btn);
/**
* Get the number of buttons in the list
* @param list pointer to a list object
* @return the number of buttons in the list
*/
uint16_t lv_list_get_size(const lv_obj_t * list);
#if LV_USE_GROUP
/**
* Get the currently selected button. Can be used while navigating in the list with a keypad.
* @param list pointer to a list object
* @return pointer to the selected button
*/
lv_obj_t * lv_list_get_btn_selected(const lv_obj_t * list);
#endif
/**
* Get layout of a list
* @param list pointer to a list object
* @return layout of the list object
*/
lv_layout_t lv_list_get_layout(lv_obj_t * list);
/**
* Get the scroll bar mode of a list
* @param list pointer to a list object
* @return scrollbar mode from 'lv_scrollbar_mode_t' enum
*/
static inline lv_scrollbar_mode_t lv_list_get_scrollbar_mode(const lv_obj_t * list)
{
return lv_page_get_scrollbar_mode(list);
}
/**
* Get the scroll propagation property
* @param list pointer to a List
* @return true or false
*/
static inline bool lv_list_get_scroll_propagation(lv_obj_t * list)
{
return lv_page_get_scroll_propagation(list);
}
/**
* Get the scroll propagation property
* @param list pointer to a List
* @return true or false
*/
static inline bool lv_list_get_edge_flash(lv_obj_t * list)
{
return lv_page_get_edge_flash(list);
}
/**
* Get scroll animation duration
* @param list pointer to a list object
* @return duration of animation [ms]
*/
static inline uint16_t lv_list_get_anim_time(const lv_obj_t * list)
{
return lv_page_get_anim_time(list);
}
/*=====================
* Other functions
*====================*/
/**
* Move the list elements up by one
* @param list pointer a to list object
*/
void lv_list_up(const lv_obj_t * list);
/**
* Move the list elements down by one
* @param list pointer to a list object
*/
void lv_list_down(const lv_obj_t * list);
/**
* Focus on a list button. It ensures that the button will be visible on the list.
* @param btn pointer to a list button to focus
* @param anim LV_ANIM_ON: scroll with animation, LV_ANIM_OFF: without animation
*/
void lv_list_focus(const lv_obj_t * btn, lv_anim_enable_t anim);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LIST*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_LIST_H*/
+1 -1
View File
@@ -94,7 +94,7 @@ void lv_roller_set_align(lv_obj_t * roller, lv_label_align_t align);
* Set the selected option
* @param roller pointer to a roller object
* @param sel_opt id of the selected option (0 ... number of option - 1);
* @param anim LV_ANOM_ON: set with animation; LV_ANIM_OFF set immediately
* @param anim LV_ANIM_ON: set with animation; LV_ANIM_OFF set immediately
*/
void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, lv_anim_enable_t anim);
+1 -2
View File
@@ -37,7 +37,6 @@
static lv_res_t lv_switch_signal(lv_obj_t * sw, lv_signal_t sign, void * param);
static lv_design_res_t lv_switch_design(lv_obj_t * sw, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_style_list_t * lv_switch_get_style(lv_obj_t * sw, uint8_t part);
static lv_style_list_t * lv_switch_get_style(lv_obj_t * sw, uint8_t part);
/**********************
* STATIC VARIABLES
@@ -114,7 +113,7 @@ lv_obj_t * lv_switch_create(lv_obj_t * parent, const lv_obj_t * copy)
/**
* Turn ON the switch
* @param sw pointer to a switch object
* @param anim LV_ANOM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_switch_on(lv_obj_t * sw, lv_anim_enable_t anim)
{
File diff suppressed because it is too large Load Diff
+192
View File
@@ -0,0 +1,192 @@
/**
* @file lv_tabview.h
*
*/
#ifndef LV_TABVIEW_H
#define LV_TABVIEW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_TABVIEW != 0
/*Testing of dependencies*/
#if LV_USE_BTNMATRIX == 0
#error "lv_tabview: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) "
#endif
#if LV_USE_PAGE == 0
#error "lv_tabview: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "../lv_widgets/lv_win.h"
#include "../lv_widgets/lv_page.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Position of tabview buttons. */
enum {
LV_TABVIEW_TAB_POS_NONE,
LV_TABVIEW_TAB_POS_TOP,
LV_TABVIEW_TAB_POS_BOTTOM,
LV_TABVIEW_TAB_POS_LEFT,
LV_TABVIEW_TAB_POS_RIGHT
};
typedef uint8_t lv_tabview_btns_pos_t;
/*Data of tab*/
typedef struct {
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * btns;
lv_obj_t * indic;
lv_obj_t * content; /*A background page which holds tab's pages*/
const char ** tab_name_ptr;
lv_point_t point_last;
uint16_t tab_cur;
uint16_t tab_cnt;
#if LV_USE_ANIMATION
uint16_t anim_time;
#endif
lv_tabview_btns_pos_t btns_pos : 3;
} lv_tabview_ext_t;
enum {
LV_TABVIEW_PART_BG = LV_OBJ_PART_MAIN,
_LV_TABVIEW_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST,
LV_TABVIEW_PART_BG_SCROLLABLE = _LV_OBJ_PART_REAL_LAST,
LV_TABVIEW_PART_TAB_BG,
LV_TABVIEW_PART_TAB_BTN,
LV_TABVIEW_PART_INDIC,
_LV_TABVIEW_PART_REAL_LAST,
};
typedef uint8_t lv_tabview_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a Tab view object
* @param par pointer to an object, it will be the parent of the new tab
* @param copy pointer to a tab object, if not NULL then the new object will be copied from it
* @return pointer to the created tab
*/
lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/**
* Add a new tab with the given name
* @param tabview pointer to Tab view object where to ass the new tab
* @param name the text on the tab button
* @return pointer to the created page object (lv_page). You can create your content here
*/
lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name);
/**
* Delete all children of a tab created by `lv_tabview_add_tab`.
* @param tab pointer to a tab
*/
void lv_tabview_clean_tab(lv_obj_t * tab);
/*=====================
* Setter functions
*====================*/
/**
* Set a new tab
* @param tabview pointer to Tab view object
* @param id index of a tab to load
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t anim);
/**
* Set the name of a tab.
* @param tabview pointer to Tab view object
* @param id index of the tab the name should be set
* @param name new tab name
*/
void lv_tabview_set_tab_name(lv_obj_t * tabview, uint16_t id, char * name);
/**
* Set the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @param anim_time time of animation in milliseconds
*/
void lv_tabview_set_anim_time(lv_obj_t * tabview, uint16_t anim_time);
/**
* Set the position of tab select buttons
* @param tabview pointer to a tab view object
* @param btns_pos which button position
*/
void lv_tabview_set_btns_pos(lv_obj_t * tabview, lv_tabview_btns_pos_t btns_pos);
/*=====================
* Getter functions
*====================*/
/**
* Get the index of the currently active tab
* @param tabview pointer to Tab view object
* @return the active tab index
*/
uint16_t lv_tabview_get_tab_act(const lv_obj_t * tabview);
/**
* Get the number of tabs
* @param tabview pointer to Tab view object
* @return tab count
*/
uint16_t lv_tabview_get_tab_count(const lv_obj_t * tabview);
/**
* Get the page (content area) of a tab
* @param tabview pointer to Tab view object
* @param id index of the tab (>= 0)
* @return pointer to page (lv_page) object
*/
lv_obj_t * lv_tabview_get_tab(const lv_obj_t * tabview, uint16_t id);
/**
* Get the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @return time of animation in milliseconds
*/
uint16_t lv_tabview_get_anim_time(const lv_obj_t * tabview);
/**
* Get position of tab select buttons
* @param tabview pointer to a ab view object
*/
lv_tabview_btns_pos_t lv_tabview_get_btns_pos(const lv_obj_t * tabview);
/**********************
* MACROS
**********************/
#endif /*LV_USE_TABVIEW*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_TABVIEW_H*/
+8 -8
View File
@@ -106,7 +106,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
ext->pwd_mode = 0;
ext->pwd_tmp = NULL;
ext->pwd_show_time = LV_TEXTAREA_DEF_PWD_SHOW_TIME;
ext->accapted_chars = NULL;
ext->accepted_chars = NULL;
ext->max_length = 0;
ext->cursor.state = 1;
ext->cursor.hidden = 0;
@@ -146,7 +146,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
lv_textarea_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->label = lv_label_create(ta, copy_ext->label);
ext->pwd_mode = copy_ext->pwd_mode;
ext->accapted_chars = copy_ext->accapted_chars;
ext->accepted_chars = copy_ext->accepted_chars;
ext->max_length = copy_ext->max_length;
ext->cursor.pos = copy_ext->cursor.pos;
ext->cursor.valid_x = copy_ext->cursor.valid_x;
@@ -764,7 +764,7 @@ void lv_textarea_set_accepted_chars(lv_obj_t * ta, const char * list)
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
ext->accapted_chars = list;
ext->accepted_chars = list;
}
/**
@@ -1006,7 +1006,7 @@ const char * lv_textarea_get_accepted_chars(lv_obj_t * ta)
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->accapted_chars;
return ext->accepted_chars;
}
/**
@@ -1472,7 +1472,7 @@ static bool char_is_accepted(lv_obj_t * ta, uint32_t c)
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
/*If no restriction accept it*/
if(ext->accapted_chars == NULL && ext->max_length == 0) return true;
if(ext->accepted_chars == NULL && ext->max_length == 0) return true;
/*Too many characters?*/
if(ext->max_length > 0 && _lv_txt_get_encoded_length(lv_textarea_get_text(ta)) >= ext->max_length) {
@@ -1480,11 +1480,11 @@ static bool char_is_accepted(lv_obj_t * ta, uint32_t c)
}
/*Accepted character?*/
if(ext->accapted_chars) {
if(ext->accepted_chars) {
uint32_t i = 0;
while(ext->accapted_chars[i] != '\0') {
uint32_t a = _lv_txt_encoded_next(ext->accapted_chars, &i);
while(ext->accepted_chars[i] != '\0') {
uint32_t a = _lv_txt_encoded_next(ext->accepted_chars, &i);
if(a == c) return true; /*Accepted*/
}
+1 -1
View File
@@ -43,7 +43,7 @@ typedef struct {
char * placeholder_txt; /*Place holder label. only visible if text is an empty string*/
lv_style_list_t style_placeholder;
char * pwd_tmp; /*Used to store the original text in password mode*/
const char * accapted_chars; /*Only these characters will be accepted. NULL: accept all*/
const char * accepted_chars; /*Only these characters will be accepted. NULL: accept all*/
uint32_t max_length; /*The max. number of characters. 0: no limit*/
uint16_t pwd_show_time; /*Time to show characters in password mode before change them to '*' */
struct {
File diff suppressed because it is too large Load Diff
+300
View File
@@ -0,0 +1,300 @@
/**
* @file lv_win.h
*
*/
#ifndef LV_WIN_H
#define LV_WIN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_WIN != 0
/*Testing of dependencies*/
#if LV_USE_BTN == 0
#error "lv_win: lv_btn is required. Enable it in lv_conf.h (LV_USE_BTN 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_win: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#if LV_USE_IMG == 0
#error "lv_win: lv_img is required. Enable it in lv_conf.h (LV_USE_IMG 1) "
#endif
#if LV_USE_PAGE == 0
#error "lv_win: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_cont.h"
#include "lv_btn.h"
#include "lv_label.h"
#include "lv_img.h"
#include "lv_page.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of window*/
typedef struct {
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * page; /*Pointer to a page which holds the content*/
lv_obj_t * header; /*Pointer to the header container of the window*/
char * title_txt; /*Pointer to the title label of the window*/
lv_coord_t btn_w; /*Width of the control buttons*/
} lv_win_ext_t;
/** Window parts. */
enum {
LV_WIN_PART_BG = LV_OBJ_PART_MAIN, /**< Window object background style. */
_LV_WIN_PART_VIRTUAL_LAST,
LV_WIN_PART_HEADER = _LV_OBJ_PART_REAL_LAST, /**< Window titlebar background style. */
LV_WIN_PART_CONTENT_SCROLLABLE, /**< Window content style. */
LV_WIN_PART_SCROLLBAR, /**< Window scrollbar style. */
_LV_WIN_PART_REAL_LAST
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a window objects
* @param par pointer to an object, it will be the parent of the new window
* @param copy pointer to a window object, if not NULL then the new object will be copied from it
* @return pointer to the created window
*/
lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param win pointer to an object
*/
void lv_win_clean(lv_obj_t * win);
/*======================
* Add/remove functions
*=====================*/
/**
* Add control button on the right side of the window header
* @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_btn_right(lv_obj_t * win, const void * img_src);
/**
* Add control button on the left side of the window header
* @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_btn_left(lv_obj_t * win, const void * img_src);
/*=====================
* Setter functions
*====================*/
/**
* Can be assigned to a window control button to close the window
* @param btn pointer to the control button on the widows header
* @param event the event type
*/
void lv_win_close_event_cb(lv_obj_t * btn, lv_event_t event);
/**
* Set the title of a window
* @param win pointer to a window object
* @param title string of the new title
*/
void lv_win_set_title(lv_obj_t * win, const char * title);
/**
* Set the control button size of a window
* @param win pointer to a window object
* @return control button size
*/
void lv_win_set_header_height(lv_obj_t * win, lv_coord_t size);
/**
* Set the width of the control buttons on the header
* @param win pointer to a window object
* @param width width of the control button. 0: to make them square automatically.
*/
void lv_win_set_btn_width(lv_obj_t * win, lv_coord_t width);
/**
* Set the size of the content area.
* @param win pointer to a window object
* @param w width
* @param h height (the window will be higher with the height of the header)
*/
void lv_win_set_content_size(lv_obj_t * win, lv_coord_t w, lv_coord_t h);
/**
* Set the layout of the window
* @param win pointer to a window object
* @param layout the layout from 'lv_layout_t'
*/
void lv_win_set_layout(lv_obj_t * win, lv_layout_t layout);
/**
* Set the scroll bar mode of a window
* @param win pointer to a window object
* @param sb_mode the new scroll bar mode from 'lv_scrollbar_mode_t'
*/
void lv_win_set_scrollbar_mode(lv_obj_t * win, lv_scrollbar_mode_t sb_mode);
/**
* Set focus animation duration on `lv_win_focus()`
* @param win pointer to a window object
* @param anim_time duration of animation [ms]
*/
void lv_win_set_anim_time(lv_obj_t * win, uint16_t anim_time);
/**
* Set drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @param en whether dragging is enabled
*/
void lv_win_set_drag(lv_obj_t * win, bool en);
/*=====================
* Getter functions
*====================*/
/**
* Get the title of a window
* @param win pointer to a window object
* @return title string of the window
*/
const char * lv_win_get_title(const lv_obj_t * win);
/**
* Get the content holder object of window (`lv_page`) to allow additional customization
* @param win pointer to a window object
* @return the Page object where the window's content is
*/
lv_obj_t * lv_win_get_content(const lv_obj_t * win);
/**
* Get the header height
* @param win pointer to a window object
* @return header height
*/
lv_coord_t lv_win_get_header_height(const lv_obj_t * win);
/**
* Get the width of the control buttons on the header
* @param win pointer to a window object
* @return width of the control button. 0: square.
*/
lv_coord_t lv_win_get_btn_width(lv_obj_t * win);
/**
* Get the pointer of a widow from one of its control button.
* It is useful in the action of the control buttons where only button is known.
* @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn'
*/
lv_obj_t * lv_win_get_from_btn(const lv_obj_t * ctrl_btn);
/**
* Get the layout of a window
* @param win pointer to a window object
* @return the layout of the window (from 'lv_layout_t')
*/
lv_layout_t lv_win_get_layout(lv_obj_t * win);
/**
* Get the scroll bar mode of a window
* @param win pointer to a window object
* @return the scroll bar mode of the window (from 'lv_sb_mode_t')
*/
lv_scrollbar_mode_t lv_win_get_sb_mode(lv_obj_t * win);
/**
* Get focus animation duration
* @param win pointer to a window object
* @return duration of animation [ms]
*/
uint16_t lv_win_get_anim_time(const lv_obj_t * win);
/**
* Get width of the content area (page scrollable) of the window
* @param win pointer to a window object
* @return the width of the content area
*/
lv_coord_t lv_win_get_width(lv_obj_t * win);
/**
* Get drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @return whether window is draggable
*/
static inline bool lv_win_get_drag(const lv_obj_t * win)
{
return lv_obj_get_drag(win);
}
/*=====================
* Other functions
*====================*/
/**
* Focus on an object. It ensures that the object will be visible in the window.
* @param win pointer to a window object
* @param obj pointer to an object to focus (must be in the window)
* @param anim_en LV_ANIM_ON focus with an animation; LV_ANIM_OFF focus without animation
*/
void lv_win_focus(lv_obj_t * win, lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Scroll the window horizontally
* @param win pointer to a window object
* @param dist the distance to scroll (< 0: scroll right; > 0 scroll left)
*/
static inline void lv_win_scroll_hor(lv_obj_t * win, lv_coord_t dist)
{
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
lv_page_scroll_hor(ext->page, dist);
}
/**
* Scroll the window vertically
* @param win pointer to a window object
* @param dist the distance to scroll (< 0: scroll down; > 0 scroll up)
*/
static inline void lv_win_scroll_ver(lv_obj_t * win, lv_coord_t dist)
{
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
lv_page_scroll_ver(ext->page, dist);
}
/**********************
* MACROS
**********************/
#endif /*LV_USE_WIN*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_WIN_H*/