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