/* $Id: togglebutton.hg,v 1.3 2006/07/16 19:18:49 murrayc Exp $ */

/* togglebutton.h
 * 
 * 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 Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtkmm/button.h>
_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 ToggleButton : public Button
{
  _CLASS_GTKOBJECT(ToggleButton,GtkToggleButton,GTK_TOGGLE_BUTTON,Gtk::Button,GtkButton)
public:

  /** Create an empty toggle button.
   * With an empty button, you can Gtk::Button::add() a widget such as a
   * Gtk::Pixmap 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);

  /** 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.
   */
  explicit ToggleButton(const StockID& stock_id);
  
  _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)

  /** Emitted whenever the toggle tool button changes state.
   */
  _WRAP_SIGNAL(void toggled(), "toggled")

  _WRAP_PROPERTY("active", bool)
  _WRAP_PROPERTY("inconsistent", bool)
  _WRAP_PROPERTY("draw-indicator", bool)
};

} /* namespace Gtk */

