1 /* $Id: toggleaction.hg,v 1.5 2004/07/01 08:55:45 murrayc Exp $ */
3 /* Copyright (C) 2003 The gtkmm Development Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <gtkmm/action.h>
23 _PINCLUDE(gtkmm/private/action_p.h)
29 /** An action which can be toggled between two states.
31 * A Gtk::ToggleAction corresponds roughly to a Gtk::CheckMenuItem.
32 * It has an "active" state specifying whether the action has been checked or not.
35 class ToggleAction : public Gtk::Action
37 _CLASS_GOBJECT(ToggleAction, GtkToggleAction, GTK_TOGGLE_ACTION, Gtk::Action, GtkAction)
41 explicit ToggleAction(const Glib::ustring& name, const StockID& stock_id = StockID(), const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring(), bool is_active = false);
44 //Note that gtk_toggle_action_new() does not allow name to be NULL, which suggests that we should not have a default constructor,
45 //but it's OK to set the name later:
48 static Glib::RefPtr<ToggleAction> create(const Glib::ustring& name, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring(), bool is_active = false);
49 static Glib::RefPtr<ToggleAction> create(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring(), bool is_active = false);
51 _WRAP_METHOD(void toggled(), gtk_toggle_action_toggled)
52 _WRAP_METHOD(void set_active(bool is_active = true), gtk_toggle_action_set_active)
53 _WRAP_METHOD(bool get_active() const, gtk_toggle_action_get_active)
54 _WRAP_METHOD(void set_draw_as_radio(bool draw_as_radio = true), gtk_toggle_action_set_draw_as_radio)
55 _WRAP_METHOD(bool get_draw_as_radio() const, gtk_toggle_action_get_draw_as_radio)
57 _WRAP_SIGNAL(void toggled(), "toggled")
59 _WRAP_PROPERTY("draw_as_radio", bool)