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


Xfc::Gtk::Container Class Reference

A GtkContainer C++ wrapper class. More...

#include <xfc/gtk/container.hh>

Inheritance diagram for Xfc::Gtk::Container:

Xfc::Gtk::Widget Xfc::Gtk::Object Xfc::Atk::Implementor Xfc::G::Object Xfc::G::TypeInterface Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable Xfc::Gtk::Bin Xfc::Gtk::Box Xfc::Gtk::Fixed Xfc::Gtk::IconView Xfc::Gtk::Layout Xfc::Gtk::MenuShell Xfc::Gtk::Notebook Xfc::Gtk::Paned Xfc::Gtk::Socket Xfc::Gtk::Table Xfc::Gtk::TextView Xfc::Gtk::Toolbar Xfc::Gtk::TreeView List of all members.

Signal Prototypes

Public Types

Public Member Functions

Accessors
Methods
Signal Proxies

Detailed Description

A GtkContainer C++ wrapper class.

Container is a base class for widgets (parents) that contain other widgets (children). Container is responsible for managing the parent-child relationship. There are several types of containers, some having only one child and others having several. Some containers with only one child derive from Bin (Window, Button, Frame, HandleBox), while others with several children derive from Box (HBox, VBox), MenuShell (Menu, MenuBar) and Paned (HPaned, VPaned). Other containers with several children include Fixed, Layout, Notebook, Table and Toolbar.


Member Typedef Documentation

typedef sigc::slot<void, Widget&> Xfc::Gtk::Container::ForeachSlot

Signature of the callback slot to be called for each widget in the container.

Example: Method signature for ForeachSlot.

< void method(Widget& widget);
< // widget: The child widget.
<

Reimplemented in Xfc::Gtk::IconView.


Constructor & Destructor Documentation

Xfc::Gtk::Container::Container ( GtkContainer *  container,
bool  owns_reference = false 
) [explicit, protected]

Construct a new Container from an existing GtkContainer.

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

Xfc::Gtk::Container::Container ( GtkContainer *  container,
bool  owns_reference = false 
) [explicit, protected]

Construct a new Container from an existing GtkContainer.

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


Member Function Documentation

GType Xfc::Gtk::Container::child_type (  )  const

Returns the type of the children supported by the container.

Returns:
A GType.
Note that this may return G_TYPE_NONE to indicate that no more children can be added, e.g. for a Gtk::Paned which already has two children.

bool Xfc::Gtk::Container::get_children ( std::vector< Widget * > &  child_list  )  const

Gets a list ot the container's non-internal children.

Parameters:
child_list A vector of Widget* to hold the list of the container's non-internal children.
See foreach() for details on what constitutes an "internal" child.

bool Xfc::Gtk::Container::get_focus_chain ( std::vector< Widget * > &  focusable_widgets  )  const

Retrieves the focus chain of the container, if one has been set explicitly.

Parameters:
focusable_widgets A vector of Widget* to store the focus chain of the container.
Returns:
true if the focus chain of the container has been set explicitly.
If no focus chain has been explicitly set, GTK+ computes the focus chain based on the positions of the children. In that case, GTK+ stores null in focusable_widgets and returns false. No additional reference count is added to the individual widgets in the focus chain.

Adjustment* Xfc::Gtk::Container::get_focus_vadjustment (  )  const

Retrieves the vertical focus adjustment for the container; see set_focus_vadjustment().

Returns:
The vertical focus adjustment, or null if none has been set.

Adjustment* Xfc::Gtk::Container::get_focus_hadjustment (  )  const

Retrieves the horizontal focus adjustment for the container; see set_focus_hadjustment().

Returns:
The horizontal focus adjustment, or null if none has been set.

void Xfc::Gtk::Container::add ( Widget widget  ) 

Adds widget to the container.

Parameters:
widget A widget to be placed inside the container.
Typically used for simple containers such as Window, Frame, or Button; for more complicated layout containers such as Box or Table, this method will pick default packing parameters that may not be correct. So consider methods such as Gtk::Box::pack_start() and Gtk::Table::attach() as an alternative to add() in those cases. A widget may be added to only one container at a time; you can't place the same widget inside two different containers.

void Xfc::Gtk::Container::remove ( Widget widget  ) 

Removes widget from the container.

Parameters:
widget A current child of the container.
The widget must be inside container. Note that the container will own a reference to widget, and that this may be the last reference held; so removing a widget from its container can destroy that widget. If you want to use widget again, you need to add a reference to it while it's not inside a container, using G::Object::ref().

void Xfc::Gtk::Container::check_resize (  ) 

