Xfce Foundation Classes
 « Main Page | Index

Layout Container

The Layout container is similar to the Fixed container except that it implements an infinite (where infinity is less than 2^32) scrolling area. The X window system has a limitation where windows can be at most 32767 pixels wide or tall. The Layout container gets around this limitation by doing some exotic stuff using window and bit gravities, so that you can have smooth scrolling even when you have many child widgets in your scrolling area.

A Layout container is created using one of the following constructors:


Layout(Gtk::Adjustment *hadjustment, Gtk::Adjustment *vadjustment);

The first constructor creates a Layout with default horizontal and vertical adjustments. The second constructor lets you optionally specify the Adjustment objects that the Layout widget will use for its scrolling.

You can add and move widgets in the Layout container using the following two methods:

void put(Gtk::Widget& child_widget, int x, int y);

void move(Gtk::Widget& child_widget, int x, int y);

The put() method places 'widget' in the container at the position specified by x and y. The move() method moves the specified widget to a new position.

The size of the Layout container can be set using this next method:

void set_size(unsigned int width, unsigned int height);

The final four methods for use with Layout widgets are for manipulating their horizontal and vertical adjustment widgets:

void set_hadjustment(Gtk::Adjustment *adjustment);

void set_vadjustment(Gtk::Adjustment *adjustment);

Gtk::Adjustment* get_hadjustment() const;

Gtk::Adjustment* get_vadjustment() const;

Copyright © 2004-2005 The XFC Development Team Top
XFC 4.4