2
/* $Id: bin.ccg,v 1.2 2004/03/15 00:26:00 murrayc Exp $ */
6
* Copyright 1998-2002 The gtkmm Development Team
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free
20
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
#include <gtkmm/adjustment.h>
25
#include <gtkmm/label.h>
26
#include <gtkmm/box.h>
27
#include <gtkmm/image.h>
36
GtkWidget* child = gtk_bin_get_child(gobj());
39
Gtk::Widget* cppChild = Glib::wrap(child);
41
//If this is a managed widget,
42
//then do an extra ref so that it will
43
//not be destroyed when adding to another container
44
//This should leave it in much the same state as when it was instantiated,
45
//before being added to the first container.
46
if(cppChild->is_managed_())
47
cppChild->reference();
49
gtk_container_remove(Container::gobj(), cppChild->gobj());
54
Bin::add_label(const Glib::ustring& str, bool mnemonic /* = false */,
55
double x_align /* = 0.5 */, double y_align /* = 0.5 */)
57
Label* label = manage(new Label(str, x_align, y_align, mnemonic));
60
//This might not always be appropriate:
61
//because maybe the mnemonic widget should be another child widget.
63
//label->set_mnemonic_widget(*this);
69
Bin::add_label(const Glib::ustring& str, bool mnemonic,
70
Align x_align, Align y_align /* = ALIGN_CENTER */)
72
add_label(str, mnemonic,
73
_gtkmm_align_float_from_enum(x_align),
74
_gtkmm_align_float_from_enum(y_align));
78
Bin::add_pixlabel(const std::string& pixfile,
79
const Glib::ustring& str,
80
double x_align /* = 0.5 */, double y_align /* = 0.5 */)
82
//Create Image and Label widgets:
83
Image* pmap = manage(new Image(pixfile));
84
Label* label = manage(new Label(str));
85
label->set_alignment (x_align, y_align);
88
Box* hbox = manage(new HBox(false, 5));
89
hbox->pack_start(*pmap, PACK_SHRINK);
90
hbox->pack_start(*label);
93
//And put that Box in this: