GtkLayout

GtkLayout — Infinite scrollable area containing child widgets and/or custom drawing

Functions

Types and Values

struct GtkLayout

Includes

#include <gtk/gtk.h>

Description

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.

Functions

gtk_layout_new ()

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 .

Parameters

hadjustment

horizontal scroll adjustment, or NULL.

[allow-none]

vadjustment

vertical scroll adjustment, or NULL.

[allow-none]

Returns

a new GtkLayout


gtk_layout_put ()

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 .

Parameters

layout

a GtkLayout

 

child_widget

child widget

 

x

X position of child widget

 

y

Y position of child widget

 

gtk_layout_move ()

void
gtk_layout_move (GtkLayout *layout,
                 GtkWidget *child_widget,
                 gint x,
                 gint y);

Moves a current child of layout to a new position.

Parameters

layout

a GtkLayout

 

child_widget

a current child of layout

 

x

X position to move to

 

y

Y position to move to

 

gtk_layout_set_size ()

void
gtk_layout_set_size (GtkLayout *layout,
                     guint width,
                     guint height);

Sets the size of the scrollable area of the layout.

Parameters

layout

a GtkLayout

 

width

width of entire scrollable area

 

height

height of entire scrollable area

 

gtk_layout_get_size ()

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().

Parameters

layout

a GtkLayout

 

width

location to store the width set on layout , or NULL.

[out][allow-none]

height

location to store the height set on layout , or NULL.

[out][allow-none]

Types and Values

struct GtkLayout

struct GtkLayout {
  GtkContainer container;
};

See Also

GtkDrawingArea, GtkFixed