GtkScrolledWindow

GtkScrolledWindow — Adds scrollbars to its child widget

Functions

GtkWidget * gtk_scrolled_window_new ()
GtkAdjustment * gtk_scrolled_window_get_hadjustment ()
void gtk_scrolled_window_set_hadjustment ()
GtkAdjustment * gtk_scrolled_window_get_vadjustment ()
void gtk_scrolled_window_set_vadjustment ()
GtkWidget * gtk_scrolled_window_get_hscrollbar ()
GtkWidget * gtk_scrolled_window_get_vscrollbar ()
void gtk_scrolled_window_get_policy ()
void gtk_scrolled_window_set_policy ()
void gtk_scrolled_window_add_with_viewport ()
GtkCornerType gtk_scrolled_window_get_placement ()
void gtk_scrolled_window_set_placement ()
void gtk_scrolled_window_unset_placement ()
GtkShadowType gtk_scrolled_window_get_shadow_type ()
void gtk_scrolled_window_set_shadow_type ()
gboolean gtk_scrolled_window_get_kinetic_scrolling ()
void gtk_scrolled_window_set_kinetic_scrolling ()
gboolean gtk_scrolled_window_get_capture_button_press ()
void gtk_scrolled_window_set_capture_button_press ()
gboolean gtk_scrolled_window_get_overlay_scrolling ()
void gtk_scrolled_window_set_overlay_scrolling ()
gint gtk_scrolled_window_get_min_content_width ()
void gtk_scrolled_window_set_min_content_width ()
gint gtk_scrolled_window_get_min_content_height ()
void gtk_scrolled_window_set_min_content_height ()
gint gtk_scrolled_window_get_max_content_width ()
void gtk_scrolled_window_set_max_content_width ()
gint gtk_scrolled_window_get_max_content_height ()
void gtk_scrolled_window_set_max_content_height ()
gboolean gtk_scrolled_window_get_propagate_natural_width ()
void gtk_scrolled_window_set_propagate_natural_width ()
gboolean gtk_scrolled_window_get_propagate_natural_height ()
void gtk_scrolled_window_set_propagate_natural_height ()

Properties

GtkAdjustment * hadjustment Read / Write / Construct
GtkPolicyType hscrollbar-policy Read / Write
gboolean kinetic-scrolling Read / Write
int max-content-height Read / Write
int max-content-width Read / Write
int min-content-height Read / Write
int min-content-width Read / Write
gboolean overlay-scrolling Read / Write
gboolean propagate-natural-height Read / Write
gboolean propagate-natural-width Read / Write
GtkShadowType shadow-type Read / Write
GtkAdjustment * vadjustment Read / Write / Construct
GtkPolicyType vscrollbar-policy Read / Write
GtkCornerType window-placement Read / Write
gboolean window-placement-set Read / Write

Style Properties

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkBin
                    ╰── GtkScrolledWindow
                        ╰── GtkPlacesSidebar

Implemented Interfaces

GtkScrolledWindow implements AtkImplementorIface and GtkBuildable.

Includes

#include <gtk/gtk.h>

Description

GtkScrolledWindow 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 GtkScrollable interface, are added directly. For other types of widget, the class GtkViewport acts as an adaptor, giving scrollability to other widgets. GtkScrolledWindow’s implementation of gtk_container_add() intelligently accounts for whether or not the added child is a GtkScrollable. If it isn’t, GtkScrolledWindow wraps the child in a GtkViewport and adds that for you. Therefore, you can just add any child widget and not worry about the details.

If gtk_container_add() has added a GtkViewport for you, you can remove both your added child widget from the GtkViewport, and the GtkViewport from the GtkScrolledWindow, like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 “policy” is GTK_POLICY_NEVER or GTK_POLICY_EXTERNAL, GtkScrolledWindow adds internal GtkScrollbar widgets around its child. The scroll position of the child, and if applicable the scrollbars, is controlled by the “hadjustment” and “vadjustment” that are associated with the GtkScrolledWindow. See the docs on GtkScrollbar 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 GtkScrolledWindow 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 GtkScrollbar and for example a GtkGrid.

