Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::Box Class Reference

A GtkBox C++ wrapper class. More...

`#include <inti/gtk/box.h>`

Inheritance diagram for Inti::Gtk::Box:

List of all members.

## Public Member Functions

Accessors

- GtkBox * gtk_box () const
    Get a pointer to the GtkBox structure.
- GtkBoxClass * gtk_box_class () const
    Get a pointer to the GtkBoxClass structure.
- operator GtkBox * () const
    Conversion operator; safely converts a Box to a GtkBox pointer.
- bool children (std::vector< BoxChild * > &child_list) const
    Get a list of children belonging to the Box.
- bool get_homogeneous () const
    Returns whether the box is homogeneous (all children are the same size); see set_homogeneous().
- int get_spacing () const
    Gets the value set by set_spacing().

Methods

- void pack_start (Widget &child, bool expand=true, bool fill=true, unsigned int padding=0)
    Adds child to the box, packed with reference to the start of box.
- void pack_end (Widget &child, bool expand=true, bool fill=true, unsigned int padding=0)
    Adds child to the box, packed with reference to the end of box.
- void insert_start (Widget &child, int position, bool expand=true, bool fill=true, unsigned int padding=0)
    Inserts child into the box at position, with reference to the start of box.
- void insert_end (Widget &child, int position, bool expand=true, bool fill=true, unsigned int padding=0)
    Inserts child into the box at position, packed with reference to the end of box.
- void set_homogeneous (bool homogeneous)
    Sets the homogeneous field of the Box, controlling whether or not all children of box are given equal space in the box.
- void set_spacing (int spacing)
    Sets the spacing field of the Box, which is the number of pixels to place between children of box.
- void reorder_child (Widget &child, int position)
    Moves child to a new position in the list of box children.
- void query_child_packing (Widget &child, bool *expand, bool *fill, unsigned int *padding, PackType *pack_type) const
    Returns information about how child is packed into the box.
- void set_child_packing (Widget &child, bool expand, bool fill, unsigned int padding, PackType pack_type)
    Sets the way child is packed into the box.

Property Proxies

- const SpacingPropertyProxy prop_spacing ()
    The amount of space between children (int : Read / Write).
- const HomogeneousPropertyProxy prop_homogeneous ()
    Whether the children should all be the same size (bool : Read / Write).

Child Property Proxies

- const ExpandPropertyProxy prop_expand ()
    Whether the child should receive extra space when the parent grows (bool : Read / Write).
- const FillPropertyProxy prop_fill ()
    Whether extra space given to the child is allocated to the child or used as padding (bool : Read / Write).
- const PaddingPropertyProxy prop_padding ()
    Extra space to put between the child and its neighbors, in pixels (unsigned int : Read / Write).
- const PackTypePropertyProxy prop_pack_type ()
    Whether the child is packed with reference to the start or end of the parent (PackType : Read / Write).
- const PositionPropertyProxy prop_position ()
    The index of the child in the parent (int : Read / Write).

## Protected Member Functions

Constructors

- Box ()
    Construct a new type of Box Widget.
- Box (GtkBox *box, bool reference=false)
    Construct a new Box from an existing GtkBox.
- virtual ~Box ()=0
    Destructor.

## Detailed Description

A GtkBox C++ wrapper class.

Box is an abstract widget which encapsulates functionallity for a particular kind of container, one that organizes a variable number of widgets into a rectangular area. Box currently has two derived classes, HBox and VBox. The rectangular area of a Box is organized into either a single row or a single column of child widgets depending upon whether the box is of type HBox or VBox, respectively. Thus, all children of a Box are allocated one dimension in common, which is the height of a row, or the width of a column.

Box uses a notion of packing. Packing refers to adding widgets with reference to a particular position in a Container. For a Box, there are two reference positions: the start and the end of the box. For a VBox, the start is defined as the top of the box and the end is defined as the bottom. For a HBox the start is defined as the left side and the end is defined as the right side. Use repeated calls to pack_start() to pack widgets into a Box from start to end. Use pack_end() to add widgets from end to start. You may intersperse these calls and add widgets from both ends of the same Box.

