/* Copyright (C) 1998-2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see .
*/
#include
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/button_p.h)
namespace Gtk
{
/** A Gtk::ToggleButton will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to it's normal state.
* The state of a Gtk::ToggleButton can be set specifically using set_active(), and retrieved using get_active().
* To simply switch the state of a toggle button, use toggled().
*
* @ingroup Widgets
*/
class GTKMM_API ToggleButton : public Button
{
_CLASS_GTKOBJECT(ToggleButton,GtkToggleButton,GTK_TOGGLE_BUTTON,Gtk::Button,GtkButton,,,GTKMM_API)
public:
/** Create an empty toggle button.
* With an empty button, you can Gtk::Button::add() a widget such as a
* Gtk::Image or Gtk::Box.
*
* If you just wish to add a Gtk::Label, you may want to use the
* Gtk::ToggleButton(const Glib::ustring &label) constructor directly
* instead.
*/
_CTOR_DEFAULT
/** Create a toggle button with a label.
* You won't be able
* to add a widget to this button since it already contains a Gtk::Label
*/
explicit ToggleButton(const Glib::ustring& label, bool mnemonic = false);
#ifndef GTKMM_DISABLE_DEPRECATED
/** Creates a toggle button containing the image and text from a stock item.
* Stock ids have identifiers like Gtk::Stock::OK and Gtk::Stock::APPLY.
* @param stock_id The stock item.
* @deprecated Use the constructor that takes a Glib::ustring instead.
*/
explicit ToggleButton(const StockID& stock_id);
#endif // GTKMM_DISABLE_DEPRECATED
_WRAP_METHOD(void set_mode(bool draw_indicator = true),gtk_toggle_button_set_mode)
_WRAP_METHOD(bool get_mode() const,gtk_toggle_button_get_mode)
_WRAP_METHOD(void set_active(bool is_active = true),gtk_toggle_button_set_active)
_WRAP_METHOD(bool get_active() const,gtk_toggle_button_get_active)
_WRAP_METHOD(void set_inconsistent(bool setting = true), gtk_toggle_button_set_inconsistent)
_WRAP_METHOD(bool get_inconsistent() const, gtk_toggle_button_get_inconsistent)
_WRAP_METHOD(void toggled(), gtk_toggle_button_toggled)
_WRAP_SIGNAL(void toggled(), "toggled")
_WRAP_PROPERTY("active", bool)
_WRAP_PROPERTY("inconsistent", bool)
_WRAP_PROPERTY("draw-indicator", bool)
};
} //namespace Gtk