acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

bar.md (2262B)

      1 ```eval_rst
      2 .. include:: /header.rst
      3 :github_url: |github_link_base|/widgets/core/bar.md
      4 ```
      5 # Bar (lv_bar)
      6 
      7 ## Overview
      8 
      9 The bar object has a background and an indicator on it. The width of the indicator is set according to the current value of the bar.
     10 
     11 Vertical bars can be created if the width of the object is smaller than its height.
     12 
     13 Not only the end, but also the start value of the bar can be set, which changes the start position of the indicator.
     14 
     15 
     16 ## Parts and Styles
     17 - `LV_PART_MAIN` The background of the bar and it uses the typical background style properties. Adding padding makes the indicator smaller or larger. The `anim_time` style property sets the animation time if the values set with `LV_ANIM_ON`.
     18 - `LV_PART_INDICATOR` The indicator itself; also uses all the typical background properties.
     19 
     20 ## Usage
     21 
     22 ### Value and range
     23 A new value can be set by `lv_bar_set_value(bar, new_value, LV_ANIM_ON/OFF)`.
     24 The value is interpreted in a range (minimum and maximum values) which can be modified with `lv_bar_set_range(bar, min, max)`.
     25 The default range is 0..100.
     26 
     27 The new value in `lv_bar_set_value` can be set with or without an animation depending on the last parameter (`LV_ANIM_ON/OFF`).
     28 
     29 ### Modes
     30 The bar can be one of the following modes:
     31 - `LV_BAR_MODE_NORMAL` A normal bar as described above
     32 - `LV_BAR_MODE_SYMMETRICAL` Draw the indicator from the zero value to current value. Requires a negative minimum range and positive maximum range.
     33 - `LV_BAR_MODE_RANGE` Allows setting the start value too by `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)`. The start value always has to be smaller than the end value.
     34 
     35 ## Events
     36 - `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for the following parts:
     37     - `LV_BAR_DRAW_PART_INDICATOR` The indicator of the bar
     38         - `part`: `LV_PART_INDICATOR`
     39         - `draw_area`: area of the indicator
     40         - `rect_dsc`
     41 
     42 See the events of the [Base object](/widgets/obj) too.
     43 
     44 Learn more about [Events](/overview/event).
     45 
     46 ## Keys
     47 No *Keys* are processed by the object type.
     48 
     49 Learn more about [Keys](/overview/indev).
     50 
     51 ## Example
     52 
     53 ```eval_rst
     54 
     55 .. include:: ../../../examples/widgets/bar/index.rst
     56 
     57 ```
     58 
     59 ## API
     60 
     61 ```eval_rst
     62 
     63 .. doxygenfile:: lv_bar.h
     64   :project: lvgl
     65 
     66 ```