GtkLayout: GTK+ 3 Reference Manual

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

## Functions

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

## Properties

guint | height | Read / Write
guint | width | Read / Write

## Child Properties

gint | x | Read / Write
gint | y | Read / Write

## Types and Values

struct | GtkLayout

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkLayout

## Implemented Interfaces

GtkLayout implements AtkImplementorIface, GtkBuildable and GtkScrollable.

## Includes

    #include <gtk/gtk.h>

## Description

GtkLayout is similar to GtkDrawingArea in that it’s a “blank slate” and doesn’t do anything but paint a blank background by default. It's different in that it supports scrolling natively (you can add it to a GtkScrolledWindow), and it can contain child widgets, since it’s a GtkContainer. However if you’re just going to draw, a GtkDrawingArea is a better choice since it has lower overhead.

When handling expose events on a GtkLayout, you must draw to GTK_LAYOUT (layout)->bin_window, rather than to GTK_WIDGET (layout)->window, as you would for a drawing area.

## 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]

### gtk_layout_get_hadjustment ()

    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.

Use `gtk_scrollable_get_hadjustment()`

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.

#### Parameters

layout | a GtkLayout |

#### Returns

horizontal scroll adjustment.

[transfer none]

### gtk_layout_get_vadjustment ()

    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.

Use `gtk_scrollable_get_vadjustment()`

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.

#### Parameters

layout | a GtkLayout |

#### Returns

vertical scroll adjustment.

[transfer none]

### gtk_layout_set_hadjustment ()

    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.

Use `gtk_scrollable_set_hadjustment()`

Sets the horizontal scroll adjustment for the layout.

See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

#### Parameters

layout | a GtkLayout |
adjustment | new scroll adjustment. | [allow-none]

### gtk_layout_set_vadjustment ()

    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.

Use `gtk_scrollable_set_vadjustment()`

Sets the vertical scroll adjustment for the layout.

See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.

#### Parameters

layout | a GtkLayout |
adjustment | new scroll adjustment. | [allow-none]

### gtk_layout_get_bin_window ()

    GdkWindow *
    gtk_layout_get_bin_window (GtkLayout *layout);

Retrieve the bin window of the layout used for drawing operations.

#### Parameters

layout | a GtkLayout |

#### Returns

a GdkWindow.

[transfer none]

Since: 2.14

## Types and Values

### struct GtkLayout

    struct GtkLayout;

## Property Details

### The `“height”` property

      “height”                   guint

The height of the layout.

Flags: Read / Write

Allowed values: <= G_MAXINT

Default value: 100

### The `“width”` property

      “width”                    guint

The width of the layout.

Flags: Read / Write

Allowed values: <= G_MAXINT

Default value: 100

## Child Property Details

### The `“x”` child property

      “x”                        gint

X position of child widget.

Flags: Read / Write

Default value: 0

### The `“y”` child property

      “y”                        gint

Y position of child widget.

Flags: Read / Write

Default value: 0

## See Also

GtkDrawingArea, GtkScrolledWindow