2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_ACTIONGROUP_H
4 #define _GTKMM_ACTIONGROUP_H
11 /* Copyright (C) 2003 The gtkmm Development Team
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <gtkmm/widget.h>
29 #include <gtkmm/action.h>
30 #include <gtkmm/accelkey.h>
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 typedef struct _GtkActionGroup GtkActionGroup;
35 typedef struct _GtkActionGroupClass GtkActionGroupClass;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
40 { class ActionGroup_Class; } // namespace Gtk
45 class ActionGroup : public Glib::Object
48 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51 typedef ActionGroup CppObjectType;
52 typedef ActionGroup_Class CppClassType;
53 typedef GtkActionGroup BaseObjectType;
54 typedef GtkActionGroupClass BaseClassType;
56 private: friend class ActionGroup_Class;
57 static CppClassType actiongroup_class_;
61 ActionGroup(const ActionGroup&);
62 ActionGroup& operator=(const ActionGroup&);
65 explicit ActionGroup(const Glib::ConstructParams& construct_params);
66 explicit ActionGroup(GtkActionGroup* castitem);
68 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
71 virtual ~ActionGroup();
73 #ifndef DOXYGEN_SHOULD_SKIP_THIS
74 static GType get_type() G_GNUC_CONST;
75 static GType get_base_type() G_GNUC_CONST;
78 ///Provides access to the underlying C GObject.
79 GtkActionGroup* gobj() { return reinterpret_cast<GtkActionGroup*>(gobject_); }
81 ///Provides access to the underlying C GObject.
82 const GtkActionGroup* gobj() const { return reinterpret_cast<GtkActionGroup*>(gobject_); }
84 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
85 GtkActionGroup* gobj_copy();
91 explicit ActionGroup(const Glib::ustring& name = Glib::ustring());
95 static Glib::RefPtr<ActionGroup> create(const Glib::ustring& name = Glib::ustring());
98 /** Gets the name of the action group.
99 * @return The name of the action group.
103 Glib::ustring get_name() const;
106 /** Return value: <tt>true</tt> if the group is sensitive.
107 * @return <tt>true</tt> if the group is sensitive.
111 bool get_sensitive() const;
113 /** Changes the sensitivity of @a action_group
116 * @param sensitive New sensitivity.
118 void set_sensitive(bool sensitive = true);
120 /** Return value: <tt>true</tt> if the group is visible.
121 * @return <tt>true</tt> if the group is visible.
125 bool get_visible() const;
127 /** Changes the visible of @a action_group .
130 * @param visible New visiblity.
132 void set_visible(bool visible = true);
135 /** Looks up an action in the action group by name.
136 * @param action_name The name of the action.
137 * @return The action, or <tt>0</tt> if no action by that name exists
141 Glib::RefPtr<Action> get_action(const Glib::ustring& action_name);
143 /** Looks up an action in the action group by name.
144 * @param action_name The name of the action.
145 * @return The action, or <tt>0</tt> if no action by that name exists
149 Glib::RefPtr<const Action> get_action(const Glib::ustring& action_name) const;
152 /** Lists the actions in the action group.
153 * @return An allocated list of the action objects in the action group
157 Glib::ListHandle< Glib::RefPtr<Action> > get_actions();
159 /** Lists the actions in the action group.
160 * @return An allocated list of the action objects in the action group
164 Glib::ListHandle< Glib::RefPtr<const Action> > get_actions() const;
166 void add(const Glib::RefPtr<Action>& action);
168 //We want it to always try to use the stock accelerator,
169 //so we use gtk_action_group_add_action_with_accel(), instead of gtk_action_group_add_action(),
170 //passing null for the accelerator.
172 void add(const Glib::RefPtr<Action>& action, const AccelKey& accel_key);
174 //We need to duplicate the gtk_action_group_add_action_with_accel() implementation, because we want to
175 //use AccelKey, not just the accelerator string format that is _one_ of the ways to create an AccelKey.
177 //TODO: Could this whole class have an STL-style interface?
178 void add(const Glib::RefPtr<Action>& action, const Action::SlotActivate& slot);
179 void add(const Glib::RefPtr<Action>& action, const AccelKey& accel_key, const Action::SlotActivate& slot);
181 /** Removes an action object from the action group.
184 * @param action An action.
186 void remove(const Glib::RefPtr<Action>& action);
188 //TODO: We probably need to use this in our add_actions() implementation:
190 /** Translates a string using the specified translate_func(). This
191 * is mainly intended for language bindings.
192 * @param string A string.
193 * @return The translation of @a string
197 Glib::ustring translate_string(const Glib::ustring& str) const;
200 //These are just C convenience methods:
202 //These are also just C convenience methods that are useless unless you are using the other convenience methods:
205 /** The connect_proxy signal is emitted after connecting a proxy to
206 * an action in the group. Note that the proxy may have been connected
207 * to a different action before.
209 * This is intended for simple customizations for which a custom action
210 * class would be too clumsy, e.g. showing tooltips for menuitems in the
213 * UIManager proxies the signal and provides global notification
214 * just before any action is connected to a proxy, which is probably more
217 * @param action the action
218 * @param proxy the proxy
221 * <tt>void on_my_%connect_proxy(const Glib::RefPtr<Action>& action, Widget* proxy)</tt>
224 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > signal_connect_proxy();
227 /** The disconnect_proxy signal is emitted after disconnecting a proxy
228 * from an action in the group.
230 * UIManager proxies the signal and provides global notification
231 * just before any action is connected to a proxy, which is probably more
234 * @param action the action
235 * @param proxy the proxy
238 * <tt>void on_my_%disconnect_proxy(const Glib::RefPtr<Action>& action, Widget* proxy)</tt>
241 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > signal_disconnect_proxy();
244 /** The pre_activate signal is emitted just before the @action in the
245 * action_group is activated
247 * This is intended for UIManager to proxy the signal and provide global
248 * notification just before any action is activated.
253 * <tt>void on_my_%pre_activate(const Glib::RefPtr<Action>& action)</tt>
256 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > signal_pre_activate();
259 /** The post_activate signal is emitted just after the @action in the
260 * @action_group is activated
262 * This is intended for UIManager to proxy the signal and provide global
263 * notification just after any action is activated.
265 * @param action the action
268 * <tt>void on_my_%post_activate(const Glib::RefPtr<Action>& action)</tt>
271 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > signal_post_activate();
277 //C++ methods used to invoke GTK+ virtual functions:
278 #ifdef GLIBMM_VFUNCS_ENABLED
279 #endif //GLIBMM_VFUNCS_ENABLED
282 //GTK+ Virtual Functions (override these to change behaviour):
283 #ifdef GLIBMM_VFUNCS_ENABLED
284 #endif //GLIBMM_VFUNCS_ENABLED
286 //Default Signal Handlers::
287 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
288 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
298 /** A Glib::wrap() method for this object.
300 * @param object The C instance.
301 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
302 * @result A C++ instance that wraps this C instance.
304 * @relates Gtk::ActionGroup
306 Glib::RefPtr<Gtk::ActionGroup> wrap(GtkActionGroup* object, bool take_copy = false);
310 #endif /* _GTKMM_ACTIONGROUP_H */