mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
refactor: minor refactoring and widget docs update
This commit is contained in:
parent
7119b7488b
commit
88865dd910
@ -270,7 +270,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
|||||||
obj = lv_label_create(obj);
|
obj = lv_label_create(obj);
|
||||||
lv_label_set_text(obj, "Tile: 1;1");
|
lv_label_set_text(obj, "Tile: 1;1");
|
||||||
|
|
||||||
lv_obj_set_tile_id(tv, 1, 1, LV_ANIM_ON);
|
lv_tileview_set_tile_by_index(tv, 1, 1, LV_ANIM_ON);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -54,16 +54,6 @@ The bar can be one of the following modes:
|
|||||||
|
|
||||||
Events
|
Events
|
||||||
******
|
******
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN` and :cpp:enumerator:`LV_EVENT_DRAW_PART_END` are sent
|
|
||||||
for the following parts:
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_BAR_DRAW_PART_INDICATOR` The indicator of the bar
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_INDICATOR`
|
|
||||||
- ``draw_area``: area of the indicator
|
|
||||||
- ``rect_dsc``
|
|
||||||
|
|
||||||
See the events of the `Base object </widgets/obj>`__ too.
|
See the events of the `Base object </widgets/obj>`__ too.
|
||||||
|
|
||||||
Learn more about :ref:`events`.
|
Learn more about :ref:`events`.
|
||||||
|
@ -1,147 +0,0 @@
|
|||||||
Button matrix (lv_btnmatrix)
|
|
||||||
============================
|
|
||||||
|
|
||||||
Overview
|
|
||||||
********
|
|
||||||
|
|
||||||
The Button Matrix object is a lightweight way to display multiple
|
|
||||||
buttons in rows and columns. Lightweight because the buttons are not
|
|
||||||
actually created but just virtually drawn on the fly. This way, one
|
|
||||||
button use only eight extra bytes of memory instead of the ~100-150
|
|
||||||
bytes a normal `Button </widgets/btn>`__ object plus the 100 or so bytes
|
|
||||||
for the `Label </widgets/label>`__ object.
|
|
||||||
|
|
||||||
The Button matrix is added to the default group (if one is set). Besides
|
|
||||||
the Button matrix is an editable object to allow selecting and clicking
|
|
||||||
the buttons with encoder navigation too.
|
|
||||||
|
|
||||||
Parts and Styles
|
|
||||||
****************
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_PART_MAIN` The background of the button matrix, uses the
|
|
||||||
typical background style properties. ``pad_row`` and ``pad_column``
|
|
||||||
sets the space between the buttons.
|
|
||||||
- :cpp:enumerator:`LV_PART_ITEMS` The buttons all use the text and typical background
|
|
||||||
style properties except translations and transformations.
|
|
||||||
|
|
||||||
Usage
|
|
||||||
*****
|
|
||||||
|
|
||||||
Button's text
|
|
||||||
-------------
|
|
||||||
|
|
||||||
There is a text on each button. To specify them a descriptor string
|
|
||||||
array, called *map*, needs to be used. The map can be set with
|
|
||||||
:cpp:expr:`lv_btnmatrix_set_map(btnm, my_map)`. The declaration of a map should
|
|
||||||
look like ``const char * map[] = {"btn1", "btn2", "btn3", NULL}``. Note
|
|
||||||
that the last element has to be either ``NULL`` or an empty string
|
|
||||||
(``""``)!
|
|
||||||
|
|
||||||
Use ``"\n"`` in the map to insert a **line break**. E.g.
|
|
||||||
``{"btn1", "btn2", "\n", "btn3", ""}``. Each line's buttons have their
|
|
||||||
width calculated automatically. So in the example the first row will
|
|
||||||
have 2 buttons each with 50% width and a second row with 1 button having
|
|
||||||
100% width.
|
|
||||||
|
|
||||||
Control buttons
|
|
||||||
---------------
|
|
||||||
|
|
||||||
The buttons' width can be set relative to the other button in the same
|
|
||||||
row with :cpp:expr:`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..15] range and the
|
|
||||||
default width is 1.
|
|
||||||
|
|
||||||
In addition to the width, each button can be customized with the
|
|
||||||
following parameters:
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_HIDDEN`: Makes a button hidden (hidden buttons still take up space in the layout, they are just not visible or clickable)
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_NO_REPEAT`: Disable repeating when the button is long pressed
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_DISABLED`: Makes a button disabled Like :cpp:enumerator:`LV_STATE_DISABLED` on normal objects
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_CHECKABLE`: Enable toggling of a button. I.e. :cpp:enumerator:`LV_STATE_CHECKED` will be added/removed as the button is clicked
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_CHECKED`: Make the button checked. It will use the :cpp:enumerator:`LV_STATE_CHECHKED` styles.
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_CLICK_TRIG`: Enabled: send LV_EVENT_VALUE_CHANGE on CLICK, Disabled: send :cpp:enumerator:`LV_EVENT_VALUE_CHANGE` on PRESS
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_POPOVER`: Show the button label in a popover when pressing this key
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_RECOLOR`: Enable recoloring of button texts with ``#``. E.g. ``"It's #ff0000 red#"``
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_CUSTOM_1`: Custom free to use flag
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_CTRL_CUSTOM_2`: Custom free to use flag
|
|
||||||
|
|
||||||
By default, all flags are disabled.
|
|
||||||
|
|
||||||
To set or clear a button's control attribute, use
|
|
||||||
``lv_btnmatrix_set_btn_ctrl(btnm, btn_id, LV_BTNM_CTRL_...)`` and
|
|
||||||
``lv_btnmatrix_clear_btn_ctrl(btnm, btn_id, LV_BTNMATRIX_CTRL_...)``
|
|
||||||
respectively. More ``LV_BTNM_CTRL_...`` values can be OR-ed
|
|
||||||
|
|
||||||
To set/clear the same control attribute for all buttons of a button
|
|
||||||
matrix, use ``lv_btnmatrix_set_btn_ctrl_all(btnm, LV_BTNM_CTRL_...)``
|
|
||||||
and ``lv_btnmatrix_clear_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_...)``.
|
|
||||||
|
|
||||||
The set a control map for a button matrix (similarly to the map for the
|
|
||||||
text), use ``lv_btnmatrix_set_ctrl_map(btnm, ctrl_map)``. An element of
|
|
||||||
``ctrl_map`` should look like
|
|
||||||
``ctrl_map[0] = width | LV_BTNM_CTRL_NO_REPEAT | LV_BTNM_CTRL_CHECHKABLE``.
|
|
||||||
The number of elements should be equal to the number of buttons
|
|
||||||
(excluding newlines characters).
|
|
||||||
|
|
||||||
One check
|
|
||||||
---------
|
|
||||||
|
|
||||||
The "One check" feature can be enabled with
|
|
||||||
:cpp:expr:`lv_btnmatrix_set_one_checked(btnm, true)` to allow only one button to
|
|
||||||
be checked at a time.
|
|
||||||
|
|
||||||
Events
|
|
||||||
******
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED`: Sent when a button is pressed/released or
|
|
||||||
repeated after long press. The event parameter is set to the ID of
|
|
||||||
the pressed/released button.
|
|
||||||
- :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN` and :cpp:enumerator:`LV_EVENT_DRAW_PART_END` are sent
|
|
||||||
for the following types:
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_BTNMATRIX_DRAW_PART_BTN` The individual buttons.
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_ITEMS`
|
|
||||||
- ``id``:index of the button being drawn
|
|
||||||
- ``draw_area``: the area of the button
|
|
||||||
- ``rect_dsc``
|
|
||||||
|
|
||||||
See the events of the `Base object </widgets/obj>`__ too.
|
|
||||||
|
|
||||||
:cpp:expr:`lv_btnmatrix_get_selected_btn(btnm)` returns the index of the most
|
|
||||||
recently released or focused button or :cpp:enumerator:`LV_BTNMATRIX_BTN_NONE` if no
|
|
||||||
such button.
|
|
||||||
|
|
||||||
:cpp:expr:`lv_btnmatrix_get_btn_text(btnm, btn_id)` returns a pointer to the
|
|
||||||
text of ``btn_id``\ th button.
|
|
||||||
|
|
||||||
Learn more about :ref:`events`.
|
|
||||||
|
|
||||||
Keys
|
|
||||||
****
|
|
||||||
|
|
||||||
- ``LV_KEY_RIGHT/UP/LEFT/RIGHT`` To navigate among the buttons to
|
|
||||||
select one
|
|
||||||
- :cpp:enumerator:`LV_KEY_ENTER` To press/release the selected button
|
|
||||||
|
|
||||||
Note that long pressing the button matrix with an encoder can mean to
|
|
||||||
enter/leave edit mode and simply long pressing a button to make it
|
|
||||||
repeat as well. To avoid this contradiction it's suggested to add
|
|
||||||
:cpp:expr:`lv_btnmatrix_set_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_CLICK_TRIG | LV_BTNMATRIX_CTRL_NO_REPEAT)`
|
|
||||||
to the button matrix if used with encoder. This way, the pressed button
|
|
||||||
repeat feature is disabled and on leaving edit mode the selected button
|
|
||||||
won't be activated.
|
|
||||||
|
|
||||||
Learn more about :ref:`indev_keys`.
|
|
||||||
|
|
||||||
Example
|
|
||||||
*******
|
|
||||||
|
|
||||||
.. include:: ../examples/widgets/btnmatrix/index.rst
|
|
||||||
|
|
||||||
API
|
|
||||||
***
|
|
@ -1,4 +1,4 @@
|
|||||||
Button (lv_btn)
|
Button (lv_button)
|
||||||
===============
|
===============
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
@ -46,7 +46,7 @@ Learn more about :ref:`indev_keys`.
|
|||||||
Example
|
Example
|
||||||
*******
|
*******
|
||||||
|
|
||||||
.. include:: ../examples/widgets/btn/index.rst
|
.. include:: ../examples/widgets/button/index.rst
|
||||||
|
|
||||||
API
|
API
|
||||||
***
|
***
|
138
docs/widgets/butttonmatrix.rst
Normal file
138
docs/widgets/butttonmatrix.rst
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
Button matrix (lv_buttonmatrix)
|
||||||
|
============================
|
||||||
|
|
||||||
|
Overview
|
||||||
|
********
|
||||||
|
|
||||||
|
The Button Matrix object is a lightweight way to display multiple
|
||||||
|
buttons in rows and columns. Lightweight because the buttons are not
|
||||||
|
actually created but just virtually drawn on the fly. This way, one
|
||||||
|
button use only eight extra bytes of memory instead of the ~100-150
|
||||||
|
bytes a normal `Button </widgets/button>`__ object plus the 100 or so bytes
|
||||||
|
for the `Label </widgets/label>`__ object.
|
||||||
|
|
||||||
|
The Button matrix is added to the default group (if one is set). Besides
|
||||||
|
the Button matrix is an editable object to allow selecting and clicking
|
||||||
|
the buttons with encoder navigation too.
|
||||||
|
|
||||||
|
Parts and Styles
|
||||||
|
****************
|
||||||
|
|
||||||
|
- :cpp:enumerator:`LV_PART_MAIN` The background of the button matrix, uses the
|
||||||
|
typical background style properties. ``pad_row`` and ``pad_column``
|
||||||
|
sets the space between the buttons.
|
||||||
|
- :cpp:enumerator:`LV_PART_ITEMS` The buttons all use the text and typical background
|
||||||
|
style properties except translations and transformations.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
*****
|
||||||
|
|
||||||
|
Button's text
|
||||||
|
-------------
|
||||||
|
|
||||||
|
There is a text on each button. To specify them a descriptor string
|
||||||
|
array, called *map*, needs to be used. The map can be set with
|
||||||
|
:cpp:expr:`lv_buttonmatrix_set_map(buttonm, my_map)`. The declaration of a map should
|
||||||
|
look like ``const char * map[] = {"button1", "button2", "button3", NULL}``. Note
|
||||||
|
that the last element has to be either ``NULL`` or an empty string
|
||||||
|
(``""``)!
|
||||||
|
|
||||||
|
Use ``"\n"`` in the map to insert a **line break**. E.g.
|
||||||
|
``{"button1", "button2", "\n", "button3", ""}``. Each line's buttons have their
|
||||||
|
width calculated automatically. So in the example the first row will
|
||||||
|
have 2 buttons each with 50% width and a second row with 1 button having
|
||||||
|
100% width.
|
||||||
|
|
||||||
|
Control buttons
|
||||||
|
---------------
|
||||||
|
|
||||||
|
The buttons' width can be set relative to the other button in the same
|
||||||
|
row with :cpp:expr:`lv_buttonmatrix_set_button_width(buttonm, button_id, width)` E.g. in a
|
||||||
|
line with two buttons: *buttonA, width = 1* and *buttonB, width = 2*, *buttonA*
|
||||||
|
will have 33 % width and *buttonB* 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..15] range and the
|
||||||
|
default width is 1.
|
||||||
|
|
||||||
|
In addition to the width, each button can be customized with the
|
||||||
|
following parameters:
|
||||||
|
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_HIDDEN`: Makes a button hidden (hidden buttons still take up space in the layout, they are just not visible or clickable)
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_NO_REPEAT`: Disable repeating when the button is long pressed
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_DISABLED`: Makes a button disabled Like :cpp:enumerator:`LV_STATE_DISABLED` on normal objects
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_CHECKABLE`: Enable toggling of a button. I.e. :cpp:enumerator:`LV_STATE_CHECKED` will be added/removed as the button is clicked
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_CHECKED`: Make the button checked. It will use the :cpp:enumerator:`LV_STATE_CHECHKED` styles.
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_CLICK_TRIG`: Enabled: send LV_EVENT_VALUE_CHANGE on CLICK, Disabled: send :cpp:enumerator:`LV_EVENT_VALUE_CHANGE` on PRESS
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_POPOVER`: Show the button label in a popover when pressing this key
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_RECOLOR`: Enable recoloring of button texts with ``#``. E.g. ``"It's #ff0000 red#"``
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_CUSTOM_1`: Custom free to use flag
|
||||||
|
- :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_CUSTOM_2`: Custom free to use flag
|
||||||
|
|
||||||
|
By default, all flags are disabled.
|
||||||
|
|
||||||
|
To set or clear a button's control attribute, use
|
||||||
|
``lv_buttonmatrix_set_button_ctrl(buttonm, button_id, LV_BUTTONMATRIX_CTRL_...)`` and
|
||||||
|
``lv_buttonmatrix_clear_button_ctrl(buttonm, button_id, LV_BUTTONMATRIX_CTRL_...)``
|
||||||
|
respectively. More ``LV_BUTTONMATRIX_CTRL_...`` values can be OR-ed
|
||||||
|
|
||||||
|
To set/clear the same control attribute for all buttons of a button
|
||||||
|
matrix, use ``lv_buttonmatrix_set_button_ctrl_all(buttonm, LV_BUTTONMATRIX_CTRL_...)``
|
||||||
|
and ``lv_buttonmatrix_clear_button_ctrl_all(buttonm, LV_BUTTONMATRIX_CTRL_...)``.
|
||||||
|
|
||||||
|
The set a control map for a button matrix (similarly to the map for the
|
||||||
|
text), use ``lv_buttonmatrix_set_ctrl_map(buttonm, ctrl_map)``. An element of
|
||||||
|
``ctrl_map`` should look like
|
||||||
|
``ctrl_map[0] = width | LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CHECHKABLE``.
|
||||||
|
The number of elements should be equal to the number of buttons
|
||||||
|
(excluding newlines characters).
|
||||||
|
|
||||||
|
One check
|
||||||
|
---------
|
||||||
|
|
||||||
|
The "One check" feature can be enabled with
|
||||||
|
:cpp:expr:`lv_buttonmatrix_set_one_checked(buttonm, true)` to allow only one button to
|
||||||
|
be checked at a time.
|
||||||
|
|
||||||
|
Events
|
||||||
|
******
|
||||||
|
|
||||||
|
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED`: Sent when a button is pressed/released or
|
||||||
|
repeated after long press. The event parameter is set to the ID of
|
||||||
|
the pressed/released button.
|
||||||
|
|
||||||
|
See the events of the `Base object </widgets/obj>`__ too.
|
||||||
|
|
||||||
|
:cpp:expr:`lv_buttonmatrix_get_selected_button(buttonm)` returns the index of the most
|
||||||
|
recently released or focused button or :cpp:enumerator:`LV_BUTTONMATRIX_BUTTON_NONE` if no
|
||||||
|
such button.
|
||||||
|
|
||||||
|
:cpp:expr:`lv_buttonmatrix_get_button_text(buttonm, button_id)` returns a pointer to the
|
||||||
|
text of ``button_id``\ th button.
|
||||||
|
|
||||||
|
Learn more about :ref:`events`.
|
||||||
|
|
||||||
|
Keys
|
||||||
|
****
|
||||||
|
|
||||||
|
- ``LV_KEY_RIGHT/UP/LEFT/RIGHT`` To navigate among the buttons to
|
||||||
|
select one
|
||||||
|
- :cpp:enumerator:`LV_KEY_ENTER` To press/release the selected button
|
||||||
|
|
||||||
|
Note that long pressing the button matrix with an encoder can mean to
|
||||||
|
enter/leave edit mode and simply long pressing a button to make it
|
||||||
|
repeat as well. To avoid this contradiction it's suggested to add
|
||||||
|
:cpp:expr:`lv_buttonmatrix_set_button_ctrl_all(buttonm, LV_BUTTONMATRIX_CTRL_CLICK_TRIG | LV_BUTTONMATRIX_CTRL_NO_REPEAT)`
|
||||||
|
to the button matrix if used with encoder. This way, the pressed button
|
||||||
|
repeat feature is disabled and on leaving edit mode the selected button
|
||||||
|
won't be activated.
|
||||||
|
|
||||||
|
Learn more about :ref:`indev_keys`.
|
||||||
|
|
||||||
|
Example
|
||||||
|
*******
|
||||||
|
|
||||||
|
.. include:: ../examples/widgets/buttonmatrix/index.rst
|
||||||
|
|
||||||
|
API
|
||||||
|
***
|
@ -73,7 +73,7 @@ Events
|
|||||||
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent if a date is clicked.
|
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent if a date is clicked.
|
||||||
:cpp:expr:`lv_calendar_get_pressed_date(calendar, &date)` set ``date`` to the
|
:cpp:expr:`lv_calendar_get_pressed_date(calendar, &date)` set ``date`` to the
|
||||||
date currently being pressed. Returns :cpp:enumerator:`LV_RES_OK` if there is a
|
date currently being pressed. Returns :cpp:enumerator:`LV_RES_OK` if there is a
|
||||||
valid pressed date, else :cpp:enumerator:`LV_RES_INV`.
|
valid pressed date, else :cpp:enumerator:`LV_RES_INVALID`.
|
||||||
|
|
||||||
Learn more about :ref:`events`.
|
Learn more about :ref:`events`.
|
||||||
|
|
||||||
|
@ -6,8 +6,7 @@ Overview
|
|||||||
|
|
||||||
A Canvas inherits from `Image </widgets/img>`__ where the user can draw
|
A Canvas inherits from `Image </widgets/img>`__ where the user can draw
|
||||||
anything. Rectangles, texts, images, lines, arcs can be drawn here using
|
anything. Rectangles, texts, images, lines, arcs can be drawn here using
|
||||||
lvgl's drawing engine. Additionally "effects" can be applied, such as
|
lvgl's drawing engine.
|
||||||
rotation, zoom and blur.
|
|
||||||
|
|
||||||
Parts and Styles
|
Parts and Styles
|
||||||
****************
|
****************
|
||||||
@ -21,95 +20,53 @@ Usage
|
|||||||
Buffer
|
Buffer
|
||||||
------
|
------
|
||||||
|
|
||||||
The Canvas needs a buffer in which stores the drawn image. To assign a
|
The Canvas needs a buffer in which it stores the drawn image. To assign a
|
||||||
buffer to a Canvas, use
|
buffer to a Canvas, use
|
||||||
:cpp:expr:`lv_canvas_set_buffer(canvas, buffer, width, height, LV_IMG_CF_...)`.
|
:cpp:expr:`lv_canvas_set_buffer(canvas, buffer, width, height, LV_COLOR_FORMAT_...)`.
|
||||||
Where ``buffer`` is a static buffer (not just a local variable) to hold
|
Where ``buffer`` is a static buffer (not just a local variable) to hold
|
||||||
the image of the canvas. For example,
|
the image of the canvas. For example for a 100x50 ARGB8888 buffer:
|
||||||
``static uint8_t buffer[LV_CANVAS_BUF_SIZE_TRUE_COLOR(width, height)]``.
|
``static uint8_t buffer[100 * 50 * 4]``.
|
||||||
``LV_CANVAS_BUF_SIZE_...`` macros help to determine the size of the
|
|
||||||
buffer with different color formats.
|
|
||||||
|
|
||||||
The canvas supports all the built-in color formats like
|
Or you can use
|
||||||
:cpp:enumerator:`LV_IMG_CF_TRUE_COLOR` or :cpp:enumerator:`LV_IMG_CF_INDEXED_2BIT`. See the full
|
``static uint8_t buffer[LV_CANVAS_BUF_SIZE(width, height, bit_per_pixel, stride_in_bytes)]``.
|
||||||
|
|
||||||
|
The canvas supports all the color formats like
|
||||||
|
:cpp:enumerator:`LV_COLOR_FORMAT_ARGB8888` or :cpp:enumerator:`LV_COLOR_FORMAT_I2`. See the full
|
||||||
list in the `Color formats </overview/image.html#color-formats>`__
|
list in the `Color formats </overview/image.html#color-formats>`__
|
||||||
section.
|
section.
|
||||||
|
|
||||||
Indexed colors
|
Indexed colors
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
For ``LV_IMG_CF_INDEXED_1/2/4/8`` color formats a palette needs to be
|
For ``LV_COLOR_FORMAT_I1/2/4/8`` color formats a palette needs to be
|
||||||
initialized with :cpp:expr:`lv_canvas_set_palette(canvas, 3, LV_COLOR_RED)`. It
|
initialized with :cpp:expr:`lv_canvas_set_palette(canvas, 3, lv_color_hex(0xff0000))`. It
|
||||||
sets pixels with *index=3* to red.
|
sets pixels with *index=3* to red.
|
||||||
|
|
||||||
Drawing
|
Drawing
|
||||||
-------
|
-------
|
||||||
|
|
||||||
To set a pixel's color on the canvas, use
|
To set a pixel's color on the canvas, use
|
||||||
:cpp:expr:`lv_canvas_set_px_color(canvas, x, y, LV_COLOR_RED)`. With
|
:cpp:expr:`lv_canvas_set_px_color(canvas, x, y, color, opa)`. With
|
||||||
``LV_IMG_CF_INDEXED_...`` the index of the color needs to be passed as
|
``LV_COLOR_FORMAT_I1/2/4/8`` the index of the color needs to be passed as
|
||||||
color. E.g. ``lv_color_t c; c.full = 3;``
|
color like this ``lv_color_from_int(13);``. It passes index 13 as a color.
|
||||||
|
|
||||||
To set a pixel's opacity with :cpp:enumerator:`LV_IMG_CF_TRUE_COLOR_ALPHA` or
|
|
||||||
``LV_IMG_CF_ALPHA_...`` format on the canvas, use
|
|
||||||
:cpp:expr:`lv_canvas_set_px_opa(canvas, x, y, opa)`.
|
|
||||||
|
|
||||||
:cpp:expr:`lv_canvas_fill_bg(canvas, LV_COLOR_BLUE, LV_OPA_50)` fills the whole
|
:cpp:expr:`lv_canvas_fill_bg(canvas, lv_color_hex(0x00ff00), LV_OPA_50)` fills the whole
|
||||||
canvas to blue with 50% opacity. Note that if the current color format
|
canvas to blue with 50% opacity. Note that if the current color format
|
||||||
doesn't support colors (e.g. :cpp:enumerator:`LV_IMG_CF_ALPHA_2BIT`) the color will be
|
doesn't support colors (e.g. :cpp:enumerator:`LV_COLOR_FORMAT_A8`) the color will be
|
||||||
ignored. Similarly, if opacity is not supported
|
ignored. Similarly, if opacity is not supported
|
||||||
(e.g. :cpp:enumerator:`LV_IMG_CF_TRUE_COLOR`) it will be ignored.
|
(e.g. :cpp:enumerator:`LV_COLOR_FORMAT_RGB565`) it will be ignored.
|
||||||
|
|
||||||
An array of pixels can be copied to the canvas with
|
An array of pixels can be copied to the canvas with
|
||||||
:cpp:expr:`lv_canvas_copy_buf(canvas, buffer_to_copy, x, y, width, height)`. The
|
:cpp:expr:`lv_canvas_copy_buf(canvas, buffer_to_copy, x, y, width, height)`. The
|
||||||
color format of the buffer and the canvas need to match.
|
color format of the buffer and the canvas need to match.
|
||||||
|
|
||||||
To draw something to the canvas use:
|
To draw something to the canvas use LVGL's draw functions directly. See the examples for more details.
|
||||||
|
|
||||||
- :cpp:expr:`lv_canvas_draw_rect(canvas, x, y, width, height, &draw_dsc)`
|
The draw function can draw to any color format to which LVGL can render. Typically it means
|
||||||
- :cpp:expr:`lv_canvas_draw_text(canvas, x, y, max_width, &draw_dsc, txt)`
|
:cpp:enumerator:`LV_COLOR_FORMAT_RGB565`, :cpp:enumerator:`LV_COLOR_FORMAT_RGB888`,
|
||||||
- :cpp:expr:`lv_canvas_draw_img(canvas, x, y, &img_src, &draw_dsc)`
|
:cpp:enumerator:`LV_COLOR_FORMAT_XRGB888`, and :cpp:enumerator:`LV_COLOR_FORMAT_ARGB8888`.
|
||||||
- :cpp:expr:`lv_canvas_draw_line(canvas, point_array, point_cnt, &draw_dsc)`
|
|
||||||
- :cpp:expr:`lv_canvas_draw_polygon(canvas, points_array, point_cnt, &draw_dsc)`
|
|
||||||
- :cpp:expr:`lv_canvas_draw_arc(canvas, x, y, radius, start_angle, end_angle, &draw_dsc)`
|
|
||||||
|
|
||||||
``draw_dsc`` is a ``lv_draw_rect/label/img/line/arc_dsc_t`` variable
|
|
||||||
which should be first initialized with one of
|
|
||||||
``lv_draw_rect/label/img/line/arc_dsc_init()`` and then modified with
|
|
||||||
the desired colors and other values.
|
|
||||||
|
|
||||||
The draw function can draw to any color format. For example, it's
|
|
||||||
possible to draw a text to an :cpp:enumerator:`LV_IMG_VF_ALPHA_8BIT` canvas and use
|
|
||||||
the result image as a `draw mask </overview/drawing>`__ later.
|
|
||||||
|
|
||||||
Transformations
|
|
||||||
---------------
|
|
||||||
|
|
||||||
:cpp:func:`lv_canvas_transform` can be used to rotate and/or scale the image
|
|
||||||
of an image and store the result on the canvas. The function needs the
|
|
||||||
following parameters:
|
|
||||||
|
|
||||||
- ``canvas`` pointer to a canvas object to store the result of the transformation.
|
|
||||||
- ``img pointer`` to an image descriptor to transform. Can be the image descriptor of another canvas too (:cpp:func:`lv_canvas_get_img`).
|
|
||||||
- ``angle`` the angle of rotation (0..3600), 0.1 deg resolution
|
|
||||||
- ``zoom`` zoom factor (256: no zoom, 512: double size, 128: half size);
|
|
||||||
- ``offset_x`` offset X to tell where to put the result data on destination canvas
|
|
||||||
- ``offset_y`` offset X to tell where to put the result data on destination canvas
|
|
||||||
- ``pivot_x`` pivot X of rotation. Relative to the source canvas. Set to ``source width / 2`` to rotate around the center
|
|
||||||
- ``pivot_y`` pivot Y of rotation. Relative to the source canvas. Set to ``source height / 2`` to rotate around the center
|
|
||||||
- ``antialias`` true: apply anti-aliasing during the transformation. Looks better but slower.
|
|
||||||
|
|
||||||
Note that a canvas can't be rotated on itself. You need a source and
|
|
||||||
destination canvas or image.
|
|
||||||
|
|
||||||
Blur
|
|
||||||
----
|
|
||||||
|
|
||||||
A given area of the canvas can be blurred horizontally with
|
|
||||||
:cpp:expr:`lv_canvas_blur_hor(canvas, &area, r)` or vertically with
|
|
||||||
:cpp:expr:`lv_canvas_blur_ver(canvas, &area, r)`. ``r`` is the radius of the
|
|
||||||
blur (greater value means more intensive burring). ``area`` is the area
|
|
||||||
where the blur should be applied (interpreted relative to the canvas).
|
|
||||||
|
|
||||||
Events
|
Events
|
||||||
******
|
******
|
||||||
|
@ -166,24 +166,14 @@ Note that :cpp:enumerator:`LV_CHART_UPDATE_MODE_SHIFT` also changes the
|
|||||||
Tick marks and labels
|
Tick marks and labels
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
Ticks and labels can be added to the axis with
|
With the help of </widgets/scale>`__ vertical and horizontal scales can be added in a very flexible way.
|
||||||
:cpp:expr:`lv_chart_set_axis_tick(chart, axis, major_len, minor_len, major_cnt, minor_cnt, label_en, draw_size)`.
|
See the example below to learn more.
|
||||||
|
|
||||||
- ``axis`` can be ``LV_CHART_AXIS_X/PRIMARY_Y/SECONDARY_Y``
|
|
||||||
- ``major_len`` is the length of major ticks - ``minor_len`` is the length of minor ticks
|
|
||||||
- ``major_cnt`` is the number of major ticks on the axis
|
|
||||||
- ``minor_cnt`` in the number of minor ticks between two major ticks
|
|
||||||
- ``label_en`` ``true``: enable label drawing on major ticks
|
|
||||||
- ``draw_size`` extra size required to draw the tick and labels (start with 20 px and increase if the ticks/labels are clipped)
|
|
||||||
|
|
||||||
Zoom
|
Zoom
|
||||||
----
|
----
|
||||||
|
|
||||||
The chart can be zoomed independently in x and y directions with
|
To zoom the chart all you need to is wrapping it into a parent container and set the chart's width or height
|
||||||
:cpp:expr:`lv_chart_set_scale_x(chart, factor)` and
|
to larger value. This way the chart will be scrollable on its parent.
|
||||||
:cpp:expr:`lv_chart_set_scale_y(chart, factor)`. If ``factor`` is 256 there is no
|
|
||||||
zoom. 512 means double zoom, etc. Fractional values are also possible
|
|
||||||
but < 256 value is not allowed.
|
|
||||||
|
|
||||||
Cursor
|
Cursor
|
||||||
------
|
------
|
||||||
@ -211,63 +201,6 @@ Events
|
|||||||
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent when a new point is clicked pressed.
|
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent when a new point is clicked pressed.
|
||||||
:cpp:expr:`lv_chart_get_pressed_point(chart)` returns the zero-based index of
|
:cpp:expr:`lv_chart_get_pressed_point(chart)` returns the zero-based index of
|
||||||
the pressed point.
|
the pressed point.
|
||||||
- :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN` and :cpp:enumerator:`LV_EVENT_DRAW_PART_END` are sent
|
|
||||||
with the following types:
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_CHART_DRAW_PART_DIV_LINE_INIT` Used before/after drawn the
|
|
||||||
div lines to add masks to any extra drawings. The following fields
|
|
||||||
are set:
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_MAIN`
|
|
||||||
- ``line_dsc``
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_CHART_DRAW_PART_DIV_LINE_HOR`,
|
|
||||||
:cpp:enumerator:`LV_CHART_DRAW_PART_DIV_LINE_VER` Used for each horizontal and
|
|
||||||
vertical division lines.
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_MAIN`
|
|
||||||
- ``id``: index of the line
|
|
||||||
- ``p1``, ``p2``: points of the line
|
|
||||||
- ``line_dsc``
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_CHART_DRAW_PART_LINE_AND_POINT` Used on line and scatter
|
|
||||||
charts for lines and points.
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_ITEMS`
|
|
||||||
- ``id``: index of the point
|
|
||||||
- ``value``: value of ``id``\ th point
|
|
||||||
- ``p1``, ``p2``: points of the line
|
|
||||||
- ``draw_area``: area of the point
|
|
||||||
- ``line_dsc``
|
|
||||||
- ``rect_dsc``
|
|
||||||
- ``sub_part_ptr``: pointer to the series
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_CHART_DRAW_PART_BAR` Used on bar charts for the rectangles.
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_ITEMS`
|
|
||||||
- ``id``: index of the point
|
|
||||||
- ``value``: value of ``id``\ th point
|
|
||||||
- ``draw_area``: area of the point
|
|
||||||
- ``rect_dsc``:
|
|
||||||
- ``sub_part_ptr``: pointer to the series
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_CHART_DRAW_PART_CURSOR` Used on cursor lines and points.
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_CURSOR`
|
|
||||||
- ``p1``, ``p2``: points of the line
|
|
||||||
- ``line_dsc``
|
|
||||||
- ``rect_dsc``
|
|
||||||
- ``draw_area``: area of the points
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_CHART_DRAW_PART_TICK_LABEL` Used on tick lines and labels.
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_ITEMS`
|
|
||||||
- ``id``: axis
|
|
||||||
- ``value``: value of the tick
|
|
||||||
- ``text``: ``value`` converted to decimal or ``NULL`` for minor
|
|
||||||
ticks
|
|
||||||
- ``line_dsc``,
|
|
||||||
- ``label_dsc``,
|
|
||||||
|
|
||||||
See the events of the `Base object </widgets/obj>`__ too.
|
See the events of the `Base object </widgets/obj>`__ too.
|
||||||
|
|
||||||
|
@ -53,14 +53,6 @@ Events
|
|||||||
******
|
******
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent when the checkbox is toggled.
|
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent when the checkbox is toggled.
|
||||||
- :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN` and :cpp:enumerator:`LV_EVENT_DRAW_PART_END` are sent
|
|
||||||
for the following types:
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_CHECKBOX_DRAW_PART_BOX` The tickbox of the checkbox
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_INDICATOR`
|
|
||||||
- ``draw_area``: the area of the tickbox
|
|
||||||
- ``rect_dsc``
|
|
||||||
|
|
||||||
See the events of the `Base object </widgets/obj>`__ too.
|
See the events of the `Base object </widgets/obj>`__ too.
|
||||||
|
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
Color wheel (lv_colorwheel)
|
|
||||||
===========================
|
|
||||||
|
|
||||||
Overview
|
|
||||||
********
|
|
||||||
|
|
||||||
As its name implies *Color wheel* allows the user to select a color. The
|
|
||||||
Hue, Saturation and Value of the color can be selected separately.
|
|
||||||
|
|
||||||
Long pressing the object, the color wheel will change to the next
|
|
||||||
parameter of the color (hue, saturation or value). A double click will
|
|
||||||
reset the current parameter.
|
|
||||||
|
|
||||||
Parts and Styles
|
|
||||||
****************
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_PART_MAIN` Only ``arc_width`` is used to set the width of the
|
|
||||||
color wheel
|
|
||||||
- :cpp:enumerator:`LV_PART_KNOB` A rectangle (or circle) drawn on the current value.
|
|
||||||
It uses all the rectangle like style properties and padding to make
|
|
||||||
it larger than the width of the arc.
|
|
||||||
|
|
||||||
Usage
|
|
||||||
*****
|
|
||||||
|
|
||||||
Create a color wheel
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
:cpp:expr:`lv_colorwheel_create(parent, knob_recolor)` creates a new color
|
|
||||||
wheel. With ``knob_recolor=true`` the knob's background color will be
|
|
||||||
set to the current color.
|
|
||||||
|
|
||||||
Set color
|
|
||||||
---------
|
|
||||||
|
|
||||||
The color can be set manually with
|
|
||||||
``lv_colorwheel_set_hue/saturation/value(colorwheel, x)`` or all at once
|
|
||||||
with :cpp:expr:`lv_colorwheel_set_hsv(colorwheel, hsv)` or
|
|
||||||
:cpp:expr:`lv_colorwheel_set_color(colorwheel, rgb)`
|
|
||||||
|
|
||||||
Color mode
|
|
||||||
----------
|
|
||||||
|
|
||||||
The current color mode can be manually selected with
|
|
||||||
:cpp:expr:`lv_colorwheel_set_mode(colorwheel, LV_COLORWHEEL_MODE_HUE)`.
|
|
||||||
|
|
||||||
The color mode can be fixed (so as to not change with long press) using
|
|
||||||
:cpp:expr:`lv_colorwheel_set_mode_fixed(colorwheel, true)`
|
|
||||||
|
|
||||||
Events
|
|
||||||
******
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent if a new color is selected.
|
|
||||||
|
|
||||||
Learn more about :ref:`events`.
|
|
||||||
|
|
||||||
Keys
|
|
||||||
****
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_KEY_UP`, :cpp:enumerator:`LV_KEY_RIGHT` Increment the current parameter's
|
|
||||||
value by 1
|
|
||||||
- :cpp:enumerator:`LV_KEY_DOWN`, :cpp:enumerator:`LV_KEY_LEFT` Decrement the current parameter's
|
|
||||||
value by 1
|
|
||||||
- :cpp:enumerator:`LV_KEY_ENTER` A long press will show the next mode. Double click
|
|
||||||
to reset the current parameter.
|
|
||||||
|
|
||||||
Learn more about :ref:`indev_keys`.
|
|
||||||
|
|
||||||
Example
|
|
||||||
*******
|
|
||||||
|
|
||||||
.. include:: ../examples/widgets/colorwheel/index.rst
|
|
||||||
|
|
||||||
API
|
|
||||||
***
|
|
@ -11,15 +11,15 @@ Widgets
|
|||||||
arc
|
arc
|
||||||
animimg
|
animimg
|
||||||
bar
|
bar
|
||||||
btn
|
button
|
||||||
btnmatrix
|
buttonmatrix
|
||||||
calendar
|
calendar
|
||||||
chart
|
chart
|
||||||
colorwheel
|
colorwheel
|
||||||
canvas
|
canvas
|
||||||
checkbox
|
checkbox
|
||||||
dropdown
|
dropdown
|
||||||
img
|
image
|
||||||
imgbtn
|
imgbtn
|
||||||
keyboard
|
keyboard
|
||||||
label
|
label
|
||||||
|
@ -4,7 +4,7 @@ Keyboard (lv_keyboard)
|
|||||||
Overview
|
Overview
|
||||||
********
|
********
|
||||||
|
|
||||||
The Keyboard object is a special `Button matrix </widgets/btnmatrix>`__
|
The Keyboard object is a special `Button matrix </widgets/buttonmatrix>`__
|
||||||
with predefined keymaps and other features to realize a virtual keyboard
|
with predefined keymaps and other features to realize a virtual keyboard
|
||||||
to write texts into a `Text area </widgets/textarea>`__.
|
to write texts into a `Text area </widgets/textarea>`__.
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ To enable key popovers on press, like on common Android and iOS
|
|||||||
keyboards, use :cpp:expr:`lv_keyboard_set_popovers(kb, true)`. The default
|
keyboards, use :cpp:expr:`lv_keyboard_set_popovers(kb, true)`. The default
|
||||||
control maps are preconfigured to only show the popovers on keys that
|
control maps are preconfigured to only show the popovers on keys that
|
||||||
produce a symbol and not on e.g. space. If you use a custom keymap, set
|
produce a symbol and not on e.g. space. If you use a custom keymap, set
|
||||||
the :cpp:enumerator:`LV_BTNMATRIX_CTRL_POPOVER` flag for all keys that you want to
|
the :cpp:enumerator:`LV_BUTTONMATRIX_CTRL_POPOVER` flag for all keys that you want to
|
||||||
show a popover.
|
show a popover.
|
||||||
|
|
||||||
Note that popovers for keys in the top row will draw outside the widget
|
Note that popovers for keys in the top row will draw outside the widget
|
||||||
@ -65,7 +65,7 @@ New Keymap
|
|||||||
|
|
||||||
You can specify a new map (layout) for the keyboard with
|
You can specify a new map (layout) for the keyboard with
|
||||||
:cpp:expr:`lv_keyboard_set_map(kb, LV_KEYBOARD_MODE_..., kb_map, kb_ctrl)`. See
|
:cpp:expr:`lv_keyboard_set_map(kb, LV_KEYBOARD_MODE_..., kb_map, kb_ctrl)`. See
|
||||||
the `Button matrix </widgets/btnmatrix>`__ for more information about
|
the `Button matrix </widgets/buttonmatrix>`__ for more information about
|
||||||
creating new maps and ctrls.
|
creating new maps and ctrls.
|
||||||
|
|
||||||
Keep in mind that using following keywords will have the same effect as
|
Keep in mind that using following keywords will have the same effect as
|
||||||
|
@ -101,7 +101,7 @@ the Label widget only allows manual text selection with
|
|||||||
Text alignment
|
Text alignment
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
To horizontally align the lines of a label the `text_align` style property can be used with
|
To horizontally align the lines of a label the `text_align` style property can be used with
|
||||||
:cpp:expr:`lv_obj_set_style_text_align()` or :cpp:expr:`lv_style_set_text_align()`
|
:cpp:expr:`lv_obj_set_style_text_align()` or :cpp:expr:`lv_style_set_text_align()`
|
||||||
Note that it has a visible effect only if
|
Note that it has a visible effect only if
|
||||||
|
|
||||||
@ -121,11 +121,8 @@ Custom scrolling animations
|
|||||||
Some aspects of the scrolling animations in long modes
|
Some aspects of the scrolling animations in long modes
|
||||||
:cpp:enumerator:`LV_LABEL_LONG_SCROLL` and :cpp:enumerator:`LV_LABEL_LONG_SCROLL_CIRCULAR` can be
|
:cpp:enumerator:`LV_LABEL_LONG_SCROLL` and :cpp:enumerator:`LV_LABEL_LONG_SCROLL_CIRCULAR` can be
|
||||||
customized by setting the animation property of a style, using
|
customized by setting the animation property of a style, using
|
||||||
:cpp:func:`lv_style_set_anim`. Currently, only the start and repeat delay of
|
:cpp:func:`lv_style_set_anim`.
|
||||||
the circular scrolling animation can be customized. If you need to
|
It will be treated as a template which will be used to create the scroll animatins.
|
||||||
customize another aspect of the scrolling animation, feel free to open
|
|
||||||
an `issue on Github <https://github.com/lvgl/lvgl/issues>`__ to request
|
|
||||||
the feature.
|
|
||||||
|
|
||||||
Symbols
|
Symbols
|
||||||
-------
|
-------
|
||||||
|
@ -39,16 +39,6 @@ the ON and OFF state.
|
|||||||
Events
|
Events
|
||||||
******
|
******
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN` and :cpp:enumerator:`LV_EVENT_DRAW_PART_END` is sent
|
|
||||||
for the following types:
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_LED_DRAW_PART_RECTANGLE` The main rectangle.
|
|
||||||
:cpp:enumerator:`LV_OBJ_DRAW_PART_RECTANGLE` is not sent by the base object.
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_MAIN`
|
|
||||||
- ``rect_dsc``
|
|
||||||
- ``draw_area``: the area of the rectangle
|
|
||||||
|
|
||||||
See the events of the `Base object </widgets/obj>`__ too.
|
See the events of the `Base object </widgets/obj>`__ too.
|
||||||
|
|
||||||
Learn more about :ref:`events`.
|
Learn more about :ref:`events`.
|
||||||
|
@ -19,7 +19,7 @@ Usage
|
|||||||
Set points
|
Set points
|
||||||
----------
|
----------
|
||||||
|
|
||||||
The points have to be stored in an :cpp:struct:`lv_point_t` array and passed to
|
The points have to be stored in an :cpp:struct:`lv_point_precise_t` array and passed to
|
||||||
the object by the :cpp:expr:`lv_line_set_points(lines, point_array, point_cnt)`
|
the object by the :cpp:expr:`lv_line_set_points(lines, point_array, point_cnt)`
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ Parts and Styles
|
|||||||
- :cpp:enumerator:`LV_PART_MAIN` The main part of the list that uses all the typical background properties
|
- :cpp:enumerator:`LV_PART_MAIN` The main part of the list that uses all the typical background properties
|
||||||
- :cpp:enumerator:`LV_PART_SCROLLBAR` The scrollbar. See the `Base objects </widgets/obj>`__ documentation for details.
|
- :cpp:enumerator:`LV_PART_SCROLLBAR` The scrollbar. See the `Base objects </widgets/obj>`__ documentation for details.
|
||||||
|
|
||||||
**Buttons and Texts** See the `Button </widgets/btn>`__\ 's and `Label </widgets/label>`__\ 's documentation.
|
**Buttons and Texts** See the `Button </widgets/button>`__\ 's and `Label </widgets/label>`__\ 's documentation.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
*****
|
*****
|
||||||
@ -23,7 +23,7 @@ Usage
|
|||||||
Buttons
|
Buttons
|
||||||
-------
|
-------
|
||||||
|
|
||||||
:cpp:expr:`lv_list_add_btn(list, icon, text)` adds a full-width button with an icon
|
:cpp:expr:`lv_list_add_button(list, icon, text)` adds a full-width button with an icon
|
||||||
|
|
||||||
- that can be an image or symbol
|
- that can be an image or symbol
|
||||||
- and a text.
|
- and a text.
|
||||||
|
@ -11,11 +11,11 @@ Parts and Styles
|
|||||||
****************
|
****************
|
||||||
|
|
||||||
The menu widget is built from the following objects: - Main container:
|
The menu widget is built from the following objects: - Main container:
|
||||||
lv_menu_main_cont - Main header: lv_menu_main_header_cont - Back btn:
|
lv_menu_main_cont - Main header: lv_menu_main_header_cont - Back button:
|
||||||
`lv_btn </widgets/btn>`__ - Back btn icon: `lv_img </widgets/img>`__ -
|
`lv_button </widgets/button>`__ - Back button icon: `lv_img </widgets/img>`__ -
|
||||||
Main page: lv_menu_page - Sidebar container: lv_menu_sidebar_cont -
|
Main page: lv_menu_page - Sidebar container: lv_menu_sidebar_cont -
|
||||||
Sidebar header: lv_menu_sidebar_header_cont - Back btn:
|
Sidebar header: lv_menu_sidebar_header_cont - Back button:
|
||||||
`lv_btn </widgets/btn>`__ - Back btn icon: `lv_img </widgets/img>`__ -
|
`lv_button </widgets/button>`__ - Back button icon: `lv_img </widgets/img>`__ -
|
||||||
Sidebar page: lv_menu_page
|
Sidebar page: lv_menu_page
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@ -46,7 +46,7 @@ The following root back button modes exist:
|
|||||||
- :cpp:enumerator:`LV_MENU_ROOT_BACK_BTN_ENABLED`
|
- :cpp:enumerator:`LV_MENU_ROOT_BACK_BTN_ENABLED`
|
||||||
|
|
||||||
You can set root back button modes with
|
You can set root back button modes with
|
||||||
:cpp:expr:`lv_menu_set_mode_root_back_btn(menu, LV_MENU_ROOT_BACK_BTN...)`.
|
:cpp:expr:`lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BTN...)`.
|
||||||
|
|
||||||
Create a menu page
|
Create a menu page
|
||||||
------------------
|
------------------
|
||||||
@ -70,8 +70,8 @@ Once a menu page has been created, you can set it to the sidebar with
|
|||||||
Linking between menu pages
|
Linking between menu pages
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
For instance, you have created a btn obj in the main page. When you
|
For instance, you have created a button obj in the main page. When you
|
||||||
click the btn obj, you want it to open up a new page, use
|
click the button obj, you want it to open up a new page, use
|
||||||
:cpp:expr:`lv_menu_set_load_page_event(menu, obj, new page)`.
|
:cpp:expr:`lv_menu_set_load_page_event(menu, obj, new page)`.
|
||||||
|
|
||||||
Create a menu container, section, separator
|
Create a menu container, section, separator
|
||||||
@ -94,12 +94,12 @@ Events
|
|||||||
- :cpp:expr:`lv_menu_get_cur_sidebar_page(menu)` returns a pointer to menu
|
- :cpp:expr:`lv_menu_get_cur_sidebar_page(menu)` returns a pointer to menu
|
||||||
page that is currently displayed in sidebar.
|
page that is currently displayed in sidebar.
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_EVENT_CLICKED` Sent when a back btn in a header from either
|
- :cpp:enumerator:`LV_EVENT_CLICKED` Sent when a back button in a header from either
|
||||||
main or sidebar is clicked. :cpp:enumerator:`LV_OBJ_FLAG_EVENT_BUBBLE` is enabled
|
main or sidebar is clicked. :cpp:enumerator:`LV_OBJ_FLAG_EVENT_BUBBLE` is enabled
|
||||||
on the buttons so you can add events to the menu itself.
|
on the buttons so you can add events to the menu itself.
|
||||||
|
|
||||||
- :cpp:expr:`lv_menu_back_btn_is_root(menu, btn)` to check if btn is root
|
- :cpp:expr:`lv_menu_back_button_is_root(menu, button)` to check if button is root
|
||||||
back btn
|
back button
|
||||||
|
|
||||||
See the events of the `Base object </widgets/obj>`__ too.
|
See the events of the `Base object </widgets/obj>`__ too.
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ Flags
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
There are some attributes which can be enabled/disabled by
|
There are some attributes which can be enabled/disabled by
|
||||||
``lv_obj_add/remove_flag(obj, LV_OBJ_FLAG_...)``:
|
``lv_obj_add/remove_flag(obj, LV_OBJ_FLAG_...)`` and ``lv_obj_set_flag(obj, LV_OBJ_FLAG_..., true/false)``
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_OBJ_FLAG_HIDDEN` Make the object hidden. (Like it wasn't there at all)
|
- :cpp:enumerator:`LV_OBJ_FLAG_HIDDEN` Make the object hidden. (Like it wasn't there at all)
|
||||||
- :cpp:enumerator:`LV_OBJ_FLAG_CLICKABLE` Make the object clickable by input devices
|
- :cpp:enumerator:`LV_OBJ_FLAG_CLICKABLE` Make the object clickable by input devices
|
||||||
@ -176,7 +176,9 @@ There are some attributes which can be enabled/disabled by
|
|||||||
- :cpp:enumerator:`LV_OBJ_FLAG_ADV_HITTEST` Allow performing more accurate hit (click) test. E.g. accounting for rounded corners
|
- :cpp:enumerator:`LV_OBJ_FLAG_ADV_HITTEST` Allow performing more accurate hit (click) test. E.g. accounting for rounded corners
|
||||||
- :cpp:enumerator:`LV_OBJ_FLAG_IGNORE_LAYOUT` Make the object positionable by the layouts
|
- :cpp:enumerator:`LV_OBJ_FLAG_IGNORE_LAYOUT` Make the object positionable by the layouts
|
||||||
- :cpp:enumerator:`LV_OBJ_FLAG_FLOATING` Do not scroll the object when the parent scrolls and ignore layout
|
- :cpp:enumerator:`LV_OBJ_FLAG_FLOATING` Do not scroll the object when the parent scrolls and ignore layout
|
||||||
|
- :cpp:enumerator:`LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS` Enable sending ``LV_EVENT_DRAW_TASK_ADDED`` events
|
||||||
- :cpp:enumerator:`LV_OBJ_FLAG_OVERFLOW_VISIBLE` Do not clip the children's content to the parent's boundary
|
- :cpp:enumerator:`LV_OBJ_FLAG_OVERFLOW_VISIBLE` Do not clip the children's content to the parent's boundary
|
||||||
|
- :cpp:enumerator:`LV_OBJ_FLAG_FLEX_IN_NEW_TRACK` Start a new flex track on this item
|
||||||
- :cpp:enumerator:`LV_OBJ_FLAG_LAYOUT_1` Custom flag, free to use by layouts
|
- :cpp:enumerator:`LV_OBJ_FLAG_LAYOUT_1` Custom flag, free to use by layouts
|
||||||
- :cpp:enumerator:`LV_OBJ_FLAG_LAYOUT_2` Custom flag, free to use by layouts
|
- :cpp:enumerator:`LV_OBJ_FLAG_LAYOUT_2` Custom flag, free to use by layouts
|
||||||
- :cpp:enumerator:`LV_OBJ_FLAG_WIDGET_1` Custom flag, free to use by widget
|
- :cpp:enumerator:`LV_OBJ_FLAG_WIDGET_1` Custom flag, free to use by widget
|
||||||
@ -224,27 +226,6 @@ Events
|
|||||||
|
|
||||||
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` when the :cpp:enumerator:`LV_OBJ_FLAG_CHECKABLE` flag is
|
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` when the :cpp:enumerator:`LV_OBJ_FLAG_CHECKABLE` flag is
|
||||||
enabled and the object clicked (on transition to/from the checked state)
|
enabled and the object clicked (on transition to/from the checked state)
|
||||||
- :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN` and :cpp:enumerator:`LV_EVENT_DRAW_PART_END` is sent
|
|
||||||
for the following types:
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_OBJ_DRAW_PART_RECTANGLE` The main rectangle
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_MAIN`
|
|
||||||
- ``rect_dsc``
|
|
||||||
- ``draw_area``: the area of the rectangle
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_OBJ_DRAW_PART_BORDER_POST` The border if the ``border_post``
|
|
||||||
style property is ``true``
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_MAIN`
|
|
||||||
- ``rect_dsc``
|
|
||||||
- ``draw_area``: the area of the rectangle
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_OBJ_DRAW_PART_SCROLLBAR` the scrollbars
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_SCROLLBAR`
|
|
||||||
- ``rect_dsc``
|
|
||||||
- ``draw_area``: the area of the rectangle
|
|
||||||
|
|
||||||
Learn more about :ref:`events`.
|
Learn more about :ref:`events`.
|
||||||
|
|
||||||
|
@ -72,22 +72,6 @@ Events
|
|||||||
changed with keys. The event is sent continuously while the slider is
|
changed with keys. The event is sent continuously while the slider is
|
||||||
being dragged.
|
being dragged.
|
||||||
- :cpp:enumerator:`LV_EVENT_RELEASED` Sent when the slider has just been released.
|
- :cpp:enumerator:`LV_EVENT_RELEASED` Sent when the slider has just been released.
|
||||||
- :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN` and :cpp:enumerator:`LV_EVENT_DRAW_PART_END` are sent
|
|
||||||
for the following parts.
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_SLIDER_DRAW_PART_KNOB` The main (right) knob of the slider
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_KNOB`
|
|
||||||
- ``draw_area``: area of the indicator
|
|
||||||
- ``rect_dsc``
|
|
||||||
- ``id``: 0
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_SLIDER_DRAW_PART_KNOB` The left knob of the slider
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_KNOB`
|
|
||||||
- ``draw_area``: area of the indicator
|
|
||||||
- ``rect_dsc``
|
|
||||||
- ``id``: 1
|
|
||||||
|
|
||||||
See the events of the `Bar </widgets/bar>`__ too.
|
See the events of the `Bar </widgets/bar>`__ too.
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ The spangroup can be set to one the following modes:
|
|||||||
|
|
||||||
Use :cpp:expr:`lv_spangroup_set_overflow(spangroup, LV_SPAN_OVERFLOW_CLIP)` to set object overflow mode.
|
Use :cpp:expr:`lv_spangroup_set_overflow(spangroup, LV_SPAN_OVERFLOW_CLIP)` to set object overflow mode.
|
||||||
|
|
||||||
first line indent
|
First line indent
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Use :cpp:expr:`lv_spangroup_set_indent(spangroup, 20)` to set the indent of the
|
Use :cpp:expr:`lv_spangroup_set_indent(spangroup, 20)` to set the indent of the
|
||||||
@ -96,7 +96,7 @@ first line. all modes support pixel units, in addition to :cpp:enumerator:`LV_SP
|
|||||||
and :cpp:enumerator:`LV_SPAN_MODE_BREAK` mode supports percentage units
|
and :cpp:enumerator:`LV_SPAN_MODE_BREAK` mode supports percentage units
|
||||||
too.
|
too.
|
||||||
|
|
||||||
lines
|
Lines
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Use :cpp:expr:`lv_spangroup_set_max_lines(spangroup, 10)` to set the maximum number
|
Use :cpp:expr:`lv_spangroup_set_max_lines(spangroup, 10)` to set the maximum number
|
||||||
|
@ -18,8 +18,10 @@ Create a spinner
|
|||||||
----------------
|
----------------
|
||||||
|
|
||||||
To create a spinner use
|
To create a spinner use
|
||||||
:cpp:expr:`lv_spinner_create(parent, spin_time, arc_length)`. ``spin time`` sets
|
:cpp:expr:`lv_spinner_create(parent)`.
|
||||||
the spin time in milliseconds, ``arc_length`` sets the length of the spinning arc in degrees.
|
|
||||||
|
Using :cpp:expr:`lv_spinner_set_anim_params(spinner, spin_duration, angle)` the duration
|
||||||
|
of one revulation and the length of he arc can be customized.
|
||||||
|
|
||||||
Events
|
Events
|
||||||
******
|
******
|
||||||
|
@ -79,16 +79,6 @@ Events
|
|||||||
|
|
||||||
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent when a new cell is selected with
|
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent when a new cell is selected with
|
||||||
keys.
|
keys.
|
||||||
- :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN` and :cpp:enumerator:`LV_EVENT_DRAW_PART_END` are sent
|
|
||||||
for the following types:
|
|
||||||
|
|
||||||
- :cpp:enumerator:`LV_TABLE_DRAW_PART_CELL` The individual cells of the table
|
|
||||||
|
|
||||||
- ``part``: :cpp:enumerator:`LV_PART_ITEMS`
|
|
||||||
- ``draw_area``: area of the indicator
|
|
||||||
- ``rect_dsc``
|
|
||||||
- ``label_dsc``
|
|
||||||
- ``id``: current row × col count + current column
|
|
||||||
|
|
||||||
See the events of the `Base object </widgets/obj>`__ too.
|
See the events of the `Base object </widgets/obj>`__ too.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ The Tab view object can be used to organize content in tabs. The Tab
|
|||||||
view is built from other widgets:
|
view is built from other widgets:
|
||||||
|
|
||||||
- Main container: `lv_obj </widgets/obj>`__
|
- Main container: `lv_obj </widgets/obj>`__
|
||||||
- Tab buttons: `lv_btnmatrix </widgets/btnmatrix>`__
|
- Tab buttons: an `lv_obj </widgets/obj>`__` with `lv_button </widgets/button>`__ s
|
||||||
- Container for the tabs: `lv_obj </widgets/obj>`__
|
- Container for the tabs: `lv_obj </widgets/obj>`__
|
||||||
- Content of the tabs: `lv_obj </widgets/obj>`__
|
- Content of the tabs: `lv_obj </widgets/obj>`__
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ Parts and Styles
|
|||||||
****************
|
****************
|
||||||
|
|
||||||
There are no special parts on the Tab view but the ``lv_obj`` and
|
There are no special parts on the Tab view but the ``lv_obj`` and
|
||||||
``lv_btnmatrix`` widgets are used to create the Tab view.
|
``lv_button`` widgets are used to create the Tab view.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
*****
|
*****
|
||||||
@ -30,12 +30,8 @@ Usage
|
|||||||
Create a Tab view
|
Create a Tab view
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
:cpp:expr:`lv_tabview_create(parent, tab_pos, tab_size)` creates a new empty
|
:cpp:expr:`lv_tabview_create(parent)` creates a new empty
|
||||||
Tab view. ``tab_pos`` can be ``LV_DIR_TOP/BOTTOM/LEFT/RIGHT`` to
|
Tab view.
|
||||||
position the tab buttons to a side. ``tab_size`` is the height (in case
|
|
||||||
of ``LV_DIR_TOP/BOTTOM``) or width (in case of ``LV_DIR_LEFT/RIGHT``)
|
|
||||||
tab buttons.
|
|
||||||
|
|
||||||
Add tabs
|
Add tabs
|
||||||
--------
|
--------
|
||||||
|
|
||||||
@ -58,12 +54,26 @@ To select a new tab you can:
|
|||||||
- Slide horizontally
|
- Slide horizontally
|
||||||
- Use :cpp:expr:`lv_tabview_set_active(tabview, id, LV_ANIM_ON)` function
|
- Use :cpp:expr:`lv_tabview_set_active(tabview, id, LV_ANIM_ON)` function
|
||||||
|
|
||||||
|
|
||||||
|
Set tab bar position
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Using the :cpp:expr:`lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT/RIGHT/TOP/BOTTOM)`
|
||||||
|
the tab bar can be moved to any sides.
|
||||||
|
|
||||||
|
Set tab bra size
|
||||||
|
----------------
|
||||||
|
|
||||||
|
The size of the tab bar can be adjusted by :spp:expr:`lv_tabview_set_tab_bar_size(tabview, size)`
|
||||||
|
In case of vertical arrangement is means the height of the tab bar, and in horizontal
|
||||||
|
arrangement it means the width.
|
||||||
|
|
||||||
Get the parts
|
Get the parts
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
:cpp:expr:`lv_tabview_get_content(tabview)` returns the container for the tabs,
|
:cpp:expr:`lv_tabview_get_content(tabview)` returns the container for the tabs,
|
||||||
:cpp:expr:`lv_tabview_get_tab_btns(tabview)` returns the Tab buttons object
|
:cpp:expr:`lv_tabview_get_tab_buttons(tabview)` returns the Tab buttons object
|
||||||
which is a `Button matrix </widgets/btnmatrix>`__.
|
which is a `Button matrix </widgets/buttonmatrix>`__.
|
||||||
|
|
||||||
Events
|
Events
|
||||||
******
|
******
|
||||||
|
@ -38,8 +38,8 @@ Change tile
|
|||||||
-----------
|
-----------
|
||||||
|
|
||||||
The Tile view can scroll to a tile with
|
The Tile view can scroll to a tile with
|
||||||
:cpp:expr:`lv_obj_set_tile(tileview, tile_obj, LV_ANIM_ON/OFF)` or
|
:cpp:expr:`lv_tileview_set_tile(tileview, tile_obj, LV_ANIM_ON/OFF)` or
|
||||||
:cpp:expr:`lv_obj_set_tile_id(tileview, col_id, row_id, LV_ANIM_ON/OFF)`
|
:cpp:expr:`lv_tileview_set_tile_by_index(tileview, col_id, row_id, LV_ANIM_ON/OFF)`
|
||||||
|
|
||||||
Events
|
Events
|
||||||
******
|
******
|
||||||
|
@ -16,7 +16,7 @@ documentation for details:
|
|||||||
- Background: `lv_obj </widgets/obj>`__
|
- Background: `lv_obj </widgets/obj>`__
|
||||||
- Header on the background: `lv_obj </widgets/obj>`__
|
- Header on the background: `lv_obj </widgets/obj>`__
|
||||||
- Title on the header: `lv_label </widgets/label>`__
|
- Title on the header: `lv_label </widgets/label>`__
|
||||||
- Buttons on the header: `lv_btn </widgets/btn>`__
|
- Buttons on the header: `lv_button </widgets/button>`__
|
||||||
- Content area on the background: `lv_obj </widgets/obj>`__
|
- Content area on the background: `lv_obj </widgets/obj>`__
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@ -35,8 +35,8 @@ Any number of texts (but typically only one) can be added to the header
|
|||||||
with :cpp:expr:`lv_win_add_title(win, "The title")`.
|
with :cpp:expr:`lv_win_add_title(win, "The title")`.
|
||||||
|
|
||||||
Control buttons can be added to the window's header with
|
Control buttons can be added to the window's header with
|
||||||
:cpp:expr:`lv_win_add_btn(win, icon, btn_width)`. ``icon`` can be any image
|
:cpp:expr:`lv_win_add_button(win, icon, button_width)`. ``icon`` can be any image
|
||||||
source, and ``btn_width`` is the width of the button.
|
source, and ``button_width`` is the width of the button.
|
||||||
|
|
||||||
The title and the buttons will be added in the order the functions are
|
The title and the buttons will be added in the order the functions are
|
||||||
called. So adding a button, a text and two other buttons will result in
|
called. So adding a button, a text and two other buttons will result in
|
||||||
@ -56,7 +56,7 @@ Events
|
|||||||
******
|
******
|
||||||
|
|
||||||
No special events are sent by the windows, however events can be added
|
No special events are sent by the windows, however events can be added
|
||||||
manually to the return value of :cpp:func:`lv_win_add_btn`.
|
manually to the return value of :cpp:func:`lv_win_add_button`.
|
||||||
|
|
||||||
Learn more about :ref:`events`.
|
Learn more about :ref:`events`.
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
Simple Buttons
|
|
||||||
--------------
|
|
||||||
|
|
||||||
.. lv_example:: widgets/btn/lv_example_btn_1
|
|
||||||
:language: c
|
|
||||||
|
|
||||||
|
|
||||||
Styling buttons
|
|
||||||
---------------
|
|
||||||
|
|
||||||
.. lv_example:: widgets/btn/lv_example_btn_2
|
|
||||||
:language: c
|
|
||||||
|
|
||||||
Gummy button
|
|
||||||
------------
|
|
||||||
|
|
||||||
.. lv_example:: widgets/btn/lv_example_btn_3
|
|
||||||
:language: c
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
Simple Button matrix
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
.. lv_example:: widgets/btnmatrix/lv_example_btnmatrix_1
|
|
||||||
:language: c
|
|
||||||
|
|
||||||
|
|
||||||
Custom buttons
|
|
||||||
--------------
|
|
||||||
|
|
||||||
.. lv_example:: widgets/btnmatrix/lv_example_btnmatrix_2
|
|
||||||
:language: c
|
|
||||||
|
|
||||||
|
|
||||||
Pagination
|
|
||||||
----------
|
|
||||||
|
|
||||||
.. lv_example:: widgets/btnmatrix/lv_example_btnmatrix_3
|
|
||||||
:language: c
|
|
||||||
|
|
||||||
|
|
20
examples/widgets/button/index.rst
Normal file
20
examples/widgets/button/index.rst
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Simple Buttons
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. lv_example:: widgets/button/lv_example_button_1
|
||||||
|
:language: c
|
||||||
|
|
||||||
|
|
||||||
|
Styling buttons
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. lv_example:: widgets/button/lv_example_button_2
|
||||||
|
:language: c
|
||||||
|
|
||||||
|
Gummy button
|
||||||
|
------------
|
||||||
|
|
||||||
|
.. lv_example:: widgets/button/lv_example_button_3
|
||||||
|
:language: c
|
||||||
|
|
22
examples/widgets/buttonmatrix/index.rst
Normal file
22
examples/widgets/buttonmatrix/index.rst
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
Simple Button matrix
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
.. lv_example:: widgets/buttonmatrix/lv_example_buttonmatrix_1
|
||||||
|
:language: c
|
||||||
|
|
||||||
|
|
||||||
|
Custom buttons
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. lv_example:: widgets/buttonmatrix/lv_example_buttonmatrix_2
|
||||||
|
:language: c
|
||||||
|
|
||||||
|
|
||||||
|
Pagination
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. lv_example:: widgets/buttonmatrix/lv_example_buttonmatrix_3
|
||||||
|
:language: c
|
||||||
|
|
||||||
|
|
@ -2,27 +2,27 @@
|
|||||||
Image from variable and symbol
|
Image from variable and symbol
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
.. lv_example:: widgets/img/lv_example_img_1
|
.. lv_example:: widgets/image/lv_example_image_1
|
||||||
:language: c
|
:language: c
|
||||||
|
|
||||||
|
|
||||||
Image recoloring
|
Image recoloring
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
.. lv_example:: widgets/img/lv_example_img_2
|
.. lv_example:: widgets/image/lv_example_image_2
|
||||||
:language: c
|
:language: c
|
||||||
|
|
||||||
|
|
||||||
Rotate and zoom
|
Rotate and zoom
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
.. lv_example:: widgets/img/lv_example_img_3
|
.. lv_example:: widgets/image/lv_example_image_3
|
||||||
:language: c
|
:language: c
|
||||||
|
|
||||||
Image offset and styling
|
Image offset and styling
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
.. lv_example:: widgets/img/lv_example_img_4
|
.. lv_example:: widgets/image/lv_example_image_4
|
||||||
:language: c
|
:language: c
|
||||||
|
|
||||||
|
|
@ -7,7 +7,7 @@ void lv_example_tabview_2(void)
|
|||||||
/*Create a Tab view object*/
|
/*Create a Tab view object*/
|
||||||
lv_obj_t * tabview;
|
lv_obj_t * tabview;
|
||||||
tabview = lv_tabview_create(lv_screen_active());
|
tabview = lv_tabview_create(lv_screen_active());
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_LEFT);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 80);
|
lv_tabview_set_tab_bar_size(tabview, 80);
|
||||||
|
|
||||||
lv_obj_set_style_bg_color(tabview, lv_palette_lighten(LV_PALETTE_RED, 2), 0);
|
lv_obj_set_style_bg_color(tabview, lv_palette_lighten(LV_PALETTE_RED, 2), 0);
|
||||||
|
@ -211,6 +211,8 @@ static inline void lv_obj_move_background(lv_obj_t * obj)
|
|||||||
#define lv_tabview_set_act lv_tabview_set_active
|
#define lv_tabview_set_act lv_tabview_set_active
|
||||||
|
|
||||||
#define lv_tileview_get_tile_act lv_tileview_get_tile_active
|
#define lv_tileview_get_tile_act lv_tileview_get_tile_active
|
||||||
|
#define lv_obj_set_tile_id lv_obj_set_tile_by_index
|
||||||
|
#define lv_obj_set_tile lv_obj_set_tile
|
||||||
|
|
||||||
#define lv_msgbox_get_btns lv_msgbox_get_buttons
|
#define lv_msgbox_get_btns lv_msgbox_get_buttons
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ void lv_tabview_set_active(lv_obj_t * obj, uint32_t idx, lv_anim_enable_t anim_e
|
|||||||
tabview->tab_cur = idx;
|
tabview->tab_cur = idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_tabview_set_tab_position(lv_obj_t * obj, lv_dir_t dir)
|
void lv_tabview_set_tab_bar_position(lv_obj_t * obj, lv_dir_t dir)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
lv_tabview_t * tabview = (lv_tabview_t *)obj;
|
lv_tabview_t * tabview = (lv_tabview_t *)obj;
|
||||||
@ -267,7 +267,7 @@ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob
|
|||||||
|
|
||||||
lv_obj_add_event_cb(cont, cont_scroll_end_event_cb, LV_EVENT_ALL, NULL);
|
lv_obj_add_event_cb(cont, cont_scroll_end_event_cb, LV_EVENT_ALL, NULL);
|
||||||
lv_obj_set_scrollbar_mode(cont, LV_SCROLLBAR_MODE_OFF);
|
lv_obj_set_scrollbar_mode(cont, LV_SCROLLBAR_MODE_OFF);
|
||||||
lv_tabview_set_tab_position(obj, LV_DIR_TOP);
|
lv_tabview_set_tab_bar_position(obj, LV_DIR_TOP);
|
||||||
|
|
||||||
lv_obj_add_flag(cont, LV_OBJ_FLAG_SCROLL_ONE);
|
lv_obj_add_flag(cont, LV_OBJ_FLAG_SCROLL_ONE);
|
||||||
lv_obj_remove_flag(cont, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_remove_flag(cont, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
||||||
|
@ -45,7 +45,7 @@ void lv_tabview_rename_tab(lv_obj_t * obj, uint32_t tab_id, const char * new_nam
|
|||||||
|
|
||||||
void lv_tabview_set_active(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en);
|
void lv_tabview_set_active(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en);
|
||||||
|
|
||||||
void lv_tabview_set_tab_position(lv_obj_t * obj, lv_dir_t dir);
|
void lv_tabview_set_tab_bar_position(lv_obj_t * obj, lv_dir_t dir);
|
||||||
|
|
||||||
void lv_tabview_set_tab_bar_size(lv_obj_t * obj, int32_t size);
|
void lv_tabview_set_tab_bar_size(lv_obj_t * obj, int32_t size);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, l
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_obj_set_tile(lv_obj_t * obj, lv_obj_t * tile_obj, lv_anim_enable_t anim_en)
|
void lv_tileview_set_tile(lv_obj_t * obj, lv_obj_t * tile_obj, lv_anim_enable_t anim_en)
|
||||||
{
|
{
|
||||||
int32_t tx = lv_obj_get_x(tile_obj);
|
int32_t tx = lv_obj_get_x(tile_obj);
|
||||||
int32_t ty = lv_obj_get_y(tile_obj);
|
int32_t ty = lv_obj_get_y(tile_obj);
|
||||||
@ -95,7 +95,7 @@ void lv_obj_set_tile(lv_obj_t * obj, lv_obj_t * tile_obj, lv_anim_enable_t anim_
|
|||||||
lv_obj_scroll_to(obj, tx, ty, anim_en);
|
lv_obj_scroll_to(obj, tx, ty, anim_en);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en)
|
void lv_tileview_set_tile_by_index(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en)
|
||||||
{
|
{
|
||||||
lv_obj_update_layout(tv);
|
lv_obj_update_layout(tv);
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim
|
|||||||
int32_t x = lv_obj_get_x(tile_obj);
|
int32_t x = lv_obj_get_x(tile_obj);
|
||||||
int32_t y = lv_obj_get_y(tile_obj);
|
int32_t y = lv_obj_get_y(tile_obj);
|
||||||
if(x == tx && y == ty) {
|
if(x == tx && y == ty) {
|
||||||
lv_obj_set_tile(tv, tile_obj, anim_en);
|
lv_tileview_set_tile(tv, tile_obj, anim_en);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,8 +50,8 @@ lv_obj_t * lv_tileview_create(lv_obj_t * parent);
|
|||||||
|
|
||||||
lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, lv_dir_t dir);
|
lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, lv_dir_t dir);
|
||||||
|
|
||||||
void lv_obj_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_en);
|
void lv_tileview_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_en);
|
||||||
void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en);
|
void lv_tileview_set_tile_by_index(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en);
|
||||||
|
|
||||||
lv_obj_t * lv_tileview_get_tile_active(lv_obj_t * obj);
|
lv_obj_t * lv_tileview_get_tile_active(lv_obj_t * obj);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ void test_tabview_create_successful_dir_top(void)
|
|||||||
void test_tabview_create_successful_dir_bottom(void)
|
void test_tabview_create_successful_dir_bottom(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_BOTTOM);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_BOTTOM);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
TEST_ASSERT_NOT_NULL(tabview);
|
TEST_ASSERT_NOT_NULL(tabview);
|
||||||
@ -60,7 +60,7 @@ void test_tabview_create_successful_dir_bottom(void)
|
|||||||
void test_tabview_create_successful_dir_left(void)
|
void test_tabview_create_successful_dir_left(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_LEFT);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
TEST_ASSERT_NOT_NULL(tabview);
|
TEST_ASSERT_NOT_NULL(tabview);
|
||||||
@ -71,7 +71,7 @@ void test_tabview_create_successful_dir_left(void)
|
|||||||
void test_tabview_create_successful_dir_right(void)
|
void test_tabview_create_successful_dir_right(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_RIGHT);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_RIGHT);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
TEST_ASSERT_NOT_NULL(tabview);
|
TEST_ASSERT_NOT_NULL(tabview);
|
||||||
@ -82,7 +82,7 @@ void test_tabview_create_successful_dir_right(void)
|
|||||||
void test_tabview_add_one_tab_empty(void)
|
void test_tabview_add_one_tab_empty(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_TOP);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_TOP);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
||||||
@ -93,7 +93,7 @@ void test_tabview_add_one_tab_empty(void)
|
|||||||
void test_tabview_add_one_tab_empty_hor(void)
|
void test_tabview_add_one_tab_empty_hor(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_LEFT);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
||||||
@ -104,7 +104,7 @@ void test_tabview_add_one_tab_empty_hor(void)
|
|||||||
void test_tabview_add_one_tab_no_scroll(void)
|
void test_tabview_add_one_tab_no_scroll(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_TOP);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_TOP);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
||||||
@ -119,7 +119,7 @@ void test_tabview_add_one_tab_no_scroll(void)
|
|||||||
void test_tabview_add_one_tab_with_scroll(void)
|
void test_tabview_add_one_tab_with_scroll(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_TOP);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_TOP);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
||||||
@ -147,7 +147,7 @@ void test_tabview_add_one_tab_with_scroll(void)
|
|||||||
void test_tabview_add_several_tabs_no_scroll(void)
|
void test_tabview_add_several_tabs_no_scroll(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_TOP);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_TOP);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
||||||
@ -167,7 +167,7 @@ void test_tabview_add_several_tabs_no_scroll(void)
|
|||||||
void test_tabview_rename_tab(void)
|
void test_tabview_rename_tab(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_TOP);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_TOP);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
||||||
@ -188,7 +188,7 @@ void test_tabview_rename_tab(void)
|
|||||||
void test_tabview_add_several_tabs_hor(void)
|
void test_tabview_add_several_tabs_hor(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_TOP);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_TOP);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
||||||
@ -235,7 +235,7 @@ void test_tabview_set_act_non_existent(void)
|
|||||||
void test_tabview_tab2_selected_event(void)
|
void test_tabview_tab2_selected_event(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_TOP);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_TOP);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
||||||
@ -253,7 +253,7 @@ void test_tabview_tab2_selected_event(void)
|
|||||||
void test_tabview_update_on_external_scroll(void)
|
void test_tabview_update_on_external_scroll(void)
|
||||||
{
|
{
|
||||||
tabview = lv_tabview_create(active_screen);
|
tabview = lv_tabview_create(active_screen);
|
||||||
lv_tabview_set_tab_position(tabview, LV_DIR_TOP);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_TOP);
|
||||||
lv_tabview_set_tab_bar_size(tabview, 50);
|
lv_tabview_set_tab_bar_size(tabview, 50);
|
||||||
|
|
||||||
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user