/* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
 */

_CONFIGINCLUDE(gtkmmconfig.h)

#include <glibmm/ustring.h>
#include <glibmm/value.h>

_DEFS(gtkmm,gtk)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { typedef struct _GtkPadActionEntry GtkPadActionEntry; }
#endif

namespace Gtk
{
_WRAP_ENUM(PadActionType, GtkPadActionType, decl_prefix GTKMM_API)

/** Class defining a pad action entry.
 *
 * @see Gtk::PadController
 * @newin{3,96}
 */
class GTKMM_API PadActionEntry
{
  _CLASS_GENERIC(PadActionEntry, GtkPadActionEntry)
public:

  PadActionEntry();

  /** Construct a new %PadActionEntry.
   *
   * @param type The type of pad feature that will trigger this action.
   * @param index The 0-indexed button/ring/strip number that will trigger this action.
   * @param mode The mode that will trigger this action, or -1 for all modes.
   * @param label Human readable description of this action, this string should
   * be deemed user-visible.
   * @param action_name Action name that will be activated in the Gio::ActionGroup.
   */
  PadActionEntry(PadActionType type, int index, int mode,
    const Glib::ustring& label, const Glib::ustring& action_name);

  PadActionEntry(const PadActionEntry& src);
  PadActionEntry& operator=(const PadActionEntry& src);

  PadActionEntry(PadActionEntry&& other) noexcept;
  PadActionEntry& operator=(PadActionEntry&& other) noexcept;

  virtual ~PadActionEntry();

  _MEMBER_GET(type, type, PadActionType, GtkPadActionType)
  _MEMBER_SET(type, type, PadActionType, GtkPadActionType)

  _MEMBER_GET(index, index, int, int)
  _MEMBER_SET(index, index, int, int)

  _MEMBER_GET(mode, mode, int, int)
  _MEMBER_SET(mode, mode, int, int)

#m4 _CONVERSION(`const char*',`Glib::ustring',`Glib::convert_const_gchar_ptr_to_ustring($3)')
#m4 _CONVERSION(`Glib::ustring',`const char*',`($3).c_str()')
  _MEMBER_GET(label, label, Glib::ustring, const char*)
  _MEMBER_SET_STR(label, label, Glib::ustring, const char*)

  _MEMBER_GET(action_name, action_name, Glib::ustring, const char*)
  _MEMBER_SET_STR(action_name, action_name, Glib::ustring, const char*)

  GtkPadActionEntry*       gobj()       { return gobject_; }
  const GtkPadActionEntry* gobj() const { return gobject_; }

protected:
  GtkPadActionEntry* gobject_;

private:
  void release_gobject() noexcept;
};

} // namespace Gtk
