docs update some widgets to v8
This commit is contained in:
@@ -30,7 +30,7 @@ The new value in `lv_bar_set_value` can be set with or without an animation depe
|
||||
The bar can be one the following modes:
|
||||
- `LV_BAR_MODE_NORMAL` A normal bar as described above
|
||||
- `LV_BAR_SYMMETRICAL` Draw the indicator form the zero value to current value. Requires negaitve minimum range and positive maximum range.
|
||||
- `LV_BAR_RANGE` Allows setting the setar value too by `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)`. The start value has to be always smaller than the end value.
|
||||
- `LV_BAR_RANGE` Allows setting the start value too by `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)`. The start value has to be always smaller than the end value.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both main and indicator parts to allow hooking the drawing.
|
||||
|
||||
@@ -10,45 +10,39 @@ The Slider object looks like a [Bar](/widgets/core/bar) supplemented with a knob
|
||||
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the Slider and it uses all the typical background style properties. `padding` makes the indicator smaller in the respective direction.
|
||||
- `LV_PART_INDICATOR` The indccator the show the current state os the slider. Also uses all the typical background style properties.
|
||||
`LV_SLIDER_PART_INDIC` is a virtual part which also uses all the typical background properties.
|
||||
By default, the indicator maximal size is the same as the background's size but setting positive padding values in `LV_SLIDER_PART_BG` will make the indicator smaller. (negative values will make it larger)
|
||||
If the *value* style property is used on the indicator the alignment will be calculated based on the current size of the indicator.
|
||||
For example a center aligned value is always shown in the middle of the indicator regardless it's current size.
|
||||
|
||||
`LV_SLIDER_PART_KNOB` is a virtual part using all the typical background properties to describe the knob(s). Similarly to the *indicator* the *value* text is also aligned to the current position and size of the knob.
|
||||
By default the knob is square (with a radius) with side length equal to the smaller side of the slider. The knob can be made larger with the *padding* values. Padding values can be asymmetric too.
|
||||
- `LV_PART_MAIN` The background of the slider and it uses all the typical background style properties. `padding` makes the indicator smaller in the respective direction.
|
||||
- `LV_PART_INDICATOR` The indicator the show the current state of the slider. Also uses all the typical background style properties.
|
||||
- `LV_PART_KNOB` A rectangle (or circle) drawn at the current value. It also uses all the typical background properties to describe the knob(s). By default the knob is square (with a optional radius) with side length equal to the smaller side of the slider. The knob can be made larger with the `padding` values. Padding values can be asymmetric too.
|
||||
|
||||
## Usage
|
||||
|
||||
### Value and range
|
||||
To set an initial value use `lv_slider_set_value(slider, new_value, LV_ANIM_ON/OFF)`.
|
||||
`lv_slider_set_anim_time(slider, anim_time)` sets the animation time in milliseconds.
|
||||
To set an initial value use `lv_slider_set_value(slider, new_value, LV_ANIM_ON/OFF)`. The animation time is set by the styles' `anim_time` property.
|
||||
|
||||
To specify the range (min, max values) the `lv_slider_set_range(slider, min , max)` can be used.
|
||||
|
||||
### Symmetrical and Range
|
||||
Besides the normal type the Slider can be configured in two additional types:
|
||||
- `LV_SLIDER_TYPE_NORMAL` normal type
|
||||
- `LV_SLIDER_TYPE_SYMMETRICAL` draw the indicator symmetrical to zero (drawn from zero, left to right)
|
||||
- `LV_SLIDER_TYPE_RANGE` allow the use of an additional knob for the left (start) value. (Can be used with `lv_slider_set/get_left_value()`)
|
||||
### Modes
|
||||
The slider can be one the following modes:
|
||||
- `LV_SLIDER_MODE_NORMAL` A normal slider as described above
|
||||
- `LV_SLIDER_SYMMETRICAL` Draw the indicator form the zero value to current value. Requires negaitve minimum range and positive maximum range.
|
||||
- `LV_SLIDER_RANGE` Allows setting the start value too by `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)`. The start value has to be always smaller than the end value.
|
||||
|
||||
The type can be changed with `lv_slider_set_type(slider, LV_SLIDER_TYPE_...)`
|
||||
The mode can be changed with `lv_slider_set_mode(slider, LV_SLIDER_MODE_...)`
|
||||
|
||||
### Knob-only mode
|
||||
Normally, the slider can be adjusted either by dragging the knob, or clicking on the slider bar.
|
||||
In the latter case the knob moves to the point clicked and slider value changes accordingly. In some cases it is desirable to set the slider to react on dragging the knob only.
|
||||
|
||||
This feature is enabled by calling `lv_obj_set_adv_hittest(slider, true);`.
|
||||
This feature is enabled by adding the `LV_OBJ_FLAG_ADV_HITTEST`: `lv_obj_add_flag(slider, LV_OBJ_FLAG_ADV_HITTEST)`.
|
||||
|
||||
## Events
|
||||
Besides the [Generic events](../overview/event.html#generic-events) the following [Special events](../overview/event.html#special-events) are sent by the Slider:
|
||||
- **LV_EVENT_VALUE_CHANGED** Sent while the slider is being dragged or changed with keys. The event is sent continuously while the slider is dragged and only when it is released. Use `lv_slider_is_dragged` to decide whether is slider is being dragged or just released.
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent while the slider is being dragged or changed with keys.
|
||||
The event is sent continuously while the slider is dragged and only when it is released. Use `lv_slider_is_dragged` to decide whether is slider is being dragged or just released.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
## Keys
|
||||
- **LV_KEY_UP**, **LV_KEY_RIGHT** Increment the slider's value by 1
|
||||
- **LV_KEY_DOWN**, **LV_KEY_LEFT** Decrement the slider's value by 1
|
||||
- `LV_KEY_UP/RIGHT` Increment the slider's value by 1
|
||||
- `LV_KEY_DOWN/LEFT` Decrement the slider's value by 1
|
||||
|
||||
Learn more about [Keys](/overview/indev).
|
||||
|
||||
@@ -56,11 +50,10 @@ Learn more about [Keys](/overview/indev).
|
||||
|
||||
```eval_rst
|
||||
|
||||
.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_slider/index.rst
|
||||
.. include:: ../../../examples/widgets/lv_example_slider/index.rst
|
||||
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
```eval_rst
|
||||
|
||||
@@ -11,30 +11,26 @@ The Switch can be used to turn on/off something. It looks like a little slider.
|
||||
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the switch and it uses all the typical background style properties. `padding` makes the indicator smaller in the respective direction.
|
||||
- `LV_PART_INDICATOR` The indicator the show the current state of the switch. Also uses all the typical background style properties.
|
||||
- `LV_PART_KNOB` A rectangle (or circle) drawn at left or right side of teh indicator. It also uses all the typical background properties to describe the knob(s). By default the knob is square (with a optional radius) with side length equal to the smaller side of the slider. The knob can be made larger with the `padding` values. Padding values can be asymmetric too.
|
||||
|
||||
The Switch uses the the following parts:
|
||||
- `LV_SWITCH_PART_BG`: main part
|
||||
- `LV_SWITCH_PART_INDIC`: the indicator (virtual part)
|
||||
- `LV_SWITCH_PART_KNOB`: the knob (virtual part)
|
||||
|
||||
The parts and style works the same as in case of [Slider](/widgets/slider). Read its documentation for a details description.
|
||||
|
||||
##Usage
|
||||
## Usage
|
||||
|
||||
### Change state
|
||||
The state of the Switch can be changed by clicking on it or by `lv_switch_on(switch, LV_ANIM_ON/OFF)`, `lv_switch_off(switch, LV_ANIM_ON/OFF)` or `lv_switch_toggle(switch, LV_ANOM_ON/OFF)` functions
|
||||
When the switch is turned on it goes to `LV_STATE_CHACKED`. To get the current satte of the switch use `lv_obj_has_state(switch, LV_STATE_CHECHKED)`.
|
||||
To manually turn the switch on/off call `lvobj_add/clear_state(switch, LV_STATE_CHECKED)`.
|
||||
|
||||
### Animation time
|
||||
|
||||
The time of animations, when the switch changes state, can be adjusted with `lv_switch_set_anim_time(switch, anim_time)`.
|
||||
|
||||
## Events
|
||||
Besides the [Generic events](../overview/event.html#generic-events) the following [Special events](../overview/event.html#special-events) are sent by the Switch:
|
||||
- **LV_EVENT_VALUE_CHANGED** Sent when the switch changes state.
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when the switch changes state.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
## Keys
|
||||
- **LV_KEY_UP**, **LV_KEY_RIGHT** Turn on the slider
|
||||
- **LV_KEY_DOWN**, **LV_KEY_LEFT** Turn off the slider
|
||||
- `LV_KEY_UP/RIGHT` Turns on the slider
|
||||
- `LV_KEY_DOWN/LEFT` Turns off the slider
|
||||
- `LV_KEY_ENTER` Toggles the switch
|
||||
|
||||
Learn more about [Keys](/overview/indev).
|
||||
|
||||
@@ -42,11 +38,10 @@ Learn more about [Keys](/overview/indev).
|
||||
|
||||
```eval_rst
|
||||
|
||||
.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_switch/index.rst
|
||||
.. include:: ../../../examples/widgets/lv_ex_switch/index.rst
|
||||
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
```eval_rst
|
||||
|
||||
@@ -12,32 +12,12 @@ The Table object is very light weighted because only the texts are stored. No re
|
||||
|
||||
|
||||
## Parts and Styles
|
||||
The main part of the Table is called `LV_TABLE_PART_BG`. It's a rectangle like background and uses all the typical background style properties.
|
||||
- `LV_PART_MAIN` The background of the table and uses all the typical background style properties.
|
||||
- `LV_PART_ITEMS` The cells of the table and they also use all the typical background style properties and the text properties.
|
||||
|
||||
For the cells there are 4 virtual parts. Every cell has type (1, 2, ... 16) which tells which part's styles to apply on them. The cell parts can be referenced by `LV_TABLE_PART_CELL1 + x` where `x` is between `0..15`.
|
||||
|
||||
The number of cell types can be adjusted in `lv_conf.h` by `LV_TABLE_CELL_STYLE_CNT`. By default it's 4. The default 4 cell types' part be referenced with dedicated names too:
|
||||
- `LV_TABLE_PART_CELL1`
|
||||
- `LV_TABLE_PART_CELL2`
|
||||
- `LV_TABLE_PART_CELL3`
|
||||
- `LV_TABLE_PART_CELL4`
|
||||
|
||||
The cells also use all the typical background style properties. If there is a line break (`\n`) in a cell's content then a horizontal division line will drawn after the line break using the *line* style properties.
|
||||
|
||||
The style of texts in the cells are inherited from the cell parts or the background part.
|
||||
|
||||
## Usage
|
||||
|
||||
### Rows and Columns
|
||||
|
||||
To set number of rows and columns use `lv_table_set_row_cnt(table, row_cnt)` and `lv_table_set_col_cnt(table, col_cnt)`
|
||||
|
||||
### Width and Height
|
||||
|
||||
The width of the columns can be set with `lv_table_set_col_width(table, col_id, width)`. The overall width of the Table object will be set to the sum of columns widths.
|
||||
|
||||
The height is calculated automatically from the cell styles (font, padding etc) and the number of rows.
|
||||
|
||||
### Set cell value
|
||||
|
||||
The cells can store only texts so numbers needs to be converted to text before displaying them in a table.
|
||||
@@ -46,36 +26,33 @@ The cells can store only texts so numbers needs to be converted to text before d
|
||||
|
||||
Line break can be used in the text like `"Value\n60.3"`.
|
||||
|
||||
### Align
|
||||
The new rows and column are automatically added is required
|
||||
|
||||
The text alignment in cells can be adjusted individually with `lv_table_set_cell_align(table, row, col, LV_LABEL_ALIGN_LEFT/CENTER/RIGHT)`.
|
||||
### Rows and Columns
|
||||
|
||||
### Cell type
|
||||
To explicitly set number of rows and columns use `lv_table_set_row_cnt(table, row_cnt)` and `lv_table_set_col_cnt(table, col_cnt)`
|
||||
|
||||
You can use 4 different cell types. Each has its own style.
|
||||
### Width and Height
|
||||
|
||||
Cell types can be used to add different style for example to:
|
||||
- table header
|
||||
- first column
|
||||
- highlight a cell
|
||||
- etc
|
||||
The width of the columns can be set with `lv_table_set_col_width(table, col_id, width)`. The overall width of the Table object will be set to the sum of columns widths.
|
||||
|
||||
The type can be selected with `lv_table_set_cell_type(table, row, col, type)` `type` can be 1, 2, 3 or 4.
|
||||
The height is calculated automatically from the cell styles (font, padding etc) and the number of rows.
|
||||
|
||||
### Merge cells
|
||||
|
||||
Cells can be merged horizontally with `lv_table_set_cell_merge_right(table, col, row, true)`. To merge more adjacent cells apply this function for each cell.
|
||||
|
||||
|
||||
### Crop text
|
||||
By default, the texts are word-wrapped to fit into the width of the cell and the height of the cell is set automatically.
|
||||
To disable this and keep the text as it is enable `lv_table_set_cell_crop(table, row, col, true)`.
|
||||
|
||||
### Scroll
|
||||
The make the Table scrollable place it on a [Page](/widgets/page)
|
||||
If the label's width or height is set to `LV_SIZE_CONTENT` that size will be se to show the whole table in the respective direction.
|
||||
E.g. `lv_obj_set_size(table, LV_SIZE_CONTENT, LV_SIZE_CONTENT)` automatically sets the table size to show all the columns and rows.
|
||||
|
||||
If the width or height is set to smaller number than the "intrinsic" size then the table becomes scrollable.
|
||||
|
||||
## Events
|
||||
Only the [Generic events](../overview/event.html#generic-events) are sent by the object type.
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both main and items parts to allow hooking the drawing.
|
||||
The for more detail on the main part see the [Base object](/widgets/obj#events)'s documentation.
|
||||
For the items (sells) the following fields are used: `clip_area`, `draw_area`, `part`, `rect_dsc`, `label_dsc` `id` (current row × col count + current column).
|
||||
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user