2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_ACTIONGROUP_H
4 #define _GTKMM_ACTIONGROUP_H
10 /* Copyright (C) 2003 The gtkmm Development Team
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <gtkmm/widget.h>
28 #include <gtkmm/action.h>
29 #include <gtkmm/accelkey.h>
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 typedef struct _GtkActionGroup GtkActionGroup;
34 typedef struct _GtkActionGroupClass GtkActionGroupClass;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
39 { class ActionGroup_Class; } // namespace Gtk
44 class ActionGroup : public Glib::Object
47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 typedef ActionGroup CppObjectType;
51 typedef ActionGroup_Class CppClassType;
52 typedef GtkActionGroup BaseObjectType;
53 typedef GtkActionGroupClass BaseClassType;
55 private: friend class ActionGroup_Class;
56 static CppClassType actiongroup_class_;
60 ActionGroup(const ActionGroup&);
61 ActionGroup& operator=(const ActionGroup&);
64 explicit ActionGroup(const Glib::ConstructParams& construct_params);
65 explicit ActionGroup(GtkActionGroup* castitem);
67 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
70 virtual ~ActionGroup();
72 #ifndef DOXYGEN_SHOULD_SKIP_THIS
73 static GType get_type() G_GNUC_CONST;
74 static GType get_base_type() G_GNUC_CONST;
77 ///Provides access to the underlying C GObject.
78 GtkActionGroup* gobj() { return reinterpret_cast<GtkActionGroup*>(gobject_); }
80 ///Provides access to the underlying C GObject.
81 const GtkActionGroup* gobj() const { return reinterpret_cast<GtkActionGroup*>(gobject_); }
83 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
84 GtkActionGroup* gobj_copy();
90 explicit ActionGroup(const Glib::ustring& name = Glib::ustring());
94 static Glib::RefPtr<ActionGroup> create(const Glib::ustring& name = Glib::ustring());
97 /** Gets the name of the action group.
98 * @return The name of the action group.
102 Glib::ustring get_name() const;
105 /** Returns <tt>true</tt> if the group is sensitive. The constituent actions
106 * can only be logically sensitive (see is_sensitive()) if
107 * they are sensitive (see get_sensitive()) and their group
109 * @return <tt>true</tt> if the group is sensitive.
113 bool get_sensitive() const;
115 /** Changes the sensitivity of @a action_group
118 * @param sensitive New sensitivity.
120 void set_sensitive(bool sensitive = true);
122 /** Returns <tt>true</tt> if the group is visible. The constituent actions
123 * can only be logically visible (see is_visible()) if
124 * they are visible (see get_visible()) and their group
126 * @return <tt>true</tt> if the group is visible.
130 bool get_visible() const;
132 /** Changes the visible of @a action_group .
135 * @param visible New visiblity.
137 void set_visible(bool visible = true);
140 /** Looks up an action in the action group by name.
141 * @param action_name The name of the action.
142 * @return The action, or <tt>0</tt> if no action by that name exists
146 Glib::RefPtr<Action> get_action(const Glib::ustring& action_name);
148 /** Looks up an action in the action group by name.
149 * @param action_name The name of the action.
150 * @return The action, or <tt>0</tt> if no action by that name exists
154 Glib::RefPtr<const Action> get_action(const Glib::ustring& action_name) const;
157 /** Lists the actions in the action group.
158 * @return An allocated list of the action objects in the action group
162 Glib::ListHandle< Glib::RefPtr<Action> > get_actions();
164 /** Lists the actions in the action group.
165 * @return An allocated list of the action objects in the action group
169 Glib::ListHandle< Glib::RefPtr<const Action> > get_actions() const;
171 void add(const Glib::RefPtr<Action>& action);
173 //We want it to always try to use the stock accelerator,
174 //so we use gtk_action_group_add_action_with_accel(), instead of gtk_action_group_add_action(),
175 //passing null for the accelerator.
177 void add(const Glib::RefPtr<Action>& action, const AccelKey& accel_key);
179 //We need to duplicate the gtk_action_group_add_action_with_accel() implementation, because we want to
180 //use AccelKey, not just the accelerator string format that is _one_ of the ways to create an AccelKey.
182 //TODO: Could this whole class have an STL-style interface?
183 void add(const Glib::RefPtr<Action>& action, const Action::SlotActivate& slot);
184 void add(const Glib::RefPtr<Action>& action, const AccelKey& accel_key, const Action::SlotActivate& slot);
186 /** Removes an action object from the action group.
189 * @param action An action.
191 void remove(const Glib::RefPtr<Action>& action);
193 //TODO: We probably need to use this in our add_actions() implementation:
195 /** Translates a string using the specified translate_func(). This
196 * is mainly intended for language bindings.
197 * @param string A string.
198 * @return The translation of @a string
202 Glib::ustring translate_string(const Glib::ustring& str) const;
205 //These are just C convenience methods:
207 //These are also just C convenience methods that are useless unless you are using the other convenience methods:
210 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > signal_connect_proxy();
213 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > signal_disconnect_proxy();
216 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > signal_pre_activate();
219 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > signal_post_activate();
225 //C++ methods used to invoke GTK+ virtual functions:
228 //GTK+ Virtual Functions (override these to change behaviour):
230 //Default Signal Handlers::
240 /** @relates Gtk::ActionGroup
241 * @param object The C instance
242 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
243 * @result A C++ instance that wraps this C instance.
245 Glib::RefPtr<Gtk::ActionGroup> wrap(GtkActionGroup* object, bool take_copy = false);
249 #endif /* _GTKMM_ACTIONGROUP_H */