Because Box is a Container, you may also use Gtk::Container::add() to insert widgets into the box, and they will be packed as if with pack_start() using the default values: expand true, fill true and padding zero. Use Gtk::Container::remove() to remove widgets from the Box.

Use set_homogeneous() to specify whether or not all children of the Box are forced to get the same amount of space. Use set_spacing() to determine how much space will be minimally placed between all children in the Box. Use reorder_child() to move a Box child to a different place in the box. Use set_child_packing() to reset the expand, fill, and padding attributes of any Box child. Use query_child_packing() to query these fields.

## Constructor & Destructor Documentation

Inti::Gtk::Box::Box | ( | GtkBox * | box,
|  | bool | reference = false
| ) | `[explicit, protected]`

  | Construct a new Box from an existing GtkBox. Parameters:
  box | A pointer to a GtkBox.
  reference | Set false if the initial reference count is floating, set true if it's not.
The box can be a newly created GtkBox or an existing GtkBox. (see G::Object::Object).

## Member Function Documentation

bool Inti::Gtk::Box::children | ( | std::vector< BoxChild * > & | child_list | ) | const

  | Get a list of children belonging to the Box. Parameters:
  child_list | A reference to an empty vector of BoxChild* to hold the children.
Returns: true if successful, false otherwise. The data is a vector of BoxChild pointers. The returned children do not have a reference added, so you do not need to unref them.

bool Inti::Gtk::Box::get_homogeneous | ( |  | ) | const

| Returns whether the box is homogeneous (all children are the same size); see set_homogeneous(). Returns: true if the box is homogeneous.

int Inti::Gtk::Box::get_spacing | ( |  | ) | const

| Gets the value set by set_spacing(). Returns: The spacing between children.

void Inti::Gtk::Box::insert_end | ( | Widget & | child,
|  | int | position,
|  | bool | expand = true,
|  | bool | fill = true,
|  | unsigned int | padding = 0
| ) |

  | Inserts child into the box at position, packed with reference to the end of box. Parameters:
  child | The Widget to be added to the box.
  position | The new position for child at the end, starting from 0.
  expand | Set true if the new child is to be given extra space allocated to the box. The extra space is divided evenly between all children of box using this option.
  fill | Set true if space given to child by the expand option is actually allocated to the child, rather than just padding it. This parameter has no effect if expand is set to false. A child is always allocated the full height of a HBox and the full width of a VBox. This option affects the other dimension.
  padding | The extra space in pixels to put between this child and its neighbors, over and above the global amount specified by spacing in Box. If child is a widget at one of the reference ends of the box, then padding pixels are also put between child and the reference edge of box.
This method is equivalent to calling pack_end() followed by reorder_child(). The default arguments specified are those most frequently used. Setting position to -1 is the same as calling pack_end(); the position argument is ignored.

void Inti::Gtk::Box::insert_start | ( | Widget & | child,
|  | int | position,
|  | bool | expand = true,
|  | bool | fill = true,
|  | unsigned int | padding = 0
| ) |

  | Inserts child into the box at position, with reference to the start of box. Parameters:
  child | The Widget to be added to the box.
  position | The new position for child at the start, starting from 0.
  expand | Set true if the new child is to be given extra space allocated to the box. The extra space is divided evenly between all children of box using this option.
  fill | Set true if space given to child by the expand option is actually allocated to the child, rather than just padding it. This parameter has no effect if expand is set to false. A child is alwaHys allocated the full height of a HBox and the full width of a VBox. This option affects the other dimension.
  padding | The extra space in pixels to put between this child and its neighbors, over and above the global amount specified by spacing in Box. If child is a widget at one of the reference ends of the box, then padding pixels are also put between child and the reference edge of box.
This method is equivalent to calling pack_start() followed by reorder_child(). The default arguments specified are those most frequently used. Setting position to -1 is the same as calling pack_start(); the position argument is ignored.

