1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

66 lines
2.0 KiB
Markdown
Raw Normal View History

```eval_rst
.. include:: /header.rst
:github_url: |github_link_base|/widgets/win.md
```
# Window (lv_win)
## Overview
The Window is container-like objects built from a header with title and button and a content area.
## Parts and Styles
2021-05-19 13:51:22 +02:00
The Window is built from other widgets so you can check these widget's documentation for details:
- Background: [lv_obj](/widgets/obj)
- Header on the background: [lv_obj](/widgets/obj)
- Title on the header: [lv_label](/widgets/core/label)
- Buttons on the header: [lv_btn](/widgets/core/btn)
- Content area on the background: [lv_obj](/widgets/obj)
2021-05-19 13:51:22 +02:00
## Usage
2021-05-19 13:51:22 +02:00
### Create a Window
2021-05-19 13:51:22 +02:00
`lv_win_create(parent, header_height)` creates a Window with am empty header.
2021-05-19 13:51:22 +02:00
### Title and buttons
2021-05-19 13:51:22 +02:00
Any number of text's (but typically only one) can be added to the header with `lv_win_add_title(win, "The title")`.
2021-05-19 13:51:22 +02:00
Control buttons can be added to the window's header with `lv_win_add_btn_right(win, icon, btn_width)`. `icon` can be any image source, and `btn_width` is the width of the button.
2021-05-19 13:51:22 +02:00
The title and the buttons will be added in the order of the functions are called. So adding a button, a text and two other buttons will result in a button on the left, a title, ant 2 buttons on the right.
The width of the title is set to take all the remaining space on the header. In other words it pushes the buttons to the right added after the title.
2021-05-19 13:51:22 +02:00
## Get the parts
`lv_win_get_header(win)` return a pointer to the header, `lv_win_get_content(win)` returns a pointer to the content container to which the content of the window can be added.
## Events
2021-05-19 13:51:22 +02:00
No special events are sent by the windows, however events can be added manually to the return value of `lv_win_add_btn_right`.
Learn more about [Events](/overview/event).
## Keys
2021-05-19 13:51:22 +02:00
No *Keys* are handled by the window.
Learn more about [Keys](/overview/indev).
## Example
```eval_rst
2021-05-19 13:51:22 +02:00
.. include:: ../../../examples/widgets/win/index.rst
```
## API
```eval_rst
.. doxygenfile:: lv_win.h
:project: lvgl
```