2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TOGGLEBUTTON_H
4 #define _GTKMM_TOGGLEBUTTON_H
12 * Copyright (C) 1998-2002 The gtkmm Development Team
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.
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.
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.
29 #include <gtkmm/button.h>
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 typedef struct _GtkToggleButton GtkToggleButton;
34 typedef struct _GtkToggleButtonClass GtkToggleButtonClass;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
39 { class ToggleButton_Class; } // namespace Gtk
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().
50 class ToggleButton : public Button
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 */
60 virtual ~ToggleButton();
62 #ifndef DOXYGEN_SHOULD_SKIP_THIS
65 friend class ToggleButton_Class;
66 static CppClassType togglebutton_class_;
69 ToggleButton(const ToggleButton&);
70 ToggleButton& operator=(const ToggleButton&);
73 explicit ToggleButton(const Glib::ConstructParams& construct_params);
74 explicit ToggleButton(GtkToggleButton* castitem);
76 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
79 #ifndef DOXYGEN_SHOULD_SKIP_THIS
80 static GType get_type() G_GNUC_CONST;
81 static GType get_base_type() G_GNUC_CONST;
84 ///Provides access to the underlying C GtkObject.
85 GtkToggleButton* gobj() { return reinterpret_cast<GtkToggleButton*>(gobject_); }
87 ///Provides access to the underlying C GtkObject.
88 const GtkToggleButton* gobj() const { return reinterpret_cast<GtkToggleButton*>(gobject_); }
92 //C++ methods used to invoke GTK+ virtual functions:
95 //GTK+ Virtual Functions (override these to change behaviour):
97 //Default Signal Handlers::
98 virtual void on_toggled();
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.
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
115 /** Create a toggle button with a label.
117 * to add a widget to this button since it already contains a Gtk::Label
119 explicit ToggleButton(const Glib::ustring& label, bool mnemonic = false);
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
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.
132 void set_mode(bool draw_indicator = true);
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
139 bool get_mode() const;
142 void set_active(bool is_active = true);
144 bool get_active() const;
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.
157 void set_inconsistent(bool setting = true);
159 /** Gets the value set by set_inconsistent().
160 * @return <tt>true</tt> if the button is displayed as inconsistent, <tt>false</tt> otherwise.
162 bool get_inconsistent() const;
168 Glib::SignalProxy0< void > signal_toggled();
171 /** If the toggle button should be pressed in or not.
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.
177 Glib::PropertyProxy<bool> property_active() ;
179 /** If the toggle button should be pressed in or not.
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.
185 Glib::PropertyProxy_ReadOnly<bool> property_active() const;
187 /** If the toggle button is in an in-between state.
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.
193 Glib::PropertyProxy<bool> property_inconsistent() ;
195 /** If the toggle button is in an in-between state.
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.
201 Glib::PropertyProxy_ReadOnly<bool> property_inconsistent() const;
203 /** If the toggle part of the button is displayed.
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.
209 Glib::PropertyProxy<bool> property_draw_indicator() ;
211 /** If the toggle part of the button is displayed.
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.
217 Glib::PropertyProxy_ReadOnly<bool> property_draw_indicator() const;
222 } /* namespace Gtk */
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.
232 Gtk::ToggleButton* wrap(GtkToggleButton* object, bool take_copy = false);
234 #endif /* _GTKMM_TOGGLEBUTTON_H */