1 /* $Id: expander.hg,v 1.9 2006/04/12 11:11:25 murrayc Exp $ */
5 * Copyright (C) 2003 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/bin.h>
24 _PINCLUDE(gtkmm/private/bin_p.h)
30 /** A container which can hide its child.
32 * An Expander allows the user to hide or show its child by clicking on an
33 * expander triangle similar to the triangles used in a Gtk::TreeView.
35 * Normally you use an expander as you would use any other descendant
36 * of Gtk::Bin; you create the child widget and use add() to add it to
37 * the expander. When the expander is toggled, it will take care of
38 * showing and hiding the child automatically.
40 * Special Usage: There are situations in which you may prefer to show and
41 * hide the expanded widget yourself, such as when you want to
42 * actually create the widget at expansion time. In this case,
43 * create an Expander but do not add a child to it. The
44 * expander widget has an <tt>expanded</tt> property
45 * which can be used to monitor its expansion state. You should
46 * watch this property with a signal connection as follows:
48 * expander.property_expanded().signal_changed().connect(
49 * sigc::mem_fun(*this, &SomeClass::on_expander_changed)
56 class Expander : public Bin
58 _CLASS_GTKOBJECT(Expander, GtkExpander, GTK_EXPANDER, Gtk::Bin, GtkBin)
61 /** Creates a new Expander.
63 * The Expander has an empty label.
69 /** Creates a new Expander with a label.
71 * Creates a new expander using label as the text of the label. Settin @a mnemonic to true
72 * will allow you to precede characters in the label with an underscore which will make them
73 * underlined. If you need a literal underscore character in a label, use '__' (two underscores).
74 * The first underlined character represents a keyboard accelerator called a mnemonic.
75 * Pressing Alt and that key activates the button.
77 * @param label The string for the label describing the Expander.
78 * @param mnemonic Wether the label may contain underscores to set up accelerators.
82 explicit Expander(const Glib::ustring& label, bool mnemonic = false);
83 _IGNORE(gtk_expander_new, gkt_expander_new_with_mnemonic)
85 _WRAP_METHOD(void set_expanded(bool expanded = true), gtk_expander_set_expanded)
86 _WRAP_METHOD(bool get_expanded() const, gtk_expander_get_expanded)
88 _WRAP_METHOD(void set_spacing(int spacing), gtk_expander_set_spacing)
89 _WRAP_METHOD(int get_spacing() const, gtk_expander_get_spacing)
91 _WRAP_METHOD(void set_label(const Glib::ustring& label), gtk_expander_set_label)
92 _WRAP_METHOD(Glib::ustring get_label() const, gtk_expander_get_label)
94 _WRAP_METHOD(void set_use_underline(bool use_underline = true), gtk_expander_set_use_underline)
95 _WRAP_METHOD(bool get_use_underline() const, gtk_expander_get_use_underline)
97 _WRAP_METHOD(void set_use_markup(bool use_markup = true), gtk_expander_set_use_markup)
98 _WRAP_METHOD(bool get_use_markup() const, gtk_expander_get_use_markup)
100 _WRAP_METHOD(void set_label_widget(Widget& label_widget), gtk_expander_set_label_widget)
101 _WRAP_METHOD(Widget* get_label_widget(), gtk_expander_get_label_widget)
102 _WRAP_METHOD(const Widget* get_label_widget() const, gtk_expander_get_label_widget, constversion)
104 _IGNORE_SIGNAL("activate") //keybinding
106 _WRAP_PROPERTY("expanded", bool)
107 _WRAP_PROPERTY("label", Glib::ustring)
108 _WRAP_PROPERTY("use_underline", bool)
109 _WRAP_PROPERTY("use_markup", bool)
110 _WRAP_PROPERTY("spacing", int)
111 _WRAP_PROPERTY("label_widget", Widget*)