MIDI branch becomes trunk
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / togglebutton.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TOGGLEBUTTON_H
4 #define _GTKMM_TOGGLEBUTTON_H
5
6 #include <glibmm.h>
7
8 /* $Id$ */
9
10 /* togglebutton.h
11  * 
12  * Copyright (C) 1998-2002 The gtkmm Development Team
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Library General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU Library General Public
25  * License along with this library; if not, write to the Free
26  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28
29 #include <gtkmm/button.h>
30
31
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 typedef struct _GtkToggleButton GtkToggleButton;
34 typedef struct _GtkToggleButtonClass GtkToggleButtonClass;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
36
37
38 namespace Gtk
39 { class ToggleButton_Class; } // namespace Gtk
40 namespace Gtk
41 {
42
43 /** A Gtk::ToggleButton will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to it's normal state.
44  * The state of a Gtk::ToggleButton can be set specifically using set_active(), and retrieved using get_active().
45  * To simply switch the state of a toggle button, use toggled().
46  *
47  * @ingroup Widgets
48  */
49
50 class ToggleButton : public Button
51 {
52   public:
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54   typedef ToggleButton CppObjectType;
55   typedef ToggleButton_Class CppClassType;
56   typedef GtkToggleButton BaseObjectType;
57   typedef GtkToggleButtonClass BaseClassType;
58 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
59
60   virtual ~ToggleButton();
61
62 #ifndef DOXYGEN_SHOULD_SKIP_THIS
63
64 private:
65   friend class ToggleButton_Class;
66   static CppClassType togglebutton_class_;
67
68   // noncopyable
69   ToggleButton(const ToggleButton&);
70   ToggleButton& operator=(const ToggleButton&);
71
72 protected:
73   explicit ToggleButton(const Glib::ConstructParams& construct_params);
74   explicit ToggleButton(GtkToggleButton* castitem);
75
76 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
77
78 public:
79 #ifndef DOXYGEN_SHOULD_SKIP_THIS
80   static GType get_type()      G_GNUC_CONST;
81   static GType get_base_type() G_GNUC_CONST;
82 #endif
83
84   ///Provides access to the underlying C GtkObject.
85   GtkToggleButton*       gobj()       { return reinterpret_cast<GtkToggleButton*>(gobject_); }
86
87   ///Provides access to the underlying C GtkObject.
88   const GtkToggleButton* gobj() const { return reinterpret_cast<GtkToggleButton*>(gobject_); }
89
90
91 public:
92   //C++ methods used to invoke GTK+ virtual functions:
93
94 protected:
95   //GTK+ Virtual Functions (override these to change behaviour):
96
97   //Default Signal Handlers::
98   virtual void on_toggled();
99
100
101 private:
102
103 public:
104
105   /** Create an empty toggle button.
106    * With an empty button, you can Gtk::Button::add() a widget such as a
107    * Gtk::Pixmap or Gtk::Box.
108    *
109    * If you just wish to add a Gtk::Label, you may want to use the
110    * Gtk::ToggleButton(const Glib::ustring &label) constructor directly
111    * instead.
112    */
113   ToggleButton();
114
115   /** Create a toggle button with a label.
116    * You won't be able
117    * to add a widget to this button since it already contains a Gtk::Label
118    */
119   explicit ToggleButton(const Glib::ustring& label, bool mnemonic = false);
120   
121
122   /** Sets whether the button is displayed as a separate indicator and label.
123    * You can call this function on a checkbutton or a radiobutton with
124    *  @a draw_indicator  = <tt>false</tt> to make the button look like a normal button
125    * 
126    * This function only effects instances of classes like Gtk::CheckButton
127    * and Gtk::RadioButton that derive from Gtk::ToggleButton,
128    * not instances of Gtk::ToggleButton itself.
129    * @param draw_indicator If <tt>true</tt>, draw the button as a separate indicator
130    * and label; if <tt>false</tt>, draw the button like a normal button.
131    */
132   void set_mode(bool draw_indicator = true);
133   
134   /** Retrieves whether the button is displayed as a separate indicator
135    * and label. See set_mode().
136    * @return <tt>true</tt> if the togglebutton is drawn as a separate indicator
137    * and label.
138    */
139   bool get_mode() const;
140
141   
142   void set_active(bool is_active = true);
143   
144   bool get_active() const;
145
146   
147   /** If the user has selected a range of elements (such as some text or
148    * spreadsheet cells) that are affected by a toggle button, and the
149    * current values in that range are inconsistent, you may want to
150    * display the toggle in an "in between" state. This function turns on
151    * "in between" display.  Normally you would turn off the inconsistent
152    * state again if the user toggles the toggle button. This has to be
153    * done manually, set_inconsistent() only affects
154    * visual appearance, it doesn't affect the semantics of the button.
155    * @param setting <tt>true</tt> if state is inconsistent.
156    */
157   void set_inconsistent(bool setting = true);
158   
159   /** Gets the value set by set_inconsistent().
160    * @return <tt>true</tt> if the button is displayed as inconsistent, <tt>false</tt> otherwise.
161    */
162   bool get_inconsistent() const;
163
164   
165   void toggled();
166
167   
168   Glib::SignalProxy0< void > signal_toggled();
169
170
171   /** If the toggle button should be pressed in or not.
172    *
173    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
174    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
175    * the value of the property changes.
176    */
177   Glib::PropertyProxy<bool> property_active() ;
178
179 /** If the toggle button should be pressed in or not.
180    *
181    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
182    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
183    * the value of the property changes.
184    */
185   Glib::PropertyProxy_ReadOnly<bool> property_active() const;
186
187   /** If the toggle button is in an in-between state.
188    *
189    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
190    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
191    * the value of the property changes.
192    */
193   Glib::PropertyProxy<bool> property_inconsistent() ;
194
195 /** If the toggle button is in an in-between state.
196    *
197    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
198    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
199    * the value of the property changes.
200    */
201   Glib::PropertyProxy_ReadOnly<bool> property_inconsistent() const;
202
203   /** If the toggle part of the button is displayed.
204    *
205    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
206    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
207    * the value of the property changes.
208    */
209   Glib::PropertyProxy<bool> property_draw_indicator() ;
210
211 /** If the toggle part of the button is displayed.
212    *
213    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
214    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
215    * the value of the property changes.
216    */
217   Glib::PropertyProxy_ReadOnly<bool> property_draw_indicator() const;
218
219
220 };
221
222 } /* namespace Gtk */
223
224
225 namespace Glib
226 {
227   /** @relates Gtk::ToggleButton
228    * @param object The C instance
229    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
230    * @result A C++ instance that wraps this C instance.
231    */
232   Gtk::ToggleButton* wrap(GtkToggleButton* object, bool take_copy = false);
233 }
234 #endif /* _GTKMM_TOGGLEBUTTON_H */
235