/* PIKA - Photo and Image Kooker Application
 * a rebranding of The GNU Image Manipulation Program (created with heckimp)
 * A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
 *
 * Original copyright, applying to most contents (license remains unchanged): 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * pikaaction.h
 * Copyright (C) 2004-2019 Michael Natterer <mitch@gimp.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef __PIKA_ACTION_H__
#define __PIKA_ACTION_H__

G_BEGIN_DECLS

#include "core/pikaobject.h"

#define PIKA_TYPE_ACTION (pika_action_get_type ())
G_DECLARE_INTERFACE (PikaAction, pika_action, PIKA, ACTION, PikaObject)

enum
{
  PIKA_ACTION_PROP_0,
  PIKA_ACTION_PROP_CONTEXT,
  PIKA_ACTION_PROP_SENSITIVE,
  PIKA_ACTION_PROP_VISIBLE,
  PIKA_ACTION_PROP_LABEL,
  PIKA_ACTION_PROP_SHORT_LABEL,
  PIKA_ACTION_PROP_TOOLTIP,
  PIKA_ACTION_PROP_ICON_NAME,
  PIKA_ACTION_PROP_ICON,

  PIKA_ACTION_PROP_COLOR,
  PIKA_ACTION_PROP_VIEWABLE,
  PIKA_ACTION_PROP_ELLIPSIZE,
  PIKA_ACTION_PROP_MAX_WIDTH_CHARS,

  PIKA_ACTION_PROP_LAST = PIKA_ACTION_PROP_MAX_WIDTH_CHARS,
};

struct _PikaActionInterface
{
  GTypeInterface base_interface;

  /* Signals */
  void          (* activate)           (PikaAction   *action,
                                        GVariant     *value);
  void          (* change_state)       (PikaAction   *action,
                                        GVariant     *value);
  void          (* accels_changed)     (PikaAction   *action,
                                        const gchar **accels);
};


void             pika_action_init                (PikaAction       *action);

void             pika_action_emit_activate       (PikaAction       *action,
                                                  GVariant         *value);
void             pika_action_emit_change_state   (PikaAction       *action,
                                                  GVariant         *value);

const gchar     * pika_action_get_name            (PikaAction      *action);
PikaActionGroup * pika_action_get_group           (PikaAction      *action);

void              pika_action_set_label           (PikaAction      *action,
                                                   const gchar     *label);
const gchar     * pika_action_get_label           (PikaAction      *action);

void              pika_action_set_short_label     (PikaAction      *action,
                                                   const gchar     *label);
const gchar     * pika_action_get_short_label     (PikaAction      *action);

void              pika_action_set_tooltip         (PikaAction      *action,
                                                   const gchar     *tooltip);
const gchar     * pika_action_get_tooltip         (PikaAction      *action);

void              pika_action_set_icon_name       (PikaAction      *action,
                                                   const gchar     *icon_name);
const gchar     * pika_action_get_icon_name       (PikaAction      *action);

void              pika_action_set_gicon           (PikaAction      *action,
                                                   GIcon           *icon);
GIcon           * pika_action_get_gicon           (PikaAction      *action);

void              pika_action_set_help_id         (PikaAction      *action,
                                                   const gchar     *help_id);
const gchar     * pika_action_get_help_id         (PikaAction      *action);

void              pika_action_set_visible         (PikaAction      *action,
                                                   gboolean         visible);
gboolean          pika_action_get_visible         (PikaAction      *action);
gboolean          pika_action_is_visible          (PikaAction      *action);

void              pika_action_set_sensitive       (PikaAction      *action,
                                                   gboolean         sensitive,
                                                   const gchar     *reason);
gboolean          pika_action_get_sensitive       (PikaAction      *action,
                                                   const gchar    **reason);
gboolean          pika_action_is_sensitive        (PikaAction      *action,
                                                   const gchar    **reason);

void              pika_action_set_accels          (PikaAction      *action,
                                                   const gchar    **accels);
const gchar    ** pika_action_get_default_accels  (PikaAction      *action);
const gchar    ** pika_action_get_accels          (PikaAction      *action);
gchar **          pika_action_get_display_accels  (PikaAction      *action);
gboolean          pika_action_use_default_accels  (PikaAction      *action);
gboolean          pika_action_is_default_accel    (PikaAction      *action,
                                                   const gchar     *accel);

const gchar     * pika_action_get_menu_path       (PikaAction      *action);

void              pika_action_activate            (PikaAction      *action);

gint              pika_action_name_compare        (PikaAction      *action1,
                                                   PikaAction      *action2);

gboolean          pika_action_is_gui_blacklisted  (const gchar     *action_name);

PikaContext     * pika_action_get_context         (PikaAction      *action);
PikaViewable    * pika_action_get_viewable        (PikaAction      *action);


/* Protected functions. */

void              pika_action_install_properties  (GObjectClass    *klass);
void              pika_action_get_property        (GObject         *object,
                                                   guint            property_id,
                                                   GValue          *value,
                                                   GParamSpec      *pspec);
void              pika_action_set_property        (GObject         *object,
                                                   guint            property_id,
                                                   const GValue    *value,
                                                   GParamSpec      *pspec);

void              pika_action_set_proxy           (PikaAction      *action,
                                                   GtkWidget       *proxy);


/* Friend functions. */

void              pika_action_set_group           (PikaAction      *action,
                                                   PikaActionGroup *group);
void              pika_action_set_default_accels  (PikaAction      *action,
                                                   const gchar    **accels);
void              pika_action_set_menu_path       (PikaAction      *action,
                                                   const gchar     *menu_path);

G_END_DECLS

#endif  /* __PIKA_ACTION_H__ */
