lv_buttonmatrix.h¶
Defines
-
LV_BUTTONMATRIX_BUTTON_NONE¶
Typedefs
Enums
-
enum lv_buttonmatrix_ctrl_t¶
Type to store button control flags (disabled, hidden etc.) The least-significant 4 bits are used to store button-width proportions in range [1..15].
Values:
-
enumerator LV_BUTTONMATRIX_CTRL_NONE¶
No extra control, use the default settings
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_1¶
Set the width to 1 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_2¶
Set the width to 2 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_3¶
Set the width to 3 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_4¶
Set the width to 4 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_5¶
Set the width to 5 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_6¶
Set the width to 6 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_7¶
Set the width to 7 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_8¶
Set the width to 8 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_9¶
Set the width to 9 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_10¶
Set the width to 10 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_11¶
Set the width to 11 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_12¶
Set the width to 12 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_13¶
Set the width to 13 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_14¶
Set the width to 14 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_WIDTH_15¶
Set the width to 15 relative to the other buttons in the same row
-
enumerator LV_BUTTONMATRIX_CTRL_HIDDEN¶
Hides button; it continues to hold its space in layout.
-
enumerator LV_BUTTONMATRIX_CTRL_NO_REPEAT¶
Do not emit LV_EVENT_LONG_PRESSED_REPEAT events while button is long-pressed.
-
enumerator LV_BUTTONMATRIX_CTRL_DISABLED¶
Disables button like LV_STATE_DISABLED on normal Widgets.
-
enumerator LV_BUTTONMATRIX_CTRL_CHECKABLE¶
Enable toggling of LV_STATE_CHECKED when clicked.
-
enumerator LV_BUTTONMATRIX_CTRL_CHECKED¶
Make the button checked. It will use the :cpp:enumerator:
LV_STATE_CHECHKED
styles.
-
enumerator LV_BUTTONMATRIX_CTRL_CLICK_TRIG¶
1: Enables sending LV_EVENT_VALUE_CHANGE on CLICK, 0: sends LV_EVENT_VALUE_CHANGE on PRESS.
-
enumerator LV_BUTTONMATRIX_CTRL_POPOVER¶
Show button text in a pop-over while being pressed.
-
enumerator LV_BUTTONMATRIX_CTRL_RECOLOR¶
Enable text recoloring with
#color
-
enumerator LV_BUTTONMATRIX_CTRL_RESERVED_1¶
Reserved for later use
-
enumerator LV_BUTTONMATRIX_CTRL_RESERVED_2¶
Reserved for later use
-
enumerator LV_BUTTONMATRIX_CTRL_CUSTOM_1¶
Custom free-to-use flag
-
enumerator LV_BUTTONMATRIX_CTRL_CUSTOM_2¶
Custom free-to-use flag
-
enumerator LV_BUTTONMATRIX_CTRL_NONE¶
Functions
-
lv_obj_t *lv_buttonmatrix_create(lv_obj_t *parent)¶
Create a button matrix object
- Parameters:
parent – pointer to an object, it will be the parent of the new button matrix
- Returns:
pointer to the created button matrix
-
void lv_buttonmatrix_set_map(lv_obj_t *obj, const char *const map[])¶
Set a new map. Buttons will be created/deleted according to the map. The button matrix keeps a reference to the map and so the string array must not be deallocated during the life of the matrix.
- Parameters:
obj – pointer to a button matrix object
map – pointer a string array. The last string has to be: "". Use "\n" to make a line break.
-
void lv_buttonmatrix_set_ctrl_map(lv_obj_t *obj, const lv_buttonmatrix_ctrl_t ctrl_map[])¶
Set the button control map (hidden, disabled etc.) for a button matrix. The control map array will be copied and so may be deallocated after this function returns.
- Parameters:
obj – pointer to a button matrix object
ctrl_map – pointer to an array of
lv_button_ctrl_t
control bytes. The length of the array and position of the elements must match the number and order of the individual buttons (i.e. excludes newline entries). An element of the map should look like e.g.:ctrl_map[0] = width | LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_TGL_ENABLE
-
void lv_buttonmatrix_set_selected_button(lv_obj_t *obj, uint32_t btn_id)¶
Set the selected buttons
- Parameters:
obj – pointer to button matrix object
btn_id – 0 based index of the button to modify. (Not counting new lines)
-
void lv_buttonmatrix_set_button_ctrl(lv_obj_t *obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl)¶
Set the attributes of a button of the button matrix
- Parameters:
obj – pointer to button matrix object
btn_id – 0 based index of the button to modify. (Not counting new lines)
ctrl – OR-ed attributes. E.g.
LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CHECKABLE
-
void lv_buttonmatrix_clear_button_ctrl(lv_obj_t *obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl)¶
Clear the attributes of a button of the button matrix
- Parameters:
obj – pointer to button matrix object
btn_id – 0 based index of the button to modify. (Not counting new lines)
ctrl – OR-ed attributes. E.g.
LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CHECKABLE
-
void lv_buttonmatrix_set_button_ctrl_all(lv_obj_t *obj, lv_buttonmatrix_ctrl_t ctrl)¶
Set attributes of all buttons of a button matrix
- Parameters:
obj – pointer to a button matrix object
ctrl – attribute(s) to set from
lv_buttonmatrix_ctrl_t
. Values can be ORed.
-
void lv_buttonmatrix_clear_button_ctrl_all(lv_obj_t *obj, lv_buttonmatrix_ctrl_t ctrl)¶
Clear the attributes of all buttons of a button matrix
- Parameters:
obj – pointer to a button matrix object
ctrl – attribute(s) to set from
lv_buttonmatrix_ctrl_t
. Values can be ORed.
-
void lv_buttonmatrix_set_button_width(lv_obj_t *obj, uint32_t btn_id, uint32_t width)¶
Set a single button's relative width. This method will cause the matrix be regenerated and is a relatively expensive operation. It is recommended that initial width be specified using
lv_buttonmatrix_set_ctrl_map
and this method only be used for dynamic changes.- Parameters:
obj – pointer to button matrix object
btn_id – 0 based index of the button to modify.
width – relative width compared to the buttons in the same row. [1..15]
-
void lv_buttonmatrix_set_one_checked(lv_obj_t *obj, bool en)¶
Make the button matrix like a selector widget (only one button may be checked at a time).
LV_BUTTONMATRIX_CTRL_CHECKABLE
must be enabled on the buttons to be selected usinglv_buttonmatrix_set_ctrl()
orlv_buttonmatrix_set_button_ctrl_all()
.- Parameters:
obj – pointer to a button matrix object
en – whether "one check" mode is enabled
-
const char *const *lv_buttonmatrix_get_map(const lv_obj_t *obj)¶
Get the current map of a button matrix
- Parameters:
obj – pointer to a button matrix object
- Returns:
the current map
-
uint32_t lv_buttonmatrix_get_selected_button(const lv_obj_t *obj)¶
Get the index of the lastly "activated" button by the user (pressed, released, focused etc) Useful in the
event_cb
to get the text of the button, check if hidden etc.- Parameters:
obj – pointer to button matrix object
- Returns:
index of the last released button (LV_BUTTONMATRIX_BUTTON_NONE: if unset)
-
const char *lv_buttonmatrix_get_button_text(const lv_obj_t *obj, uint32_t btn_id)¶
Get the button's text
- Parameters:
obj – pointer to button matrix object
btn_id – the index a button not counting new line characters.
- Returns:
text of btn_index` button
-
bool lv_buttonmatrix_has_button_ctrl(lv_obj_t *obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl)¶
Get the whether a control value is enabled or disabled for button of a button matrix
- Parameters:
obj – pointer to a button matrix object
btn_id – the index of a button not counting new line characters.
ctrl – control values to check (ORed value can be used)
- Returns:
true: the control attribute is enabled false: disabled
-
bool lv_buttonmatrix_get_one_checked(const lv_obj_t *obj)¶
Tell whether "one check" mode is enabled or not.
- Parameters:
obj – Button matrix object
- Returns:
true: "one check" mode is enabled; false: disabled
Variables
-
const lv_obj_class_t lv_buttonmatrix_class¶