Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::Paned Class Reference

A GtkPaned C++ wrapper class. More...

`#include <xfc/gtk/paned.hh>`

Inheritance diagram for Xfc::Gtk::Paned:

List of all members.

## Public Member Functions

Accessors

- GtkPaned * gtk_paned () const
    Get a pointer to the GtkPaned structure.
- operator GtkPaned * () const
    Conversion operator; safely converts a Paned to a GtkPaned pointer.
- Gdk::Window * handle () const
    Returns the handle window in the divider between the two panes.
- int get_position () const
    Obtains the position of the divider between the two panes.
- Widget * get_child1 () const
    Obtains the first child of the paned widget.
- Widget * get_child2 () const
    Obtains the second child of the paned widget.

Methods

- void add1 (Widget &child)
    Adds a child to the top or left pane with default parameters.
- void add2 (Widget &child)
    Adds a child to the bottom or right pane with default parameters.
- void pack1 (Widget &child, bool resize=false, bool shrink=true)
    Adds a child to the top or left pane.
- void pack2 (Widget &child, bool resize=true, bool shrink=true)
    Adds a child to the bottom or right pane.
- void set_position (int position)
    Sets the position of the divider between the two panes.

## Protected Member Functions

Constructors

- Paned ()
    Construct a new Paned.
- Paned (GtkPaned *paned, bool owns_reference=false)
    Construct a new Paned from an existing GtkPaned.
- virtual ~Paned ()=0
    Destructor.

## Detailed Description

A GtkPaned C++ wrapper class.

Paned is the base class for widgets with two panes, arranged either horizontally (HPaned) or vertically (VPaned). Child widgets are added to the panes of the widget with pack1() and pack2(). The division beween the two children is set by default from the size requests of the children, but it can be adjusted by the user. A paned widget draws a separator between the two child widgets and a small handle that the user can drag to adjust the division. It does not draw any relief around the children or around the separator. (The space in which the separator is drawn is called the gutter.) Often, it is useful to put each child inside a Frame with the shadow type set to Gtk::SHADOW_IN so that the gutter appears as a ridge. The application can set the position of the separator as if it were set by the user, by calling set_position().

Each child has two options that can be set, resize and shrink. If resize is true, then when the Paned is resized, that child will expand or shrink along with the paned widget. If shrink is true, then when that child can be made smaller than it's requisition by the user. Setting shrink to false allows the application to set a minimum size. If resize is false for both children, then this is treated as if resize is true for both children.

Example: Creating a paned widget with minimum sizes.

        Gtk::HPaned *hpaned = new Gtk::HPaned;
        hpaned->set_size_request(200, -1);

        Gtk::Frame *frame1 = new Gtk::Frame;
        frame1->set_shadow_type(Gtk::SHADOW_IN);
        frame1->set_size_request(50, -1);

        Gtk::Frame *frame2 = new Gtk::Frame;
        frame2->set_shadow_type(Gtk::SHADOW_IN);
        frame2->set_size_request(50, -1);

        hpaned->pack1(*frame1, true, false);
        hpaned->pack2(*frame2, false, false);

See also: the Paned Window HOWTO and example.

## Constructor & Destructor Documentation

Xfc::Gtk::Paned::Paned | ( | GtkPaned * | paned,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new Paned from an existing GtkPaned.

Parameters:

  | paned | A pointer to a GtkPaned.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.

The paned can be a newly created GtkPaned or an existing GtkPaned (see G::Object::Object).

## Member Function Documentation

void Xfc::Gtk::Paned::add1 | ( | Widget & | child | ) |

Adds a child to the top or left pane with default parameters.

Parameters:

  | child | The child to add.

This is equivalent to pack1(child, false, true).

void Xfc::Gtk::Paned::add2 | ( | Widget & | child | ) |

Adds a child to the bottom or right pane with default parameters.

Parameters:

  | child | The child to add.

This is equivalent to pack2(child, true, true).

Widget* Xfc::Gtk::Paned::get_child1 | ( |  | ) | const

Obtains the first child of the paned widget.

Returns:
  The first child, or null if it is not set.

Widget* Xfc::Gtk::Paned::get_child2 | ( |  | ) | const

Obtains the second child of the paned widget.

Returns:
  The second child, or null if it is not set.

void Xfc::Gtk::Paned::pack1 | ( | Widget & | child,
|  | bool | resize = `false`,
|  | bool | shrink = `true`
| ) |

Adds a child to the top or left pane.

Parameters:

  | child | The child to add.
  | resize | Should this child expand when the paned widget is resized.
  | shrink | Can this child be made smaller than its requsition.

void Xfc::Gtk::Paned::pack2 | ( | Widget & | child,
|  | bool | resize = `true`,
|  | bool | shrink = `true`
| ) |

Adds a child to the bottom or right pane.

Parameters:

  | child | The child to add.
  | resize | Should this child expand when the paned widget is resized.
  | shrink | Can this child be made smaller than its requsition.

void Xfc::Gtk::Paned::set_position | ( | int | position | ) |

Sets the position of the divider between the two panes.

Parameters:

  | position | The pixel position of divider, a negative value means that the position is unset.

The documentation for this class was generated from the following file:

- paned.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3