GimpQueryBox: GIMP Widgets Library Reference Manual

## GimpQueryBox GimpQueryBox — Some simple dialogs to enter a single int, double, string or boolean value. |

## Functions

void | (*GimpQueryStringCallback) ()
void | (*GimpQueryIntCallback) ()
void | (*GimpQueryDoubleCallback) ()
void | (*GimpQuerySizeCallback) ()
void | (*GimpQueryBooleanCallback) ()
GtkWidget * | gimp_query_string_box ()
GtkWidget * | gimp_query_int_box ()
GtkWidget * | gimp_query_double_box ()
GtkWidget * | gimp_query_size_box ()
GtkWidget * | gimp_query_boolean_box ()
#define | GIMP_QUERY_BOX_VBOX()

## Description

These functions provide simple dialogs for entering a single string, integer, double, boolean or pixel size value.

They return a pointer to a GtkDialog which has to be shown with `gtk_widget_show()` by the caller.

The dialogs contain an entry widget for the kind of value they ask for and "OK" and "Cancel" buttons. On "Cancel", all query boxes except the boolean one silently destroy themselves. On "OK" the user defined callback function is called and returns the entered value.

## Functions

### GimpQueryStringCallback ()

    void
    (*GimpQueryStringCallback) (GtkWidget *query_box,
                                const gchar *string,
                                gpointer data);

Note that you must not `g_free()` the passed string.

#### Parameters

query_box | The query box. |
string | The entered string. |
data | The user data. |

### GimpQueryIntCallback ()

    void
    (*GimpQueryIntCallback) (GtkWidget *query_box,
                             gint value,
                             gpointer data);

The callback for an int query box.

#### Parameters

query_box | The query box. |
value | The entered integer value. |
data | The user data. |

### GimpQueryDoubleCallback ()

    void
    (*GimpQueryDoubleCallback) (GtkWidget *query_box,
                                gdouble value,
                                gpointer data);

The callback for a double query box.

#### Parameters

query_box | The query box. |
value | The entered double value. |
data | The user data. |

### GimpQuerySizeCallback ()

    void
    (*GimpQuerySizeCallback) (GtkWidget *query_box,
                              gdouble size,
                              GimpUnit unit,
                              gpointer data);

The callback for a size query box.

#### Parameters

query_box | The query box. |
size | The entered size in pixels. |
unit | The selected unit from the GimpUnitMenu. |
data | The user data. |

### GimpQueryBooleanCallback ()

    void
    (*GimpQueryBooleanCallback) (GtkWidget *query_box,
                                 gboolean value,
                                 gpointer data);

The callback for a boolean query box.

#### Parameters

query_box | The query box. |
value | The entered boolean value. |
data | The user data. |

### gimp_query_string_box ()

    GtkWidget *
    gimp_query_string_box (const gchar *title,
                           GtkWidget *parent,
                           GimpHelpFunc help_func,
                           const gchar *help_id,
                           const gchar *message,
                           const gchar *initial,
                           GObject *object,
                           const gchar *signal,
                           GimpQueryStringCallback callback,
                           gpointer data);

Creates a new GtkDialog that queries the user for a string value.

#### Parameters

title | The query box dialog's title. |
parent | The dialog's parent widget. |
help_func | The help function to show this dialog's help page. |
help_id | A string identifying this dialog's help page. |
message | A string which will be shown above the dialog's entry widget. |
initial | The initial value. |
object | The object this query box is associated with. |
signal | The object's signal which will cause the query box to be closed. |
callback | The function which will be called when the user selects "OK". |
data | The callback's user data. |

#### Returns

A pointer to the new GtkDialog.

### gimp_query_int_box ()

    GtkWidget *
    gimp_query_int_box (const gchar *title,
                        GtkWidget *parent,
                        GimpHelpFunc help_func,
                        const gchar *help_id,
                        const gchar *message,
                        gint initial,
                        gint lower,
                        gint upper,
                        GObject *object,
                        const gchar *signal,
                        GimpQueryIntCallback callback,
                        gpointer data);

Creates a new GtkDialog that queries the user for an integer value.

#### Parameters

title | The query box dialog's title. |
parent | The dialog's parent widget. |
help_func | The help function to show this dialog's help page. |
help_id | A string identifying this dialog's help page. |
message | A string which will be shown above the dialog's entry widget. |
initial | The initial value. |
lower | The lower boundary of the range of possible values. |
upper | The upper boundray of the range of possible values. |
object | The object this query box is associated with. |
signal | The object's signal which will cause the query box to be closed. |
callback | The function which will be called when the user selects "OK". |
data | The callback's user data. |

