GtkLayout — Infinite scrollable area containing child widgets and/or custom drawing
GtkWidget * | gtk_layout_new () |
void | gtk_layout_put () |
void | gtk_layout_move () |
void | gtk_layout_set_size () |
void | gtk_layout_get_size () |
GtkAdjustment * | gtk_layout_get_hadjustment () |
GtkAdjustment * | gtk_layout_get_vadjustment () |
void | gtk_layout_set_hadjustment () |
void | gtk_layout_set_vadjustment () |
GdkWindow * | gtk_layout_get_bin_window () |
struct | GtkLayout |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkContainer ╰── GtkLayout
GtkLayout implements AtkImplementorIface, GtkBuildable and GtkScrollable.
#include <gtk/gtk.h>
GtkLayout is similar to GtkDrawingArea in that it’s a “blank slate” and doesn’t do anything except paint a blank background by default. It’s different in that it supports scrolling natively due to implementing GtkScrollable, and can contain child widgets since it’s a GtkContainer.
If you just want to draw, a GtkDrawingArea is a better choice since it has lower overhead. If you just need to position child widgets at specific points, then GtkFixed provides that functionality on its own.
When handling expose events on a GtkLayout, you must draw to the GdkWindow returned by gtk_layout_get_bin_window()
, rather than to the one returned by gtk_widget_get_window()
as you would for a GtkDrawingArea.
GtkWidget * gtk_layout_new (GtkAdjustment *hadjustment
,GtkAdjustment *vadjustment
);
Creates a new GtkLayout. Unless you have a specific adjustment you’d like the layout to use for scrolling, pass NULL
for hadjustment
and vadjustment
.
hadjustment | horizontal scroll adjustment, or | [allow-none] |
vadjustment | vertical scroll adjustment, or | [allow-none] |
a new GtkLayout
void gtk_layout_put (GtkLayout *layout
,GtkWidget *child_widget
,gint x
,gint y
);
Adds child_widget
to layout
, at position (x
,y
). layout
becomes the new parent container of child_widget
.
layout | ||
child_widget | child widget | |
x | X position of child widget | |
y | Y position of child widget |
void gtk_layout_move (GtkLayout *layout
,GtkWidget *child_widget
,gint x
,gint y
);
Moves a current child of layout
to a new position.
layout | ||
child_widget | a current child of | |
x | X position to move to | |
y | Y position to move to |
void gtk_layout_set_size (GtkLayout *layout
,guint width
,guint height
);
Sets the size of the scrollable area of the layout.
layout | ||
width | width of entire scrollable area | |
height | height of entire scrollable area |
void gtk_layout_get_size (GtkLayout *layout
,guint *width
,guint *height
);
Gets the size that has been set on the layout, and that determines the total extents of the layout’s scrollbar area. See gtk_layout_set_size()
.
layout | ||
width | location to store the width set on | [out][allow-none] |
height | location to store the height set on | [out][allow-none] |
GtkAdjustment *
gtk_layout_get_hadjustment (GtkLayout *layout
);
gtk_layout_get_hadjustment
has been deprecated since version 3.0 and should not be used in newly-written code.
This function should only be called after the layout has been placed in a GtkScrolledWindow or otherwise configured for scrolling. It returns the GtkAdjustment used for communication between the horizontal scrollbar and layout
.
See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.
layout |
horizontal scroll adjustment.
[transfer none]
GtkAdjustment *
gtk_layout_get_vadjustment (GtkLayout *layout
);
gtk_layout_get_vadjustment
has been deprecated since version 3.0 and should not be used in newly-written code.
This function should only be called after the layout has been placed in a GtkScrolledWindow or otherwise configured for scrolling. It returns the GtkAdjustment used for communication between the vertical scrollbar and layout
.
See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.
layout |
vertical scroll adjustment.
[transfer none]
void gtk_layout_set_hadjustment (GtkLayout *layout
,GtkAdjustment *adjustment
);
gtk_layout_set_hadjustment
has been deprecated since version 3.0 and should not be used in newly-written code.
Sets the horizontal scroll adjustment for the layout.
See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.
layout | ||
adjustment | new scroll adjustment. | [allow-none] |
void gtk_layout_set_vadjustment (GtkLayout *layout
,GtkAdjustment *adjustment
);
gtk_layout_set_vadjustment
has been deprecated since version 3.0 and should not be used in newly-written code.
Sets the vertical scroll adjustment for the layout.
See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.
layout | ||
adjustment | new scroll adjustment. | [allow-none] |
struct GtkLayout;
“height”
property“height” guint
The height of the layout.
Owner: GtkLayout
Flags: Read / Write
Allowed values: <= G_MAXINT
Default value: 100
“width”
property“width” guint
The width of the layout.
Owner: GtkLayout
Flags: Read / Write
Allowed values: <= G_MAXINT
Default value: 100
“x”
child property“x” int
X position of child widget.
Owner: GtkLayout
Flags: Read / Write
Default value: 0
“y”
child property“y” int
Y position of child widget.
Owner: GtkLayout
Flags: Read / Write
Default value: 0
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk3/3.24/GtkLayout.html