Merge branch 'dev-6.0' into event

This commit is contained in:
Gabor Kiss-Vamosi
2019-03-03 04:29:17 +01:00
7 changed files with 78 additions and 10 deletions

View File

@@ -303,6 +303,25 @@ void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_action_t action)
ext->action = action;
}
/**
* Set the pressed button
* @param btnm pointer to button matrix object
* @param id index of the currently pressed button (`LV_BTNM_PR_NONE` to unpress)
*/
void lv_btnm_set_pressed(const lv_obj_t * btnm, uint16_t id)
{
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
if (id >= ext->btn_cnt && id != LV_BTNM_PR_NONE)
return;
if (id == ext->btn_id_pr)
return;
ext->btn_id_pr = id;
lv_obj_invalidate(btnm);
}
/**
* Enable or disable button toggling
* @param btnm pointer to button matrix object

View File

@@ -141,6 +141,13 @@ void lv_btnm_set_ctrl_map(const lv_obj_t * btnm, const lv_btnm_ctrl_t * ctrl_map
*/
void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_action_t action);
/**
* Set the pressed button
* @param btnm pointer to button matrix object
* @param id index of the currently pressed button (`LV_BTNM_PR_NONE` to unpress)
*/
void lv_btnm_set_pressed(const lv_obj_t * btnm, uint16_t id);
/**
* Enable or disable button toggling
* @param btnm pointer to button matrix object

View File

@@ -120,9 +120,10 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy)
*====================*/
/**
* Set the text of a check box
* Set the text of a check box. `txt` will be copied and may be deallocated
* after this function returns.
* @param cb pointer to a check box
* @param txt the text of the check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_cb_set_text(lv_obj_t * cb, const char * txt)
{
@@ -130,6 +131,17 @@ void lv_cb_set_text(lv_obj_t * cb, const char * txt)
lv_label_set_text(ext->label, txt);
}
/**
* Set the text of a check box. `txt` must not be deallocated during the life
* of this checkbox.
* @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_cb_set_static_text(lv_obj_t * cb, const char * txt) {
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);
lv_label_set_static_text(ext->label, txt);
}
/**
* Set a style of a check box
* @param cb pointer to check box object

View File

@@ -78,12 +78,21 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy);
*====================*/
/**
* Set the text of a check box
* Set the text of a check box. `txt` will be copied and may be deallocated
* after this function returns.
* @param cb pointer to a check box
* @param txt the text of the check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_cb_set_text(lv_obj_t * cb, const char * txt);
/**
* Set the text of a check box. `txt` must not be deallocated during the life
* of this checkbox.
* @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_cb_set_static_text(lv_obj_t * cb, const char * txt);
/**
* Set the state of the check box
* @param cb pointer to a check box object

View File

@@ -82,6 +82,7 @@ static const char * kb_map_num[] = {
};
static const lv_btnm_ctrl_t kb_ctrl_num_map[] = {
1, 1, 1, 2,
1, 1, 1, 2,
1, 1, 1, 2,
1, 1, 1, 1, 1

View File

@@ -377,17 +377,29 @@ lv_style_t * lv_mbox_get_style(const lv_obj_t * mbox, lv_mbox_style_t type)
/**
* Get whether recoloring is enabled
* @param btnm pointer to button matrix object
* @param mbox pointer to a message box object
* @return whether recoloring is enabled
*/
bool lv_mbox_get_recolor(const lv_obj_t * mbox)
{
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
if(!ext->btnm)
return false;
if(!ext->btnm)
return false;
return lv_btnm_get_recolor(ext->btnm);
return lv_btnm_get_recolor(ext->btnm);
}
/**
* Get message box button matrix
* @param mbox pointer to a message box object
* @return pointer to button matrix object
* @remarks return value will be NULL unless `lv_mbox_add_btns` has been already called
*/
lv_obj_t * lv_mbox_get_btnm(lv_obj_t * mbox)
{
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
return ext->btnm;
}

View File

@@ -184,11 +184,19 @@ lv_style_t * lv_mbox_get_style(const lv_obj_t *mbox, lv_mbox_style_t type);
/**
* Get whether recoloring is enabled
* @param btnm pointer to button matrix object
* @param mbox pointer to a message box object
* @return whether recoloring is enabled
*/
bool lv_mbox_get_recolor(const lv_obj_t * mbox);
/**
* Get message box button matrix
* @param mbox pointer to a message box object
* @return pointer to button matrix object
* @remarks return value will be NULL unless `lv_mbox_add_btns` has been already called
*/
lv_obj_t * lv_mbox_get_btnm(lv_obj_t * mbox);
/**********************
* MACROS
**********************/