Touch support

GtkScrolledWindow 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 “kinetic-scrolling” property if it is undesired.

GtkScrolledWindow also displays visual 'overshoot' indication when the content is pulled beyond the end, and this situation can be captured with the “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 “overlay-scrolling” property.


CSS nodes

GtkScrolledWindow 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.

GtkScrolledWindow 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.

Functions

gtk_scrolled_window_new ()

GtkWidget *
gtk_scrolled_window_new (GtkAdjustment *hadjustment,
                         GtkAdjustment *vadjustment);

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 NULL for the adjustments, which will cause the scrolled window to create them for you.

Parameters

hadjustment

horizontal adjustment.

[nullable]

vadjustment

vertical adjustment.

[nullable]

Returns

a new scrolled window


gtk_scrolled_window_get_hadjustment ()

GtkAdjustment *
gtk_scrolled_window_get_hadjustment (GtkScrolledWindow *scrolled_window);

Returns the horizontal scrollbar’s adjustment, used to connect the horizontal scrollbar to the child widget’s horizontal scroll functionality.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the horizontal GtkAdjustment.

[transfer none]


gtk_scrolled_window_set_hadjustment ()

void
gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
                                     GtkAdjustment *hadjustment);

Sets the GtkAdjustment for the horizontal scrollbar.

Parameters

scrolled_window

a GtkScrolledWindow

 

hadjustment

the GtkAdjustment to use, or NULL to create a new one.

[nullable]

gtk_scrolled_window_get_vadjustment ()

GtkAdjustment *
gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *scrolled_window);

Returns the vertical scrollbar’s adjustment, used to connect the vertical scrollbar to the child widget’s vertical scroll functionality.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the vertical GtkAdjustment.

[transfer none]


gtk_scrolled_window_set_vadjustment ()

void
gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
                                     GtkAdjustment *vadjustment);

Sets the GtkAdjustment for the vertical scrollbar.

Parameters

scrolled_window

a GtkScrolledWindow

 

vadjustment

the GtkAdjustment to use, or NULL to create a new one.

[nullable]

gtk_scrolled_window_get_hscrollbar ()

GtkWidget *
gtk_scrolled_window_get_hscrollbar (GtkScrolledWindow *scrolled_window);

Returns the horizontal scrollbar of scrolled_window .

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the horizontal scrollbar of the scrolled window.

[transfer none]

Since: 2.8


gtk_scrolled_window_get_vscrollbar ()

GtkWidget *
gtk_scrolled_window_get_vscrollbar (GtkScrolledWindow *scrolled_window);

Returns the vertical scrollbar of scrolled_window .

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the vertical scrollbar of the scrolled window.

[transfer none]

Since: 2.8


gtk_scrolled_window_get_policy ()

void
gtk_scrolled_window_get_policy (GtkScrolledWindow *scrolled_window,
                                GtkPolicyType *hscrollbar_policy,
                                GtkPolicyType *vscrollbar_policy);

Retrieves the current policy values for the horizontal and vertical scrollbars. See gtk_scrolled_window_set_policy().

Parameters

scrolled_window

a GtkScrolledWindow

 

hscrollbar_policy

location to store the policy for the horizontal scrollbar, or NULL.

[out][optional]

vscrollbar_policy

location to store the policy for the vertical scrollbar, or NULL.

[out][optional]

gtk_scrolled_window_set_policy ()

void
gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window,
                                GtkPolicyType hscrollbar_policy,
                                GtkPolicyType vscrollbar_policy);

Sets the scrollbar policy for the horizontal and vertical scrollbars.

The policy determines when the scrollbar should appear; it is a value from the GtkPolicyType enumeration. If GTK_POLICY_ALWAYS, the scrollbar is always present; if GTK_POLICY_NEVER, the scrollbar is never present; if GTK_POLICY_AUTOMATIC, the scrollbar is present only if needed (that is, if the slider part of the bar would be smaller than the trough — the display is larger than the page size).

