Next: , Previous: GtkVPaned, Up: Top


99 GtkLayout

Infinite scrollable area containing child widgets and/or custom drawing

99.1 Overview

<gtk-layout> is similar to <gtk-drawing-area> 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 <gtk-scrolled-window>), and it can contain child widgets, since it's a <gtk-container>. However if you're just going to draw, a <gtk-drawing-area> is a better choice since it has lower overhead.

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

99.2 Usage

— Class: <gtk-layout>

Derives from <gtk-container>.

This class defines the following slots:

hadjustment
The GtkAdjustment for the horizontal position
vadjustment
The GtkAdjustment for the vertical position
width
The width of the layout
height
The height of the layout
— Signal on <gtk-layout>: set-scroll-adjustments (arg0 <gtk-adjustment>) (arg1 <gtk-adjustment>)
— Function: gtk-layout-new (hadjustment <gtk-adjustment>) (vadjustment <gtk-adjustment>) ⇒  (ret <gtk-widget>)

Creates a new <gtk-layout>. Unless you have a specific adjustment you'd like the layout to use for scrolling, pass ‘#f’ for hadjustment and vadjustment.

hadjustment
horizontal scroll adjustment, or ‘#f
vadjustment
vertical scroll adjustment, or ‘#f
ret
a new <gtk-layout>
— Function: gtk-layout-put (self <gtk-layout>) (child_widget <gtk-widget>) (int) (int)
— Method: put

Adds child-widget to layout, at position (x,y). layout becomes the new parent container of child-widget.

layout
a <gtk-layout>
child-widget
child widget
x
X position of child widget
y
Y position of child widget
— Function: gtk-layout-move (self <gtk-layout>) (child_widget <gtk-widget>) (int) (int)
— Method: move

Moves a current child of layout to a new position.

layout
a <gtk-layout>
child-widget
a current child of layout
x
X position to move to
y
Y position to move to
— Function: gtk-layout-set-size (self <gtk-layout>) (width unsigned-int) (height unsigned-int)
— Method: set-size

Sets the size of the scrollable area of the layout.

layout
a <gtk-layout>
width
width of entire scrollable area
height
height of entire scrollable area
— Function: gtk-layout-get-size (self <gtk-layout>) ⇒  (width unsigned-int) (height unsigned-int)
— Method: get-size

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
a <gtk-layout>
width
location to store the width set on layout, or ‘#f
height
location to store the height set on layout, or ‘#f
— Function: gtk-layout-get-hadjustment (self <gtk-layout>) ⇒  (ret <gtk-adjustment>)
— Method: get-hadjustment

This function should only be called after the layout has been placed in a <gtk-scrolled-window> or otherwise configured for scrolling. It returns the <gtk-adjustment> used for communication between the horizontal scrollbar and layout.

See <gtk-scrolled-window>, <gtk-scrollbar>, <gtk-adjustment> for details.

layout
a <gtk-layout>
ret
horizontal scroll adjustment
— Function: gtk-layout-get-vadjustment (self <gtk-layout>) ⇒  (ret <gtk-adjustment>)
— Method: get-vadjustment

This function should only be called after the layout has been placed in a <gtk-scrolled-window> or otherwise configured for scrolling. It returns the <gtk-adjustment> used for communication between the vertical scrollbar and layout.

See <gtk-scrolled-window>, <gtk-scrollbar>, <gtk-adjustment> for details.

layout
a <gtk-layout>
ret
vertical scroll adjustment
— Function: gtk-layout-set-hadjustment (self <gtk-layout>) (adjustment <gtk-adjustment>)
— Method: set-hadjustment

Sets the horizontal scroll adjustment for the layout.

See <gtk-scrolled-window>, <gtk-scrollbar>, <gtk-adjustment> for details.

layout
a <gtk-layout>
adjustment
new scroll adjustment
— Function: gtk-layout-set-vadjustment (self <gtk-layout>) (adjustment <gtk-adjustment>)
— Method: set-vadjustment

Sets the vertical scroll adjustment for the layout.

See <gtk-scrolled-window>, <gtk-scrollbar>, <gtk-adjustment> for details.

layout
a <gtk-layout>
adjustment
new scroll adjustment