1 /* $Id: togglebutton.hg,v 1.3 2006/07/16 19:18:49 murrayc Exp $ */
5 * Copyright (C) 1998-2002 The gtkmm Development Team
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.
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.
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.
22 #include <gtkmm/button.h>
24 _PINCLUDE(gtkmm/private/button_p.h)
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().
35 class ToggleButton : public Button
37 _CLASS_GTKOBJECT(ToggleButton,GtkToggleButton,GTK_TOGGLE_BUTTON,Gtk::Button,GtkButton)
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.
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
50 /** Create a toggle button with a label.
52 * to add a widget to this button since it already contains a Gtk::Label
54 explicit ToggleButton(const Glib::ustring& label, bool mnemonic = false);
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.
60 explicit ToggleButton(const StockID& stock_id);
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)
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)
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)
71 _WRAP_METHOD(void toggled(), gtk_toggle_button_toggled)
73 /** Emitted whenever the toggle tool button changes state.
75 _WRAP_SIGNAL(void toggled(), "toggled")
77 _WRAP_PROPERTY("active", bool)
78 _WRAP_PROPERTY("inconsistent", bool)
79 _WRAP_PROPERTY("draw-indicator", bool)