1# Window (lv_win)
2
3## Overview
4
5The Window is container-like object built from a header with title and buttons and a content area.
6
7## Parts and Styles
8The Window is built from other widgets so you can check their documentation for details:
9- Background: [lv_obj](/widgets/obj)
10- Header on the background: [lv_obj](/widgets/obj)
11- Title on the header: [lv_label](/widgets/core/label)
12- Buttons on the header: [lv_btn](/widgets/core/btn)
13- Content area on the background: [lv_obj](/widgets/obj)
14
15
16## Usage
17
18### Create a Window
19
20`lv_win_create(parent, header_height)` creates a Window with an empty header.
21
22### Title and buttons
23
24Any number of texts (but typically only one) can be added to the header with `lv_win_add_title(win, "The title")`.
25
26Control buttons can be added to the window's header with `lv_win_add_btn(win, icon, btn_width)`. `icon` can be any image source, and `btn_width` is the width of the button.
27
28The 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 a button on the left, a title, and 2 buttons on the right.
29The width of the title is set to take all the remaining space on the header. In other words: it pushes to the right all the buttons that are added after the title.
30
31## Get the parts
32`lv_win_get_header(win)` returns 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.
33
34## Events
35No special events are sent by the windows, however events can be added manually to the return value of `lv_win_add_btn`.
36
37Learn more about [Events](/overview/event).
38
39## Keys
40No *Keys* are handled by the window.
41
42Learn more about [Keys](/overview/indev).
43
44
45## Example
46
47```eval_rst
48
49.. include:: ../../../examples/widgets/win/index.rst
50
51```
52
53
54## API
55
56```eval_rst
57
58.. doxygenfile:: lv_win.h
59  :project: lvgl
60
61```
62