lv_buttonmatrix.h

API reference for lv_buttonmatrix.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_buttonmatrix_private.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[])
Parameters
NameTypeDescription
objlv_obj_t *pointer to a button matrix object
mapconst char *constpointer 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[])
Parameters
NameTypeDescription
objlv_obj_t *pointer to a button matrix object
ctrl_mapconst lv_buttonmatrix_ctrl_tpointer 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)
Parameters
NameTypeDescription
objlv_obj_t *pointer to button matrix object
btn_iduint32_t0 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)
Parameters
NameTypeDescription
objlv_obj_t *pointer to button matrix object
btn_iduint32_t0 based index of the button to modify. (Not counting new lines)
ctrllv_buttonmatrix_ctrl_tOR-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)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a button matrix object
ctrllv_buttonmatrix_ctrl_tattribute(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)
Parameters
NameTypeDescription
objlv_obj_t *pointer to button matrix object
btn_iduint32_t0 based index of the button to modify.
widthuint32_trelative 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)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a button matrix object
enboolwhether "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].

NameValueDescription
LV_BUTTONMATRIX_CTRL_NONE0x0000No extra control, use the default settings
LV_BUTTONMATRIX_CTRL_WIDTH_10x0001Set the width to 1 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_20x0002Set the width to 2 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_30x0003Set the width to 3 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_40x0004Set the width to 4 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_50x0005Set the width to 5 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_60x0006Set the width to 6 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_70x0007Set the width to 7 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_80x0008Set the width to 8 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_90x0009Set the width to 9 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_100x000ASet the width to 10 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_110x000BSet the width to 11 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_120x000CSet the width to 12 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_130x000DSet the width to 13 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_140x000ESet the width to 14 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_WIDTH_150x000FSet the width to 15 relative to the other buttons in the same row
LV_BUTTONMATRIX_CTRL_HIDDEN0x0010Hides button; it continues to hold its space in layout.
LV_BUTTONMATRIX_CTRL_NO_REPEAT0x0020Do not emit LV_EVENT_LONG_PRESSED_REPEAT events while button is long-pressed.
LV_BUTTONMATRIX_CTRL_DISABLED0x0040Disables button like LV_STATE_DISABLED on normal Widgets.
LV_BUTTONMATRIX_CTRL_CHECKABLE0x0080Enable toggling of LV_STATE_CHECKED when clicked.
LV_BUTTONMATRIX_CTRL_CHECKED0x0100Make the button checked. It will use the :cpp:enumerator:LV_STATE_CHECHKED styles.
LV_BUTTONMATRIX_CTRL_CLICK_TRIG0x02001: Enables sending LV_EVENT_VALUE_CHANGE on CLICK, 0: sends LV_EVENT_VALUE_CHANGE on PRESS.
LV_BUTTONMATRIX_CTRL_POPOVER0x0400Show button text in a pop-over while being pressed.
LV_BUTTONMATRIX_CTRL_RECOLOR0x0800Enable text recoloring with #color
LV_BUTTONMATRIX_CTRL_RESERVED_10x1000Reserved for later use
LV_BUTTONMATRIX_CTRL_RESERVED_20x2000Reserved for later use
LV_BUTTONMATRIX_CTRL_CUSTOM_10x4000Custom free-to-use flag
LV_BUTTONMATRIX_CTRL_CUSTOM_20x8000Custom free-to-use flag
Used by 7 functions
  • lv_buttonmatrix_set_ctrl_map — param ctrl_map
  • lv_buttonmatrix_set_button_ctrl — param ctrl
  • lv_buttonmatrix_clear_button_ctrl — param ctrl
  • lv_buttonmatrix_set_button_ctrl_all — param ctrl
  • lv_buttonmatrix_clear_button_ctrl_all — param ctrl
  • lv_buttonmatrix_has_button_ctrl — param ctrl
  • lv_keyboard_set_map — param ctrl_map

_lv_property_buttonmatrix_id_t

NameValue
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 0xFFFF

Variables

lv_buttonmatrix_class

 
const lv_obj_class_t lv_buttonmatrix_class

Dependencies

How is this guide?

Last updated on

On this page