本文へスキップ

ScrollArea

スクロール可能なビューポートと、呼び出し側でスタイルできるスクロールバー、つまみ、コーナーを組み合わせます。

デモを読み込み中…

#インポート

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

use quickgui::*;

#使い方

let area = ScrollArea::new("log");
area.viewport().h(160.0).overflow_hidden()

#構成

  • ScrollArea::root
  • ScrollArea::viewport
  • ScrollArea::content
  • ScrollArea::scrollbar
  • ScrollArea::thumb
  • ScrollArea::corner

#API リファレンス

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

pub fn new(root_id: impl Into<ElementId>) -> Self
keep_mountedpub const fn keep_mounted(mut self, keep_mounted: bool) -> Self—

Keep a scrollbar mounted while its axis does not overflow. The default unmounts it, matching Base UI's `keepMounted={false}`. A kept scrollbar is hidden from assistive technology while its axis cannot scroll, so a mounted-but-useless scrollbar is never announced.

pub const fn keep_mounted(mut self, keep_mounted: bool) -> Self
ソースを見る
is_keep_mountedpub const fn is_keep_mounted(self) -> bool—

Configures is keep mounted for this part.

pub const fn is_keep_mounted(self) -> bool
ソースを見る
root_idpub const fn root_id(self) -> ElementId—

Configures root id for this part.

pub const fn root_id(self) -> ElementId
ソースを見る
viewport_idpub fn viewport_id(self) -> ElementId—

Configures viewport id for this part.

pub fn viewport_id(self) -> ElementId
ソースを見る
content_idpub fn content_id(self) -> ElementId—

Configures content id for this part.

pub fn content_id(self) -> ElementId
ソースを見る
scrollbar_idpub fn scrollbar_id(self, orientation: ScrollAreaOrientation) -> ElementId—

Configures scrollbar id for this part.

pub fn scrollbar_id(self, orientation: ScrollAreaOrientation) -> ElementId
ソースを見る
thumb_idpub fn thumb_id(self, orientation: ScrollAreaOrientation) -> ElementId—

Configures thumb id for this part.

pub fn thumb_id(self, orientation: ScrollAreaOrientation) -> ElementId
ソースを見る
corner_idpub fn corner_id(self) -> ElementId—

Configures corner id for this part.

pub fn corner_id(self) -> ElementId
ソースを見る
shows_scrollbarpub fn shows_scrollbar( self, state: &ScrollAreaState, orientation: ScrollAreaOrientation, ) -> bool—

Whether a scrollbar for `orientation` should be mounted at all.

pub fn shows_scrollbar( self, state: &ScrollAreaState, orientation: ScrollAreaOrientation, ) -> bool
ソースを見る
shows_cornerpub fn shows_corner(self, state: &ScrollAreaState) -> bool—

Whether the corner between two scrollbars should be mounted.

pub fn shows_corner(self, state: &ScrollAreaState) -> bool
ソースを見る

ScrollArea::root_with

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

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

ScrollArea::root

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

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

ScrollArea::viewport_with

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

Decorate the application-owned scroll container. The viewport clips its content on both axes and carries the ScrollView role. The caller places the content by translating [`Self::content_with`] with the retained offset, which keeps scrolling paint-only and keeps QuickGUI's built-in overlay scrollbar out of a component whose scrollbars the application draws itself.

ScrollArea::viewport

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

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

ScrollArea::content_with

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

Decorate the application-owned scrolled content. Translate it by the negated [`ScrollAreaState::offset`]; QuickGUI adds no transform of its own so the application keeps full control of the motion.

ScrollArea::content

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

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

ScrollArea::scrollbar_with

ソースを見る
pub fn scrollbar_with( self, state: &ScrollAreaState, orientation: ScrollAreaOrientation, scrollbar: Element, ) -> Element

Decorate one application-owned scrollbar track. The track projects the ScrollBar role with the exact current position, the scrollable range, and its orientation. It is not focusable: a scrollbar duplicates keyboard scrolling the viewport already provides, so it stays out of the Tab sequence.

ScrollArea::scrollbar

ソースを見る
pub fn scrollbar(self, state: &ScrollAreaState, orientation: ScrollAreaOrientation) -> Element

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

ScrollArea::thumb_with

ソースを見る
pub fn thumb_with(self, orientation: ScrollAreaOrientation, thumb: Element) -> Element

Decorate one application-owned scrollbar thumb. The thumb carries the captured pointer drag. Attach a [`crate::ViewContext::pointer_listener`] registered for [`Self::thumb_id`] and forward the event to [`ScrollAreaState::apply_thumb_pointer`] with the track length the caller laid out.

ScrollArea::thumb

ソースを見る
pub fn thumb(self, orientation: ScrollAreaOrientation) -> Element

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

ScrollArea::positioned_thumb_with

ソースを見る
pub fn positioned_thumb_with( self, state: &ScrollAreaState, orientation: ScrollAreaOrientation, track_length: f32, thumb: Element, ) -> Element

Decorate and position one application-owned scrollbar thumb inside its scrollbar. This is [`Self::thumb_with`] plus the structural geometry a draggable thumb needs: the thumb is absolutely positioned along the scrollbar's axis at [`ScrollAreaState::thumb_offset`] with [`ScrollAreaState::thumb_length`], so it follows the offset without the application re-deriving either value. Cross-axis size and every visual property stay application-owned.

ScrollArea::positioned_thumb

ソースを見る
pub fn positioned_thumb( self, state: &ScrollAreaState, orientation: ScrollAreaOrientation, track_length: f32, ) -> Element

Create the unstyled positioned thumb part. Use [`Self::positioned_thumb_with`] to supply an existing element.

ScrollArea::corner_with

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

Decorate the application-owned corner between a horizontal and a vertical scrollbar.

ScrollArea::corner

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

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