跳到正文

ToggleGroup

配合移动式键盘焦点管理单选或多选的按下值。

正在加载交互演示…

#导入

从 quickgui 导入 ToggleGroup。

use quickgui::*;

#用法

let group = ToggleGroup::new("align", &state, &items);
group.root().flex_row()

#结构

  • ToggleGroup::root
  • ToggleGroup::item

#API 参考

展开条目查看说明和完整签名。短横线表示声明中未记录默认值。

ToggleGroup

查看源码
pub fn new( root_id: impl Into<ElementId>, state: &'a ToggleGroupState, items: &'a [ToggleGroupItem], ) -> Self

Create a toggle group over the caller's ordered items. # Panics Panics with more than [`MAX_TOGGLE_GROUP_ITEMS`] items or duplicate item values.

verticalpub const fn vertical(mut self) -> Self—

Configures vertical for this part.

pub const fn vertical(mut self) -> Self
查看源码
loop_focuspub const fn loop_focus(mut self, loop_focus: bool) -> Self—

Configures loop focus for this part.

pub const fn loop_focus(mut self, loop_focus: bool) -> Self
查看源码
root_idpub const fn root_id(self) -> ElementId—

Configures root id for this part.

pub const fn root_id(self) -> ElementId
查看源码
itemspub const fn items(self) -> &'a [ToggleGroupItem]—

Configures items for this part.

pub const fn items(self) -> &'a [ToggleGroupItem]
查看源码
item_idpub fn item_id(self, value: impl Into<ElementId>) -> ElementId—

Configures item id for this part.

pub fn item_id(self, value: impl Into<ElementId>) -> ElementId
查看源码
roving_valuepub fn roving_value(self) -> Option<ElementId>—

The item that currently owns the group's single Tab stop. The controlled active value wins, then the first pressed enabled item, then the first enabled item.

pub fn roving_value(self) -> Option<ElementId>
查看源码
itempub fn item(self, value: impl Into<ElementId>) -> Option<ToggleGroupEntry<'a>>—

Describe one declared item.

pub fn item(self, value: impl Into<ElementId>) -> Option<ToggleGroupEntry<'a>>
查看源码

ToggleGroup::root_with

查看源码
pub fn root_with(self, root: Element) -> Element

Decorate an application-owned group root without adding layout or appearance.

ToggleGroup::root

查看源码
pub fn root(self) -> Element

Create the unstyled root part. Use [`Self::root_with`] to supply an existing element.