206 lines
10 KiB
C
206 lines
10 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-1997 Spencer Kimball and Peter Mattis
|
||
|
*
|
||
|
* pikaviewable.h
|
||
|
* Copyright (C) 2001 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_VIEWABLE_H__
|
||
|
#define __PIKA_VIEWABLE_H__
|
||
|
|
||
|
|
||
|
#include "pikaobject.h"
|
||
|
|
||
|
|
||
|
#define PIKA_VIEWABLE_MAX_PREVIEW_SIZE 2048
|
||
|
#define PIKA_VIEWABLE_MAX_POPUP_SIZE 256
|
||
|
#define PIKA_VIEWABLE_MAX_BUTTON_SIZE 64
|
||
|
#define PIKA_VIEWABLE_MAX_MENU_SIZE 48
|
||
|
|
||
|
|
||
|
#define PIKA_TYPE_VIEWABLE (pika_viewable_get_type ())
|
||
|
#define PIKA_VIEWABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_VIEWABLE, PikaViewable))
|
||
|
#define PIKA_VIEWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_VIEWABLE, PikaViewableClass))
|
||
|
#define PIKA_IS_VIEWABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_VIEWABLE))
|
||
|
#define PIKA_IS_VIEWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_VIEWABLE))
|
||
|
#define PIKA_VIEWABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_VIEWABLE, PikaViewableClass))
|
||
|
|
||
|
|
||
|
typedef struct _PikaViewableClass PikaViewableClass;
|
||
|
|
||
|
struct _PikaViewable
|
||
|
{
|
||
|
PikaObject parent_instance;
|
||
|
};
|
||
|
|
||
|
struct _PikaViewableClass
|
||
|
{
|
||
|
PikaObjectClass parent_class;
|
||
|
|
||
|
const gchar *default_icon_name;
|
||
|
const gchar *name_changed_signal;
|
||
|
gboolean name_editable;
|
||
|
|
||
|
/* signals */
|
||
|
void (* invalidate_preview) (PikaViewable *viewable);
|
||
|
void (* size_changed) (PikaViewable *viewable);
|
||
|
void (* expanded_changed) (PikaViewable *viewable);
|
||
|
void (* ancestry_changed) (PikaViewable *viewable);
|
||
|
|
||
|
/* virtual functions */
|
||
|
gboolean (* get_size) (PikaViewable *viewable,
|
||
|
gint *width,
|
||
|
gint *height);
|
||
|
void (* get_preview_size) (PikaViewable *viewable,
|
||
|
gint size,
|
||
|
gboolean is_popup,
|
||
|
gboolean dot_for_dot,
|
||
|
gint *width,
|
||
|
gint *height);
|
||
|
gboolean (* get_popup_size) (PikaViewable *viewable,
|
||
|
gint width,
|
||
|
gint height,
|
||
|
gboolean dot_for_dot,
|
||
|
gint *popup_width,
|
||
|
gint *popup_height);
|
||
|
PikaTempBuf * (* get_preview) (PikaViewable *viewable,
|
||
|
PikaContext *context,
|
||
|
gint width,
|
||
|
gint height);
|
||
|
PikaTempBuf * (* get_new_preview) (PikaViewable *viewable,
|
||
|
PikaContext *context,
|
||
|
gint width,
|
||
|
gint height);
|
||
|
GdkPixbuf * (* get_pixbuf) (PikaViewable *viewable,
|
||
|
PikaContext *context,
|
||
|
gint width,
|
||
|
gint height);
|
||
|
GdkPixbuf * (* get_new_pixbuf) (PikaViewable *viewable,
|
||
|
PikaContext *context,
|
||
|
gint width,
|
||
|
gint height);
|
||
|
gchar * (* get_description) (PikaViewable *viewable,
|
||
|
gchar **tooltip);
|
||
|
|
||
|
gboolean (* is_name_editable) (PikaViewable *viewable);
|
||
|
|
||
|
void (* preview_freeze) (PikaViewable *viewable);
|
||
|
void (* preview_thaw) (PikaViewable *viewable);
|
||
|
|
||
|
PikaContainer * (* get_children) (PikaViewable *viewable);
|
||
|
|
||
|
void (* set_expanded) (PikaViewable *viewable,
|
||
|
gboolean expand);
|
||
|
gboolean (* get_expanded) (PikaViewable *viewable);
|
||
|
};
|
||
|
|
||
|
|
||
|
GType pika_viewable_get_type (void) G_GNUC_CONST;
|
||
|
|
||
|
void pika_viewable_invalidate_preview (PikaViewable *viewable);
|
||
|
void pika_viewable_size_changed (PikaViewable *viewable);
|
||
|
void pika_viewable_expanded_changed (PikaViewable *viewable);
|
||
|
|
||
|
void pika_viewable_calc_preview_size (gint aspect_width,
|
||
|
gint aspect_height,
|
||
|
gint width,
|
||
|
gint height,
|
||
|
gboolean dot_for_dot,
|
||
|
gdouble xresolution,
|
||
|
gdouble yresolution,
|
||
|
gint *return_width,
|
||
|
gint *return_height,
|
||
|
gboolean *scaling_up);
|
||
|
|
||
|
gboolean pika_viewable_get_size (PikaViewable *viewable,
|
||
|
gint *width,
|
||
|
gint *height);
|
||
|
void pika_viewable_get_preview_size (PikaViewable *viewable,
|
||
|
gint size,
|
||
|
gboolean popup,
|
||
|
gboolean dot_for_dot,
|
||
|
gint *width,
|
||
|
gint *height);
|
||
|
gboolean pika_viewable_get_popup_size (PikaViewable *viewable,
|
||
|
gint width,
|
||
|
gint height,
|
||
|
gboolean dot_for_dot,
|
||
|
gint *popup_width,
|
||
|
gint *popup_height);
|
||
|
|
||
|
PikaTempBuf * pika_viewable_get_preview (PikaViewable *viewable,
|
||
|
PikaContext *context,
|
||
|
gint width,
|
||
|
gint height);
|
||
|
PikaTempBuf * pika_viewable_get_new_preview (PikaViewable *viewable,
|
||
|
PikaContext *context,
|
||
|
gint width,
|
||
|
gint height);
|
||
|
|
||
|
PikaTempBuf * pika_viewable_get_dummy_preview (PikaViewable *viewable,
|
||
|
gint width,
|
||
|
gint height,
|
||
|
const Babl *format);
|
||
|
|
||
|
GdkPixbuf * pika_viewable_get_pixbuf (PikaViewable *viewable,
|
||
|
PikaContext *context,
|
||
|
gint width,
|
||
|
gint height);
|
||
|
GdkPixbuf * pika_viewable_get_new_pixbuf (PikaViewable *viewable,
|
||
|
PikaContext *context,
|
||
|
gint width,
|
||
|
gint height);
|
||
|
|
||
|
GdkPixbuf * pika_viewable_get_dummy_pixbuf (PikaViewable *viewable,
|
||
|
gint width,
|
||
|
gint height,
|
||
|
gboolean with_alpha);
|
||
|
|
||
|
gchar * pika_viewable_get_description (PikaViewable *viewable,
|
||
|
gchar **tooltip);
|
||
|
|
||
|
gboolean pika_viewable_is_name_editable (PikaViewable *viewable);
|
||
|
|
||
|
const gchar * pika_viewable_get_icon_name (PikaViewable *viewable);
|
||
|
void pika_viewable_set_icon_name (PikaViewable *viewable,
|
||
|
const gchar *icon_name);
|
||
|
|
||
|
void pika_viewable_preview_freeze (PikaViewable *viewable);
|
||
|
void pika_viewable_preview_thaw (PikaViewable *viewable);
|
||
|
gboolean pika_viewable_preview_is_frozen (PikaViewable *viewable);
|
||
|
|
||
|
PikaViewable * pika_viewable_get_parent (PikaViewable *viewable);
|
||
|
void pika_viewable_set_parent (PikaViewable *viewable,
|
||
|
PikaViewable *parent);
|
||
|
|
||
|
gint pika_viewable_get_depth (PikaViewable *viewable);
|
||
|
|
||
|
PikaContainer * pika_viewable_get_children (PikaViewable *viewable);
|
||
|
|
||
|
gboolean pika_viewable_get_expanded (PikaViewable *viewable);
|
||
|
void pika_viewable_set_expanded (PikaViewable *viewable,
|
||
|
gboolean expanded);
|
||
|
|
||
|
gboolean pika_viewable_is_ancestor (PikaViewable *ancestor,
|
||
|
PikaViewable *descendant);
|
||
|
|
||
|
|
||
|
#endif /* __PIKA_VIEWABLE_H__ */
|