PreviewCard
現在の画面を変えず、トリガーの横により詳しいホバー/フォーカスプレビューを表示します。
デモを読み込み中…
let card = PreviewCard::new("file", &state);
card.trigger_with(text("README.md"))#インポート
quickgui から PreviewCard をインポートします。
use quickgui::*;#使い方
let card = PreviewCard::new("file", &state);
card.trigger_with(text("README.md"))#構成
PreviewCard::rootPreviewCard::triggerPreviewCard::portalPreviewCard::backdropPreviewCard::positionerPreviewCard::popupPreviewCard::arrow
#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
PreviewCard
ソースを見るpub fn new( trigger_id: impl Into<ElementId>, popup_id: impl Into<ElementId>, open: bool, ) -> SelfDeclare a preview card over caller-owned trigger and popup identities.
from_statepub fn from_state( trigger_id: impl Into<ElementId>, popup_id: impl Into<ElementId>, state: &PreviewCardState, ) -> Self—
Declare a preview card from its retained state.
pub fn from_state( trigger_id: impl Into<ElementId>, popup_id: impl Into<ElementId>, state: &PreviewCardState, ) -> Selfソースを見るplacementpub const fn placement(mut self, placement: AnchorPlacement) -> Self—
Configures placement for this part.
pub const fn placement(mut self, placement: AnchorPlacement) -> Selfソースを見るanchor_gappub fn anchor_gap(mut self, gap: f32) -> Self—
Set the structural distance between the trigger and the popup.
pub fn anchor_gap(mut self, gap: f32) -> Selfソースを見るviewport_marginpub fn viewport_margin(mut self, margin: f32) -> Self—
Set the structural collision margin inside the current window viewport.
pub fn viewport_margin(mut self, margin: f32) -> Selfソースを見るpopoverpub const fn popover(self) -> Popover—
The composed popover, for callers that need its remaining parts directly.
pub const fn popover(self) -> Popoverソースを見るis_openpub const fn is_open(self) -> bool—
trigger_idpub const fn trigger_id(self) -> ElementId—
popup_idpub const fn popup_id(self) -> ElementId—
positioner_idpub fn positioner_id(self) -> ElementId—
backdrop_idpub fn backdrop_id(self) -> ElementId—
arrow_idpub fn arrow_id(self) -> ElementId—
trigger_focuspub fn trigger_focus(self) -> FocusHandle—
on_trigger_hoverpub fn on_trigger_hover<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: fn(&mut V) -> &mut PreviewCardState, on_open_change: Change, ) -> HoverListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,—
Build the trigger's hover behavior. Attach the returned handle with [`crate::Element::on_hover`]. `on_open_change` runs only when the open value actually changes, which for the delayed open is on the frame the deadline is applied rather than on the pointer event that armed it.
pub fn on_trigger_hover<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: fn(&mut V) -> &mut PreviewCardState, on_open_change: Change, ) -> HoverListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,ソースを見るon_trigger_hover_withpub fn on_trigger_hover_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: StateAccessor<V, PreviewCardState>, on_open_change: Change, ) -> HoverListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,—
Build the trigger's hover behavior against a per-instance state accessor.
pub fn on_trigger_hover_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: StateAccessor<V, PreviewCardState>, on_open_change: Change, ) -> HoverListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,ソースを見るon_popup_hoverpub fn on_popup_hover<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: fn(&mut V) -> &mut PreviewCardState, on_open_change: Change, ) -> HoverListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,—
Build the popup's hover behavior, which keeps an open card open.
pub fn on_popup_hover<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: fn(&mut V) -> &mut PreviewCardState, on_open_change: Change, ) -> HoverListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,ソースを見るon_popup_hover_withpub fn on_popup_hover_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: StateAccessor<V, PreviewCardState>, on_open_change: Change, ) -> HoverListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,—
Build the popup's hover behavior against a per-instance state accessor.
pub fn on_popup_hover_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: StateAccessor<V, PreviewCardState>, on_open_change: Change, ) -> HoverListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,ソースを見るon_dismisspub fn on_dismiss<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: fn(&mut V) -> &mut PreviewCardState, on_open_change: Change, ) -> DismissListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,—
Build the popup's dismissal behavior for Escape and outside presses. Attach the returned handle with [`crate::Element::on_dismiss`].
pub fn on_dismiss<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: fn(&mut V) -> &mut PreviewCardState, on_open_change: Change, ) -> DismissListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,ソースを見るon_dismiss_withpub fn on_dismiss_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: StateAccessor<V, PreviewCardState>, on_open_change: Change, ) -> DismissListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,—
Build the popup's dismissal behavior against a per-instance state accessor.
pub fn on_dismiss_with<V: 'static, Change>( self, cx: &mut ViewContext<'_, V>, access: StateAccessor<V, PreviewCardState>, on_open_change: Change, ) -> DismissListener<V> where Change: Fn(&mut V, bool, &mut EventContext) + 'static,ソースを見るschedulepub fn schedule<V: 'static>(cx: &mut ViewContext<'_, V>, state: &PreviewCardState)—
Ask for the one repaint an armed open or close deadline needs. Call this while rendering. A settled preview card requests nothing, so the window sleeps.
pub fn schedule<V: 'static>(cx: &mut ViewContext<'_, V>, state: &PreviewCardState)ソースを見るPreviewCard::root_with
ソースを見るpub fn root_with(self, root: Element) -> ElementDecorate the optional application-owned structural wrapper. A preview card needs no wrapper of its own; this part exists so a composition that wants one keeps the trigger out of the window's native drag region without inventing appearance.
PreviewCard::root
ソースを見るpub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
PreviewCard::trigger_with
ソースを見るpub fn trigger_with(self, trigger: Element) -> ElementDecorate the application-owned link-like trigger without adding appearance. Unlike a popover trigger, this projects the Link role: a preview card previews a destination rather than opening a menu, so the trigger stays an ordinary link for the keyboard and for assistive technology.
PreviewCard::trigger
ソースを見るpub fn trigger(self) -> ElementCreate the unstyled trigger part. Use [`Self::trigger_with`] to supply an existing element.
PreviewCard::portal_with
ソースを見るpub fn portal_with(self, portal: Element) -> ElementDecorate the caller-owned portal boundary. QuickGUI's retained overlay node is itself the portal, so this is the same boundary as [`Self::positioner_with`]; mount exactly one of them.
PreviewCard::portal
ソースを見るpub fn portal(self) -> ElementCreate the unstyled portal part. Use [`Self::portal_with`] to supply an existing element.
PreviewCard::positioner_with
ソースを見るpub fn positioner_with(self, positioner: Element) -> ElementDecorate the caller-owned positioner without adding appearance.
PreviewCard::positioner
ソースを見るpub fn positioner(self) -> ElementCreate the unstyled positioner part. Use [`Self::positioner_with`] to supply an existing element.
PreviewCard::popup_with
ソースを見るpub fn popup_with(self, popup: Element) -> ElementDecorate the application-owned popup without adding layout or appearance. The popup emits [`crate::Event::Dismiss`] under [`Self::popup_id`] for Escape and for an outside pointer press, and restores focus to the trigger.
PreviewCard::popup
ソースを見るpub fn popup(self) -> ElementCreate the unstyled popup part. Use [`Self::popup_with`] to supply an existing element.
PreviewCard::arrow_with
ソースを見るpub fn arrow_with(self, arrow: Element) -> ElementDecorate the application-owned arrow. The arrow is decorative: it carries a stable identity so the application can position and animate it, and is hidden from assistive technology.
PreviewCard::arrow
ソースを見るpub fn arrow(self) -> ElementCreate the unstyled arrow part. Use [`Self::arrow_with`] to supply an existing element.
PreviewCard::backdrop_with
ソースを見るpub fn backdrop_with(self, backdrop: Element) -> ElementDecorate an optional caller-painted viewport backdrop.
PreviewCard::backdrop
ソースを見るpub fn backdrop(self) -> ElementCreate the unstyled backdrop part. Use [`Self::backdrop_with`] to supply an existing element.
