# Gtk::Bin Class Reference
[Widgets]

A container with just one child. More...

Inherits Gtk::Container.

Inherited by Gtk::Alignment, Gtk::Button, Gtk::ComboBox, Gtk::EventBox, Gtk::Expander, Gtk::Frame, Gtk::HandleBox, Gtk::Item, Gtk::ScrolledWindow, Gtk::ToolItem, Gtk::Viewport, and Gtk::Window.

Collaboration diagram for Gtk::Bin:

[legend]

List of all members.

## Public Member Functions

virtual | ~Bin ()
GtkBin* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkBin* | gobj () const
| Provides access to the underlying C GtkObject.
Widget* | get_child ()
const Widget* | get_child () const
void | remove ()
| Remove the contained object Since this can only hold one object it is not necessary to specify which object to remove like other containers.
void | add_label (const Glib::ustring& label, bool mnemonic=false, double x_align=0.5, double y_align=0.5)
| Add a Label object.
void | add_label (const Glib::ustring& label, bool mnemonic, AlignmentEnum x_align, AlignmentEnum y_align=ALIGN_CENTER)
| Add a Label object.
void | add_pixmap (const Glib::RefPtr< Gdk::Pixmap >& pixmap, const Glib::RefPtr< Gdk::Bitmap >& mask)
| Add an Image object.
void | add_pixlabel (const Glib::RefPtr< Gdk::Pixmap >& pixmap, const Glib::RefPtr< Gdk::Bitmap >& mask, const Glib::ustring& label, double x_align=0.5, double y_align=0.5)
| Add Image and Label objects.
void | add_pixlabel (const Glib::ustring& pixfile, const Glib::ustring& label, double x_align=0.5, double y_align=0.5)
| Add Image and Label objects.

## Protected Member Functions

| Bin ()
| This constructor is protected because only derived classes should be instantiated.

## Related Functions