Parameters

scrolled_window

a GtkScrolledWindow

 

hscrollbar_policy

policy for horizontal bar

 

vscrollbar_policy

policy for vertical bar

 

gtk_scrolled_window_add_with_viewport ()

void
gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
                                       GtkWidget *child);

gtk_scrolled_window_add_with_viewport has been deprecated since version 3.8 and should not be used in newly-written code.

gtk_container_add() will automatically add a GtkViewport if the child doesn’t implement GtkScrollable.

Used to add children without native scrolling capabilities. This is simply a convenience function; it is equivalent to adding the unscrollable child to a viewport, then adding the viewport to the scrolled window. If a child has native scrolling, use gtk_container_add() instead of this function.

The viewport scrolls the child by moving its GdkWindow, and takes the size of the child to be the size of its toplevel GdkWindow. This will be very wrong for most widgets that support native scrolling; for example, if you add a widget such as GtkTreeView with a viewport, the whole widget will scroll, including the column headings. Thus, widgets with native scrolling support should not be used with the GtkViewport proxy.

A widget supports scrolling natively if it implements the GtkScrollable interface.

Parameters

scrolled_window

a GtkScrolledWindow

 

child

the widget you want to scroll

 

gtk_scrolled_window_get_placement ()

GtkCornerType
gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window);

Gets the placement of the contents with respect to the scrollbars for the scrolled window. See gtk_scrolled_window_set_placement().

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the current placement value.

See also gtk_scrolled_window_set_placement() and gtk_scrolled_window_unset_placement().


gtk_scrolled_window_set_placement ()

void
gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window,
                                   GtkCornerType window_placement);

Sets the placement of the contents with respect to the scrollbars for the scrolled window.

The default is GTK_CORNER_TOP_LEFT, meaning the child is in the top left, with the scrollbars underneath and to the right. Other values in GtkCornerType are GTK_CORNER_TOP_RIGHT, GTK_CORNER_BOTTOM_LEFT, and GTK_CORNER_BOTTOM_RIGHT.

See also gtk_scrolled_window_get_placement() and gtk_scrolled_window_unset_placement().

Parameters

scrolled_window

a GtkScrolledWindow

 

window_placement

position of the child window

 

gtk_scrolled_window_unset_placement ()

void
gtk_scrolled_window_unset_placement (GtkScrolledWindow *scrolled_window);

Unsets the placement of the contents with respect to the scrollbars for the scrolled window. If no window placement is set for a scrolled window, it defaults to GTK_CORNER_TOP_LEFT.

See also gtk_scrolled_window_set_placement() and gtk_scrolled_window_get_placement().

Parameters

scrolled_window

a GtkScrolledWindow

 

Since: 2.10


gtk_scrolled_window_get_shadow_type ()

GtkShadowType
gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window);

Gets the shadow type of the scrolled window. See gtk_scrolled_window_set_shadow_type().

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the current shadow type


gtk_scrolled_window_set_shadow_type ()

void
gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
                                     GtkShadowType type);

Changes the type of shadow drawn around the contents of scrolled_window .

Parameters

scrolled_window

a GtkScrolledWindow

 

type

kind of shadow to draw around scrolled window contents

 

gtk_scrolled_window_get_kinetic_scrolling ()

gboolean
gtk_scrolled_window_get_kinetic_scrolling
                               (GtkScrolledWindow *scrolled_window);

Returns the specified kinetic scrolling behavior.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the scrolling behavior flags.

Since: 3.4


gtk_scrolled_window_set_kinetic_scrolling ()

void
gtk_scrolled_window_set_kinetic_scrolling
                               (GtkScrolledWindow *scrolled_window,
                                gboolean kinetic_scrolling);

Turns kinetic scrolling on or off. Kinetic scrolling only applies to devices with source GDK_SOURCE_TOUCHSCREEN.

Parameters

scrolled_window

a GtkScrolledWindow

 

kinetic_scrolling