Check whether the container should resize, and if so queue a resize request.

Only useful when writing a special custom widget.

void Xfc::Gtk::Container::set_focus_child ( Widget widget  ) 

Sets the focus on a widget.

Parameters:
widget The widget that is to receive the focus. Only useful when writing a special custom widget.

void Xfc::Gtk::Container::set_border_width ( unsigned int  border_width  ) 

Sets the border width of the container.

Parameters:
border_width Amount of blank space to leave outside the container. Valid values are in the range 0-65535 pixels.
The border width of a container is the amount of space to leave around the outside of the container. The only exception to this is Gtk::Window; because toplevel windows can't leave space outside, they leave the space inside. The border is added on all sides of the container. To add space to only one side, one approach is to create an Alignment widget, call Gtk::Widget::set_size_request() to give it a size, and place it on the side of the container as a spacer.

void Xfc::Gtk::Container::set_resize_mode ( ResizeMode  resize_mode  ) 

Sets the resize mode for the container.

Parameters:
resize_mode The new resize mode.
The resize mode of a container determines whether a resize request will be passed to the container's parent, queued for later execution or executed immediately.

void Xfc::Gtk::Container::foreach ( const ForeachSlot each  ) 

Invokes the each slot on each non-internal child of the container.

Parameters:
each A ForeachSlot to call on each non-internal child of the container.
"Internal" children generally weren't added by the user of the container, but were added by the container implementation itself.

void Xfc::Gtk::Container::set_reallocate_redraws ( bool  needs_redraws  ) 

Containers requesting reallocation redraws get automatically redrawn if any of their children change their allocation.

Parameters:
needs_redraws The new value for the container's reallocate_redraws flag.

void Xfc::Gtk::Container::set_focus_vadjustment ( Adjustment adjustment  ) 

Sets the vertical focus adjustment for the container.

Parameters:
adjustment The new vertical focus adjustment, or null.
Updates the Adjustment to reflect the vertical position of the focused child, according to the height of the container.

void Xfc::Gtk::Container::set_focus_hadjustment ( Adjustment adjustment  ) 

Sets the horizontal focus adjustment for the container.

Parameters:
adjustment The new horizontal focus adjustment, or null.
Updates the Adjustment to reflect the horizontal position of the focused child, according to the width of the container.

void Xfc::Gtk::Container::resize_children (  ) 

Update the size and position of the child widgets.

Only useful when writing a special custom widget. Called after a size request to the get the container to reallocate its size and position to reflect a change in the size and position of its children.

void Xfc::Gtk::Container::propagate_expose ( Widget child,
const Gdk::EventExpose event 
)

When a container receives an expose event, it must send synthetic expose events to all children that don't have their own Gdk::Windows.

Parameters:
child A child of the container.
event An expose event sent to the container.
This method provides a convenient way of sending an expose event. A container, when it receives an expose event, calls propagate_expose() once for each child, passing in the event the container received. This method takes care of deciding whether an expose event needs to be sent to the child, intersecting the event's area with the child area, and sending the event. In most cases, a container can simply override the inherited on_expose_event() implementation from Container.

void Xfc::Gtk::Container::set_focus_chain ( const std::vector< Widget * > &  focusable_widgets  ) 

Sets a focus chain, overriding the one computed automatically by GTK+.

Parameters:
focusable_widgets A vector of Widgets to set as the new focus chain.
In principle each widget in the chain should be a descendant of the container, but this is not enforced by this method, since it's allowed to set the focus chain before you pack the widgets, or have a widget in the chain that isn't always packed. The necessary checks are done when the focus chain is actually traversed.


Member Data Documentation

const AddSignalType Xfc::Gtk::Container::add_signal [static, protected]

Add signal (see signal_add()).

Calls a slot with the signature:

< void function(Gtk::Widget& widget);
< // widget: The widget added to the container
<

const RemoveSignalType Xfc::Gtk::Container::remove_signal [static, protected]

Remove signal (see signal_remove()).

Calls a slot with the signature:

< void function(Gtk::Widget& widget);
< // widget: The widget removed from the container
<

const CheckResizeSignalType Xfc::Gtk::Container::check_resize_signal [static, protected]

Check resize signal (see signal_check_resize()).

Calls a slot with the signature:

< void function();
<

const SetFocusChildSignalType Xfc::Gtk::Container::set_focus_child_signal [static, protected]

Set focus child signal (see signal_set_focus_child()).

Calls a slot with the signature:

< void function(Gtk::Widget *widget);
< // widget: The widget that receives the focus.
<


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