| 1 |
/* Copyright (C) 2003 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
// To exclude this file from the documentation when build-deprecated-api=false. |
| 18 |
_CONFIGINCLUDE(gtkmmconfig.h) |
| 19 |
|
| 20 |
#include <vector> |
| 21 |
#include <gtkmm/widget.h> |
| 22 |
#include <gtkmm/action.h> |
| 23 |
#include <gtkmm/accelkey.h> |
| 24 |
#include <gtkmm/accelgroup.h> |
| 25 |
|
| 26 |
_DEFS(gtkmm,gtk) |
| 27 |
_PINCLUDE(glibmm/private/object_p.h) |
| 28 |
|
| 29 |
#m4 _PUSH(SECTION_CC_PRE_INCLUDES) |
| 30 |
#undef GTK_DISABLE_DEPRECATED |
| 31 |
#define GDK_DISABLE_DEPRECATION_WARNINGS 1 |
| 32 |
#m4 _POP() |
| 33 |
|
| 34 |
_IS_DEPRECATED // This whole file is deprecated. |
| 35 |
|
| 36 |
namespace Gtk |
| 37 |
{ |
| 38 |
|
| 39 |
/** A deprecated action group. |
| 40 |
* It is essentially a map from names to Gtk::Action objects. |
| 41 |
* |
| 42 |
* @deprecated Use Gio::ActionGroup and Gio::Action instead. |
| 43 |
*/ |
| 44 |
class GTKMM_API ActionGroup |
| 45 |
: public Glib::Object, |
| 46 |
public Buildable |
| 47 |
{ |
| 48 |
_CLASS_GOBJECT(ActionGroup, GtkActionGroup, GTK_ACTION_GROUP, Glib::Object, GObject, , , GTKMM_API) |
| 49 |
_IMPLEMENTS_INTERFACE(Buildable) |
| 50 |
|
| 51 |
protected: |
| 52 |
/** @deprecated Use Gio::ActionGroup and give it a name with Gtk::Widget::insert_action_group(). |
| 53 |
*/ |
| 54 |
_WRAP_CTOR(ActionGroup(const Glib::ustring& name = Glib::ustring()), gtk_action_group_new) |
| 55 |
|
| 56 |
public: |
| 57 |
/** @deprecated Use Gio::ActionGroup and give it a name with Gtk::Widget::insert_action_group(). |
| 58 |
*/ |
| 59 |
_WRAP_CREATE(const Glib::ustring& name = Glib::ustring()) |
| 60 |
|
| 61 |
_WRAP_METHOD(Glib::ustring get_name() const, gtk_action_group_get_name, |
| 62 |
deprecated "There is no corresponding replacement when using Gio::ActionGroup.") |
| 63 |
|
| 64 |
_WRAP_METHOD(bool get_sensitive() const, gtk_action_group_get_sensitive, |
| 65 |
deprecated "Use Gio::ActionGroup::get_action_enabled() or Gio::Action::get_enabled() instead.") |
| 66 |
_WRAP_METHOD(void set_sensitive(bool sensitive = true), gtk_action_group_set_sensitive, |
| 67 |
deprecated "Use Gio::SimpleAction::set_enabled() instead.") |
| 68 |
_WRAP_METHOD(bool get_visible() const, gtk_action_group_get_visible, |
| 69 |
deprecated "Use Gio::ActionGroup instead, and control and monitor the state of Gtk::Actionable widgets directly.") |
| 70 |
_WRAP_METHOD(void set_visible(bool visible = true), gtk_action_group_set_visible, |
| 71 |
deprecated "Use Gio::ActionGroup instead, and control and monitor the state of Gtk::Actionable widgets directly.") |
| 72 |
|
| 73 |
_WRAP_METHOD(Glib::RefPtr<AccelGroup> get_accel_group(), gtk_action_group_get_accel_group, refreturn, |
| 74 |
deprecated "Use Gio::ActionGroup and the accelerator group on an associated Gtk::Menu instead.") |
| 75 |
_WRAP_METHOD(Glib::RefPtr<const AccelGroup> get_accel_group() const, gtk_action_group_get_accel_group, refreturn, constversion, |
| 76 |
deprecated "Use Gio::ActionGroup and the accelerator group on an associated Gtk::Menu instead.") |
| 77 |
_WRAP_METHOD(void set_accel_group (const Glib::RefPtr<AccelGroup>& accel_group), gtk_action_group_set_accel_group, |
| 78 |
deprecated "Use Gio::ActionGroup and the accelerator group on an associated Gtk::Menu instead.") |
| 79 |
|
| 80 |
_WRAP_METHOD(Glib::RefPtr<Action> get_action(const Glib::ustring& action_name), gtk_action_group_get_action, refreturn, |
| 81 |
deprecated "Use Gio::ActionMap::lookup_action() on a Gio::SimpleActionGroup instead.") |
| 82 |
_WRAP_METHOD(Glib::RefPtr<const Action> get_action(const Glib::ustring& action_name) const, gtk_action_group_get_action, refreturn, constversion, |
| 83 |
deprecated "Use Gio::ActionMap::lookup_action() on a Gio::SimpleActionGroup instead.") |
| 84 |
|
| 85 |
#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Action> >',`Glib::ListHandler< Glib::RefPtr<Action> >::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)') |
| 86 |
_WRAP_METHOD(std::vector< Glib::RefPtr<Action> > get_actions(), gtk_action_group_list_actions, |
| 87 |
deprecated "Use Gio::ActionGroup::list_actions() and Gio::ActionMap::lookup_action() on a Gio::SimpleActionGroup instead.") |
| 88 |
#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<const Action> >',`Glib::ListHandler< Glib::RefPtr<const Action> >::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)') |
| 89 |
_WRAP_METHOD(std::vector< Glib::RefPtr<const Action> > get_actions() const, gtk_action_group_list_actions, |
| 90 |
deprecated "Use Gio::ActionGroup::list_actions() and Gio::ActionMap::lookup_action() on a Gio::SimpleActionGroup instead.") |
| 91 |
|
| 92 |
_DEPRECATE_IFDEF_START |
| 93 |
/** @deprecated Use Gio::ActionMap::add_action() on a Gio::SimpleActionGroup instead. |
| 94 |
*/ |
| 95 |
void add(const Glib::RefPtr<Action>& action); |
| 96 |
_IGNORE(gtk_action_group_add_action) |
| 97 |
//We want it to always try to use the stock accelerator, |
| 98 |
//so we use gtk_action_group_add_action_with_accel(), instead of gtk_action_group_add_action(), |
| 99 |
//passing null for the accelerator. |
| 100 |
|
| 101 |
/** @deprecated Use Gio::ActionMap::add_action() on a Gio::SimpleActionGroup instead, |
| 102 |
* and Gtk::Application::set_accel_for_action(). |
| 103 |
*/ |
| 104 |
void add(const Glib::RefPtr<Action>& action, const AccelKey& accel_key); |
| 105 |
_IGNORE(gtk_action_group_add_action_with_accel) |
| 106 |
//We need to duplicate the gtk_action_group_add_action_with_accel() implementation, because we want to |
| 107 |
//use AccelKey, not just the accelerator string format that is _one_ of the ways to create an AccelKey. |
| 108 |
|
| 109 |
//TODO: Could this whole class have an STL-style interface? |
| 110 |
/** @deprecated Use Gio::ActionMap::add_action() on a Gio::SimpleActionGroup instead. |
| 111 |
*/ |
| 112 |
void add(const Glib::RefPtr<Action>& action, const Action::SlotActivate& slot); |
| 113 |
/** @deprecated Use Gio::ActionMap::add_action() on a Gio::SimpleActionGroup instead, |
| 114 |
* and Gtk::Application::set_accel_for_action(). |
| 115 |
*/ |
| 116 |
void add(const Glib::RefPtr<Action>& action, const AccelKey& accel_key, const Action::SlotActivate& slot); |
| 117 |
_DEPRECATE_IFDEF_END |
| 118 |
_WRAP_METHOD(void remove(const Glib::RefPtr<Action>& action), gtk_action_group_remove_action, |
| 119 |
deprecated "Use Gio::ActionMap::remove_action() on a Gio::SimpleActionGroup instead.") |
| 120 |
|
| 121 |
//TODO: We probably need to use this in our add_actions() implementation. |
| 122 |
//But this whole class is deprecated anyway. |
| 123 |
_WRAP_METHOD(Glib::ustring translate_string(const Glib::ustring& string) const, gtk_action_group_translate_string, |
| 124 |
deprecated "There is no corresponding replacement when using Gio::ActionGroup.") |
| 125 |
|
| 126 |
//These are just C convenience methods: |
| 127 |
_IGNORE(gtk_action_group_add_actions, gtk_action_group_add_toggle_actions, gtk_action_group_add_radio_actions, |
| 128 |
gtk_action_group_add_actions_full, gtk_action_group_add_toggle_actions_full, |
| 129 |
gtk_action_group_add_radio_actions_full) |
| 130 |
//These are also just C convenience methods that are useless unless you are using the other convenience methods: |
| 131 |
_IGNORE(gtk_action_group_set_translate_func, gtk_action_group_set_translation_domain) |
| 132 |
|
| 133 |
#m4 _CONVERSION(`GtkAction*',`const Glib::RefPtr<Action>&',`Glib::wrap($3, true)') |
| 134 |
_WRAP_SIGNAL(void connect_proxy(const Glib::RefPtr<Action>& action, Widget* proxy), "connect_proxy", no_default_handler, |
| 135 |
deprecated "There is no corresponding replacement when using Gio::ActionGroup.") |
| 136 |
_WRAP_SIGNAL(void disconnect_proxy(const Glib::RefPtr<Action>& action, Widget* proxy), "disconnect_proxy", no_default_handler, |
| 137 |
deprecated "There is no corresponding replacement when using Gio::ActionGroup.") |
| 138 |
_WRAP_SIGNAL(void pre_activate(const Glib::RefPtr<Action>& action), "pre_activate", no_default_handler, |
| 139 |
deprecated "There is no corresponding replacement when using Gio::ActionGroup.") |
| 140 |
_WRAP_SIGNAL(void post_activate(const Glib::RefPtr<Action>& action), "post_activate", no_default_handler, |
| 141 |
deprecated "There is no corresponding replacement when using Gio::ActionGroup.") |
| 142 |
|
| 143 |
_WRAP_PROPERTY("name", Glib::ustring, deprecated "There is no corresponding replacement when using Gio::ActionGroup.") |
| 144 |
_WRAP_PROPERTY("sensitive", bool, deprecated "Use Gio::Action::property_enabled() and Gio::SimpleAction::property_enabled() instead.") |
| 145 |
_WRAP_PROPERTY("visible", bool, deprecated "There is no corresponding replacement when using Gio::ActionGroup.") |
| 146 |
_WRAP_PROPERTY("accel-group", Glib::RefPtr<AccelGroup>, deprecated "Use Gio::ActionGroup and the accelerator group on an associated Gtk::Menu instead.") |
| 147 |
}; |
| 148 |
|
| 149 |
} // namespace Gtk |