TRUE to enable kinetic scrolling

 

Since: 3.4


gtk_scrolled_window_get_capture_button_press ()

gboolean
gtk_scrolled_window_get_capture_button_press
                               (GtkScrolledWindow *scrolled_window);

Return whether button presses are captured during kinetic scrolling. See gtk_scrolled_window_set_capture_button_press().

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

TRUE if button presses are captured during kinetic scrolling

Since: 3.4


gtk_scrolled_window_set_capture_button_press ()

void
gtk_scrolled_window_set_capture_button_press
                               (GtkScrolledWindow *scrolled_window,
                                gboolean capture_button_press);

Changes the behaviour of scrolled_window with regard to the initial event that possibly starts kinetic scrolling. When capture_button_press is set to TRUE, the event is captured by the scrolled window, and then later replayed if it is meant to go to the child widget.

This should be enabled if any child widgets perform non-reversible actions on “button-press-event”. If they don't, and handle additionally handle “grab-broken-event”, it might be better to set capture_button_press to FALSE.

This setting only has an effect if kinetic scrolling is enabled.

Parameters

scrolled_window

a GtkScrolledWindow

 

capture_button_press

TRUE to capture button presses

 

Since: 3.4


gtk_scrolled_window_get_overlay_scrolling ()

gboolean
gtk_scrolled_window_get_overlay_scrolling
                               (GtkScrolledWindow *scrolled_window);

Returns whether overlay scrolling is enabled for this scrolled window.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

TRUE if overlay scrolling is enabled

Since: 3.16


gtk_scrolled_window_set_overlay_scrolling ()

void
gtk_scrolled_window_set_overlay_scrolling
                               (GtkScrolledWindow *scrolled_window,
                                gboolean overlay_scrolling);

Enables or disables overlay scrolling for this scrolled window.

Parameters

scrolled_window

a GtkScrolledWindow

 

overlay_scrolling

whether to enable overlay scrolling

 

Since: 3.16


gtk_scrolled_window_get_min_content_width ()

gint
gtk_scrolled_window_get_min_content_width
                               (GtkScrolledWindow *scrolled_window);

Gets the minimum content width of scrolled_window , or -1 if not set.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the minimum content width

Since: 3.0


gtk_scrolled_window_set_min_content_width ()

void
gtk_scrolled_window_set_min_content_width
                               (GtkScrolledWindow *scrolled_window,
                                gint width);

Sets the minimum width that scrolled_window should keep visible. Note that this can and (usually will) be smaller than the minimum size of the content.

It is a programming error to set the minimum content width to a value greater than “max-content-width”.

Parameters

scrolled_window

a GtkScrolledWindow

 

width

the minimal content width

 

Since: 3.0


gtk_scrolled_window_get_min_content_height ()

gint
gtk_scrolled_window_get_min_content_height
                               (GtkScrolledWindow *scrolled_window);

Gets the minimal content height of scrolled_window , or -1 if not set.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the minimal content height

Since: 3.0


gtk_scrolled_window_set_min_content_height ()

void
gtk_scrolled_window_set_min_content_height
                               (GtkScrolledWindow *scrolled_window,
                                gint height);

Sets the minimum height that scrolled_window should keep visible. Note that this can and (usually will) be smaller than the minimum size of the content.

It is a programming error to set the minimum content height to a value greater than “max-content-height”.

Parameters

scrolled_window

a GtkScrolledWindow

 

height

the minimal content height

 

Since: 3.0


gtk_scrolled_window_get_max_content_width ()

gint
gtk_scrolled_window_get_max_content_width
                               (GtkScrolledWindow *scrolled_window);

Returns the maximum content width set.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the maximum content width, or -1

Since: 3.22


gtk_scrolled_window_set_max_content_width ()

void
gtk_scrolled_window_set_max_content_width
                               (GtkScrolledWindow *scrolled_window,
                                gint width);

Sets the maximum width that scrolled_window should keep visible. The scrolled_window will grow up to this width before it starts scrolling the content.

