## GimpPreview

GimpPreview — A widget providing a GimpPreviewArea plus framework to update the preview.

## Synopsis

                GimpPreview;
    gboolean    gimp_preview_get_update         (GimpPreview *preview);
    void        gimp_preview_set_update         (GimpPreview *preview,
                                                 gboolean update);
    void        gimp_preview_set_bounds         (GimpPreview *preview,
                                                 gint xmin,
                                                 gint ymin,
                                                 gint xmax,
                                                 gint ymax);
    void        gimp_preview_get_size           (GimpPreview *preview,
                                                 gint *width,
                                                 gint *height);
    void        gimp_preview_get_position       (GimpPreview *preview,
                                                 gint *x,
                                                 gint *y);
    void        gimp_preview_draw               (GimpPreview *preview);
    void        gimp_preview_draw_buffer        (GimpPreview *preview,
                                                 const guchar *buffer,
                                                 gint rowstride);
    void        gimp_preview_invalidate         (GimpPreview *preview);
    void        gimp_preview_set_default_cursor (GimpPreview *preview,
                                                 GdkCursor *cursor);

## Object Hierarchy

      GObject
       +----GtkObject
             +----GtkWidget
                   +----GtkContainer
                         +----GtkBox
                               +----GtkVBox
                                     +----GimpPreview

## Implemented Interfaces

GimpPreview implements AtkImplementorIface.

## Properties

      "update"               gboolean              : Read / Write / Construct

## Style Properties

      "size"                 gint                  : Read

## Signal Prototypes

    "invalidated"
                void        user_function      (GimpPreview *gimppreview,
                                                gpointer user_data);

## Description

A widget providing a GimpPreviewArea plus framework to update the preview.

## Details

### GimpPreview

    typedef struct _GimpPreview GimpPreview;

### gimp_preview_get_update ()

    gboolean    gimp_preview_get_update         (GimpPreview *preview);

`preview` : | a GimpPreview widget
Returns : | the state of the "Preview" check button.

Since GIMP 2.2

### gimp_preview_set_update ()

    void        gimp_preview_set_update         (GimpPreview *preview,
                                                 gboolean update);

Sets the state of the "Preview" check button.

`preview` : | a GimpPreview widget
`update` : | `TRUE` if the preview should invalidate itself when being scrolled or when `gimp_preview_invalidate()` is being called

Since GIMP 2.2

### gimp_preview_set_bounds ()

    void        gimp_preview_set_bounds         (GimpPreview *preview,
                                                 gint xmin,
                                                 gint ymin,
                                                 gint xmax,
                                                 gint ymax);

Sets the lower and upper limits for the previewed area. The difference between the upper and lower value is used to set the maximum size of the GimpPreviewArea used in the `preview`.

`preview` : | a GimpPreview widget
`xmin` : |
`ymin` : |
`xmax` : |
`ymax` : |

Since GIMP 2.2

### gimp_preview_get_size ()

    void        gimp_preview_get_size           (GimpPreview *preview,
                                                 gint *width,
                                                 gint *height);

`preview` : | a GimpPreview widget
`width` : | return location for the preview area width
`height` : | return location for the preview area height

Since GIMP 2.2

### gimp_preview_get_position ()

    void        gimp_preview_get_position       (GimpPreview *preview,
                                                 gint *x,
                                                 gint *y);

`preview` : | a GimpPreview widget
`x` : | return location for the horizontal offset
`y` : | return location for the vertical offset

Since GIMP 2.2

### gimp_preview_draw ()

    void        gimp_preview_draw               (GimpPreview *preview);

Calls the GimpPreview::draw method. GimpPreview itself doesn't implement a default draw method so the behaviour is determined by the derived class implementing this method.

GimpDrawablePreview implements `gimp_preview_draw()` by drawing the original, unmodified drawable to the `preview`.

`preview` : | a GimpPreview widget

Since GIMP 2.2

### gimp_preview_draw_buffer ()

    void        gimp_preview_draw_buffer        (GimpPreview *preview,
                                                 const guchar *buffer,
                                                 gint rowstride);

Calls the GimpPreview::draw_buffer method. GimpPreview itself doesn't implement this method so the behaviour is determined by the derived class implementing this method.

`preview` : | a GimpPreview widget
`buffer` : | a pixel buffer the size of the preview
`rowstride` : | the `buffer`'s rowstride

Since GIMP 2.2

### gimp_preview_invalidate ()

    void        gimp_preview_invalidate         (GimpPreview *preview);

This function starts or renews a short low-priority timeout. When the timeout expires, the GimpPreview::invalidated signal is emitted which will usually cause the `preview` to be updated.

This function does nothing unless the "Preview" button is checked.

During the emission of the signal a busy cursor is set on the toplevel window containing the `preview` and on the preview area itself.

`preview` : | a GimpPreview widget

Since GIMP 2.2

### gimp_preview_set_default_cursor ()

    void        gimp_preview_set_default_cursor (GimpPreview *preview,
                                                 GdkCursor *cursor);

Sets the default mouse cursor for the preview. Note that this will be overriden by a `GDK_FLEUR` if the preview has scrollbars, or by a `GDK_WATCH` when the preview is invalidated.

`preview` : | a GimpPreview widget
`cursor` : | a GdkCursor or `NULL`

Since GIMP 2.2

## Properties

### The "`update`" property

      "update"               gboolean              : Read / Write / Construct

Default value: TRUE

## Style Properties

### The "`size`" style property

      "size"                 gint                  : Read

Allowed values: [1,1024]

Default value: 150

## Signals

### The "invalidated" signal

    void        user_function                  (GimpPreview *gimppreview,
                                                gpointer user_data);

`gimppreview` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.