lv_buttonmatrix.h
API reference for lv_buttonmatrix.h
Functions
lv_buttonmatrix_set_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.
void lv_buttonmatrix_set_map(lv_obj_t *obj, const char *const map[])| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a button matrix object |
map | const char *const | pointer a string array. The last string has to be: "". Use "\n" to make a line break. |
lv_buttonmatrix_set_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.
void lv_buttonmatrix_set_ctrl_map(lv_obj_t *obj, const lv_buttonmatrix_ctrl_t ctrl_map[])| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a button matrix object |
ctrl_map | const lv_buttonmatrix_ctrl_t | 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_set_selected_button
Set the selected buttons
void lv_buttonmatrix_set_selected_button(lv_obj_t *obj, uint32_t btn_id)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to button matrix object |
btn_id | uint32_t | 0 based index of the button to modify. (Not counting new lines) |
lv_buttonmatrix_set_button_ctrl
Set the attributes of a button of the button matrix
void lv_buttonmatrix_set_button_ctrl(lv_obj_t *obj, uint32_t btn_id, lv_buttonmatrix_ctrl_t ctrl)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to button matrix object |
btn_id | uint32_t | 0 based index of the button to modify. (Not counting new lines) |
ctrl | lv_buttonmatrix_ctrl_t | OR-ed attributes. E.g. `LV_BUTTONMATRIX_CTRL_NO_REPEAT |
lv_buttonmatrix_set_button_ctrl_all
Set attributes of all buttons of a button matrix
void lv_buttonmatrix_set_button_ctrl_all(lv_obj_t *obj, lv_buttonmatrix_ctrl_t ctrl)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a button matrix object |
ctrl | lv_buttonmatrix_ctrl_t | attribute(s) to set from lv_buttonmatrix_ctrl_t. Values can be ORed. |
lv_buttonmatrix_set_button_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.
void lv_buttonmatrix_set_button_width(lv_obj_t *obj, uint32_t btn_id, uint32_t width)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to button matrix object |
btn_id | uint32_t | 0 based index of the button to modify. |
width | uint32_t | relative width compared to the buttons in the same row. [1..15] |
lv_buttonmatrix_set_one_checked
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 using lv_buttonmatrix_set_ctrl() or lv_buttonmatrix_set_button_ctrl_all().
void lv_buttonmatrix_set_one_checked(lv_obj_t *obj, bool en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a button matrix object |
en | bool | whether "one check" mode is enabled |
Enums
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].
| Name | Value | Description |
|---|---|---|
LV_BUTTONMATRIX_CTRL_NONE | 0x0000 | No extra control, use the default settings |
LV_BUTTONMATRIX_CTRL_WIDTH_1 | 0x0001 | Set the width to 1 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_2 | 0x0002 | Set the width to 2 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_3 | 0x0003 | Set the width to 3 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_4 | 0x0004 | Set the width to 4 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_5 | 0x0005 | Set the width to 5 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_6 | 0x0006 | Set the width to 6 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_7 | 0x0007 | Set the width to 7 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_8 | 0x0008 | Set the width to 8 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_9 | 0x0009 | Set the width to 9 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_10 | 0x000A | Set the width to 10 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_11 | 0x000B | Set the width to 11 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_12 | 0x000C | Set the width to 12 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_13 | 0x000D | Set the width to 13 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_14 | 0x000E | Set the width to 14 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_WIDTH_15 | 0x000F | Set the width to 15 relative to the other buttons in the same row |
LV_BUTTONMATRIX_CTRL_HIDDEN | 0x0010 | Hides button; it continues to hold its space in layout. |
LV_BUTTONMATRIX_CTRL_NO_REPEAT | 0x0020 | Do not emit LV_EVENT_LONG_PRESSED_REPEAT events while button is long-pressed. |
LV_BUTTONMATRIX_CTRL_DISABLED | 0x0040 | Disables button like LV_STATE_DISABLED on normal Widgets. |
LV_BUTTONMATRIX_CTRL_CHECKABLE | 0x0080 | Enable toggling of LV_STATE_CHECKED when clicked. |
LV_BUTTONMATRIX_CTRL_CHECKED | 0x0100 | Make the button checked. It will use the :cpp:enumerator:LV_STATE_CHECHKED styles. |
LV_BUTTONMATRIX_CTRL_CLICK_TRIG | 0x0200 | 1: Enables sending LV_EVENT_VALUE_CHANGE on CLICK, 0: sends LV_EVENT_VALUE_CHANGE on PRESS. |
LV_BUTTONMATRIX_CTRL_POPOVER | 0x0400 | Show button text in a pop-over while being pressed. |
LV_BUTTONMATRIX_CTRL_RECOLOR | 0x0800 | Enable text recoloring with #color |
LV_BUTTONMATRIX_CTRL_RESERVED_1 | 0x1000 | Reserved for later use |
LV_BUTTONMATRIX_CTRL_RESERVED_2 | 0x2000 | Reserved for later use |
LV_BUTTONMATRIX_CTRL_CUSTOM_1 | 0x4000 | Custom free-to-use flag |
LV_BUTTONMATRIX_CTRL_CUSTOM_2 | 0x8000 | Custom free-to-use flag |
Used by 7 functions
lv_buttonmatrix_set_ctrl_map— paramctrl_maplv_buttonmatrix_set_button_ctrl— paramctrllv_buttonmatrix_clear_button_ctrl— paramctrllv_buttonmatrix_set_button_ctrl_all— paramctrllv_buttonmatrix_clear_button_ctrl_all— paramctrllv_buttonmatrix_has_button_ctrl— paramctrllv_keyboard_set_map— paramctrl_map
_lv_property_buttonmatrix_id_t
| Name | Value |
|---|---|
LV_PROPERTY_BUTTONMATRIX_SELECTED_BUTTON | (LV_PROPERTY_BUTTONMATRIX_START + ((int) 0 )) | (( 1 ) << 28 ) |
LV_PROPERTY_BUTTONMATRIX_ONE_CHECKED | (LV_PROPERTY_BUTTONMATRIX_START + ((int) 1 )) | (( 11 ) << 28 ) |
LV_PROPERTY_BUTTONMATRIX_END |
Typedefs
lv_buttonmatrix_button_draw_cb_t
typedef bool(* lv_buttonmatrix_button_draw_cb_t) (lv_obj_t *btnm, uint32_t btn_id, const lv_area_t *draw_area, const lv_area_t *clip_area)Macros
LV_BUTTONMATRIX_BUTTON_NONE
#define LV_BUTTONMATRIX_BUTTON_NONE 0xFFFFVariables
lv_buttonmatrix_class
const lv_obj_class_t lv_buttonmatrix_classDependencies
Indirect dependencies
lv_anim.hlv_area.hlv_array.hlv_assert.hlv_bidi.hlv_color.hlv_color_op.hlv_conf_kconfig.hlv_display.hlv_draw.hlv_draw_arc.hlv_draw_blur.hlv_draw_buf.hlv_draw_image.hlv_draw_label.hlv_draw_line.hlv_draw_rect.hlv_draw_triangle.hlv_event.hlv_ext_data.hlv_flex.hlv_font.hlv_fs.hlv_grad.hlv_grid.hlv_group.hlv_image_decoder.hlv_image_dsc.hlv_indev.hlv_layout.hlv_ll.hlv_log.hlv_math.hlv_matrix.hlv_mem.hlv_obj_class.hlv_obj_draw.hlv_obj_event.hlv_obj_pos.hlv_obj_property_names.hlv_obj_scroll.hlv_obj_style.hlv_obj_style_gen.hlv_obj_tree.hlv_palette.hlv_profiler.hlv_profiler_builtin.hlv_sprintf.hlv_string.hlv_style.hlv_style_gen.hlv_style_properties.hlv_symbol_def.hlv_text.hlv_tick.hlv_timer.hlv_types.h
How is this guide?
Last updated on