Debian Codegraph @

gtk/src/togglebutton.hg

raw
1 /* Copyright (C) 1998-2002 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/button.h>
18 _DEFS(gtkmm,gtk)
19 _PINCLUDE(gtkmm/private/button_p.h)
20
21 namespace Gtk
22 {
23
24 /** A Gtk::ToggleButton will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to it's normal state.
25 * The state of a Gtk::ToggleButton can be set specifically using set_active(), and retrieved using get_active().
26 * To simply switch the state of a toggle button, use toggled().
27 *
28 * @ingroup Widgets
29 */
30 class GTKMM_API ToggleButton : public Button
31 {
32 _CLASS_GTKOBJECT(ToggleButton,GtkToggleButton,GTK_TOGGLE_BUTTON,Gtk::Button,GtkButton,,,GTKMM_API)
33 public:
34
35 /** Create an empty toggle button.
36 * With an empty button, you can Gtk::Button::add() a widget such as a
37 * Gtk::Image or Gtk::Box.
38 *
39 * If you just wish to add a Gtk::Label, you may want to use the
40 * Gtk::ToggleButton(const Glib::ustring &label) constructor directly
41 * instead.
42 */
43 _CTOR_DEFAULT
44
45 /** Create a toggle button with a label.
46 * You won't be able
47 * to add a widget to this button since it already contains a Gtk::Label
48 */
49 explicit ToggleButton(const Glib::ustring& label, bool mnemonic = false);
50
51 #ifndef GTKMM_DISABLE_DEPRECATED
52 /** Creates a toggle button containing the image and text from a stock item.
53 * Stock ids have identifiers like Gtk::Stock::OK and Gtk::Stock::APPLY.
54 * @param stock_id The stock item.
55 * @deprecated Use the constructor that takes a Glib::ustring instead.
56 */
57 explicit ToggleButton(const StockID& stock_id);
58 #endif // GTKMM_DISABLE_DEPRECATED
59
60 _WRAP_METHOD(void set_mode(bool draw_indicator = true),gtk_toggle_button_set_mode)
61 _WRAP_METHOD(bool get_mode() const,gtk_toggle_button_get_mode)
62
63 _WRAP_METHOD(void set_active(bool is_active = true),gtk_toggle_button_set_active)
64 _WRAP_METHOD(bool get_active() const,gtk_toggle_button_get_active)
65
66 _WRAP_METHOD(void set_inconsistent(bool setting = true), gtk_toggle_button_set_inconsistent)
67 _WRAP_METHOD(bool get_inconsistent() const, gtk_toggle_button_get_inconsistent)
68
69 _WRAP_METHOD(void toggled(), gtk_toggle_button_toggled)
70
71 _WRAP_SIGNAL(void toggled(), "toggled")
72
73 _WRAP_PROPERTY("active", bool)
74 _WRAP_PROPERTY("inconsistent", bool)
75 _WRAP_PROPERTY("draw-indicator", bool)
76 };
77
78 } //namespace Gtk