本文へスキップ

CheckboxGroup

有限個のチェックボックス値をまとめ、必要に応じて親チェックボックスの状態も導出します。

デモを読み込み中…

#インポート

quickgui から CheckboxGroup をインポートします。

use quickgui::*;

#使い方

let group = CheckboxGroup::new("colors", &state);
group.root().flex_col().gap(8.0)

#構成

  • CheckboxGroup::root

#API リファレンス

項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。

CheckboxGroup

ソースを見る
pub fn new(root_id: impl Into<ElementId>, state: &'a CheckboxGroupState) -> Self
root_idpub const fn root_id(self) -> ElementId—

Configures root id for this part.

pub const fn root_id(self) -> ElementId
ソースを見る
statepub const fn state(self) -> &'a CheckboxGroupState—

Configures state for this part.

pub const fn state(self) -> &'a CheckboxGroupState
ソースを見る
checkbox_idpub fn checkbox_id(self, value: impl Into<ElementId>) -> ElementId—

Configures checkbox id for this part.

pub fn checkbox_id(self, value: impl Into<ElementId>) -> ElementId
ソースを見る
parent_idpub fn parent_id(self) -> ElementId—

Configures parent id for this part.

pub fn parent_id(self) -> ElementId
ソースを見る
on_checkbox_clickpub fn on_checkbox_click<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, value: impl Into<ElementId>, access: fn(&mut V) -> &mut CheckboxGroupState, on_value_change: Change, ) -> ClickListener<V> where Change: Fn(&mut V, &[ElementId], &mut EventContext) + 'static,—

Build the click behavior for one item, reporting the whole new value set. Attach the returned handle with [`crate::Element::on_click`].

pub fn on_checkbox_click<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, value: impl Into<ElementId>, access: fn(&mut V) -> &mut CheckboxGroupState, on_value_change: Change, ) -> ClickListener<V> where Change: Fn(&mut V, &[ElementId], &mut EventContext) + 'static,
ソースを見る
on_checkbox_click_withpub fn on_checkbox_click_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, value: impl Into<ElementId>, access: StateAccessor<V, CheckboxGroupState>, on_value_change: Change, ) -> ClickListener<V> where Change: Fn(&mut V, &[ElementId], &mut EventContext) + 'static,—

Build one item's click behavior against a per-instance state accessor.

pub fn on_checkbox_click_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, value: impl Into<ElementId>, access: StateAccessor<V, CheckboxGroupState>, on_value_change: Change, ) -> ClickListener<V> where Change: Fn(&mut V, &[ElementId], &mut EventContext) + 'static,
ソースを見る
on_parent_clickpub fn on_parent_click<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: fn(&mut V) -> &mut CheckboxGroupState, on_value_change: Change, ) -> ClickListener<V> where Change: Fn(&mut V, &[ElementId], &mut EventContext) + 'static,—

Build the parent checkbox's click behavior, reporting the whole new value set.

pub fn on_parent_click<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: fn(&mut V) -> &mut CheckboxGroupState, on_value_change: Change, ) -> ClickListener<V> where Change: Fn(&mut V, &[ElementId], &mut EventContext) + 'static,
ソースを見る
on_parent_click_withpub fn on_parent_click_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: StateAccessor<V, CheckboxGroupState>, on_value_change: Change, ) -> ClickListener<V> where Change: Fn(&mut V, &[ElementId], &mut EventContext) + 'static,—

Build the parent checkbox's click behavior against a per-instance state accessor.

pub fn on_parent_click_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: StateAccessor<V, CheckboxGroupState>, on_value_change: Change, ) -> ClickListener<V> where Change: Fn(&mut V, &[ElementId], &mut EventContext) + 'static,
ソースを見る

CheckboxGroup::root_with

ソースを見る
pub fn root_with(self, root: Element) -> Element

Decorate an application-owned group root without adding layout or appearance. Pair it with a [`crate::Field`] label, or with [`crate::Element::accessibility_labelled_by`], to name the group.

CheckboxGroup::root

ソースを見る
pub fn root(self) -> Element

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

CheckboxGroup::checkbox_with

ソースを見る
pub fn checkbox_with(self, value: impl Into<ElementId>, checkbox: Element) -> Element

Decorate one application-owned checkbox for `value`. The part reuses the existing [`Checkbox`] descriptor, so the checkbox role, exact on/off/mixed semantics, click behavior, and desktop pointer contract are identical to a standalone checkbox. A disabled group disables every item.

CheckboxGroup::checkbox

ソースを見る
pub fn checkbox(self, value: impl Into<ElementId>) -> Element

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

CheckboxGroup::indicator_with

ソースを見る
pub fn indicator_with(self, indicator: Element) -> Element

Hide an application-owned indicator inside one item from the accessible name.

CheckboxGroup::indicator

ソースを見る
pub fn indicator(self) -> Element

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

CheckboxGroup::parent_with

ソースを見る
pub fn parent_with(self, parent: Element) -> Element

Decorate the application-owned parent checkbox. Its checked state is derived: on when every declared value is checked, mixed when only some are, and off when none are. QuickGUI retains no separate parent value, so the parent can never disagree with its children.

CheckboxGroup::parent

ソースを見る
pub fn parent(self) -> Element

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