Minor updates
This commit is contained in:
@@ -13,11 +13,6 @@
|
||||
#include "misc/gfx/anim.h"
|
||||
#include "lvgl/lv_obj/lv_refr.h"
|
||||
|
||||
#include "lv_app_util/lv_app_kb.h"
|
||||
#include "lv_app_util/lv_app_notice.h"
|
||||
#include "lv_app_util/lv_app_fsel.h"
|
||||
|
||||
|
||||
#include "../lv_appx/lv_app_example.h"
|
||||
#include "../lv_appx/lv_app_phantom.h"
|
||||
#include "../lv_appx/lv_app_sysmon.h"
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
#include "lvgl/lvgl.h"
|
||||
|
||||
#if LV_APP_ENABLE != 0
|
||||
#include "lvgl/lv_app/lv_app_util/lv_app_kb.h"
|
||||
#include "lvgl/lv_app/lv_app_util/lv_app_fsel.h"
|
||||
#include "lvgl/lv_app/lv_app_util/lv_app_notice.h"
|
||||
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
|
||||
@@ -35,21 +35,21 @@ static const char * kb_map_lc[] = {
|
||||
"\0051#", "\004q", "\004w", "\004e", "\004r", "\004t", "\004y", "\004u", "\004i", "\004o", "\004p", "\007Del", "\n",
|
||||
"\007ABC", "\004a", "\004s", "\004d", "\004f", "\004g", "\004h", "\004j", "\004k", "\004l", "\010Enter", "\n",
|
||||
"_", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ":", "\n",
|
||||
"\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", ""
|
||||
"\003Hide", "\003Left", "\006 ", "\003Right", "\003Ok", ""
|
||||
};
|
||||
|
||||
static const char * kb_map_uc[] = {
|
||||
"\0051#", "\004Q", "\004W", "\004E", "\004R", "\004T", "\004Y", "\004U", "\004I", "\004O", "\004P", "\007Del", "\n",
|
||||
"\007abc", "\004A", "\004S", "\004D", "\004F", "\004G", "\004H", "\004J", "\004K", "\004L", "\010Enter", "\n",
|
||||
"_", "-", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ":", "\n",
|
||||
"\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", ""
|
||||
"\003Hide", "\003Left", "\006 ", "\003Right", "\003Ok", ""
|
||||
};
|
||||
|
||||
static const char * kb_map_spec[] = {
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\002Del", "\n",
|
||||
"\002abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
||||
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
|
||||
"\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", ""
|
||||
"\003Hide", "\003Left", "\006 ", "\003Right", "\003Ok", ""
|
||||
};
|
||||
|
||||
static const char * kb_map_num[] = {
|
||||
@@ -89,11 +89,11 @@ void lv_app_kb_init(void)
|
||||
|
||||
memcpy(&style_btn_rel, &app_style->menu_btn_rel, sizeof(lv_style_t));
|
||||
style_btn_rel.radius = 0;
|
||||
style_btn_rel.bwidth = 1 * LV_DOWNSCALE;
|
||||
style_btn_rel.bwidth = 1;
|
||||
|
||||
memcpy(&style_btn_pr, &app_style->menu_btn_pr, sizeof(lv_style_t));
|
||||
style_btn_pr.radius = 0;
|
||||
style_btn_pr.bwidth = 1 * LV_DOWNSCALE;
|
||||
style_btn_pr.bwidth = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,8 +102,9 @@ void lv_app_kb_init(void)
|
||||
* @param mode 'OR'd values of 'lv_app_kb_mode_t' enum
|
||||
* @param close a function to call when the keyboard is closed
|
||||
* @param ok a function to called when the "Ok" button is pressed
|
||||
* @return the created button matrix objects
|
||||
*/
|
||||
void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t *), void (*ok)(lv_obj_t *))
|
||||
lv_obj_t * lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t *), void (*ok)(lv_obj_t *))
|
||||
{
|
||||
/*Close the previous keyboard*/
|
||||
if(kb_btnm != NULL) {
|
||||
@@ -157,6 +158,8 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t
|
||||
|
||||
lv_ta_set_cursor_pos(kb_ta, LV_TA_CUR_LAST);
|
||||
|
||||
return kb_btnm;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,8 +41,9 @@ void lv_app_kb_init(void);
|
||||
* @param mode 'OR'd values of 'lv_app_kb_mode_t' enum
|
||||
* @param close a function to call when the keyboard is closed
|
||||
* @param ok a function to called when the "Ok" button is pressed
|
||||
* @return the created button matrix objects
|
||||
*/
|
||||
void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t *), void (*ok)(lv_obj_t *));
|
||||
lv_obj_t * lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t *), void (*ok)(lv_obj_t *));
|
||||
|
||||
/**
|
||||
* Close the keyboard
|
||||
|
||||
@@ -218,6 +218,16 @@ lv_style_t * lv_style_get(lv_style_name_t style_name, lv_style_t * copy)
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a style to an other
|
||||
* @param dest pointer to the destination style
|
||||
* @param src pointer to the source style
|
||||
*/
|
||||
void lv_style_cpy(lv_style_t * dest, const lv_style_t * src)
|
||||
{
|
||||
memcpy(dest, src, sizeof(lv_style_t));
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -95,281 +95,8 @@ void lv_style_init (void);
|
||||
*/
|
||||
lv_style_t * lv_style_get(lv_style_name_t style_name, lv_style_t * copy);
|
||||
|
||||
/**
|
||||
* Inherit all not set attributes of child style from a parent style
|
||||
* @param result pointer to a 'lv_style_t' variable to store the result style
|
||||
* @param child pointer to a child style. (if NULL 'lv_style_def' will be used)
|
||||
* @param parent pointer to a parent style (if NULL 'lv_style_def' will be used)
|
||||
*/
|
||||
lv_style_t * lv_style_inherit(lv_style_t * result, const lv_style_t * child, const lv_style_t * parent );
|
||||
void lv_style_cpy(lv_style_t * dest, const lv_style_t * src);
|
||||
|
||||
/**
|
||||
* Set the content color of a style
|
||||
* @param style pointer to style
|
||||
* @param ccolor content color
|
||||
*/
|
||||
void lv_style_set_ccolor(lv_style_t * style, color_t ccolor);
|
||||
|
||||
void lv_style_set_stype(lv_style_t * style, lv_stype_t stype);
|
||||
/**
|
||||
* Clear the content color of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_ccolor(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the opacity of a style
|
||||
* @param style pointer to style
|
||||
* @param opa opacity (OPA_COVER, OPA_TRANSP, OPA_10, OPA_20 ... OPA_90)
|
||||
*/
|
||||
void lv_style_set_opa(lv_style_t * style, opa_t opa);
|
||||
|
||||
/**
|
||||
* Clear the opacity of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_opa(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the proportional opacity attribute of a style (make the opacity relative to the parent)
|
||||
* @param style pointer to style
|
||||
* @param opa_prop true: enabled, false: disabled
|
||||
*/
|
||||
void lv_style_set_opa_prop(lv_style_t * style, bool opa_prop);
|
||||
|
||||
/**
|
||||
* Clear the proportional opacity attribute of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_opa_prop(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container main color of a style
|
||||
* @param style pointer to style
|
||||
* @param mcolor main color of the background
|
||||
*/
|
||||
void lv_style_set_mcolor(lv_style_t * style, color_t mcolor);
|
||||
|
||||
/**
|
||||
* Clear the container main color of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_mcolor(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container gradient color of a style
|
||||
* @param style pointer to style
|
||||
* @param gcolor gradient color of the background
|
||||
*/
|
||||
void lv_style_set_gcolor(lv_style_t * style, color_t gcolor);
|
||||
|
||||
/**
|
||||
* Clear the container gradient color of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_gcolor(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container border color of a style
|
||||
* @param style pointer to style
|
||||
* @param bcolor border color of the background
|
||||
*/
|
||||
void lv_style_set_bcolor(lv_style_t * style, color_t bcolor);
|
||||
|
||||
/**
|
||||
* Clear the container border color of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_bcolor(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container light (shadow effect) color of a style
|
||||
* @param style pointer to style
|
||||
* @param lcolor light (shadow) color of the background
|
||||
*/
|
||||
void lv_style_set_scolor(lv_style_t * style, color_t lcolor);
|
||||
|
||||
/**
|
||||
* Set the container corner radius of a style
|
||||
* @param style pointer to style
|
||||
* @param radius corner radius of the background (>= 0)
|
||||
*/
|
||||
void lv_style_set_radius(lv_style_t * style, cord_t radius);
|
||||
|
||||
/**
|
||||
* Clear the container radius of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_radius(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container border width of a style
|
||||
* @param style pointer to style
|
||||
* @param bwidth border width of the background (>= 0, 0 means no border)
|
||||
*/
|
||||
void lv_style_set_bwidth(lv_style_t * style, cord_t bwidth);
|
||||
|
||||
/**
|
||||
* Clear the container border width of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_bwidth(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container shadow width of a style
|
||||
* @param style pointer to style
|
||||
* @param swidth shadow width of the background (>= 0, 0 means no shadow)
|
||||
*/
|
||||
void lv_style_set_swidth(lv_style_t * style, cord_t swidth);
|
||||
|
||||
/**
|
||||
* Clear the container light (shadow) width of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_lwidth(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container vertical padding of a style
|
||||
* @param style pointer to style
|
||||
* @param vpad vertical padding on the background
|
||||
*/
|
||||
void lv_style_set_vpad(lv_style_t * style, cord_t vpad);
|
||||
|
||||
/**
|
||||
* Clear the container vertical padding of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_vpad(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container horizontal padding of a style
|
||||
* @param style pointer to style
|
||||
* @param hpad horizontal padding on the background
|
||||
*/
|
||||
void lv_style_set_hpad(lv_style_t * style, cord_t hpad);
|
||||
|
||||
/**
|
||||
* Clear the container horizontal padding of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_hpad(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container object padding of a style
|
||||
* @param style pointer to style
|
||||
* @param opad padding between objects on the background
|
||||
*/
|
||||
void lv_style_set_opad(lv_style_t * style, cord_t opad);
|
||||
|
||||
/**
|
||||
* Clear the container object padding of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_opad(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the container border opacity of a style (relative to the object opacity)
|
||||
* @param style pointer to style
|
||||
* @param bopa border opacity of the background (OPA_COVER, OPA_TRANSP, OPA_10, OPA_20 ... OPA_90)
|
||||
*/
|
||||
void lv_style_set_bopa(lv_style_t * style, opa_t bopa);
|
||||
|
||||
/**
|
||||
* Clear the container border opacity of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_bopa(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set container empty attribute of a style (transparent background but border drawn)
|
||||
* @param style pointer to style
|
||||
* @param empty true: empty enable, false: empty disable
|
||||
*/
|
||||
void lv_style_set_empty(lv_style_t * style, bool empty);
|
||||
|
||||
/**
|
||||
* Clear the container empty attribute of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_empty(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the font of a style
|
||||
* @param style pointer to style
|
||||
* @param font pointer to a font
|
||||
*/
|
||||
void lv_style_set_font(lv_style_t * style, const font_t * font);
|
||||
|
||||
/**
|
||||
* Clear the font of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_font(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the letter space of a style
|
||||
* @param style pointer to style
|
||||
* @param letter_space new letter space
|
||||
*/
|
||||
void lv_style_set_letter_space(lv_style_t * style, cord_t letter_space);
|
||||
|
||||
/**
|
||||
* Clear the letter space of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_letter_space(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the line space of a style
|
||||
* @param style pointer to style
|
||||
* @param line_space new letter space
|
||||
*/
|
||||
void lv_style_set_line_space(lv_style_t * style, cord_t line_space);
|
||||
|
||||
/**
|
||||
* Clear the line space of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_line_space(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the text align of a style
|
||||
* @param style pointer to style
|
||||
* @param align TODO
|
||||
*/
|
||||
void lv_style_set_txt_align(lv_style_t * style, lv_txt_align_t align);
|
||||
|
||||
/**
|
||||
* Clear the text align of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_txt_align(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the image re-color intensity of a style
|
||||
* @param style pointer to style
|
||||
* @param recolor re-coloring intensity (OPA_TRANSP: do nothing, OPA_COVER: fully re-color, OPA_10: little re-color)
|
||||
*/
|
||||
void lv_style_set_img_recolor(lv_style_t * style, opa_t recolor);
|
||||
|
||||
/**
|
||||
* Clear the image recolor of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_img_recolor(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Set the line width of a style
|
||||
* @param style pointer to style
|
||||
* @param width new line width (>=0)
|
||||
*/
|
||||
void lv_style_set_line_width(lv_style_t * style, cord_t width);
|
||||
|
||||
/**
|
||||
* Clear the line width of a style (it will be inherited from the parent style)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_style_clear_line_width(lv_style_t * style);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_MBOX_CLOSE_ANIM_TIME 300 /*ms*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -65,6 +66,7 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->btnh = NULL;
|
||||
ext->style_btn_rel = lv_style_get(LV_STYLE_BTN_REL, NULL);
|
||||
ext->style_btn_pr = lv_style_get(LV_STYLE_BTN_PR, NULL);
|
||||
ext->anim_close_time = LV_MBOX_CLOSE_ANIM_TIME;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_f(new_mbox, lv_mbox_signal);
|
||||
@@ -248,23 +250,35 @@ void lv_mbox_set_styles_btn(lv_obj_t * mbox, lv_style_t * rel, lv_style_t * pr)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set close animation duration
|
||||
* @param mbox pointer to a message box object
|
||||
* @param time animation length in milliseconds (0: no animation)
|
||||
*/
|
||||
void lv_mbox_set_anim_close_time(lv_obj_t * mbox, uint16_t time)
|
||||
{
|
||||
lv_mbox_ext_t * ext = lv_obj_get_ext(mbox);
|
||||
ext->anim_close_time = time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically delete the message box after a given time
|
||||
* @param mbox pointer to a message box object
|
||||
* @param tout a time (in milliseconds) to wait before delete the message box
|
||||
* @param anim_time time of close animation in milliseconds (0: no animation)
|
||||
*/
|
||||
void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t tout, uint16_t anim_time)
|
||||
void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t tout)
|
||||
{
|
||||
if(anim_time != 0) {
|
||||
lv_mbox_ext_t * ext = lv_obj_get_ext(mbox);
|
||||
|
||||
if(ext->anim_close_time != 0) {
|
||||
/*Add shrinking animations*/
|
||||
lv_obj_anim(mbox, LV_ANIM_GROW_H| ANIM_OUT, anim_time, tout, NULL);
|
||||
lv_obj_anim(mbox, LV_ANIM_GROW_V| ANIM_OUT, anim_time, tout, lv_obj_del);
|
||||
lv_obj_anim(mbox, LV_ANIM_GROW_H| ANIM_OUT, ext->anim_close_time, tout, NULL);
|
||||
lv_obj_anim(mbox, LV_ANIM_GROW_V| ANIM_OUT, ext->anim_close_time, tout, lv_obj_del);
|
||||
|
||||
/*When the animations start disable fit to let shrinking work*/
|
||||
lv_obj_anim(mbox, LV_ANIM_NONE, 1, tout, lv_mbox_disable_fit);
|
||||
} else {
|
||||
lv_obj_anim(mbox, LV_ANIM_NONE, anim_time, tout, lv_obj_del);
|
||||
lv_obj_anim(mbox, LV_ANIM_NONE, ext->anim_close_time, tout, lv_obj_del);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,6 +321,16 @@ lv_obj_t * lv_mbox_get_from_btn(lv_obj_t * btn)
|
||||
return mbox;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the close animation duration
|
||||
* @param mbox pointer to a message box object
|
||||
* @return animation length in milliseconds (0: no animation)
|
||||
*/
|
||||
uint16_t lv_mbox_get_anim_close_time(lv_obj_t * mbox )
|
||||
{
|
||||
lv_mbox_ext_t * ext = lv_obj_get_ext(mbox);
|
||||
return ext->anim_close_time;
|
||||
}
|
||||
/**
|
||||
* Get the style of the buttons on a message box
|
||||
* @param mbox pointer to a message box object
|
||||
|
||||
@@ -48,6 +48,7 @@ typedef struct
|
||||
lv_obj_t * btnh; /*Holder of the buttons*/
|
||||
lv_style_t * style_btn_rel; /*Style of the released buttons*/
|
||||
lv_style_t * style_btn_pr; /*Style of the pressed buttons*/
|
||||
uint16_t anim_close_time; /*Duration of close animation [ms] (0: no animation)*/
|
||||
}lv_mbox_ext_t;
|
||||
|
||||
/**********************
|
||||
@@ -111,7 +112,7 @@ void lv_mbox_set_styles_btn(lv_obj_t * mbox, lv_style_t * rel, lv_style_t * pr);
|
||||
* @param mbox pointer to a message box object
|
||||
* @param tout a time (in milliseconds) to wait before delete the message box
|
||||
*/
|
||||
void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t tout, uint16_t anim_time);
|
||||
void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t tout);
|
||||
|
||||
/**
|
||||
* Stop the auto. closing of message box
|
||||
|
||||
Reference in New Issue
Block a user