#### Returns

A pointer to the new GtkDialog.

### gimp_query_double_box ()

    GtkWidget *
    gimp_query_double_box (const gchar *title,
                           GtkWidget *parent,
                           GimpHelpFunc help_func,
                           const gchar *help_id,
                           const gchar *message,
                           gdouble initial,
                           gdouble lower,
                           gdouble upper,
                           gint digits,
                           GObject *object,
                           const gchar *signal,
                           GimpQueryDoubleCallback callback,
                           gpointer data);

Creates a new GtkDialog that queries the user for a double value.

#### Parameters

title | The query box dialog's title. |
parent | The dialog's parent widget. |
help_func | The help function to show this dialog's help page. |
help_id | A string identifying this dialog's help page. |
message | A string which will be shown above the dialog's entry widget. |
initial | The initial value. |
lower | The lower boundary of the range of possible values. |
upper | The upper boundray of the range of possible values. |
digits | The number of decimal digits the GtkSpinButton will provide. |
object | The object this query box is associated with. |
signal | The object's signal which will cause the query box to be closed. |
callback | The function which will be called when the user selects "OK". |
data | The callback's user data. |

#### Returns

A pointer to the new GtkDialog.

### gimp_query_size_box ()

    GtkWidget *
    gimp_query_size_box (const gchar *title,
                         GtkWidget *parent,
                         GimpHelpFunc help_func,
                         const gchar *help_id,
                         const gchar *message,
                         gdouble initial,
                         gdouble lower,
                         gdouble upper,
                         gint digits,
                         GimpUnit unit,
                         gdouble resolution,
                         gboolean dot_for_dot,
                         GObject *object,
                         const gchar *signal,
                         GimpQuerySizeCallback callback,
                         gpointer data);

Creates a new GtkDialog that queries the user for a size using a GimpSizeEntry.

#### Parameters

title | The query box dialog's title. |
parent | The dialog's parent widget. |
help_func | The help function to show this dialog's help page. |
help_id | A string identifying this dialog's help page. |
message | A string which will be shown above the dialog's entry widget. |
initial | The initial value. |
lower | The lower boundary of the range of possible values. |
upper | The upper boundray of the range of possible values. |
digits | The number of decimal digits the GimpSizeEntry provide in "pixel" mode. |
unit | The unit initially shown by the GimpUnitMenu. |
resolution | The resolution (in dpi) which will be used for pixel/unit calculations. |
dot_for_dot | `TRUE` if the GimpUnitMenu's initial unit should be "pixels". |
object | The object this query box is associated with. |
signal | The object's signal which will cause the query box to be closed. |
callback | The function which will be called when the user selects "OK". |
data | The callback's user data. |

#### Returns

A pointer to the new GtkDialog.

### gimp_query_boolean_box ()

    GtkWidget *
    gimp_query_boolean_box (const gchar *title,
                            GtkWidget *parent,
                            GimpHelpFunc help_func,
                            const gchar *help_id,
                            const gchar *icon_name,
                            const gchar *message,
                            const gchar *true_button,
                            const gchar *false_button,
                            GObject *object,
                            const gchar *signal,
                            GimpQueryBooleanCallback callback,
                            gpointer data);

Creates a new GtkDialog that asks the user to do a boolean decision.

#### Parameters

title | The query box dialog's title. |
parent | The dialog's parent widget. |
help_func | The help function to show this dialog's help page. |
help_id | A string identifying this dialog's help page. |
icon_name | An icon name to specify an icon to appear on the left on the dialog's message. |
message | A string which will be shown in the query box. |
true_button | The string to be shown in the dialog's left button. |
false_button | The string to be shown in the dialog's right button. |
object | The object this query box is associated with. |
signal | The object's signal which will cause the query box to be closed. |
callback | The function which will be called when the user clicks one of the buttons. |
data | The callback's user data. |

#### Returns

A pointer to the new GtkDialog.

### GIMP_QUERY_BOX_VBOX()

    #define             GIMP_QUERY_BOX_VBOX(qbox)

A macro to access the GtkVBox in a libgimpwidgets-gimpquerybox. Useful if you want to add more widgets.

#### Parameters

qbox | The query box. |

## See Also

GimpSizeEntry, GimpUnitMenu