It is a programming error to set the maximum content width to a value smaller than “min-content-width”.

Parameters

scrolled_window

a GtkScrolledWindow

 

width

the maximum content width

 

Since: 3.22


gtk_scrolled_window_get_max_content_height ()

gint
gtk_scrolled_window_get_max_content_height
                               (GtkScrolledWindow *scrolled_window);

Returns the maximum content height set.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

the maximum content height, or -1

Since: 3.22


gtk_scrolled_window_set_max_content_height ()

void
gtk_scrolled_window_set_max_content_height
                               (GtkScrolledWindow *scrolled_window,
                                gint height);

Sets the maximum height that scrolled_window should keep visible. The scrolled_window will grow up to this height before it starts scrolling the content.

It is a programming error to set the maximum content height to a value smaller than “min-content-height”.

Parameters

scrolled_window

a GtkScrolledWindow

 

height

the maximum content height

 

Since: 3.22


gtk_scrolled_window_get_propagate_natural_width ()

gboolean
gtk_scrolled_window_get_propagate_natural_width
                               (GtkScrolledWindow *scrolled_window);

Reports whether the natural width of the child will be calculated and propagated through the scrolled window’s requested natural width.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

whether natural width propagation is enabled.

Since: 3.22


gtk_scrolled_window_set_propagate_natural_width ()

void
gtk_scrolled_window_set_propagate_natural_width
                               (GtkScrolledWindow *scrolled_window,
                                gboolean propagate);

Sets whether the natural width of the child should be calculated and propagated through the scrolled window’s requested natural width.

Parameters

scrolled_window

a GtkScrolledWindow

 

propagate

whether to propagate natural width

 

Since: 3.22


gtk_scrolled_window_get_propagate_natural_height ()

gboolean
gtk_scrolled_window_get_propagate_natural_height
                               (GtkScrolledWindow *scrolled_window);

Reports whether the natural height of the child will be calculated and propagated through the scrolled window’s requested natural height.

Parameters

scrolled_window

a GtkScrolledWindow

 

Returns

whether natural height propagation is enabled.

Since: 3.22


gtk_scrolled_window_set_propagate_natural_height ()

void
gtk_scrolled_window_set_propagate_natural_height
                               (GtkScrolledWindow *scrolled_window,
                                gboolean propagate);

Sets whether the natural height of the child should be calculated and propagated through the scrolled window’s requested natural height.

Parameters

scrolled_window

a GtkScrolledWindow

 

propagate

whether to propagate natural height

 

Since: 3.22

Types and Values

struct GtkScrolledWindow

struct GtkScrolledWindow;

struct GtkScrolledWindowClass

struct GtkScrolledWindowClass {
  GtkBinClass parent_class;

  gint scrollbar_spacing;

  /* Action signals for keybindings. Do not connect to these signals
   */

  /* Unfortunately, GtkScrollType is deficient in that there is
   * no horizontal/vertical variants for GTK_SCROLL_START/END,
   * so we have to add an additional boolean flag.
   */
  gboolean (*scroll_child) (GtkScrolledWindow *scrolled_window,
	  		    GtkScrollType      scroll,
			    gboolean           horizontal);

  void (* move_focus_out) (GtkScrolledWindow *scrolled_window,
			   GtkDirectionType   direction);
};

Members

gint scrollbar_spacing;

   

scroll_child ()

Keybinding signal which gets emitted when a keybinding that scrolls is pressed.

 

move_focus_out ()

Keybinding signal which gets emitted when focus is moved away from the scrolled window by a keybinding.

 

enum GtkPolicyType

Determines how the size should be computed to achieve the one of the visibility mode for the scrollbars.

Members

GTK_POLICY_ALWAYS

The scrollbar is always visible. The view size is independent of the content.

 

GTK_POLICY_AUTOMATIC

The scrollbar will appear and disappear as necessary. For example, when all of a GtkTreeView can not be seen.

 

GTK_POLICY_NEVER

