## GimpPageSelector

GimpPageSelector — A widget to select pages from multi-page things.

## Synopsis

                        GimpPageSelector;
    enum                GimpPageSelectorTarget;
    GtkWidget *         gimp_page_selector_new              (void);
    void                gimp_page_selector_set_n_pages      (GimpPageSelector *selector,
                                                             gint n_pages);
    gint                gimp_page_selector_get_n_pages      (GimpPageSelector *selector);
    void                gimp_page_selector_set_target       (GimpPageSelector *selector,
                                                             GimpPageSelectorTarget target);
    GimpPageSelectorTarget gimp_page_selector_get_target    (GimpPageSelector *selector);
    void                gimp_page_selector_set_page_thumbnail
                                                            (GimpPageSelector *selector,
                                                             gint page_no,
                                                             GdkPixbuf *thumbnail);
    GdkPixbuf *         gimp_page_selector_get_page_thumbnail
                                                            (GimpPageSelector *selector,
                                                             gint page_no);
    void                gimp_page_selector_set_page_label   (GimpPageSelector *selector,
                                                             gint page_no,
                                                             const gchar *label);
    gchar *             gimp_page_selector_get_page_label   (GimpPageSelector *selector,
                                                             gint page_no);
    void                gimp_page_selector_select_all       (GimpPageSelector *selector);
    void                gimp_page_selector_unselect_all     (GimpPageSelector *selector);
    void                gimp_page_selector_select_page      (GimpPageSelector *selector,
                                                             gint page_no);
    void                gimp_page_selector_unselect_page    (GimpPageSelector *selector,
                                                             gint page_no);
    gboolean            gimp_page_selector_page_is_selected (GimpPageSelector *selector,
                                                             gint page_no);
    gint *              gimp_page_selector_get_selected_pages
                                                            (GimpPageSelector *selector,
                                                             gint *n_selected_pages);
    void                gimp_page_selector_select_range     (GimpPageSelector *selector,
                                                             const gchar *range);
    gchar *             gimp_page_selector_get_selected_range
                                                            (GimpPageSelector *selector);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBox
                                     +----GimpPageSelector

## Implemented Interfaces

GimpPageSelector implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Properties

      "n-pages"                  gint                  : Read / Write
      "target"                   GimpPageSelectorTarget  : Read / Write

## Signals

      "activate"                                       : Action
      "selection-changed"                              : Run First

## Description

Use this for example for specifying what pages to import from a PDF or PS document.

## Details

### GimpPageSelector

    typedef struct _GimpPageSelector GimpPageSelector;

### enum GimpPageSelectorTarget

    typedef enum {
      GIMP_PAGE_SELECTOR_TARGET_LAYERS, /*< desc="Layers" >*/
      GIMP_PAGE_SELECTOR_TARGET_IMAGES  /*< desc="Images" >*/
    } GimpPageSelectorTarget;

Import targets for GimpPageSelector.

`GIMP_PAGE_SELECTOR_TARGET_LAYERS` | import as layers of one image
`GIMP_PAGE_SELECTOR_TARGET_IMAGES` | import as separate images

### gimp_page_selector_new ()

    GtkWidget *         gimp_page_selector_new              (void);

Creates a new GimpPageSelector widget.

Returns : | Pointer to the new GimpPageSelector widget.

Since GIMP 2.4

### gimp_page_selector_set_n_pages ()

    void                gimp_page_selector_set_n_pages      (GimpPageSelector *selector,
                                                             gint n_pages);

Sets the number of pages in the document to open.

`selector` : | Pointer to a GimpPageSelector.
`n_pages` : | The number of pages.

Since GIMP 2.4

### gimp_page_selector_get_n_pages ()

    gint                gimp_page_selector_get_n_pages      (GimpPageSelector *selector);

`selector` : | Pointer to a GimpPageSelector.
Returns : | the number of pages in the document to open.

Since GIMP 2.4

### gimp_page_selector_set_target ()

    void                gimp_page_selector_set_target       (GimpPageSelector *selector,
                                                             GimpPageSelectorTarget target);

`selector` : | Pointer to a GimpPageSelector.
`target` : | How to open the selected pages.

Since GIMP 2.4

### gimp_page_selector_get_target ()

    GimpPageSelectorTarget gimp_page_selector_get_target    (GimpPageSelector *selector);

`selector` : | Pointer to a GimpPageSelector.
Returns : | How the selected pages should be opened.

Since GIMP 2.4

### gimp_page_selector_set_page_thumbnail ()

    void                gimp_page_selector_set_page_thumbnail
                                                            (GimpPageSelector *selector,
                                                             gint page_no,
                                                             GdkPixbuf *thumbnail);

Sets the thumbnail for given `page_no`. A default "page" icon will be used if no page thumbnail is set.

`selector` : | Pointer to a GimpPageSelector.
`page_no` : | The number of the page to set the thumbnail for.
`thumbnail` : | The thumbnail pixbuf.

Since GIMP 2.4

