1 /* $Id: bin.hg,v 1.2 2003/03/03 07:49:05 murrayc Exp $ */
5 * Copyright (C) 1998-2002 The gtkmm Development Team
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <gtkmm/container.h>
24 _PINCLUDE(gtkmm/private/container_p.h)
30 /** A container with just one child.
32 * This is an abstract base class from which all classes holding
33 * up to 1 widget inside of them derive. It provides access to methods
34 * relevent to a single object, such as add_label, add_pixmap, etc.
38 class Bin : public Container
40 _CLASS_GTKOBJECT(Bin,GtkBin,GTK_BIN,Gtk::Container,GtkContainer)
46 // get_child() is a convenience function to get a c++ wrapper of
47 // the contained widget. It may return NULL if such an item is not
49 _MEMBER_GET_PTR(child, child, Widget*, GtkWidget*)
51 /** Remove the contained object
52 * Since this can only hold one object it is not necessary to
53 * specify which object to remove like other containers.
55 * When calling remove() on a Gtk::ScrolledWindow this might not remove the
56 * expected child directly, because Gtk::ScrolledWindow::add() sometimes creates a
57 * Gtk::ViewPort child and places the widget in that.
61 //Convenience methods that don't correspond to GTK+ functions:
63 /** Add a Label object.
64 * This does not correspond to any GTK+ function and is provided purely for
66 * @param label The text for the label.
67 * @param mnemonic If <tt>true</tt>, characters preceded by an underscore
68 * (_) will be underlined and used as a keyboard accelerator (shortcut).
69 * @param x_align The horizontal alignment of the text. This ranges from
70 * 0.0 (left aligned) to 1.0 (right aligned).
71 * @param y_align The vertical alignment of the text. This ranges from
72 * 0.0 (top aligned) to 1.0 (bottom aligned).
74 void add_label(const Glib::ustring& label, bool mnemonic = false,
75 double x_align = 0.5, double y_align = 0.5);
77 /** Add a Label object.
78 * This does not correspond to any GTK+ function and is provided purely for
80 * @param label The label text.
81 * @param mnemonic If <tt>true</tt>, characters preceded by an underscore
82 * (_) will be underlined and used as a keyboard accelerator (shortcut).
83 * @param x_align The horizontal alignment of the text. For possible
84 * values, see Gtk::AlignmentEnum.
85 * @param y_align The vertical alignment of the text. For possible
86 * values, see Gtk::AlignmentEnum.
88 void add_label(const Glib::ustring& label, bool mnemonic,
89 AlignmentEnum x_align, AlignmentEnum y_align = ALIGN_CENTER);
91 /** Add an Image object.
92 * This does not correspond to any GTK+ function and is provided purely for
94 * This will create, manage, add, and show a new Image to this Bin.
95 * @param pixmap A Glib::RefPtr to a Gdk::Pixmap.
96 * @param mask A Glib::RefPtr to a Gdk::Bitmap.
98 void add_pixmap(const Glib::RefPtr<Gdk::Pixmap>& pixmap,
99 const Glib::RefPtr<Gdk::Bitmap>& mask);
101 /** Add Image and Label objects.
102 * This does not correspond to any GTK+ function and is provided purely for
104 * This will create, manage, add, and show a new Image and Label (within an
106 * @param pixmap A Glib::RefPtr to a Gdk::Pixmap.
107 * @param mask A Glib::RefPtr to a Gdk::Bitmap.
108 * @param label The text for the label.
109 * @param x_align The horizontal alignment of the text in the label.
110 * @param y_align The vertical alignment of the text in the label.
112 void add_pixlabel(const Glib::RefPtr<Gdk::Pixmap>& pixmap,
113 const Glib::RefPtr<Gdk::Bitmap>& mask,
114 const Glib::ustring& label,
115 double x_align = 0.5, double y_align = 0.5);
117 /** Add Image and Label objects.
118 * This does not correspond to any GTK+ function and is provided purely for
120 * This will create, manage, add, and show a new Image and Label (within an
122 * @param pixfile The path to a file to be displayed.
123 * @param label The text for the label.
124 * @param x_align The horizontal alignment of the text in the label.
125 * @param y_align The vertical alignment of the text in the label.
127 void add_pixlabel(const Glib::ustring& pixfile,
128 const Glib::ustring& label,
129 double x_align = 0.5, double y_align = 0.5);
132 } /* namespace Gtk */