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