/* LIBPIKA - The PIKA Library
 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
 *
 * pikapreview.h
 *
 * 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 3 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
 * <https://www.gnu.org/licenses/>.
 */

#if !defined (__PIKA_WIDGETS_H_INSIDE__) && !defined (PIKA_WIDGETS_COMPILATION)
#error "Only <libpikawidgets/pikawidgets.h> can be included directly."
#endif

#ifndef __PIKA_PREVIEW_H__
#define __PIKA_PREVIEW_H__

G_BEGIN_DECLS


/* For information look into the C source or the html documentation */


#define PIKA_TYPE_PREVIEW            (pika_preview_get_type ())
#define PIKA_PREVIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_PREVIEW, PikaPreview))
#define PIKA_PREVIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_PREVIEW, PikaPreviewClass))
#define PIKA_IS_PREVIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_PREVIEW))
#define PIKA_IS_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_PREVIEW))
#define PIKA_PREVIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_PREVIEW, PikaPreviewClass))


typedef struct _PikaPreviewPrivate PikaPreviewPrivate;
typedef struct _PikaPreviewClass   PikaPreviewClass;

struct _PikaPreview
{
  GtkBox              parent_instance;

  PikaPreviewPrivate *priv;
};

struct _PikaPreviewClass
{
  GtkBoxClass  parent_class;

  /* virtual methods */
  void   (* draw)        (PikaPreview     *preview);
  void   (* draw_thumb)  (PikaPreview     *preview,
                          PikaPreviewArea *area,
                          gint             width,
                          gint             height);
  void   (* draw_buffer) (PikaPreview     *preview,
                          const guchar    *buffer,
                          gint             rowstride);
  void   (* set_cursor)  (PikaPreview     *preview);

  void   (* transform)   (PikaPreview     *preview,
                          gint             src_x,
                          gint             src_y,
                          gint            *dest_x,
                          gint            *dest_y);
  void   (* untransform) (PikaPreview     *preview,
                          gint             src_x,
                          gint             src_y,
                          gint            *dest_x,
                          gint            *dest_y);

  /* signal */
  void   (* invalidated) (PikaPreview     *preview);

  /* Padding for future expansion */
  void (* _pika_reserved1) (void);
  void (* _pika_reserved2) (void);
  void (* _pika_reserved3) (void);
  void (* _pika_reserved4) (void);
  void (* _pika_reserved5) (void);
  void (* _pika_reserved6) (void);
  void (* _pika_reserved7) (void);
  void (* _pika_reserved8) (void);
};


GType       pika_preview_get_type           (void) G_GNUC_CONST;

void        pika_preview_set_update         (PikaPreview  *preview,
                                             gboolean      update);
gboolean    pika_preview_get_update         (PikaPreview  *preview);

void        pika_preview_set_bounds         (PikaPreview  *preview,
                                             gint          xmin,
                                             gint          ymin,
                                             gint          xmax,
                                             gint          ymax);
void        pika_preview_get_bounds         (PikaPreview  *preview,
                                             gint         *xmin,
                                             gint         *ymin,
                                             gint         *xmax,
                                             gint         *ymax);

void        pika_preview_set_size           (PikaPreview  *preview,
                                             gint          width,
                                             gint          height);
void        pika_preview_get_size           (PikaPreview  *preview,
                                             gint         *width,
                                             gint         *height);

void        pika_preview_set_offsets        (PikaPreview  *preview,
                                             gint          xoff,
                                             gint          yoff);
void        pika_preview_get_offsets        (PikaPreview  *preview,
                                             gint         *xoff,
                                             gint         *yoff);

void        pika_preview_get_position       (PikaPreview  *preview,
                                             gint         *x,
                                             gint         *y);

void        pika_preview_transform          (PikaPreview *preview,
                                             gint         src_x,
                                             gint         src_y,
                                             gint        *dest_x,
                                             gint        *dest_y);
void        pika_preview_untransform        (PikaPreview *preview,
                                             gint         src_x,
                                             gint         src_y,
                                             gint        *dest_x,
                                             gint        *dest_y);

GtkWidget * pika_preview_get_frame          (PikaPreview  *preview);
GtkWidget * pika_preview_get_grid           (PikaPreview  *preview);
GtkWidget * pika_preview_get_area           (PikaPreview  *preview);

void        pika_preview_draw               (PikaPreview  *preview);
void        pika_preview_draw_buffer        (PikaPreview  *preview,
                                             const guchar *buffer,
                                             gint          rowstride);

void        pika_preview_invalidate         (PikaPreview  *preview);

void        pika_preview_set_default_cursor (PikaPreview  *preview,
                                             GdkCursor    *cursor);
GdkCursor * pika_preview_get_default_cursor (PikaPreview  *preview);

GtkWidget * pika_preview_get_controls       (PikaPreview  *preview);


G_END_DECLS

#endif /* __PIKA_PREVIEW_H__ */