The scrollbar should never appear. In this mode the content determines the size.

 

GTK_POLICY_EXTERNAL

Don't show a scrollbar, but don't force the size to follow the content. This can be used e.g. to make multiple scrolled windows share a scrollbar. Since: 3.16

 

enum GtkCornerType

Specifies which corner a child widget should be placed in when packed into a GtkScrolledWindow. This is effectively the opposite of where the scroll bars are placed.

Members

GTK_CORNER_TOP_LEFT

Place the scrollbars on the right and bottom of the widget (default behaviour).

 

GTK_CORNER_BOTTOM_LEFT

Place the scrollbars on the top and right of the widget.

 

GTK_CORNER_TOP_RIGHT

Place the scrollbars on the left and bottom of the widget.

 

GTK_CORNER_BOTTOM_RIGHT

Place the scrollbars on the top and left of the widget.

 

Property Details

The “hadjustment” property

  “hadjustment”              GtkAdjustment *

The GtkAdjustment for the horizontal position.

Owner: GtkScrolledWindow

Flags: Read / Write / Construct


The “hscrollbar-policy” property

  “hscrollbar-policy”        GtkPolicyType

When the horizontal scrollbar is displayed.

Owner: GtkScrolledWindow

Flags: Read / Write

Default value: GTK_POLICY_AUTOMATIC


The “kinetic-scrolling” property

  “kinetic-scrolling”        gboolean

Whether kinetic scrolling is enabled or not. Kinetic scrolling only applies to devices with source GDK_SOURCE_TOUCHSCREEN.

Owner: GtkScrolledWindow

Flags: Read / Write

Default value: TRUE

Since: 3.4


The “max-content-height” property

  “max-content-height”       int

The maximum content height of scrolled_window , or -1 if not set.

Owner: GtkScrolledWindow

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 3.22


The “max-content-width” property

  “max-content-width”        int

The maximum content width of scrolled_window , or -1 if not set.

Owner: GtkScrolledWindow

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 3.22


The “min-content-height” property

  “min-content-height”       int

The minimum content height of scrolled_window , or -1 if not set.

Owner: GtkScrolledWindow

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 3.0


The “min-content-width” property

  “min-content-width”        int

The minimum content width of scrolled_window , or -1 if not set.

Owner: GtkScrolledWindow

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 3.0


The “overlay-scrolling” property

  “overlay-scrolling”        gboolean

Whether overlay scrolling is enabled or not. If it is, the scrollbars are only added as traditional widgets when a mouse is present. Otherwise, they are overlayed on top of the content, as narrow indicators.

Note that overlay scrolling can also be globally disabled, with the “gtk-overlay-scrolling” setting.

Owner: GtkScrolledWindow

Flags: Read / Write

Default value: TRUE

Since: 3.16


The “propagate-natural-height” property

  “propagate-natural-height” gboolean

Whether the natural height of the child should be calculated and propagated through the scrolled window’s requested natural height.

This is useful in cases where an attempt should be made to allocate exactly enough space for the natural size of the child.

Owner: GtkScrolledWindow

Flags: Read / Write

Default value: FALSE

Since: 3.22


The “propagate-natural-width” property

  “propagate-natural-width”  gboolean

Whether the natural width of the child should be calculated and propagated through the scrolled window’s requested natural width.

This is useful in cases where an attempt should be made to allocate exactly enough space for the natural size of the child.

Owner: GtkScrolledWindow

Flags: Read / Write

Default value: FALSE

Since: 3.22


The “shadow-type” property

  “shadow-type”              GtkShadowType

Style of bevel around the contents.

Owner: GtkScrolledWindow

Flags: Read / Write

Default value: GTK_SHADOW_NONE


The “vadjustment” property

  “vadjustment”              GtkAdjustment *

The GtkAdjustment for the vertical position.

Owner: GtkScrolledWindow

Flags: Read / Write / Construct


The “vscrollbar-policy” property

  “vscrollbar-policy”        GtkPolicyType

When the vertical scrollbar is displayed.

