[]Struct gtk::ScrolledWindow

pub struct ScrolledWindow(_, _);

ScrolledWindow is a container that accepts a single child widget, makes that child scrollable using either internally added scrollbars or externally associated adjustments, and optionally draws a frame around the child.

Widgets with native scrolling support, i.e. those whose classes implement the Scrollable interface, are added directly. For other types of widget, the class Viewport acts as an adaptor, giving scrollability to other widgets. ScrolledWindow’s implementation of ContainerExt::add intelligently accounts for whether or not the added child is a Scrollable. If it isn’t, ScrolledWindow wraps the child in a Viewport and adds that for you. Therefore, you can just add any child widget and not worry about the details.

If ContainerExt::add has added a Viewport for you, you can remove both your added child widget from the Viewport, and the Viewport from the ScrolledWindow, like this:

GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
GtkWidget *child_widget = gtk_button_new ();

// GtkButton is not a GtkScrollable, so GtkScrolledWindow will automatically
// add a GtkViewport.
gtk_container_add (GTK_CONTAINER (scrolled_window),
                   child_widget);

// Either of these will result in child_widget being unparented:
gtk_container_remove (GTK_CONTAINER (scrolled_window),
                      child_widget);
// or
gtk_container_remove (GTK_CONTAINER (scrolled_window),
                      gtk_bin_get_child (GTK_BIN (scrolled_window)));

Unless ScrolledWindow:policy is GTK_POLICY_NEVER or GTK_POLICY_EXTERNAL, ScrolledWindow adds internal Scrollbar widgets around its child. The scroll position of the child, and if applicable the scrollbars, is controlled by the ScrolledWindow:hadjustment and ScrolledWindow:vadjustment that are associated with the ScrolledWindow. See the docs on Scrollbar for the details, but note that the “step_increment” and “page_increment” fields are only effective if the policy causes scrollbars to be present.

If a ScrolledWindow doesn’t behave quite as you would like, or doesn’t have exactly the right layout, it’s very possible to set up your own scrolling with Scrollbar and for example a Grid.

Touch support

ScrolledWindow has built-in support for touch devices. When a touchscreen is used, swiping will move the scrolled window, and will expose 'kinetic' behavior. This can be turned off with the ScrolledWindow:kinetic-scrolling property if it is undesired.

ScrolledWindow also displays visual 'overshoot' indication when the content is pulled beyond the end, and this situation can be captured with the ScrolledWindow::edge-overshot signal.

If no mouse device is present, the scrollbars will overlayed as narrow, auto-hiding indicators over the content. If traditional scrollbars are desired although no mouse is present, this behaviour can be turned off with the ScrolledWindow:overlay-scrolling property.

CSS nodes

ScrolledWindow has a main CSS node with name scrolledwindow.

It uses subnodes with names overshoot and undershoot to draw the overflow and underflow indications. These nodes get the .left, .right, .top or .bottom style class added depending on where the indication is drawn.

ScrolledWindow also sets the positional style classes (.left, .right, .top, .bottom) and style classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering) on its scrollbars.

If both scrollbars are visible, the area where they meet is drawn with a subnode named junction.

Implements

ScrolledWindowExt, BinExt, ContainerExt, WidgetExt, glib::object::ObjectExt, BuildableExt, WidgetExtManual, BuildableExtManual

Methods

impl ScrolledWindow[src]

pub fn new<P: IsA<Adjustment>, Q: IsA<Adjustment>>(
    hadjustment: Option<&P>,
    vadjustment: Option<&Q>
) -> ScrolledWindow
[src]

Creates a new scrolled window.

The two arguments are the scrolled window’s adjustments; these will be shared with the scrollbars and the child widget to keep the bars in sync with the child. Usually you want to pass None for the adjustments, which will cause the scrolled window to create them for you.

hadjustment

horizontal adjustment

vadjustment

vertical adjustment

Returns

a new scrolled window

Trait Implementations

impl Clone for ScrolledWindow

impl Debug for ScrolledWindow

impl Display for ScrolledWindow[src]

impl Eq for ScrolledWindow

impl Hash for ScrolledWindow

impl IsA<Bin> for ScrolledWindow

impl IsA<Buildable> for ScrolledWindow

impl IsA<Container> for ScrolledWindow

impl IsA<ScrolledWindow> for PlacesSidebar

impl IsA<Widget> for ScrolledWindow

impl Ord for ScrolledWindow

impl<T: ObjectType> PartialEq<T> for ScrolledWindow

impl<T: ObjectType> PartialOrd<T> for ScrolledWindow

impl StaticType for ScrolledWindow

Auto Trait Implementations

impl RefUnwindSafe for ScrolledWindow

impl !Send for ScrolledWindow

impl !Sync for ScrolledWindow

impl Unpin for ScrolledWindow

impl UnwindSafe for ScrolledWindow

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.