Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::SizeGroup Class Reference

A GtkSizeGroup C++ wrapper class. More...

#include <xfc/gtk/sizegroup.hh>

Inheritance diagram for Xfc::Gtk::SizeGroup:

Xfc::G::Object Xfc::G::TypeInstance Xfc::Trackable List of all members.

Public Member Functions

Accessors
Methods

Detailed Description

A GtkSizeGroup C++ wrapper class.

SizeGroup provides a mechanism for grouping a number of widgets together so they all request the same amount of space. This is typically useful when you want a column of widgets to have the same size, but you can't use a Table widget.

In detail, the size requested for each widget in a SizeGroup is the maximum of the sizes that would have been requested for each widget in the size group if they were not in the size group. The mode of the size group (see set_mode()) determines whether this applies to the horizontal size, the vertical size, or both sizes. Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If you want the widgets in a SizeGroup to actually be the same size, you need to pack them in such a way that they get the size they request and not more. For example, if you are packing your widgets into a table, you would not include the FILL flag.

SizeGroup objects are referenced by each widget in the size group, so once you have added all widgets to a SizeGroup, you can drop the initial reference to the size group with unref(). If the widgets in the size group are subsequently destroyed, then they will be removed from the size group and drop their references on the size group; when all widgets have been removed, the size group will be freed.

Widgets can be part of multiple size groups; GTK+ will compute the horizontal size of a widget from the horizontal requisition of all widgets that can be reached from the widget by a chain of size groups of type SIZE_GROUP_HORIZONTAL or SIZE_GROUP_BOTH, and the vertical size from the vertical requisition of all widgets that can be reached from the widget by a chain of size groups of type SIZE_GROUP_VERTICAL or SIZE_GROUP_BOTH.

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.


Constructor & Destructor Documentation

Xfc::Gtk::SizeGroup::SizeGroup ( GtkSizeGroup *  size_group,
bool  owns_reference = true 
) [explicit, protected]

Construct a new SizeGroup from an existing GtkSizeGroup.

Parameters:
size_group A pointer to a GtkSizeGroup.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The size_group can be a newly created GtkSizeGroup or an existing GtkSizeGroup (see G::Object::Object).

Xfc::Gtk::SizeGroup::SizeGroup ( SizeGroupMode  mode = SIZE_GROUP_HORIZONTAL  )  [explicit]

Constructs a new size group with a reference count of 1 that the caller owns.

Parameters:
mode The mode for the new size group.

Xfc::Gtk::SizeGroup::SizeGroup ( GtkSizeGroup *  size_group,
bool  owns_reference = true 
) [explicit, protected]

Construct a new SizeGroup from an existing GtkSizeGroup.

Parameters:
size_group A pointer to a GtkSizeGroup.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The size_group can be a newly created GtkSizeGroup or an existing GtkSizeGroup (see G::Object::Object).

Xfc::Gtk::SizeGroup::SizeGroup ( SizeGroupMode  mode = SIZE_GROUP_HORIZONTAL  )  [explicit]

Constructs a new size group with a reference count of 1 that the caller owns.

Parameters:
mode The mode for the new size group.


Member Function Documentation

SizeGroupMode Xfc::Gtk::SizeGroup::get_mode (  )  const

Gets the current mode of the size group (see set_mode()).

Returns:
The current mode of the size group.

void Xfc::Gtk::SizeGroup::set_mode ( SizeGroupMode  mode  ) 

Sets the SizeGroupMode of the size group.

Parameters:
mode The mode to set for the size group.
The mode of the size group determines whether the widgets in the size group should all have the same horizontal requisition (SIZE_GROUP_MODE_HORIZONTAL), all have the same vertical requisition (SIZE_GROUP_MODE_VERTICAL), or should all have the same requisition in both directions (SIZE_GROUP_MODE_BOTH).

void Xfc::Gtk::SizeGroup::add_widget ( Widget widget  ) 

Adds a widget to the SizeGroup.

Parameters:
widget The Widget to add.
In the future, the requisition of the widget will be determined as the maximum of its requisition and the requisition of the other widgets in the size group. Whether this applies horizontally, vertically, or in both directions depends on the mode of the size group (see set_mode()).

void Xfc::Gtk::SizeGroup::remove_widget ( Widget widget  ) 

Removes a widget from the SizeGroup.

Parameters:
widget The Widget to remove.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3