/* Copyright (C) 2012 The gtkmm 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, see <https://www.gnu.org/licenses/>.
 */

_CONFIGINCLUDE(gtkmmconfig.h)

#include <glibmm/interface.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/interface_p.h)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C"
{
typedef struct _GtkActionableInterface GtkActionableInterface;
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gtk
{

/** An interface for widgets that can be associated with actions.
 *
 * This interface provides a convenient way of associating widgets with
 * actions on an ApplicationWindow or Application.
 *
 * It primarily consists of two properties: "action-name" and "action-target".
 * There are also some convenience APIs for setting these properties.
 *
 * The action will be looked up in action groups that are found among
 * the widget's ancestors. Most commonly, these will be the actions with
 * the “win.” or “app.” prefix that are associated with the ApplicationWindow
 * or Application, but other action groups that are added with
 * Widget::insert_action_group() will be consulted as well.
 *
 * @newin{3,4}
 */
class GTKMM_API Actionable : public Glib::Interface
{
  _CLASS_INTERFACE(Actionable, GtkActionable, GTK_ACTIONABLE, GtkActionableInterface, , , GTKMM_API)

public:
  _WRAP_METHOD(Glib::ustring get_action_name() const, gtk_actionable_get_action_name)
  _WRAP_METHOD(void set_action_name(const Glib::ustring& action_name), gtk_actionable_set_action_name)

#m4 _CONVERSION(`GVariant*',`Glib::VariantBase',`Glib::wrap($3,true)')
  _WRAP_METHOD(Glib::VariantBase get_action_target_value(), gtk_actionable_get_action_target_value)
  _WRAP_METHOD(const Glib::VariantBase get_action_target_value() const, gtk_actionable_get_action_target_value, constversion)
  _WRAP_METHOD(void set_action_target_value(const Glib::VariantBase& target_value), gtk_actionable_set_action_target_value)

  _IGNORE(gtk_actionable_set_action_target) //gtk_actionable_set_action_target() is just a C convenience method.

  _WRAP_METHOD(void set_detailed_action_name(const Glib::ustring& detailed_action_name), gtk_actionable_set_detailed_action_name)

  _WRAP_PROPERTY("action-name", Glib::ustring)
  _WRAP_PROPERTY("action-target", Glib::VariantBase)

protected:
#m4 _CONVERSION(`Glib::ustring',`const char*',`$3.empty() ? nullptr : $3.c_str()')
  _WRAP_VFUNC(Glib::ustring get_action_name() const, "get_action_name", keep_return)

  _WRAP_VFUNC(void set_action_name(const Glib::ustring& action_name), "set_action_name")

#m4 _CONVERSION(`Glib::VariantBase',`GVariant*',`$3.gobj()')
  _WRAP_VFUNC(Glib::VariantBase get_action_target_value() const, "get_action_target_value", keep_return)

#m4 _CONVERSION(`GVariant*',`const Glib::VariantBase&',`Glib::wrap($3,true)')
  _WRAP_VFUNC(void set_action_target_value(const Glib::VariantBase& action_target_value), "set_action_target_value")
};

} // namespace Gtk