(Note that these are not member functions.)
Gtk::Bin* | wrap (GtkBin* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A container with just one child.

This is an abstract base class from which all classes holding up to 1 widget inside of them derive. It provides access to methods relevent to a single object, such as add_label, add_pixmap, etc.

## Constructor & Destructor Documentation

virtual Gtk::Bin::~Bin | ( |  | ) | `[virtual]`

Gtk::Bin::Bin | ( |  | ) | `[protected]`

This constructor is protected because only derived classes should be instantiated.

## Member Function Documentation

void Gtk::Bin::add_label | ( | const Glib::ustring & | label,
|  | bool | mnemonic,
|  | AlignmentEnum | x_align,
|  | AlignmentEnum | y_align = `ALIGN_CENTER` |
| ) |  |  |

Add a Label object.

This does not correspond to any GTK+ function and is provided purely for convenience.

Parameters:

  | label | The label text.
  | mnemonic | If `true`, characters preceded by an underscore (_) will be underlined and used as a keyboard accelerator (shortcut).
  | x_align | The horizontal alignment of the text. For possible values, see Gtk::AlignmentEnum.
  | y_align | The vertical alignment of the text. For possible values, see Gtk::AlignmentEnum.

void Gtk::Bin::add_label | ( | const Glib::ustring & | label,
|  | bool | mnemonic = `false`,
|  | double | x_align = `0.5`,
|  | double | y_align = `0.5` |
| ) |  |  |

Add a Label object.

This does not correspond to any GTK+ function and is provided purely for convenience.

Parameters:

  | label | The text for the label.
  | mnemonic | If `true`, characters preceded by an underscore (_) will be underlined and used as a keyboard accelerator (shortcut).
  | x_align | The horizontal alignment of the text. This ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | y_align | The vertical alignment of the text. This ranges from 0.0 (top aligned) to 1.0 (bottom aligned).

void Gtk::Bin::add_pixlabel | ( | const Glib::ustring & | pixfile,
|  | const Glib::ustring & | label,
|  | double | x_align = `0.5`,
|  | double | y_align = `0.5` |
| ) |  |  |

Add Image and Label objects.

This does not correspond to any GTK+ function and is provided purely for convenience. This will create, manage, add, and show a new Image and Label (within an HBox) to this Bin.

Parameters:

  | pixfile | The path to a file to be displayed.
  | label | The text for the label.
  | x_align | The horizontal alignment of the text in the label.
  | y_align | The vertical alignment of the text in the label.

void Gtk::Bin::add_pixlabel | ( | const Glib::RefPtr< Gdk::Pixmap >& | pixmap,
|  | const Glib::RefPtr< Gdk::Bitmap >& | mask,
|  | const Glib::ustring & | label,
|  | double | x_align = `0.5`,
|  | double | y_align = `0.5` |
| ) |  |  |

Add Image and Label objects.

This does not correspond to any GTK+ function and is provided purely for convenience. This will create, manage, add, and show a new Image and Label (within an HBox) to this Bin.

Parameters:

  | pixmap | A Glib::RefPtr to a Gdk::Pixmap.
  | mask | A Glib::RefPtr to a Gdk::Bitmap.
  | label | The text for the label.
  | x_align | The horizontal alignment of the text in the label.
  | y_align | The vertical alignment of the text in the label.

void Gtk::Bin::add_pixmap | ( | const Glib::RefPtr< Gdk::Pixmap >& | pixmap,
|  | const Glib::RefPtr< Gdk::Bitmap >& | mask |
| ) |  |  |

Add an Image object.

This does not correspond to any GTK+ function and is provided purely for convenience. This will create, manage, add, and show a new Image to this Bin.

Parameters:

  | pixmap | A Glib::RefPtr to a Gdk::Pixmap.
  | mask | A Glib::RefPtr to a Gdk::Bitmap.

const Widget* Gtk::Bin::get_child | ( |  | ) | const

Widget* Gtk::Bin::get_child | ( |  | ) |

const GtkBin* Gtk::Bin::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

Reimplemented in Gtk::AboutDialog, Gtk::Alignment, Gtk::AspectFrame, Gtk::Assistant, Gtk::Button, Gtk::CheckButton, Gtk::CheckMenuItem, Gtk::ColorButton, Gtk::ColorSelectionDialog, Gtk::ComboBox, Gtk::ComboBoxEntry, Gtk::Dialog, Gtk::EventBox, Gtk::Expander, Gtk::FileChooserDialog, Gtk::FileSelection, Gtk::FontButton, Gtk::FontSelectionDialog, Gtk::Frame, Gtk::HandleBox, Gtk::ImageMenuItem, Gtk::InputDialog, Gtk::Item, Gtk::LinkButton, Gtk::MenuItem, Gtk::MenuToolButton, Gtk::MessageDialog, Gtk::OptionMenu, Gtk::Plug, Gtk::RadioButton, Gtk::RadioMenuItem, Gtk::RadioToolButton, Gtk::RecentChooserDialog, Gtk::ScaleButton, Gtk::ScrolledWindow, Gtk::SeparatorMenuItem, Gtk::SeparatorToolItem, Gtk::TearoffMenuItem, Gtk::ToggleButton, Gtk::ToggleToolButton, Gtk::ToolButton, Gtk::ToolItem, Gtk::Viewport, Gtk::VolumeButton, Gtk::Window, Gtk::PageSetupUnixDialog, Gtk::PrintUnixDialog, and Gtk::ComboDropDownItem.

GtkBin* Gtk::Bin::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

Reimplemented in Gtk::AboutDialog, Gtk::Alignment, Gtk::AspectFrame, Gtk::Assistant, Gtk::Button, Gtk::CheckButton, Gtk::CheckMenuItem, Gtk::ColorButton, Gtk::ColorSelectionDialog, Gtk::ComboBox, Gtk::ComboBoxEntry, Gtk::Dialog, Gtk::EventBox, Gtk::Expander, Gtk::FileChooserDialog, Gtk::FileSelection, Gtk::FontButton, Gtk::FontSelectionDialog, Gtk::Frame, Gtk::HandleBox, Gtk::ImageMenuItem, Gtk::InputDialog, Gtk::Item, Gtk::LinkButton, Gtk::MenuItem, Gtk::MenuToolButton, Gtk::MessageDialog, Gtk::OptionMenu, Gtk::Plug, Gtk::RadioButton, Gtk::RadioMenuItem, Gtk::RadioToolButton, Gtk::RecentChooserDialog, Gtk::ScaleButton, Gtk::ScrolledWindow, Gtk::SeparatorMenuItem, Gtk::SeparatorToolItem, Gtk::TearoffMenuItem, Gtk::ToggleButton, Gtk::ToggleToolButton, Gtk::ToolButton, Gtk::ToolItem, Gtk::Viewport, Gtk::VolumeButton, Gtk::Window, Gtk::PageSetupUnixDialog, Gtk::PrintUnixDialog, and Gtk::ComboDropDownItem.

void Gtk::Bin::remove | ( |  | ) |

Remove the contained object Since this can only hold one object it is not necessary to specify which object to remove like other containers.

When calling remove() on a Gtk::ScrolledWindow this might not remove the expected child directly, because Gtk::ScrolledWindow::add() sometimes creates a Gtk::ViewPort child and places the widget in that.

## Friends And Related Function Documentation

Gtk::Bin* wrap | ( | GtkBin * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

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

- gtkmm/bin.h