GtkViewport — An adapter which makes widgets scrollable
GtkWidget * | gtk_viewport_new () |
void | gtk_viewport_set_scroll_to_focus () |
gboolean | gtk_viewport_get_scroll_to_focus () |
void | gtk_viewport_set_child () |
GtkWidget * | gtk_viewport_get_child () |
GtkWidget * | child | Read / Write |
gboolean | scroll-to-focus | Read / Write |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkViewport
GtkViewport implements GtkAccessible, GtkBuildable, GtkConstraintTarget and GtkScrollable.
#include <gtk/gtk.h>
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 GtkGrid, GtkBox, and so on.
The GtkViewport will start scrolling content only if allocated less than the child widget’s minimum size in a given orientation.
GtkViewport has a single CSS node with name viewport
.
GtkViewport uses the GTK_ACCESSIBLE_ROLE_GROUP
role.
GtkWidget * gtk_viewport_new (GtkAdjustment *hadjustment
,GtkAdjustment *vadjustment
);
Creates a new GtkViewport with the given adjustments, or with default adjustments if none are given.
hadjustment | horizontal adjustment. | [allow-none] |
vadjustment | vertical adjustment. | [allow-none] |
a new GtkViewport
void gtk_viewport_set_scroll_to_focus (GtkViewport *viewport
,gboolean scroll_to_focus
);
Sets whether the viewport should automatically scroll to keep the focused child in view.
viewport | ||
scroll_to_focus | whether to keep the focus widget scrolled to view |
gboolean
gtk_viewport_get_scroll_to_focus (GtkViewport *viewport
);
Gets whether the viewport is scrolling to keep the focused child in view. See gtk_viewport_set_scroll_to_focus()
.
viewport |
TRUE
if the viewport keeps the focus child scrolled to view
void gtk_viewport_set_child (GtkViewport *viewport
,GtkWidget *child
);
Sets the child widget of viewport
.
viewport | ||
child | the child widget. | [allow-none] |
GtkWidget *
gtk_viewport_get_child (GtkViewport *viewport
);
Gets the child widget of viewport
.
viewport |
the child widget of viewport
.
[nullable][transfer none]
typedef struct _GtkViewport GtkViewport;
“scroll-to-focus”
property“scroll-to-focus” gboolean
Whether to scroll when the focus changes.
Owner: GtkViewport
Flags: Read / Write
Default value: FALSE
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkViewport.html