## GimpPreview

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

## Functions

gboolean | gimp_preview_get_update ()
void | gimp_preview_set_update ()
void | gimp_preview_set_bounds ()
void | gimp_preview_get_size ()
void | gimp_preview_get_position ()
void | gimp_preview_transform ()
void | gimp_preview_untransform ()
GtkWidget * | gimp_preview_get_area ()
void | gimp_preview_draw ()
void | gimp_preview_draw_buffer ()
void | gimp_preview_invalidate ()
void | gimp_preview_set_default_cursor ()
GtkWidget * | gimp_preview_get_controls ()

## Properties

gboolean | update | Read / Write / Construct

## Style Properties

int | size | Read

## Signals

void | invalidated | Run First

## Types and Values

| GimpPreview

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GtkContainer
                        ╰── GtkBox
                            ╰── GimpPreview
                                ╰── GimpScrolledPreview

## Implemented Interfaces

GimpPreview implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Description

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

## Functions

### gimp_preview_get_update ()

    gboolean
    gimp_preview_get_update (GimpPreview *preview);

#### Parameters

preview | a GimpPreview widget |

#### Returns

the state of the "Preview" check button.

Since: 2.2

### gimp_preview_set_update ()

    void
    gimp_preview_set_update (GimpPreview *preview,
                             gboolean update);

Sets the state of the "Preview" check button.

#### Parameters

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

Since: 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` .

#### Parameters

preview | a GimpPreview widget |
xmin | the minimum X value |
ymin | the minimum Y value |
xmax | the maximum X value |
ymax | the maximum Y value |

Since: 2.2

### gimp_preview_get_size ()

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

#### Parameters

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

Since: 2.2

### gimp_preview_get_position ()

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

#### Parameters

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

Since: 2.2

### gimp_preview_transform ()

    void
    gimp_preview_transform (GimpPreview *preview,
                            gint src_x,
                            gint src_y,
                            gint *dest_x,
                            gint *dest_y);

Transforms from image to widget coordinates.

#### Parameters

preview | a GimpPreview widget |
src_x | horizontal position on the previewed image |
src_y | vertical position on the previewed image |
dest_x | returns the transformed horizontal position |
dest_y | returns the transformed vertical position |

Since: 2.4

### gimp_preview_untransform ()

    void
    gimp_preview_untransform (GimpPreview *preview,
                              gint src_x,
                              gint src_y,
                              gint *dest_x,
                              gint *dest_y);

Transforms from widget to image coordinates.

#### Parameters

preview | a GimpPreview widget |
src_x | horizontal position relative to the preview area's origin |
src_y | vertical position relative to preview area's origin |
dest_x | returns the untransformed horizontal position |
dest_y | returns the untransformed vertical position |

Since: 2.4

### gimp_preview_get_area ()

    GtkWidget *
    gimp_preview_get_area (GimpPreview *preview);

In most cases, you shouldn't need to access the GimpPreviewArea that is being used in the `preview` . Sometimes however, you need to. For example if you want to receive mouse events from the area. In such cases, use `gimp_preview_get_area()`.

#### Parameters

preview | a GimpPreview widget |

#### Returns

a pointer to the GimpPreviewArea used in the `preview` .

Since: 2.4

### 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` .

#### Parameters

preview | a GimpPreview widget |

Since: 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.

#### Parameters

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

Since: 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.

#### Parameters

preview | a GimpPreview widget |

Since: 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 overridden by a `GDK_FLEUR` if the preview has scrollbars, or by a `GDK_WATCH` when the preview is invalidated.

#### Parameters

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

Since: 2.2

### gimp_preview_get_controls ()

    GtkWidget *
    gimp_preview_get_controls (GimpPreview *preview);

Gives access to the GtkHBox at the bottom of the preview that contains the update toggle. Derived widgets can use this function if they need to add controls to this area.

#### Parameters

preview | a GimpPreview widget |

#### Returns

the GtkHBox at the bottom of the preview.

Since: 2.4

## Types and Values

### GimpPreview

    typedef struct _GimpPreview GimpPreview;

## Property Details

### The `“update”` property

      “update”                   gboolean

Whether the preview should update automatically.

Owner: GimpPreview

Flags: Read / Write / Construct

Default value: TRUE

## Style Property Details

### The `“size”` style property

      “size”                     int

The preview's size.

Owner: GimpPreview

Flags: Read

Allowed values: [1,1024]

Default value: 200

## Signal Details

### The `“invalidated”` signal

    void
    user_function (GimpPreview *gimppreview,
                   gpointer     user_data)

Flags: Run First