summaryrefslogtreecommitdiff
path: root/gio/src/simpleaction.hg
blob: dfc668f65e9237052ef76c1f7b21ca60e1ad1b17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* Copyright (C) 2011 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/object.h>
#include <giomm/action.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GSimpleAction GSimpleAction;
typedef GObjectClass GSimpleActionClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gio
{

/** SimpleAction - A simple Action implementation.
 * A SimpleAction is the obvious simple implementation of the Action
 * interface. This is the easiest way to create an action for purposes of
 * adding it to a SimpleActionGroup.
 *
 * See also Gtk::Action.
 *
 * @newin{2,32}
 */
class SimpleAction : public Glib::Object, public Action
{
  _CLASS_GOBJECT(SimpleAction, GSimpleAction, G_SIMPLE_ACTION, Glib::Object, GObject)
  _IMPLEMENTS_INTERFACE(Action)
  _STRUCT_NOT_HIDDEN

protected:
#m4 _CONVERSION(`const Glib::VariantType&',`const GVariantType*',`$3.gobj()')

  _WRAP_CTOR(SimpleAction(const Glib::ustring& name, const Glib::VariantType& parameter_type), g_simple_action_new)
  _WRAP_CTOR(SimpleAction(const Glib::ustring& name, const Glib::VariantType& parameter_type, const Glib::VariantBase& sate), g_simple_action_new_stateful)

public:
  _WRAP_METHOD_DOCS_ONLY(g_simple_action_new)
  _WRAP_CREATE(const Glib::ustring& name, const Glib::VariantType& parameter_type)

  _WRAP_METHOD_DOCS_ONLY(g_simple_action_new_stateful)
  _WRAP_CREATE(const Glib::ustring& name, const Glib::VariantType& parameter_type, const Glib::VariantBase& sate)

  _WRAP_METHOD(void set_enabled(bool enabled), g_simple_action_set_enabled)
  _WRAP_METHOD(void set_state(const Glib::VariantBase& value), g_simple_action_set_state)

  _WRAP_PROPERTY("enabled", bool)
  _WRAP_PROPERTY("name", Glib::ustring)
  _WRAP_PROPERTY("parameter-type", Glib::VariantType)
  _WRAP_PROPERTY("state", Glib::VariantBase)
  _WRAP_PROPERTY("state-type", Glib::VariantType)

#m4 _CONVERSION(`GVariant*',`const Glib::VariantBase&',`Glib::wrap($3, true)')

  _WRAP_SIGNAL(void activate(const Glib::VariantBase& parameter), "activate", no_default_handler)
  _WRAP_SIGNAL(void change_state(const Glib::VariantBase& value), "change-state", no_default_handler)
};

} // namespace Gio