Owner: GtkScrolledWindow

Flags: Read / Write

Default value: GTK_POLICY_AUTOMATIC


The “window-placement” property

  “window-placement”         GtkCornerType

Where the contents are located with respect to the scrollbars.

Owner: GtkScrolledWindow

Flags: Read / Write

Default value: GTK_CORNER_TOP_LEFT


The “window-placement-set” property

  “window-placement-set”     gboolean

Whether "window-placement" should be used to determine the location of the contents with respect to the scrollbars.

GtkScrolledWindow:window-placement-set has been deprecated since version 3.10 and should not be used in newly-written code.

This value is ignored and “window-placement” value is always honored.

Owner: GtkScrolledWindow

Flags: Read / Write

Default value: TRUE

Since: 2.10

Style Property Details

The “scrollbar-spacing” style property

  “scrollbar-spacing”        int

Number of pixels between the scrollbars and the scrolled window.

Owner: GtkScrolledWindow

Flags: Read

Allowed values: >= 0

Default value: 3


The “scrollbars-within-bevel” style property

  “scrollbars-within-bevel”  gboolean

Whether to place scrollbars within the scrolled window's bevel.

GtkScrolledWindow:scrollbars-within-bevel has been deprecated since version 3.20 and should not be used in newly-written code.

the value of this style property is ignored.

Owner: GtkScrolledWindow

Flags: Read

Default value: FALSE

Since: 2.12

Signal Details

The “edge-overshot” signal

void
user_function (GtkScrolledWindow *scrolled_window,
               GtkPositionType    pos,
               gpointer           user_data)

The ::edge-overshot signal is emitted whenever user initiated scrolling makes the scrolled window firmly surpass (i.e. with some edge resistance) the lower or upper limits defined by the adjustment in that orientation.

A similar behavior without edge resistance is provided by the “edge-reached” signal.

Note: The pos argument is LTR/RTL aware, so callers should be aware too if intending to provide behavior on horizontal edges.

Parameters

scrolled_window

a GtkScrolledWindow

 

pos

edge side that was hit

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.16


The “edge-reached” signal

void
user_function (GtkScrolledWindow *scrolled_window,
               GtkPositionType    pos,
               gpointer           user_data)

The ::edge-reached signal is emitted whenever user-initiated scrolling makes the scrolled window exactly reach the lower or upper limits defined by the adjustment in that orientation.

A similar behavior with edge resistance is provided by the “edge-overshot” signal.

Note: The pos argument is LTR/RTL aware, so callers should be aware too if intending to provide behavior on horizontal edges.

Parameters

scrolled_window

a GtkScrolledWindow

 

pos

edge side that was reached

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.16


The “move-focus-out” signal

void
user_function (GtkScrolledWindow *scrolled_window,
               GtkDirectionType   direction_type,
               gpointer           user_data)

The ::move-focus-out signal is a keybinding signal which gets emitted when focus is moved away from the scrolled window by a keybinding. The “move-focus” signal is emitted with direction_type on this scrolled window’s toplevel parent in the container hierarchy. The default bindings for this signal are Ctrl + Tab to move forward and Ctrl + Shift + Tab to move backward.

Parameters

scrolled_window

a GtkScrolledWindow

 

direction_type

either GTK_DIR_TAB_FORWARD or GTK_DIR_TAB_BACKWARD

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “scroll-child” signal

gboolean
user_function (GtkScrolledWindow *scrolled_window,
               GtkScrollType      scroll,
               gboolean           horizontal,
               gpointer           user_data)

The ::scroll-child signal is a keybinding signal which gets emitted when a keybinding that scrolls is pressed. The horizontal or vertical adjustment is updated which triggers a signal that the scrolled window’s child may listen to and scroll itself.

Parameters

scrolled_window

a GtkScrolledWindow

 

scroll

a GtkScrollType describing how much to scroll

 

horizontal

whether the keybinding scrolls the child horizontally or not

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

See Also

GtkScrollable, GtkViewport, GtkAdjustment