docs: update API comments

This commit is contained in:
Gabor Kiss-Vamosi
2023-12-13 21:23:08 +01:00
parent 636aba8c34
commit d5daccdd48
116 changed files with 1283 additions and 1918 deletions

View File

@@ -51,7 +51,7 @@ widgets = {
"colorwheel": "Colorwheel",
"dropdown": "Dropdown",
"img": "Image",
"imgbtn": "Image button",
"imagebutton": "Image button",
"keyboard": "Keyboard",
"label": "Label",
"led": "LED",

View File

@@ -65,7 +65,7 @@ and configured with ``lv_anim_set_...()`` functions.
lv_anim_set_start_cb(&a, start_cb);
/*When ready, play the animation backward with this duration. Default is 0 (disabled) [ms]*/
lv_anim_set_playback_time(&a, time);
lv_anim_set_playback_duration(&a, time);
/*Delay before playback. Default is 0 (disabled) [ms]*/
lv_anim_set_playback_delay(&a, delay);

View File

@@ -6,8 +6,9 @@ The color module handles all color-related functions like changing color
depth, creating colors from hex code, converting between color depths,
mixing colors, etc.
The type :cpp:type:`lv_color_t` is used to store a color. Its fields are set
according to :c:macro:`LV_COLOR_DEPTH` in ``lv_conf.h``. (See below)
The type :cpp:type:`lv_color_t` is used to store a color in RGB888 format.
This type and format is used in almost all APIs regardless to
:cpp:expr`LV_COLOR_DEPTH`.
Creating colors
***************
@@ -19,13 +20,17 @@ Create colors from Red, Green and Blue channel values:
.. code:: c
//All channels are 0-255
/*All channels are 0-255*/
lv_color_t c = lv_color_make(red, green, blue);
//From hex code 0x000000..0xFFFFFF interpreted as RED + GREEN + BLUE
/*Same but can be used for const initialization too */
lv_color_t c = LV_COLOR_MAKE(red, green, blue);
/*From hex code 0x000000..0xFFFFFF interpreted as RED + GREEN + BLUE*/
lv_color_t c = lv_color_hex(0x123456);
//From 3 digits. Same as lv_color_hex(0x112233)
/*From 3 digits. Same as lv_color_hex(0x112233)*/
lv_color_t c = lv_color_hex3(0x123);
HSV
@@ -52,7 +57,7 @@ LVGL includes `Material Design's palette <https://vuetifyjs.com/en/styles/colors
colors. In this system all named colors have a nominal main color as
well as four darker and five lighter variants.
The names of the colors are as follows:
The names of the colors are as follows:
- :c:macro:`LV_PALETTE_RED`
- :c:macro:`LV_PALETTE_PINK`
@@ -126,62 +131,7 @@ Some special purpose defines are also introduced:
You can also use the ``LV_OPA_*`` defines in :cpp:func:`lv_color_mix` as a
mixing *ratio*.
Color types
***********
The following variable types are defined by the color module:
- :cpp:union:`lv_color1_t` Monochrome color. Also has R, G, B fields for
compatibility but they are always the same value (1 byte)
- :cpp:union:`lv_color8_t` A structure to store R (3 bit),G (3 bit),B (2 bit)
components for 8-bit colors (1 byte)
- :cpp:class:`lv_color16_t` A structure to store R (5 bit),G (6 bit),B (5 bit)
components for 16-bit colors (2 byte)
- :cpp:class:`lv_color32_t` A structure to store R (8 bit),G (8 bit), B (8 bit)
components for 24-bit colors (4 byte)
- :cpp:type:`lv_color_t` Equal to ``lv_color1/8/16/24_t`` depending on the
configured color depth setting
- :cpp:type:`lv_color_int_t` ``uint8_t``, ``uint16_t`` or ``uint32_t``
depending on the color depth setting. Used to build color arrays from
plain numbers.
- :cpp:type:`lv_opa_t` A simple ``uint8_t`` type to describe opacity.
The :cpp:type:`lv_color_t`, :cpp:union:`lv_color1_t`, :cpp:union:`lv_color8_t`, :cpp:class:`lv_color16_t`
and :cpp:class:`lv_color32_t` types have four fields:
- :cpp:member:`red` red channel
- :cpp:member:`green` green channel
- :cpp:member:`blue` blue channel
- :cpp:member:`full` red + green + blue as one number
You can set the current color depth in *lv_conf.h*, by setting the
:c:macro:`LV_COLOR_DEPTH` define to 1 (monochrome), 8, 16 or 32.
Convert color
-------------
You can convert a color from the current color depth to another. The
converter functions return with a number, so you have to use the
:cpp:member:`full` field to map a converted color back into a structure:
.. code:: c
lv_color_t c;
c.red = 0x38;
c.green = 0x70;
c.blue = 0xCC;
lv_color1_t c1;
c1.full = lv_color_to1(c); /*Return 1 for light colors, 0 for dark colors*/
lv_color8_t c8;
c8.full = lv_color_to8(c); /*Give a 8 bit number with the converted color*/
lv_color16_t c16;
c16.full = lv_color_to16(c); /*Give a 16 bit number with the converted color*/
lv_color32_t c24;
c32.full = lv_color_to32(c); /*Give a 32 bit number with the converted color*/
API
***

View File

@@ -40,6 +40,7 @@ model. An object's "box" is built from the following parts:
- bounding box: the width/height of the elements.
- border width: the width of the border.
- padding: space between the sides of the object and its children.
- margin: space outside of the object (considered only by some layouts)
- content: the content area which is the size of the bounding box reduced by the border width and padding.
.. image:: /misc/boxmodel.png

View File

@@ -7,15 +7,12 @@ Displays
Multiple display support
************************
In LVGL you can have multiple displays, each with their own driver and
objects. The only limitation is that every display needs to have the
same color depth (as defined in :c:macro:`LV_COLOR_DEPTH`). If the displays are
different in this regard the rendered image can be converted to the
correct format in the drivers ``flush_cb``.
In LVGL you can have multiple displays, each with their own driver,
widgets and color depth.
Creating more displays is easy: just initialize more display buffers and
register another driver for every display. When you create the UI, use
:cpp:expr:`lv_disp_set_default(disp)` to tell the library on which display to
Creating more displays is easy: just use :cpp:func:`lv_display_create` and
add set the buffer and the ``flush_cb``. When you create the UI, use
:cpp:expr:`lv_display_set_default(disp)` to tell the library on which display to
create objects.
Why would you want multi-display support? Here are some examples:
@@ -38,7 +35,7 @@ hidden if you register only one display. By default, the last created
:cpp:func:`lv_layer_sys`, :c:macro:`LV_HOR_RES` and :c:macro:`LV_VER_RES` are always applied
on the most recently created (default) display. If you pass ``NULL`` as
``disp`` parameter to display related functions the default display will
usually be used. E.g. :cpp:expr:`lv_disp_trig_activity(NULL)` will trigger a
usually be used. E.g. :cpp:expr:`lv_display_trig_activity(NULL)` will trigger a
user activity on the default display. (See below in `Inactivity <#Inactivity>`__).
Mirror display
@@ -87,7 +84,7 @@ existing screen copied into the new screen.
To load a screen, use :cpp:expr:`lv_screen_load(scr)`. To get the active screen,
use :cpp:expr:`lv_screen_active()`. These functions work on the default display. If
you want to specify which display to work on, use
:cpp:expr:`lv_disp_get_screen_active(disp)` and :cpp:expr:`lv_disp_load_scr(disp, scr)`. A
:cpp:expr:`lv_display_get_screen_active(disp)` and :cpp:expr:`lv_display_load_scr(disp, scr)`. A
screen can be loaded with animations too. Read more
`here <object.html#load-screens>`__.
@@ -120,7 +117,7 @@ UIs:
- Set the screen's bg_opa to 0:
:cpp:expr:`lv_obj_set_style_bg_opa(lv_layer_bottom(), LV_OPA_TRANSP, 0)`
- Set a color format with alpha channel. E.g.
:cpp:expr:`lv_disp_set_color_format(disp, LV_COLOR_FORMAT_NATIVE_ALPHA)`
:cpp:expr:`lv_display_set_color_format(disp, LV_COLOR_FORMAT_ARGB8888)`
Features of displays
********************
@@ -131,12 +128,12 @@ Inactivity
A user's inactivity time is measured on each display. Every use of an
`Input device </overview/indev>`__ (if `associated with the display </porting/indev#other-features>`__) counts as an activity. To
get time elapsed since the last activity, use
:cpp:expr:`lv_disp_get_inactive_time(disp)`. If ``NULL`` is passed, the lowest
:cpp:expr:`lv_display_get_inactive_time(disp)`. If ``NULL`` is passed, the lowest
inactivity time among all displays will be returned (**NULL isn't just
the default display**).
You can manually trigger an activity using
:cpp:expr:`lv_disp_trig_activity(disp)`. If ``disp`` is ``NULL``, the default
:cpp:expr:`lv_display_trig_activity(disp)`. If ``disp`` is ``NULL``, the default
screen will be used (**and not all displays**).
Background

View File

@@ -12,15 +12,17 @@ interesting to the user, e.g. when an object:
- has its value changed
- is redrawn, etc.
Add events to the object
************************
Besides widgets, events can registered from displays and input devices too.
Add events to a widget
**********************
The user can assign callback functions to an object to see its events.
In practice, it looks like this:
.. code:: c
lv_obj_t * btn = lv_btn_create(lv_screen_active());
lv_obj_t * btn = lv_button_create(lv_screen_active());
lv_obj_add_event_cb(btn, my_event_cb, LV_EVENT_CLICKED, NULL); /*Assign an event callback*/
...
@@ -58,11 +60,29 @@ The events will be called in the order as they were added.
Other objects can use the same *event callback*.
Remove event(s) from an object
******************************
In the very same way events can attached to the input devices and displays like this
.. code:: c
lv_display_add_event_cb(disp, event_cb, LV_EVENT_RESOLUTION_CHANGED, NULL);
lv_indev_add_event_cb(indev, event_cb, LV_EVENT_CLICKED, NULL);
Remove event(s) from widgets
****************************
.. code:: c
uint32_t i;
uint32_t event_cnt = lv_obj_get_event_count(obj);
for(i = 0; i < event_cnt; i++) {
lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(obj, i);
if(lv_event_dsc_get_cb(event_dsc) == some_event_cb) {
lv_obj_remove_event(obj, i);
break;
}
}
Events can be removed from an object with the
:cpp:expr:`lv_obj_remove_event(obj, event_cb)` function
Event codes
***********
@@ -81,70 +101,82 @@ are sent,
The following event codes exist:
Input device events
-------------------
- :cpp:enumerator:`LV_EVENT_PRESSED`: An object has been pressed
- :cpp:enumerator:`LV_EVENT_PRESSING`: An object is being pressed (called continuously while pressing)
- :cpp:enumerator:`LV_EVENT_PRESS_LOST`: An object is still being pressed but slid cursor/finger off of the object
- :cpp:enumerator:`LV_EVENT_SHORT_CLICKED`: An object was pressed for a short period of time, then released. Not called if scrolled.
- :cpp:enumerator:`LV_EVENT_LONG_PRESSED`: An object has been pressed for at least the ``long_press_time`` specified in the input device driver. Not called if scrolled.
- :cpp:enumerator:`LV_EVENT_LONG_PRESSED_REPEAT`: Called after ``long_press_time`` in every ``long_press_repeat_time`` ms. Not called if scrolled.
- :cpp:enumerator:`LV_EVENT_CLICKED`: Called on release if an object did not scroll (regardless of long press)
- :cpp:enumerator:`LV_EVENT_RELEASED`: Called in every case when an object has been released
- :cpp:enumerator:`LV_EVENT_SCROLL_BEGIN`: Scrolling begins. The event parameter is ``NULL`` or an :cpp:type:`lv_anim_t` ``*`` with a scroll animation descriptor that can be modified if required.
- :cpp:enumerator:`LV_EVENT_SCROLL_THROW_BEGIN`: Sent once when the object is released while scrolling but the "momentum" still keeps the content scrolling.
- :cpp:enumerator:`LV_EVENT_SCROLL_END`: Scrolling ends.
- :cpp:enumerator:`LV_EVENT_SCROLL`: An object was scrolled
- :cpp:enumerator:`LV_EVENT_GESTURE`: A gesture is detected. Get the gesture with :cpp:expr:`lv_indev_get_gesture_dir(lv_indev_active())`
- :cpp:enumerator:`LV_EVENT_KEY`: A key is sent to an object. Get the key with :cpp:expr:`lv_indev_get_key(lv_indev_active())`
- :cpp:enumerator:`LV_EVENT_FOCUSED`: An object is focused
- :cpp:enumerator:`LV_EVENT_DEFOCUSED`: An object is unfocused
- :cpp:enumerator:`LV_EVENT_LEAVE`: An object is unfocused but still selected
- :cpp:enumerator:`LV_EVENT_HIT_TEST`: Perform advanced hit-testing. Use :cpp:struct:`lv_hit_test_info_t` ``* a =`` :cpp:expr:`lv_event_get_hit_test_info(e)` and check if ``a->point`` can click the object or not. If not set ``a->res = false``
- :cpp:enumerator:`LV_EVENT_PRESSED`: The object has been pressed
- :cpp:enumerator:`LV_EVENT_PRESSING`: The object is being pressed (called continuously while pressing)
- :cpp:enumerator:`LV_EVENT_PRESS_LOST`: The object is still being pressed but slid cursor/finger off of the object
- :cpp:enumerator:`LV_EVENT_SHORT_CLICKED`: The object was pressed for a short period of time, then released it. Not called if scrolled.
- :cpp:enumerator:`LV_EVENT_LONG_PRESSED`: Object has been pressed for at least `long_press_time`. Not called if scrolled.
- :cpp:enumerator:`LV_EVENT_LONG_PRESSED_REPEAT`: Called after `long_press_time` in every `long_press_repeat_time` ms. Not called if scrolled.
- :cpp:enumerator:`LV_EVENT_CLICKED`: Called on release if not scrolled (regardless to long press)
- :cpp:enumerator:`LV_EVENT_RELEASED`: Called in every cases when the object has been released
- :cpp:enumerator:`LV_EVENT_SCROLL_BEGIN`: Scrolling begins. The event parameter is a pointer to the animation of the scroll. Can be modified
- :cpp:enumerator:`LV_EVENT_SCROLL_THROW_BEGIN,
- :cpp:enumerator:`LV_EVENT_SCROLL_END`: Scrolling ends
- :cpp:enumerator:`LV_EVENT_SCROLL`: Scrolling
- :cpp:enumerator:`LV_EVENT_GESTURE`: A gesture is detected. Get the gesture with `lv_indev_get_gesture_dir(lv_indev_active());`
- :cpp:enumerator:`LV_EVENT_KEY`: A key is sent to the object. Get the key with `lv_indev_get_key(lv_indev_active());`
- :cpp:enumerator:`LV_EVENT_FOCUSED`: The object is focused
- :cpp:enumerator:`LV_EVENT_DEFOCUSED`: The object is defocused
- :cpp:enumerator:`LV_EVENT_LEAVE`: The object is defocused but still selected
- :cpp:enumerator:`LV_EVENT_HIT_TEST`: Perform advanced hit-testing
- :cpp:enumerator:`LV_EVENT_INDEV_RESET`: Indev has been reset
Drawing events
--------------
- :cpp:enumerator:`LV_EVENT_COVER_CHECK`: Check if an object fully covers an area. The event parameter is :cpp:struct:`lv_cover_check_info_t` ``*``.
- :cpp:enumerator:`LV_EVENT_REFR_EXT_DRAW_SIZE`: Get the required extra draw area around an object (e.g. for a shadow). The event parameter is :cpp:type:`int32_t` ``*`` to store the size. Only overwrite it with a larger value.
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN_BEGIN`: Starting the main drawing phase.
- :cpp:enumerator:`LV_EVENT_COVER_CHECK`: Check if the object fully covers an area. The event parameter is `lv_cover_check_info_t *`.
- :cpp:enumerator:`LV_EVENT_REFR_EXT_DRAW_SIZE`: Get the required extra draw area around the object (e.g. for shadow). The event parameter is `int32_t *` to store the size.
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN_BEGIN`: Starting the main drawing phase
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN`: Perform the main drawing
- :cpp:enumerator:`LV_EVENT_DRAW_MAIN_END`: Finishing the main drawing phase
- :cpp:enumerator:`LV_EVENT_DRAW_POST_BEGIN`: Starting the post draw phase (when all children are drawn)
- :cpp:enumerator:`LV_EVENT_DRAW_POST`: Perform the post draw phase (when all children are drawn)
- :cpp:enumerator:`LV_EVENT_DRAW_POST_END`: Finishing the post draw phase (when all children are drawn)
- :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN`: Starting to draw a part. The event parameter is :cpp:struct:`lv_obj_draw_dsc_t` ``*``. Learn more :ref:`drawing`.
- :cpp:enumerator:`LV_EVENT_DRAW_PART_END`: Finishing to draw a part. The event parameter is :cpp:struct:`lv_obj_draw_dsc_t` ``*``. Learn more :ref:`drawing`.
In ``LV_EVENT_DRAW_...`` events it's not allowed to adjust the widgets'
properties. E.g. you can not call :cpp:func:`lv_obj_set_width`. In other words
only ``get`` functions can be called.
Other events
------------
- :cpp:enumerator:`LV_EVENT_DELETE`: Object is being deleted
- :cpp:enumerator:`LV_EVENT_CHILD_CHANGED`: Child was removed/added
- :cpp:enumerator:`LV_EVENT_CHILD_CREATED`: Child was created, always bubbles up to all parents
- :cpp:enumerator:`LV_EVENT_CHILD_DELETED`: Child was deleted, always bubbles up to all parents
- :cpp:enumerator:`LV_EVENT_SIZE_CHANGED`: Object coordinates/size have changed
- :cpp:enumerator:`LV_EVENT_STYLE_CHANGED`: Object's style has changed
- :cpp:enumerator:`LV_EVENT_BASE_DIR_CHANGED`: The base dir has changed
- :cpp:enumerator:`LV_EVENT_GET_SELF_SIZE`: Get the internal size of a widget
- :cpp:enumerator:`LV_EVENT_SCREEN_UNLOAD_START`: A screen unload started, fired immediately when lv_screen_load/lv_screen_load_anim is called
- :cpp:enumerator:`LV_EVENT_SCREEN_LOAD_START`: A screen load started, fired when the screen change delay is expired
- :cpp:enumerator:`LV_EVENT_SCREEN_LOADED`: A screen was loaded, called when all animations are finished
- :cpp:enumerator:`LV_EVENT_SCREEN_UNLOADED`: A screen was unloaded, called when all animations are finished
- :cpp:enumerator:`LV_EVENT_DRAW_TASK_ADDED`: Adding a draw task
Special events
--------------
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED`: The object's value has changed (i.e. slider moved)
- :cpp:enumerator:`LV_EVENT_INSERT`: Text is being inserted into the object. The event data is ``char *`` being inserted.
- :cpp:enumerator:`LV_EVENT_INSERT`: A text is inserted to the object. The event data is `char *` being inserted.
- :cpp:enumerator:`LV_EVENT_REFRESH`: Notify the object to refresh something on it (for the user)
- :cpp:enumerator:`LV_EVENT_READY`: A process has finished
- :cpp:enumerator:`LV_EVENT_CANCEL`: A process has been canceled
- :cpp:enumerator:`LV_EVENT_CANCEL`: A process has been cancelled
Other events
------------
- :cpp:enumerator:`LV_EVENT_CREATE`: Object is being created
- :cpp:enumerator:`LV_EVENT_DELETE`: Object is being deleted
- :cpp:enumerator:`LV_EVENT_CHILD_CHANGED`: Child was removed, added, or its size, position were changed
- :cpp:enumerator:`LV_EVENT_CHILD_CREATED`: Child was created, always bubbles up to all parents
- :cpp:enumerator:`LV_EVENT_CHILD_DELETED`: Child was deleted, always bubbles up to all parents
- :cpp:enumerator:`LV_EVENT_SCREEN_UNLOAD_START`: A screen unload started, fired immediately when scr_load is called
- :cpp:enumerator:`LV_EVENT_SCREEN_LOAD_START`: A screen load started, fired when the screen change delay is expired
- :cpp:enumerator:`LV_EVENT_SCREEN_LOADED`: A screen was loaded
- :cpp:enumerator:`LV_EVENT_SCREEN_UNLOADED`: A screen was unloaded
- :cpp:enumerator:`LV_EVENT_SIZE_CHANGED`: Object coordinates/size have changed
- :cpp:enumerator:`LV_EVENT_STYLE_CHANGED`: Object's style has changed
- :cpp:enumerator:`LV_EVENT_LAYOUT_CHANGED`: The children position has changed due to a layout recalculation
- :cpp:enumerator:`LV_EVENT_GET_SELF_SIZE`: Get the internal size of a widget
Display events
--------------
- :cpp:enumerator:`LV_EVENT_INVALIDATE_AREA,
- :cpp:enumerator:`LV_EVENT_RESOLUTION_CHANGED,
- :cpp:enumerator:`LV_EVENT_REFR_REQUEST,
- :cpp:enumerator:`LV_EVENT_REFR_START,
- :cpp:enumerator:`LV_EVENT_REFR_READY,
- :cpp:enumerator:`LV_EVENT_RENDER_START,
- :cpp:enumerator:`LV_EVENT_RENDER_READY,
- :cpp:enumerator:`LV_EVENT_FLUSH_START,
- :cpp:enumerator:`LV_EVENT_FLUSH_FINISH,
Custom events
-------------
@@ -159,7 +191,7 @@ Sending events
**************
To manually send events to an object, use
:cpp:expr:`lv_event_send` ``(obj, <EVENT_CODE> &some_data)``.
:cpp:expr:`lv_obj_send_event(obj, <EVENT_CODE>, &some_data)`.
For example, this can be used to manually close a message box by
simulating a button press (although there are simpler ways to do this):
@@ -170,6 +202,10 @@ simulating a button press (although there are simpler ways to do this):
uint32_t btn_id = 0;
lv_event_send(mbox, LV_EVENT_VALUE_CHANGED, &btn_id);
The same works for display and input devices with
:cpp:expr:`lv_display_send_event(obj, <EVENT_CODE>, &some_data)` and
:cpp:expr:`lv_indev_send_event(obj, <EVENT_CODE>, &some_data)`.
Refresh event
-------------

View File

@@ -63,6 +63,11 @@ however, shared among multiple physical displays.** The ``layer_top`` is
always on top of the default screen (:cpp:func:`lv_screen_active`), and
``layer_sys`` is on top of ``layer_top``.
The get these layers use :cpp:func:`lv_layer_top()` and :cpp:func:`lv_layer_sys()`.
These layers work like any other widget, meaning the can be styles, scrolled,
and any kind of widgets can be created on them.
The ``layer_top`` can be used by the user to create some content visible
everywhere. For example, a menu bar, a pop-up, etc. If the ``click``
attribute is enabled, then ``layer_top`` will absorb all user clicks and
@@ -76,5 +81,15 @@ The ``layer_sys`` is also used for similar purposes in LVGL. For
example, it places the mouse cursor above all layers to be sure it's
always visible.
Bottom layers
*************
Similarly top and sys. layer bottom layer is also screen size but
it's located below the active screen. It's visible only if the active screen's
background opacity is < 255.
The get the bottom layer use :cpp:func:`lv_layer_bottom()`.
API
***

View File

@@ -146,30 +146,6 @@ property. The parents will use their own state to determine the value.
So if a button is pressed, and the text color comes from here, the
pressed text color will be used.
Forced value inheritance/default value
**************************************
Sometimes you may want to force a child object to use the parent's value
for a given style property. To do this you can use one of the following
(depending on what type of style you're using):
.. code:: c
/* regular style */
lv_style_set_prop_meta(&style, LV_STYLE_TEXT_COLOR, LV_STYLE_PROP_META_INHERIT);
/* local style */
lv_obj_set_local_style_prop_meta(child, LV_STYLE_TEXT_COLOR, LV_STYLE_PROP_META_INHERIT, LV_PART_MAIN);
This acts like a value has been set on the style, so setting the value
of the property afterwards will remove the flag.
You may also want to force the default value of a property to be used,
without needing to hardcode it in your application. To do this you can
use the same API but with :cpp:enumerator:`LV_STYLE_PROP_META_INITIAL` instead. In
future versions of LVGL, this will use the value based upon the current
theme, but for now it just selects the internal default regardless of
theme.
Parts
*****

View File

@@ -24,7 +24,7 @@ Image sources
-------------
To set the image in a state, use the
:cpp:expr:`lv_animimg_set_src(imgbtn, dsc[], num)`.
:cpp:expr:`lv_animimg_set_src(imagebutton, dsc[], num)`.
Events
******

View File

@@ -1,4 +1,4 @@
Image button (lv_imgbtn)
Image button (lv_imagebutton)
========================
Overview
@@ -25,29 +25,29 @@ Image sources
-------------
To set the image in a state, use the
:cpp:expr:`lv_imgbtn_set_src(imgbtn, LV_IMGBTN_STATE_..., src_left, src_center, src_right)`.
:cpp:expr:`lv_imagebutton_set_src(imagebutton, LV_IMAGEBUTTON_STATE_..., src_left, src_center, src_right)`.
The image sources work the same as described in the `Image object </widgets/img>`__
except that "Symbols" are not supported by the Image button. Any of the sources can ``NULL``.
The possible states are:
- :cpp:enumerator:`LV_IMGBTN_STATE_RELEASED`
- :cpp:enumerator:`LV_IMGBTN_STATE_PRESSED`
- :cpp:enumerator:`LV_IMGBTN_STATE_DISABLED`
- :cpp:enumerator:`LV_IMGBTN_STATE_CHECKED_RELEASED`
- :cpp:enumerator:`LV_IMGBTN_STATE_CHECKED_PRESSED`
- :cpp:enumerator:`LV_IMGBTN_STATE_CHECKED_DISABLED`
- :cpp:enumerator:`LV_IMAGEBUTTON_STATE_RELEASED`
- :cpp:enumerator:`LV_IMAGEBUTTON_STATE_PRESSED`
- :cpp:enumerator:`LV_IMAGEBUTTON_STATE_DISABLED`
- :cpp:enumerator:`LV_IMAGEBUTTON_STATE_CHECKED_RELEASED`
- :cpp:enumerator:`LV_IMAGEBUTTON_STATE_CHECKED_PRESSED`
- :cpp:enumerator:`LV_IMAGEBUTTON_STATE_CHECKED_DISABLED`
If you set sources only in :cpp:enumerator:`LV_IMGBTN_STATE_RELEASED`, these sources
will be used in other states too. If you set e.g. :cpp:enumerator:`LV_IMGBTN_STATE_PRESSED`
If you set sources only in :cpp:enumerator:`LV_IMAGEBUTTON_STATE_RELEASED`, these sources
will be used in other states too. If you set e.g. :cpp:enumerator:`LV_IMAGEBUTTON_STATE_PRESSED`
they will be used in pressed state instead of the released images.
States
------
Instead of the regular ``lv_obj_add/remove_state()`` functions the
:cpp:expr:`lv_imgbtn_set_state(imgbtn, LV_IMGBTN_STATE_...)` functions should be
:cpp:expr:`lv_imagebutton_set_state(imagebutton, LV_IMAGEBUTTON_STATE_...)` functions should be
used to manually set a state.
Events
@@ -71,7 +71,7 @@ Learn more about :ref:`indev_keys`.
Example
*******
.. include:: ../examples/widgets/imgbtn/index.rst
.. include:: ../examples/widgets/imgagebutton/index.rst
API
***

View File

@@ -20,7 +20,7 @@ Widgets
checkbox
dropdown
image
imgbtn
imagebutton
keyboard
label
led

View File

@@ -48,10 +48,10 @@ the last (or most recent) child.
Child Count
-----------
Use the function :cpp:expr:`lv_spangroup_get_child_count(spangroup)` to get back
Use the function :cpp:expr:`lv_spangroup_get_span_count(spangroup)` to get back
the number of spans the group is maintaining.
e.g. ``uint32_t size = lv_spangroup_get_child_count(spangroup)``
e.g. ``uint32_t size = lv_spangroup_get_span_count(spangroup)``
Text align
----------