Skip to content

Latest commit

 

History

History
executable file
·
206 lines (121 loc) · 4.46 KB

win.rst

File metadata and controls

executable file
·
206 lines (121 loc) · 4.46 KB

Window (窗口)(lv_win)

Overview

显示原文

The Window is container-like object built from a header with title and buttons and a content area.


窗口是类似容器的对象,由带有标题和按钮的标题以及内容区域构建。

Parts and Styles(零件和样式)

显示原文

The Window is built from other widgets so you can check their documentation for details:

  • Background: lv_obj
  • Header on the background: lv_obj
  • Title on the header: lv_label
  • Buttons on the header: lv_button
  • Content area on the background: lv_obj

该窗口是由其他控件构建的,因此您可以查看它们的文档以获取详细信息:

  • 背景:lv_obj
  • 背景标题:lv_obj
  • 标题上的标题:lv_label
  • 标题上的按钮: lv_button
  • 背景内容区:lv_obj

Usage(用法)

Create a Window(创建一个窗口)

显示原文

:cpplv_win_create(parent, header_height) creates a Window with an empty header.


:cpplv_win_create(parent, header_height) 创建一个带有空标题的窗口。

Title and buttons(标题和按钮)

显示原文

Any number of texts (but typically only one) can be added to the header with :cpplv_win_add_title(win, "The title").

Control buttons can be added to the window's header with :cpplv_win_add_button(win, icon, button_width). icon can be any image source, and button_width is the width of the button.

The 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. The 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.


可以使用 :cpplv_win_add_title(win, "The title") 将任意数量的文本(但通常只有一个)添加到标题中。

可以使用 :cpplv_win_add_button(win, icon, button_width) 将控制按钮添加到窗口的标题 。 icon 可以是任何图像源, button_width 是按钮的宽度。

标题和按钮将按照函数调用的顺序添加。因此,添加一个按钮、一个文本和另外两个按钮将导致左侧有一个按钮、一个标题和右侧有两个按钮。标题的宽度设置为占据标题上的所有剩余空间。换句话说:它将标题后添加的所有按钮推到右侧。

Get the parts(获取零件)

显示原文

:cpplv_win_get_header(win) returns a pointer to the header, :cpplv_win_get_content(win) returns a pointer to the content container to which the content of the window can be added.


:cpplv_win_get_header(win) 返回一个指向标题的指针, :cpplv_win_get_content(win) 返回一个指向可以添加窗口内容的内容容器的指针。

Events(事件)

显示原文

No special events are sent by the windows, however events can be added manually to the return value of :cpplv_win_add_button.

Learn more about events.


窗口不会发送特殊事件,但是可以手动将事件添加到 :cpplv_win_add_button 的返回值中。

了解有关 events 的更多信息。

Keys

显示原文

No Keys are handled by the window.

Learn more about indev_keys.


窗口不处理任何 按键

了解有关 indev_keys 的更多信息。

Example

API