/* 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 * * pikadialogfactory.h * Copyright (C) 2001 Michael Natterer * * 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 . */ #ifndef __PIKA_DIALOG_FACTORY_H__ #define __PIKA_DIALOG_FACTORY_H__ #include "core/pikaobject.h" #define PIKA_DIALOG_VISIBILITY_KEY "pika-dialog-visibility" typedef enum { PIKA_DIALOG_VISIBILITY_UNKNOWN = 0, PIKA_DIALOG_VISIBILITY_INVISIBLE, PIKA_DIALOG_VISIBILITY_VISIBLE, PIKA_DIALOG_VISIBILITY_HIDDEN } PikaDialogVisibilityState; /* In order to support constructors of various types, these functions * takes the union of the set of arguments required for each type of * widget constructor. If this set becomes too big we can consider * passing a struct or use varargs. */ typedef GtkWidget * (* PikaDialogNewFunc) (PikaDialogFactory *factory, PikaContext *context, PikaUIManager *ui_manager, gint view_size); struct _PikaDialogFactoryEntry { gchar *identifier; gchar *name; gchar *blurb; gchar *icon_name; gchar *help_id; PikaDialogNewFunc new_func; PikaDialogRestoreFunc restore_func; gint view_size; gboolean singleton; gboolean session_managed; gboolean remember_size; gboolean remember_if_open; /* If TRUE the visibility of the dialog is toggleable */ gboolean hideable; /* If TRUE the entry is for a PikaImageWindow, FALSE otherwise */ gboolean image_window; /* If TRUE the entry is for a dockable, FALSE otherwise */ gboolean dockable; }; #define PIKA_TYPE_DIALOG_FACTORY (pika_dialog_factory_get_type ()) #define PIKA_DIALOG_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_DIALOG_FACTORY, PikaDialogFactory)) #define PIKA_DIALOG_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_DIALOG_FACTORY, PikaDialogFactoryClass)) #define PIKA_IS_DIALOG_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_DIALOG_FACTORY)) #define PIKA_IS_DIALOG_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_DIALOG_FACTORY)) #define PIKA_DIALOG_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_DIALOG_FACTORY, PikaDialogFactoryClass)) typedef struct _PikaDialogFactoryPrivate PikaDialogFactoryPrivate; typedef struct _PikaDialogFactoryClass PikaDialogFactoryClass; /** * PikaDialogFactory: * * A factory with the main purpose of creating toplevel windows and * position them according to the session information kept within the * factory. Over time it has accumulated more functionality than this. */ struct _PikaDialogFactory { PikaObject parent_instance; PikaDialogFactoryPrivate *p; }; struct _PikaDialogFactoryClass { PikaObjectClass parent_class; void (* dock_window_added) (PikaDialogFactory *factory, PikaDockWindow *dock_window); void (* dock_window_removed) (PikaDialogFactory *factory, PikaDockWindow *dock_window); }; GType pika_dialog_factory_get_type (void) G_GNUC_CONST; PikaDialogFactory * pika_dialog_factory_new (const gchar *name, PikaContext *context); void pika_dialog_factory_register_entry (PikaDialogFactory *factory, const gchar *identifier, const gchar *name, const gchar *blurb, const gchar *icon_name, const gchar *help_id, PikaDialogNewFunc new_func, PikaDialogRestoreFunc restore_func, gint view_size, gboolean singleton, gboolean session_managed, gboolean remember_size, gboolean remember_if_open, gboolean hideable, gboolean image_window, gboolean dockable); PikaDialogFactoryEntry * pika_dialog_factory_find_entry (PikaDialogFactory *factory, const gchar *identifier); PikaSessionInfo * pika_dialog_factory_find_session_info (PikaDialogFactory *factory, const gchar *identifier); GtkWidget * pika_dialog_factory_find_widget (PikaDialogFactory *factory, const gchar *identifiers); GtkWidget * pika_dialog_factory_dialog_new (PikaDialogFactory *factory, GdkMonitor *monitor, PikaUIManager *ui_manager, GtkWidget *parent, const gchar *identifier, gint view_size, gboolean present); PikaContext * pika_dialog_factory_get_context (PikaDialogFactory *factory); GList * pika_dialog_factory_get_open_dialogs (PikaDialogFactory *factory); GList * pika_dialog_factory_get_session_infos (PikaDialogFactory *factory); void pika_dialog_factory_add_session_info (PikaDialogFactory *factory, PikaSessionInfo *info); GtkWidget * pika_dialog_factory_dialog_raise (PikaDialogFactory *factory, GdkMonitor *monitor, GtkWidget *parent, const gchar *identifiers, gint view_size); GtkWidget * pika_dialog_factory_dockable_new (PikaDialogFactory *factory, PikaDock *dock, const gchar *identifier, gint view_size); void pika_dialog_factory_add_dialog (PikaDialogFactory *factory, GtkWidget *dialog, GdkMonitor *monitor); void pika_dialog_factory_add_foreign (PikaDialogFactory *factory, const gchar *identifier, GtkWidget *dialog, GdkMonitor *monitor); void pika_dialog_factory_position_dialog (PikaDialogFactory *factory, const gchar *identifier, GtkWidget *dialog, GdkMonitor *monitor); void pika_dialog_factory_remove_dialog (PikaDialogFactory *factory, GtkWidget *dialog); void pika_dialog_factory_hide_dialog (GtkWidget *dialog); void pika_dialog_factory_save (PikaDialogFactory *factory, PikaConfigWriter *writer); void pika_dialog_factory_restore (PikaDialogFactory *factory, GdkMonitor *monitor); void pika_dialog_factory_set_state (PikaDialogFactory *factory, PikaDialogsState state); PikaDialogsState pika_dialog_factory_get_state (PikaDialogFactory *factory); void pika_dialog_factory_show_with_display (PikaDialogFactory *factory); void pika_dialog_factory_hide_with_display (PikaDialogFactory *factory); void pika_dialog_factory_set_busy (PikaDialogFactory *factory); void pika_dialog_factory_unset_busy (PikaDialogFactory *factory); PikaDialogFactory * pika_dialog_factory_from_widget (GtkWidget *dialog, PikaDialogFactoryEntry **entry); void pika_dialog_factory_set_has_min_size (GtkWindow *window, gboolean has_min_size); gboolean pika_dialog_factory_get_has_min_size (GtkWindow *window); PikaDialogFactory * pika_dialog_factory_get_singleton (void); void pika_dialog_factory_set_singleton (PikaDialogFactory *factory); #endif /* __PIKA_DIALOG_FACTORY_H__ */