ScrollArea
スクロール可能なビューポートと、呼び出し側でスタイルできるスクロールバー、つまみ、コーナーを組み合わせます。
デモを読み込み中…
let area = ScrollArea::new("log");
area.viewport().h(160.0).overflow_hidden()#インポート
quickgui から ScrollArea をインポートします。
use quickgui::*;#使い方
let area = ScrollArea::new("log");
area.viewport().h(160.0).overflow_hidden()#構成
ScrollArea::rootScrollArea::viewportScrollArea::contentScrollArea::scrollbarScrollArea::thumbScrollArea::corner
#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
ScrollArea
ソースを見るpub fn new(root_id: impl Into<ElementId>) -> Selfkeep_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—
root_idpub const fn root_id(self) -> ElementId—
viewport_idpub fn viewport_id(self) -> ElementId—
content_idpub 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—
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) -> ElementDecorate an application-owned root without adding layout or appearance.
ScrollArea::root
ソースを見るpub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
ScrollArea::viewport_with
ソースを見るpub fn viewport_with(self, viewport: Element) -> ElementDecorate 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) -> ElementCreate the unstyled viewport part. Use [`Self::viewport_with`] to supply an existing element.
ScrollArea::content_with
ソースを見るpub fn content_with(self, content: Element) -> ElementDecorate 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) -> ElementCreate 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, ) -> ElementDecorate 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) -> ElementCreate 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) -> ElementDecorate 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) -> ElementCreate 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, ) -> ElementDecorate 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, ) -> ElementCreate 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) -> ElementDecorate the application-owned corner between a horizontal and a vertical scrollbar.
ScrollArea::corner
ソースを見るpub fn corner(self) -> ElementCreate the unstyled corner part. Use [`Self::corner_with`] to supply an existing element.
