GtkViewport

GtkViewport — An adapter which makes widgets scrollable

Functions

Properties

GtkAdjustment * hadjustment Read / Write / Construct
GtkShadowType shadow-type Read / Write
GtkAdjustment * vadjustment Read / Write / Construct

Signals

Types and Values

struct GtkViewport

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkObject
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBin
                        ╰── GtkViewport

Implemented Interfaces

GtkViewport implements AtkImplementorIface and GtkBuildable.

Includes

#include <gtk/gtk.h>

Description

The GtkViewport widget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use GtkViewport to scroll child widgets such as GtkTable, GtkBox, and so on.

If a widget has native scrolling abilities, such as GtkTextView, GtkTreeView or GtkIconview, it can be added to a GtkScrolledWindow with gtk_container_add(). If a widget does not, you must first add the widget to a GtkViewport, then add the viewport to the scrolled window. The convenience function gtk_scrolled_window_add_with_viewport() does exactly this, so you can ignore the presence of the viewport.

Functions

gtk_viewport_new ()

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

Creates a new GtkViewport with the given adjustments.

Parameters

hadjustment

horizontal adjustment.

 

vadjustment

vertical adjustment.

 

returns

a new GtkViewport.

 

gtk_viewport_get_hadjustment ()

GtkAdjustment *
gtk_viewport_get_hadjustment (GtkViewport *viewport);

Returns the horizontal adjustment of the viewport.

Parameters

viewport

a GtkViewport.

 

Returns

the horizontal adjustment of viewport .

[transfer none]


gtk_viewport_get_vadjustment ()

GtkAdjustment *
gtk_viewport_get_vadjustment (GtkViewport *viewport);

Returns the vertical adjustment of the viewport.

Parameters

viewport

a GtkViewport.

 

Returns

the vertical adjustment of viewport .

[transfer none]


gtk_viewport_set_hadjustment ()

void
gtk_viewport_set_hadjustment (GtkViewport *viewport,
                              GtkAdjustment *adjustment);

Sets the horizontal adjustment of the viewport.

Parameters

viewport

a GtkViewport.

 

adjustment

a GtkAdjustment.

[allow-none]

gtk_viewport_set_vadjustment ()

void
gtk_viewport_set_vadjustment (GtkViewport *viewport,
                              GtkAdjustment *adjustment);

Sets the vertical adjustment of the viewport.

Parameters

viewport

a GtkViewport.

 

adjustment

a GtkAdjustment.

[allow-none]

gtk_viewport_set_shadow_type ()

void
gtk_viewport_set_shadow_type (GtkViewport *viewport,
                              GtkShadowType type);

Sets the shadow type of the viewport.

Parameters

viewport

a GtkViewport.

 

type

the new shadow type.

 

gtk_viewport_get_shadow_type ()

GtkShadowType
gtk_viewport_get_shadow_type (GtkViewport *viewport);

Gets the shadow type of the GtkViewport. See gtk_viewport_set_shadow_type().

Parameters

viewport

a GtkViewport

 

Returns

the shadow type


gtk_viewport_get_bin_window ()

GdkWindow *
gtk_viewport_get_bin_window (GtkViewport *viewport);

Gets the bin window of the GtkViewport.

Parameters

viewport

a GtkViewport

 

Returns

a GdkWindow.

[transfer none]

Since: 2.20


gtk_viewport_get_view_window ()

GdkWindow *
gtk_viewport_get_view_window (GtkViewport *viewport);

Gets the view window of the GtkViewport.

Parameters

viewport

a GtkViewport

 

Returns

a GdkWindow.

[transfer none]

Since: 2.22

Types and Values

struct GtkViewport

struct GtkViewport;

Property Details

The “hadjustment” property

  “hadjustment”              GtkAdjustment *

The GtkAdjustment that determines the values of the horizontal position for this viewport.

Owner: GtkViewport

Flags: Read / Write / Construct


The “shadow-type” property

  “shadow-type”              GtkShadowType

Determines how the shadowed box around the viewport is drawn.

Owner: GtkViewport

Flags: Read / Write

Default value: GTK_SHADOW_IN


The “vadjustment” property

  “vadjustment”              GtkAdjustment *

The GtkAdjustment that determines the values of the vertical position for this viewport.

Owner: GtkViewport

Flags: Read / Write / Construct

Signal Details

The “set-scroll-adjustments” signal

void
user_function (GtkViewport   *horizontal,
               GtkAdjustment *vertical,
               GtkAdjustment *arg2,
               gpointer       user_data)

Set the scroll adjustments for the viewport. Usually scrolled containers like GtkScrolledWindow will emit this signal to connect two instances of GtkScrollbar to the scroll directions of the GtkViewport.

Parameters

horizontal

the horizontal GtkAdjustment

 

vertical

the vertical GtkAdjustment

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

See Also

GtkScrolledWindow, GtkAdjustment