### gimp_page_selector_get_page_thumbnail ()

    GdkPixbuf *         gimp_page_selector_get_page_thumbnail
                                                            (GimpPageSelector *selector,
                                                             gint page_no);

`selector` : | Pointer to a GimpPageSelector.
`page_no` : | The number of the page to get the thumbnail for.
Returns : | The page's thumbnail, or `NULL` if none is set. The returned pixbuf is owned by GimpPageSelector and must not be unref'ed when no longer needed.

Since GIMP 2.4

### gimp_page_selector_set_page_label ()

    void                gimp_page_selector_set_page_label   (GimpPageSelector *selector,
                                                             gint page_no,
                                                             const gchar *label);

Sets the label of the specified page.

`selector` : | Pointer to a GimpPageSelector.
`page_no` : | The number of the page to set the label for.
`label` : | The label.

Since GIMP 2.4

### gimp_page_selector_get_page_label ()

    gchar *             gimp_page_selector_get_page_label   (GimpPageSelector *selector,
                                                             gint page_no);

`selector` : | Pointer to a GimpPageSelector.
`page_no` : | The number of the page to get the thumbnail for.
Returns : | The page's label, or `NULL` if none is set. This is a newly allocated string that should be `g_free()`'d when no longer needed.

Since GIMP 2.4

### gimp_page_selector_select_all ()

    void                gimp_page_selector_select_all       (GimpPageSelector *selector);

Selects all pages.

`selector` : | Pointer to a GimpPageSelector.

Since GIMP 2.4

### gimp_page_selector_unselect_all ()

    void                gimp_page_selector_unselect_all     (GimpPageSelector *selector);

Unselects all pages.

`selector` : | Pointer to a GimpPageSelector.

Since GIMP 2.4

### gimp_page_selector_select_page ()

    void                gimp_page_selector_select_page      (GimpPageSelector *selector,
                                                             gint page_no);

Adds a page to the selection.

`selector` : | Pointer to a GimpPageSelector.
`page_no` : | The number of the page to select.

Since GIMP 2.4

### gimp_page_selector_unselect_page ()

    void                gimp_page_selector_unselect_page    (GimpPageSelector *selector,
                                                             gint page_no);

Removes a page from the selection.

`selector` : | Pointer to a GimpPageSelector.
`page_no` : | The number of the page to unselect.

Since GIMP 2.4

### gimp_page_selector_page_is_selected ()

    gboolean            gimp_page_selector_page_is_selected (GimpPageSelector *selector,
                                                             gint page_no);

`selector` : | Pointer to a GimpPageSelector.
`page_no` : | The number of the page to check.
Returns : | `TRUE` if the page is selected, `FALSE` otherwise.

Since GIMP 2.4

### gimp_page_selector_get_selected_pages ()

    gint *              gimp_page_selector_get_selected_pages
                                                            (GimpPageSelector *selector,
                                                             gint *n_selected_pages);

`selector` : | Pointer to a GimpPageSelector.
`n_selected_pages` : | Returns the number of selected pages.
Returns : | A sorted array of page numbers of selected pages. Use `g_free()` if you don't need the array any longer.

Since GIMP 2.4

### gimp_page_selector_select_range ()

    void                gimp_page_selector_select_range     (GimpPageSelector *selector,
                                                             const gchar *range);

Selectes the pages described by `range`. The range string is a user-editable list of pages and ranges, e.g. "1,3,5-7,9-12,14". Note that the page numbering in the range string starts with 1, not 0.

Invalid pages and ranges will be silently ignored, duplicate and overlapping pages and ranges will be merged.

`selector` : | Pointer to a GimpPageSelector.
`range` : | A string representing the set of selected pages.

Since GIMP 2.4

### gimp_page_selector_get_selected_range ()

    gchar *             gimp_page_selector_get_selected_range
                                                            (GimpPageSelector *selector);

`selector` : | Pointer to a GimpPageSelector.
Returns : | A newly allocated string representing the set of selected pages. See `gimp_page_selector_select_range()` for the format of the string.

Since GIMP 2.4

## Property Details

### The `"n-pages"` property

      "n-pages"                  gint                  : Read / Write

The number of pages of the document to open.

Allowed values: >= 0

Default value: 0

Since GIMP 2.4

### The `"target"` property

      "target"                   GimpPageSelectorTarget  : Read / Write

The target to open the document to.

Default value: GIMP_PAGE_SELECTOR_TARGET_LAYERS

Since GIMP 2.4

## Signal Details

### The `"activate"` signal

    void                user_function                      (GimpPageSelector *widget,
                                                            gpointer          user_data)      : Action

The "activate" signal on GimpPageSelector is an action signal. It is emitted when a user double-clicks an item in the page selection.

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

Since GIMP 2.4

### The `"selection-changed"` signal

    void                user_function                      (GimpPageSelector *widget,
                                                            gpointer          user_data)      : Run First

This signal is emitted whenever the set of selected pages changes.

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

Since GIMP 2.4