GimpPageSelector: GIMP Widgets Library Reference Manual

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

## Functions

GtkWidget * | gimp_page_selector_new ()
void | gimp_page_selector_set_n_pages ()
gint | gimp_page_selector_get_n_pages ()
void | gimp_page_selector_set_target ()
GimpPageSelectorTarget | gimp_page_selector_get_target ()
void | gimp_page_selector_set_page_thumbnail ()
GdkPixbuf * | gimp_page_selector_get_page_thumbnail ()
void | gimp_page_selector_set_page_label ()
gchar * | gimp_page_selector_get_page_label ()
void | gimp_page_selector_select_all ()
void | gimp_page_selector_unselect_all ()
void | gimp_page_selector_select_page ()
void | gimp_page_selector_unselect_page ()
gboolean | gimp_page_selector_page_is_selected ()
gint * | gimp_page_selector_get_selected_pages ()
void | gimp_page_selector_select_range ()
gchar * | gimp_page_selector_get_selected_range ()

## Properties

gint | n-pages | Read / Write
GimpPageSelectorTarget | target | Read / Write

## Signals

void | activate | Action
void | selection-changed | Run First

## Types and Values

| GimpPageSelector
enum | GimpPageSelectorTarget

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GtkContainer
                        ╰── GtkBox
                            ╰── GimpPageSelector

## Implemented Interfaces

GimpPageSelector implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Description

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

## Functions

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

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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.

#### Parameters

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);

#### Parameters

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.

#### Parameters

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);

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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);

#### Parameters

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);

#### Parameters

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.

#### Parameters

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);

#### Parameters

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

## Types and Values

### GimpPageSelector

    typedef struct _GimpPageSelector GimpPageSelector;

### enum GimpPageSelectorTarget

Import targets for GimpPageSelector.

#### Members

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

## Property Details

### The `“n-pages”` property

      “n-pages”                  gint

The number of pages of the document to open.

Flags: Read / Write

Allowed values: >= 0

Default value: 0

Since: GIMP 2.4

### The `“target”` property

      “target”                   GimpPageSelectorTarget

The target to open the document to.

Flags: Read / Write

Default value: GIMP_PAGE_SELECTOR_TARGET_LAYERS

Since: GIMP 2.4

## Signal Details

### The `“activate”` signal

    void
    user_function (GimpPageSelector *widget,
                   gpointer          user_data)

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

#### Parameters

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

Flags: Action

Since: GIMP 2.4

### The `“selection-changed”` signal

    void
    user_function (GimpPageSelector *widget,
                   gpointer          user_data)

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

#### Parameters

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

Flags: Run First

Since: GIMP 2.4