/* $Id: radioaction.hg,v 1.8 2006/01/29 12:21:43 murrayc Exp $ */

/* Copyright (C) 2003 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/toggleaction.h>
#include <gtkmm/radiobuttongroup.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/toggleaction_p.h)


namespace Gtk
{

/** An action of which only one in a group can be active.
 *
 * A Gtk::RadioAction is similar to Gtk::RadioMenuItem. A number of 
 * radio actions can be linked together so that only one may be active 
 * at any one time.
 */
class RadioAction : public Gtk::ToggleAction
{
  _CLASS_GOBJECT(RadioAction, GtkRadioAction, GTK_RADIO_ACTION, Gtk::ToggleAction, GtkToggleAction)
public:
  typedef RadioButtonGroup Group;
  
protected:
  _CTOR_DEFAULT
  explicit RadioAction(Group& group, const Glib::ustring& name, const StockID& stock_id, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring());

public:
  _WRAP_CREATE()
  static Glib::RefPtr<RadioAction> create(Group& group, const Glib::ustring& name, const Glib::ustring& label =  Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring());
  static Glib::RefPtr<RadioAction> create(Group& group, const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip =  Glib::ustring());

  _WRAP_METHOD(Group get_group(), gtk_radio_action_get_group)
   void set_group(Group& group);
  _IGNORE(gtk_radio_action_set_group)
  
  _WRAP_METHOD(int get_current_value() const, gtk_radio_action_get_current_value)
  _WRAP_METHOD(void set_current_value(int current_value), gtk_radio_action_set_current_value)

  #m4 _CONVERSION(`GtkRadioAction*',`const Glib::RefPtr<RadioAction>&',`Glib::wrap($3, true)')

  /** The changed signal is emitted on every member of a radio group when the
   * active member is changed. The signal is emitted after the activate signals
   * for the previous and current active members.
   *
   * @param current the member of this action's group which has just been activated.
   */
  _WRAP_SIGNAL(void changed(const Glib::RefPtr<RadioAction>& current), changed)

  _WRAP_PROPERTY("value", int)
  _WRAP_PROPERTY("current-value", int)
};

} // namespace Gtk

