mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
feat(btnmatrix): review ctrl map and allow width values to be max 15
This commit is contained in:
parent
2c138eb47a
commit
7cc34ba81b
@ -25,7 +25,7 @@ So in the example the first row will have 2 buttons each with 50% width and a se
|
||||
The buttons' width can be set relative to the other button in the same row with `lv_btnmatrix_set_btn_width(btnm, btn_id, width)`
|
||||
E.g. in a line with two buttons: *btnA, width = 1* and *btnB, width = 2*, *btnA* will have 33 % width and *btnB* will have 66 % width.
|
||||
It's similar to how the [`flex-grow`](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow) property works in CSS.
|
||||
The width must be in the \[1..7\] range and the default width is 1.
|
||||
The width must be in the \[1..15\] range and the default width is 1.
|
||||
|
||||
In addition to the width, each button can be customized with the following parameters:
|
||||
- `LV_BTNMATRIX_CTRL_HIDDEN` Makes a button hidden (hidden buttons still take up space in the layout, they are just not visible or clickable)
|
||||
|
@ -32,18 +32,19 @@ LV_EXPORT_CONST_INT(LV_BTNMATRIX_BTN_NONE);
|
||||
/** Type to store button control bits (disabled, hidden etc.)
|
||||
* The first 3 bits are used to store the width*/
|
||||
enum {
|
||||
_LV_BTNMATRIX_WIDTH = 0x0007, /**< Reserved to stire the size units*/
|
||||
LV_BTNMATRIX_CTRL_HIDDEN = 0x0008, /**< Button hidden*/
|
||||
LV_BTNMATRIX_CTRL_NO_REPEAT = 0x0010, /**< Do not repeat press this button.*/
|
||||
LV_BTNMATRIX_CTRL_DISABLED = 0x0020, /**< Disable this button.*/
|
||||
LV_BTNMATRIX_CTRL_CHECKABLE = 0x0040, /**< The button can be toggled.*/
|
||||
LV_BTNMATRIX_CTRL_CHECKED = 0x0080, /**< Button is currently toggled (e.g. checked).*/
|
||||
LV_BTNMATRIX_CTRL_CLICK_TRIG = 0x0100, /**< 1: Send LV_EVENT_VALUE_CHANGE on CLICK, 0: Send LV_EVENT_VALUE_CHANGE on PRESS*/
|
||||
LV_BTNMATRIX_CTRL_POPOVER = 0x0200, /**< Show a popover when pressing this key*/
|
||||
LV_BTNMATRIX_CTRL_RECOLOR = 0x1000, /**< Enable text recoloring with `#color`*/
|
||||
_LV_BTNMATRIX_CTRL_RESERVED = 0x2000, /**< Reserved for later use*/
|
||||
LV_BTNMATRIX_CTRL_CUSTOM_1 = 0x4000, /**< Custom free to use flag*/
|
||||
LV_BTNMATRIX_CTRL_CUSTOM_2 = 0x8000, /**< Custom free to use flag*/
|
||||
_LV_BTNMATRIX_WIDTH = 0x000F, /**< Reserved to store the size units*/
|
||||
LV_BTNMATRIX_CTRL_HIDDEN = 0x0010, /**< Button hidden*/
|
||||
LV_BTNMATRIX_CTRL_NO_REPEAT = 0x0020, /**< Do not repeat press this button.*/
|
||||
LV_BTNMATRIX_CTRL_DISABLED = 0x0040, /**< Disable this button.*/
|
||||
LV_BTNMATRIX_CTRL_CHECKABLE = 0x0080, /**< The button can be toggled.*/
|
||||
LV_BTNMATRIX_CTRL_CHECKED = 0x0100, /**< Button is currently toggled (e.g. checked).*/
|
||||
LV_BTNMATRIX_CTRL_CLICK_TRIG = 0x0200, /**< 1: Send LV_EVENT_VALUE_CHANGE on CLICK, 0: Send LV_EVENT_VALUE_CHANGE on PRESS*/
|
||||
LV_BTNMATRIX_CTRL_POPOVER = 0x0400, /**< Show a popover when pressing this key*/
|
||||
LV_BTNMATRIX_CTRL_RECOLOR = 0x0800, /**< Enable text recoloring with `#color`*/
|
||||
_LV_BTNMATRIX_CTRL_RESERVED_1 = 0x1000, /**< Reserved for later use*/
|
||||
_LV_BTNMATRIX_CTRL_RESERVED_2 = 0x2000, /**< Reserved for later use*/
|
||||
LV_BTNMATRIX_CTRL_CUSTOM_1 = 0x4000, /**< Custom free to use flag*/
|
||||
LV_BTNMATRIX_CTRL_CUSTOM_2 = 0x8000, /**< Custom free to use flag*/
|
||||
};
|
||||
|
||||
typedef uint16_t lv_btnmatrix_ctrl_t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user