diff options
author | Murray Cumming <murrayc@murrayc.com> | 2011-08-03 08:57:32 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2011-08-03 09:01:52 +0200 |
commit | f5265c7bfe9571bc3c11b95ac8e2033a3a49777d (patch) | |
tree | 359f6c08a290d74f15699a1538c9bbf27d7015ae /gio/src/actiongroup.hg | |
parent | 47769ffb8b67711509bfe8510fe5284b8bb0c5d4 (diff) | |
download | glibmm-f5265c7bfe9571bc3c11b95ac8e2033a3a49777d.tar.gz |
Add back Gio::Application and friends so we can try to finish them.
This reverts commit c446268b44f3595431ba6f535dc297557c6097e0.
Diffstat (limited to 'gio/src/actiongroup.hg')
-rw-r--r-- | gio/src/actiongroup.hg | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/gio/src/actiongroup.hg b/gio/src/actiongroup.hg new file mode 100644 index 00000000..8ff29e91 --- /dev/null +++ b/gio/src/actiongroup.hg @@ -0,0 +1,85 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + +/* Copyright (C) 2010 The giomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/interface.h> + +_DEFS(giomm,gio) +_PINCLUDE(glibmm/private/interface_p.h) +_PINCLUDE(gio/gio.h) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GActionGroupInterface GActionGroupInterface; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +namespace Gio +{ + +/** ActionGroup - a group of actions. + * ActionGroup represents a group of actions. + * + * Each action in the group has a unique name (which is a string). All method + * calls, except list_actions() take the name of an action as an argument. + * + * The GActionGroup API is meant to be the 'public' API to the action group. + * The calls here are exactly the interaction that 'external forces' (eg: UI, + * incoming D-Bus messages, etc.) are supposed to have with actions. + * 'Internal' APIs (ie: ones meant only to be accessed by the action group + * implementation) are found on subclasses. This is why you will find -- for + * example -- get_action_enabled() but not an equivalent @c set() call. + * + * Signals are emitted on the action group in response to state changes on + * individual actions. + */ +class ActionGroup : public Glib::Interface +{ + _CLASS_INTERFACE(ActionGroup, GActionGroup, G_ACTION_GROUP, GActionGroupInterface) + +public: + _WRAP_METHOD(bool has_action(const Glib::ustring& action_name) const, g_action_group_has_action) + +#m4 _CONVERSION(`gchar**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector<Glib::ustring> list_actions() const, g_action_group_list_actions) + + _WRAP_METHOD(bool get_action_enabled(const Glib::ustring& action_name) const, g_action_group_get_action_enabled) + +/* TODO: + _WRAP_METHOD(const GVariantType* get_action_parameter_type(const Glib::ustring& action_name), g_action_group_get_action_parameter_type) + GVariantType* get_action_state_type(const Glib::ustring& action_name), g_action_group_get_action_state_type) + _WRAP_METHOD(GVariant* get_action_state_hint(const Glib::ustring& action_name), g_action_group_get_action_state_hint) + _WRAP_METHOD(GVariant* get_action_state(GActionGroup* action_group, const gchar* action_name), g_action_group_get_action_state) +*/ + + _WRAP_METHOD(void change_action_state(const Glib::ustring& action_name, const Glib::VariantBase& value), g_action_group_change_action_state) + _WRAP_METHOD(void activate_action(const Glib::ustring& action_name, const Glib::VariantBase& parameter), g_action_group_activate_action) + _WRAP_METHOD(void action_added(const Glib::ustring& action_name), g_action_group_action_added) + _WRAP_METHOD(void action_removed(const Glib::ustring& action_name), g_action_group_action_removed) + _WRAP_METHOD(void action_enabled_changed(const Glib::ustring& action_name, bool enabled), g_action_group_action_enabled_changed) + _WRAP_METHOD(void action_state_changed (const Glib::ustring& action_name, const Glib::VariantBase& state), g_action_group_action_state_changed) + + _WRAP_SIGNAL(void action_added(const Glib::ustring& action_name), "action-added") + _WRAP_SIGNAL(void action_enabled_changed(const Glib::ustring& action_name, bool enabled), "action-enabled-changed") + _WRAP_SIGNAL(void action_removed(const Glib::ustring& action_name), "action-removed") + +#m4 _CONVERSION(`GVariant*', `const Glib::VariantBase&', `Glib::wrap($3, true)') + _WRAP_SIGNAL(void action_state_changed(const Glib::ustring& action_name, const Glib::VariantBase& value), "action-state-changed") + +//TODO: Wrap virtual functions. +}; + +} // namespace Gio |