2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TOGGLEBUTTON_H
4 #define _GTKMM_TOGGLEBUTTON_H
13 * Copyright (C) 1998-2002 The gtkmm Development Team
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Library General Public
17 * License as published by the Free Software Foundation; either
18 * version 2 of the License, or (at your option) any later version.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Library General Public License for more details.
25 * You should have received a copy of the GNU Library General Public
26 * License along with this library; if not, write to the Free
27 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #include <gtkmm/button.h>
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 typedef struct _GtkToggleButton GtkToggleButton;
35 typedef struct _GtkToggleButtonClass GtkToggleButtonClass;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
40 { class ToggleButton_Class; } // namespace Gtk
44 /** A Gtk::ToggleButton will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to it's normal state.
45 * The state of a Gtk::ToggleButton can be set specifically using set_active(), and retrieved using get_active().
46 * To simply switch the state of a toggle button, use toggled().
51 class ToggleButton : public Button
54 #ifndef DOXYGEN_SHOULD_SKIP_THIS
55 typedef ToggleButton CppObjectType;
56 typedef ToggleButton_Class CppClassType;
57 typedef GtkToggleButton BaseObjectType;
58 typedef GtkToggleButtonClass BaseClassType;
59 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
61 virtual ~ToggleButton();
63 #ifndef DOXYGEN_SHOULD_SKIP_THIS
66 friend class ToggleButton_Class;
67 static CppClassType togglebutton_class_;
70 ToggleButton(const ToggleButton&);
71 ToggleButton& operator=(const ToggleButton&);
74 explicit ToggleButton(const Glib::ConstructParams& construct_params);
75 explicit ToggleButton(GtkToggleButton* castitem);
77 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
80 #ifndef DOXYGEN_SHOULD_SKIP_THIS
81 static GType get_type() G_GNUC_CONST;
82 static GType get_base_type() G_GNUC_CONST;
85 ///Provides access to the underlying C GtkObject.
86 GtkToggleButton* gobj() { return reinterpret_cast<GtkToggleButton*>(gobject_); }
88 ///Provides access to the underlying C GtkObject.
89 const GtkToggleButton* gobj() const { return reinterpret_cast<GtkToggleButton*>(gobject_); }
93 //C++ methods used to invoke GTK+ virtual functions:
94 #ifdef GLIBMM_VFUNCS_ENABLED
95 #endif //GLIBMM_VFUNCS_ENABLED
98 //GTK+ Virtual Functions (override these to change behaviour):
99 #ifdef GLIBMM_VFUNCS_ENABLED
100 #endif //GLIBMM_VFUNCS_ENABLED
102 //Default Signal Handlers::
103 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
104 virtual void on_toggled();
105 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
112 /** Create an empty toggle button.
113 * With an empty button, you can Gtk::Button::add() a widget such as a
114 * Gtk::Pixmap or Gtk::Box.
116 * If you just wish to add a Gtk::Label, you may want to use the
117 * Gtk::ToggleButton(const Glib::ustring &label) constructor directly
122 /** Create a toggle button with a label.
124 * to add a widget to this button since it already contains a Gtk::Label
126 explicit ToggleButton(const Glib::ustring& label, bool mnemonic = false);
128 /** Creates a toggle button containing the image and text from a stock item.
129 * Stock ids have identifiers like Gtk::Stock::OK and Gtk::Stock::APPLY.
130 * @param stock_id The stock item.
132 explicit ToggleButton(const StockID& stock_id);
135 /** Sets whether the button is displayed as a separate indicator and label.
136 * You can call this function on a checkbutton or a radiobutton with
137 * @a draw_indicator = <tt>false</tt> to make the button look like a normal button
139 * This function only affects instances of classes like Gtk::CheckButton
140 * and Gtk::RadioButton that derive from Gtk::ToggleButton,
141 * not instances of Gtk::ToggleButton itself.
142 * @param draw_indicator If <tt>true</tt>, draw the button as a separate indicator
143 * and label; if <tt>false</tt>, draw the button like a normal button.
145 void set_mode(bool draw_indicator = true);
147 /** Retrieves whether the button is displayed as a separate indicator
148 * and label. See set_mode().
149 * @return <tt>true</tt> if the togglebutton is drawn as a separate indicator
152 bool get_mode() const;
155 void set_active(bool is_active = true);
157 bool get_active() const;
160 /** If the user has selected a range of elements (such as some text or
161 * spreadsheet cells) that are affected by a toggle button, and the
162 * current values in that range are inconsistent, you may want to
163 * display the toggle in an "in between" state. This function turns on
164 * "in between" display. Normally you would turn off the inconsistent
165 * state again if the user toggles the toggle button. This has to be
166 * done manually, set_inconsistent() only affects
167 * visual appearance, it doesn't affect the semantics of the button.
168 * @param setting <tt>true</tt> if state is inconsistent.
170 void set_inconsistent(bool setting = true);
172 /** Gets the value set by set_inconsistent().
173 * @return <tt>true</tt> if the button is displayed as inconsistent, <tt>false</tt> otherwise.
175 bool get_inconsistent() const;
180 /** Emitted whenever the toggle tool button changes state.
185 * <tt>void %toggled()</tt>
188 Glib::SignalProxy0< void > signal_toggled();
191 #ifdef GLIBMM_PROPERTIES_ENABLED
192 /** If the toggle button should be pressed in or not.
194 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
195 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
196 * the value of the property changes.
198 Glib::PropertyProxy<bool> property_active() ;
199 #endif //#GLIBMM_PROPERTIES_ENABLED
201 #ifdef GLIBMM_PROPERTIES_ENABLED
202 /** If the toggle button should be pressed in or not.
204 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
205 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
206 * the value of the property changes.
208 Glib::PropertyProxy_ReadOnly<bool> property_active() const;
209 #endif //#GLIBMM_PROPERTIES_ENABLED
211 #ifdef GLIBMM_PROPERTIES_ENABLED
212 /** If the toggle button is in an in between state.
214 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
215 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
216 * the value of the property changes.
218 Glib::PropertyProxy<bool> property_inconsistent() ;
219 #endif //#GLIBMM_PROPERTIES_ENABLED
221 #ifdef GLIBMM_PROPERTIES_ENABLED
222 /** If the toggle button is in an in between state.
224 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
225 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
226 * the value of the property changes.
228 Glib::PropertyProxy_ReadOnly<bool> property_inconsistent() const;
229 #endif //#GLIBMM_PROPERTIES_ENABLED
231 #ifdef GLIBMM_PROPERTIES_ENABLED
232 /** If the toggle part of the button is displayed.
234 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
235 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
236 * the value of the property changes.
238 Glib::PropertyProxy<bool> property_draw_indicator() ;
239 #endif //#GLIBMM_PROPERTIES_ENABLED
241 #ifdef GLIBMM_PROPERTIES_ENABLED
242 /** If the toggle part of the button is displayed.
244 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
245 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
246 * the value of the property changes.
248 Glib::PropertyProxy_ReadOnly<bool> property_draw_indicator() const;
249 #endif //#GLIBMM_PROPERTIES_ENABLED
254 } /* namespace Gtk */
259 /** @relates Gtk::ToggleButton
260 * @param object The C instance
261 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
262 * @result A C++ instance that wraps this C instance.
264 Gtk::ToggleButton* wrap(GtkToggleButton* object, bool take_copy = false);
268 #endif /* _GTKMM_TOGGLEBUTTON_H */