PIKApp/app/widgets/pikaactiongroup.h

264 lines
12 KiB
C

/* 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
*
* pikaactiongroup.h
* Copyright (C) 2004 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_GROUP_H__
#define __PIKA_ACTION_GROUP_H__
#include "core/pikaobject.h"
#define PIKA_TYPE_ACTION_GROUP (pika_action_group_get_type ())
#define PIKA_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_ACTION_GROUP, PikaActionGroup))
#define PIKA_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), PIKA_TYPE_ACTION_GROUP, PikaActionGroupClass))
#define PIKA_IS_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_ACTION_GROUP))
#define PIKA_IS_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), PIKA_TYPE_ACTION_GROUP))
#define PIKA_ACTION_GROUP_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), PIKA_TYPE_ACTION_GROUP, PikaActionGroupClass))
typedef struct _PikaActionGroupClass PikaActionGroupClass;
struct _PikaActionGroup
{
PikaObject parent_instance;
Pika *pika;
gchar *label;
gchar *icon_name;
gpointer user_data;
PikaActionGroupUpdateFunc update_func;
GList *actions;
};
struct _PikaActionGroupClass
{
PikaObjectClass parent_class;
GHashTable *groups;
};
typedef void (* PikaActionCallback) (PikaAction *action,
GVariant *value,
gpointer data);
struct _PikaActionEntry
{
const gchar *name;
const gchar *icon_name;
const gchar *label;
const gchar *short_label;
const gchar *accelerator[4];
const gchar *tooltip;
PikaActionCallback callback;
const gchar *help_id;
};
struct _PikaToggleActionEntry
{
const gchar *name;
const gchar *icon_name;
const gchar *label;
const gchar *short_label;
const gchar *accelerator[4];
const gchar *tooltip;
PikaActionCallback callback;
gboolean is_active;
const gchar *help_id;
};
struct _PikaRadioActionEntry
{
const gchar *name;
const gchar *icon_name;
const gchar *label;
const gchar *short_label;
const gchar *accelerator[4];
const gchar *tooltip;
gint value;
const gchar *help_id;
};
struct _PikaEnumActionEntry
{
const gchar *name;
const gchar *icon_name;
const gchar *label;
const gchar *short_label;
const gchar *accelerator[4];
const gchar *tooltip;
gint value;
gboolean value_variable;
const gchar *help_id;
};
struct _PikaStringActionEntry
{
const gchar *name;
const gchar *icon_name;
const gchar *label;
const gchar *short_label;
const gchar *accelerator[4];
const gchar *tooltip;
const gchar *value;
const gchar *help_id;
};
struct _PikaDoubleActionEntry
{
const gchar *name;
const gchar *icon_name;
const gchar *label;
const gchar *short_label;
const gchar *accelerator[4];
const gchar *tooltip;
const gdouble value;
const gchar *help_id;
};
struct _PikaProcedureActionEntry
{
const gchar *name;
const gchar *icon_name;
const gchar *label;
const gchar *accelerator;
const gchar *tooltip;
PikaProcedure *procedure;
const gchar *help_id;
};
GType pika_action_group_get_type (void) G_GNUC_CONST;
PikaActionGroup *pika_action_group_new (Pika *pika,
const gchar *name,
const gchar *label,
const gchar *icon_name,
gpointer user_data,
PikaActionGroupUpdateFunc update_func);
GList *pika_action_groups_from_name (const gchar *name);
const gchar * pika_action_group_get_name (PikaActionGroup *group);
void pika_action_group_add_action (PikaActionGroup *action_group,
PikaAction *action);
void pika_action_group_add_action_with_accel (PikaActionGroup *action_group,
PikaAction *action,
const gchar * const*accelerators);
void pika_action_group_remove_action (PikaActionGroup *action_group,
PikaAction *action);
PikaAction * pika_action_group_get_action (PikaActionGroup *group,
const gchar *action_name);
GList * pika_action_group_list_actions (PikaActionGroup *group);
void pika_action_group_update (PikaActionGroup *group,
gpointer update_data);
void pika_action_group_add_actions (PikaActionGroup *group,
const gchar *msg_context,
const PikaActionEntry *entries,
guint n_entries);
void pika_action_group_add_toggle_actions (PikaActionGroup *group,
const gchar *msg_context,
const PikaToggleActionEntry *entries,
guint n_entries);
GSList *pika_action_group_add_radio_actions (PikaActionGroup *group,
const gchar *msg_context,
const PikaRadioActionEntry *entries,
guint n_entries,
GSList *radio_group,
gint value,
PikaActionCallback callback);
void pika_action_group_add_enum_actions (PikaActionGroup *group,
const gchar *msg_context,
const PikaEnumActionEntry *entries,
guint n_entries,
PikaActionCallback callback);
void pika_action_group_add_string_actions (PikaActionGroup *group,
const gchar *msg_context,
const PikaStringActionEntry *entries,
guint n_entries,
PikaActionCallback callback);
void pika_action_group_add_double_actions (PikaActionGroup *group,
const gchar *msg_context,
const PikaDoubleActionEntry *entries,
guint n_entries,
PikaActionCallback callback);
void pika_action_group_add_procedure_actions(PikaActionGroup *group,
const PikaProcedureActionEntry *entries,
guint n_entries,
PikaActionCallback callback);
void pika_action_group_remove_action_and_accel (PikaActionGroup *group,
PikaAction *action);
void pika_action_group_set_action_visible (PikaActionGroup *group,
const gchar *action_name,
gboolean visible);
void pika_action_group_set_action_sensitive (PikaActionGroup *group,
const gchar *action_name,
gboolean sensitive,
const gchar *reason);
void pika_action_group_set_action_active (PikaActionGroup *group,
const gchar *action_name,
gboolean active);
void pika_action_group_set_action_label (PikaActionGroup *group,
const gchar *action_name,
const gchar *label);
void pika_action_group_set_action_pixbuf (PikaActionGroup *group,
const gchar *action_name,
GdkPixbuf *pixbuf);
void pika_action_group_set_action_tooltip (PikaActionGroup *group,
const gchar *action_name,
const gchar *tooltip);
const gchar * pika_action_group_get_action_tooltip (PikaActionGroup *group,
const gchar *action_name);
void pika_action_group_set_action_color (PikaActionGroup *group,
const gchar *action_name,
const PikaRGB *color,
gboolean set_label);
void pika_action_group_set_action_viewable (PikaActionGroup *group,
const gchar *action_name,
PikaViewable *viewable);
void pika_action_group_set_action_hide_empty (PikaActionGroup *group,
const gchar *action_name,
gboolean hide_empty);
void pika_action_group_set_action_always_show_image (PikaActionGroup *group,
const gchar *action_name,
gboolean always_show_image);
#endif /* __PIKA_ACTION_GROUP_H__ */