[−][src]Struct thyme::ScrollpaneBuilder
A WidgetBuilder
specifically for creating scrollpanes.
Create this using WidgetBuilder.scrollpane
.
Scrollpanes can have fairly complex behavior, and can include optional horizontal and vertical scrollbars.
Scrollbars are, by default, only shown when the content size exceeds the pane's inner size.
There is also a scrollpane method
on Frame
as a convenience for simple cases.
Once you are finished setting up the scrollpane, you call children
to add children to the scrollpane
content and add the widget to the frame. Note that the children are added to the scrollpane's content, not directly to
the scrollpane itself.
Example
fn build_scrollpane(ui: &mut Frame, unique_id: &str) { ui.start("scrollpane") .scrollpane(unique_id) .show_horizontal_scrollbar(ShowElement::Never) .children(|ui| { // scrollable UI here }) }
Theme definition
An example of a theme definition for a scrollpane:
scrollpane:
width_from: Parent
height_from: Parent
border: { all: 5 }
children:
content:
height_from: Parent
width_from: Parent
align: TopLeft
layout: Vertical
size: [-15, -15]
child_align: TopLeft
scrollbar_horizontal:
from: scrollbar_horizontal
scrollbar_vertical:
from: scrollbar_vertical
scroll_button:
wants_mouse: true
background: gui/small_button
size: [20, 20]
border: { all: 4 }
scrollbar_horizontal:
size: [10, 20]
pos: [-5, -5]
align: BotLeft
width_from: Parent
children:
left:
from: scroll_button
align: Left
foreground: gui/arrow_left
right:
from: scroll_button
align: Right
pos: [20, 0]
foreground: gui/arrow_right
scroll:
wants_mouse: true
background: gui/small_button
align: Left
border: { all: 4 }
scrollbar_vertical:
size: [20, 10]
pos: [-5, -5]
align: TopRight
height_from: Parent
children:
up:
from: scroll_button
align: Top
foreground: gui/arrow_up
down:
from: scroll_button
align: Bot
foreground: gui/arrow_down
pos: [0, 20]
scroll:
wants_mouse: true
background: gui/small_button
align: Top
border: { all: 4 }
Implementations
impl<'a> ScrollpaneBuilder<'a>
[src]
pub fn show_vertical_scrollbar(self, show: ShowElement) -> ScrollpaneBuilder<'a>
[src]
Specify when to show the vertical scrollbar in this scrollpane. If show
is
equal to Sometimes
, will show the vertical scrollbar if the pane content height
is greater than the scrollpane's inner height.
pub fn show_horizontal_scrollbar(
self,
show: ShowElement
) -> ScrollpaneBuilder<'a>
[src]
self,
show: ShowElement
) -> ScrollpaneBuilder<'a>
Specify when to show the horizontal scrollbar in this scrollpane. If show
is
equal to Sometimes
, will show the horizontal scrollbar if the pane content width
is greater than the scrollpane's inner width.
pub fn children<F: FnOnce(&mut Frame)>(self, children: F)
[src]
Consumes this builder to create a scrollpane. Calls the specified children
closure
to add children to the scrollpane.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for ScrollpaneBuilder<'a>
impl<'a> !Send for ScrollpaneBuilder<'a>
impl<'a> !Sync for ScrollpaneBuilder<'a>
impl<'a> Unpin for ScrollpaneBuilder<'a>
impl<'a> !UnwindSafe for ScrollpaneBuilder<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,