| 1 |
/* Copyright (C) 2003 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtkmm/bin.h> |
| 18 |
_DEFS(gtkmm,gtk) |
| 19 |
_PINCLUDE(gtkmm/private/bin_p.h) |
| 20 |
|
| 21 |
|
| 22 |
namespace Gtk |
| 23 |
{ |
| 24 |
|
| 25 |
/** A container which can hide its child. |
| 26 |
* |
| 27 |
* An Expander allows the user to hide or show its child by clicking on an |
| 28 |
* expander triangle similar to the triangles used in a Gtk::TreeView. |
| 29 |
* |
| 30 |
* Normally you use an expander as you would use any other descendant |
| 31 |
* of Gtk::Bin; you create the child widget and use add() to add it to |
| 32 |
* the expander. When the expander is toggled, it will take care of |
| 33 |
* showing and hiding the child automatically. |
| 34 |
* |
| 35 |
* Special Usage: There are situations in which you may prefer to show and |
| 36 |
* hide the expanded widget yourself, such as when you want to |
| 37 |
* actually create the widget at expansion time. In this case, |
| 38 |
* create an Expander but do not add a child to it. The |
| 39 |
* expander widget has an <tt>expanded</tt> property |
| 40 |
* which can be used to monitor its expansion state. You should |
| 41 |
* watch this property with a signal connection as follows: |
| 42 |
* @code |
| 43 |
* expander.property_expanded().signal_changed().connect( |
| 44 |
* sigc::mem_fun(*this, &SomeClass::on_expander_changed) |
| 45 |
* ); |
| 46 |
* @endcode |
| 47 |
* |
| 48 |
* @ingroup Widgets |
| 49 |
* @ingroup Containers |
| 50 |
*/ |
| 51 |
class GTKMM_API Expander : public Bin |
| 52 |
{ |
| 53 |
_CLASS_GTKOBJECT(Expander, GtkExpander, GTK_EXPANDER, Gtk::Bin, GtkBin, , , GTKMM_API) |
| 54 |
public: |
| 55 |
|
| 56 |
/** Creates a new Expander. |
| 57 |
* |
| 58 |
* The Expander has an empty label. |
| 59 |
* |
| 60 |
* @newin{2,4} |
| 61 |
*/ |
| 62 |
_CTOR_DEFAULT; |
| 63 |
|
| 64 |
/** Creates a new Expander with a label. |
| 65 |
* |
| 66 |
* Creates a new expander using label as the text of the label. Settin @a mnemonic to true |
| 67 |
* will allow you to precede characters in the label with an underscore which will make them |
| 68 |
* underlined. If you need a literal underscore character in a label, use '__' (two underscores). |
| 69 |
* The first underlined character represents a keyboard accelerator called a mnemonic. |
| 70 |
* Pressing Alt and that key activates the button. |
| 71 |
* |
| 72 |
* @param label The string for the label describing the Expander. |
| 73 |
* @param mnemonic Wether the label may contain underscores to set up accelerators. |
| 74 |
|
| 75 |
* @newin{2,4} |
| 76 |
*/ |
| 77 |
explicit Expander(const Glib::ustring& label, bool mnemonic = false); |
| 78 |
_IGNORE(gtk_expander_new, gtk_expander_new_with_mnemonic) |
| 79 |
|
| 80 |
_WRAP_METHOD(void set_expanded(bool expanded = true), gtk_expander_set_expanded) |
| 81 |
_WRAP_METHOD(bool get_expanded() const, gtk_expander_get_expanded) |
| 82 |
|
| 83 |
_WRAP_METHOD(void set_spacing(int spacing), gtk_expander_set_spacing) |
| 84 |
_WRAP_METHOD(int get_spacing() const, gtk_expander_get_spacing) |
| 85 |
|
| 86 |
_WRAP_METHOD(void set_label(const Glib::ustring& label), gtk_expander_set_label) |
| 87 |
_WRAP_METHOD(Glib::ustring get_label() const, gtk_expander_get_label) |
| 88 |
|
| 89 |
_WRAP_METHOD(void set_use_underline(bool use_underline = true), gtk_expander_set_use_underline) |
| 90 |
_WRAP_METHOD(bool get_use_underline() const, gtk_expander_get_use_underline) |
| 91 |
|
| 92 |
_WRAP_METHOD(void set_use_markup(bool use_markup = true), gtk_expander_set_use_markup) |
| 93 |
_WRAP_METHOD(bool get_use_markup() const, gtk_expander_get_use_markup) |
| 94 |
|
| 95 |
_WRAP_METHOD(void set_label_widget(Widget& label_widget), gtk_expander_set_label_widget) |
| 96 |
_WRAP_METHOD(Widget* get_label_widget(), gtk_expander_get_label_widget) |
| 97 |
_WRAP_METHOD(const Widget* get_label_widget() const, gtk_expander_get_label_widget, constversion) |
| 98 |
|
| 99 |
_WRAP_METHOD(void set_label_fill(bool label_fill = true), gtk_expander_set_label_fill) |
| 100 |
_WRAP_METHOD(bool get_label_fill() const, gtk_expander_get_label_fill) |
| 101 |
|
| 102 |
_WRAP_METHOD(void set_resize_toplevel(bool resize_toplevel = true), gtk_expander_set_resize_toplevel) |
| 103 |
_WRAP_METHOD(bool get_resize_toplevel() const, gtk_expander_get_resize_toplevel) |
| 104 |
|
| 105 |
_IGNORE_SIGNAL("activate") //keybinding |
| 106 |
|
| 107 |
_WRAP_PROPERTY("expanded", bool) |
| 108 |
_WRAP_PROPERTY("label", Glib::ustring) |
| 109 |
_WRAP_PROPERTY("use_underline", bool) |
| 110 |
_WRAP_PROPERTY("use_markup", bool) |
| 111 |
_WRAP_PROPERTY("spacing", int, |
| 112 |
deprecated "This property is ignored. Use margins on the child instead.") |
| 113 |
_WRAP_PROPERTY("label_widget", Widget*) |
| 114 |
_WRAP_PROPERTY("label_fill", bool) |
| 115 |
_WRAP_PROPERTY("resize-toplevel", bool) |
| 116 |
}; |
| 117 |
|
| 118 |
} // namespace Gtk |