void Inti::Gtk::Box::pack_end | ( | Widget & | child,
|  | bool | expand = true,
|  | bool | fill = true,
|  | unsigned int | padding = 0
| ) |

  | Adds child to the box, packed with reference to the end of box. Parameters:
  child | The Widget to be added to the box.
  expand | Set true if the new child is to be given extra space allocated to the box. The extra space is divided evenly between all children of box using this option.
  fill | Set true if space given to child by the expand option is actually allocated to the child, rather than just padding it. This parameter has no effect if expand is set to false. A child is always allocated the full height of a HBox and the full width of a VBox. This option affects the other dimension.
  padding | The extra space in pixels to put between this child and its neighbors, over and above the global amount specified by spacing in Box. If child is a widget at one of the reference ends of the box, then padding pixels are also put between child and the reference edge of box.
The child is packed after (away from end of) any other child packed with reference to the end of box. The default arguments specified are those most frequently used.

void Inti::Gtk::Box::pack_start | ( | Widget & | child,
|  | bool | expand = true,
|  | bool | fill = true,
|  | unsigned int | padding = 0
| ) |

  | Adds child to the box, packed with reference to the start of box. Parameters:
  child | The Widget to be added to the box.
  expand | Set true if the new child is to be given extra space allocated to the box. The extra space is divided evenly between all children of box using this option.
  fill | Set true if space given to child by the expand option is actually allocated to the child, rather than just padding it. This parameter has no effect if expand is set to false. A child is always allocated the full height of a HBox and the full width of a VBox. This option affects the other dimension.
  padding | The extra space in pixels to put between this child and its neighbors, over and above the global amount specified by spacing in Box. If child is a widget at one of the reference ends of the box, then padding pixels are also put between child and the reference edge of box.
The child is packed after any other child packed with reference to the start of box. The default arguments specified are those most frequently used.

void Inti::Gtk::Box::query_child_packing | ( | Widget & | child,
|  | bool * | expand,
|  | bool * | fill,
|  | unsigned int * | padding,
|  | PackType * | pack_type
| ) | const

  | Returns information about how child is packed into the box. Parameters:
  child | The Widget of the child to query.
  expand | The returned value of the expand field in BoxChild.
  fill | The returned value of the fill field in BoxChild.
  padding | The returned value of the padding field in BoxChild.
  pack_type | The returned value of the pack field in BoxChild.

void Inti::Gtk::Box::reorder_child | ( | Widget & | child,
|  | int | position
| ) |

  | Moves child to a new position in the list of box children. Parameters:
  child | The Widget to move.
  position | The new position for child in the children list, starting from 0.
The list is the children field of GtkBox, and contains both widgets packed Gtk::PACK_START as well as widgets packed Gtk::PACK_END, in the order that these widgets were added to box. A negative value indicates the end of the list. A widget's position in the box children list determines where the widget is packed into box. A child widget at some position in the list will be packed just after all other widgets of the same packing type that appear earlier in the list.

void Inti::Gtk::Box::set_child_packing | ( | Widget & | child,
|  | bool | expand,
|  | bool | fill,
|  | unsigned int | padding,
|  | PackType | pack_type
| ) |

  | Sets the way child is packed into the box. Parameters:
  child | The Widget of the child to set.
  expand | The new value of the expand field in BoxChild.
  fill | The new value of the fill field in BoxChild.
  padding | The new value of the padding field in BoxChild.
  pack_type | The new value of the pack field in BoxChild.

void Inti::Gtk::Box::set_homogeneous | ( | bool | homogeneous | ) |

  | Sets the homogeneous field of the Box, controlling whether or not all children of box are given equal space in the box. Parameters:
  homogeneous | A boolean value, true to create equal allotments, false for variable allotments.

void Inti::Gtk::Box::set_spacing | ( | int | spacing | ) |

  | Sets the spacing field of the Box, which is the number of pixels to place between children of box. Parameters:
  spacing | The number of pixels to put between children.

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

- box.h

Main Page - Footer