GimpNumberPairEntry

## GimpNumberPairEntry GimpNumberPairEntry — A GtkEntry subclass to enter ratios. |

## Functions

GtkWidget * | gimp_number_pair_entry_new ()
void | gimp_number_pair_entry_set_default_values ()
void | gimp_number_pair_entry_get_default_values ()
void | gimp_number_pair_entry_set_values ()
void | gimp_number_pair_entry_get_values ()
GimpAspectType | gimp_number_pair_entry_get_aspect ()
void | gimp_number_pair_entry_set_aspect ()
gdouble | gimp_number_pair_entry_get_ratio ()
void | gimp_number_pair_entry_set_ratio ()
gboolean | gimp_number_pair_entry_get_user_override ()
void | gimp_number_pair_entry_set_user_override ()
const gchar * | gimp_number_pair_entry_get_default_text ()
void | gimp_number_pair_entry_set_default_text ()

## Properties

gboolean | allow-simplification | Read / Write
GimpAspectType | aspect | Read / Write
gdouble | default-left-number | Read / Write
gdouble | default-right-number | Read / Write
gchar * | default-text | Read / Write
gdouble | left-number | Read / Write
gdouble | max-valid-value | Read / Write
gdouble | min-valid-value | Read / Write
gdouble | ratio | Read / Write
gdouble | right-number | Read / Write
gchar * | separators | Read / Write / Construct Only
gboolean | user-override | Read / Write

## Signals

void | numbers-changed | Run First
void | ratio-changed | Run First

## Types and Values

| GimpNumberPairEntry
enum | GimpAspectType

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GtkEntry
                        ╰── GimpNumberPairEntry

## Implemented Interfaces

GimpNumberPairEntry implements AtkImplementorIface, GtkBuildable, GtkEditable and GtkCellEditable.

## Description

A GtkEntry subclass to enter ratios.

## Functions

### gimp_number_pair_entry_new ()

    GtkWidget *
    gimp_number_pair_entry_new (const gchar *separators,
                                gboolean allow_simplification,
                                gdouble min_valid_value,
                                gdouble max_valid_value);

Creates a new GimpNumberPairEntry widget, which is a GtkEntry that accepts two numbers separated by a separator. Typical input example with a 'x' separator: "377x233".

The widget supports simplification of the entered ratio when the input ends in '=', if "allow-simplification" is TRUE.

The "separators" property contains a string of characters valid as separators when parsing input. The first separator is used when displaying the current values.

It is possible to specify what range of values that shall be considered as valid when parsing user input, by changing "min-valid-value" and "max-valid-value".

The first separator of `separators` is used to display the current value.

#### Parameters

separators | The allowed separators. |
allow_simplification | Whether to do simplification on the entered term. |
min_valid_value | The minimum allowed result value. |
max_valid_value | The maximum allowed result value. |

#### Returns

The new GimpNumberPairEntry widget.

Since: GIMP 2.4

### gimp_number_pair_entry_set_default_values ()

    void
    gimp_number_pair_entry_set_default_values
                                   (GimpNumberPairEntry *entry,
                                    gdouble left,
                                    gdouble right);

#### Parameters

entry | A GimpNumberPairEntry widget. |
left | Default left value in the entry. |
right | Default right value in the entry. |

Since: GIMP 2.4

### gimp_number_pair_entry_get_default_values ()

    void
    gimp_number_pair_entry_get_default_values
                                   (GimpNumberPairEntry *entry,
                                    gdouble *left,
                                    gdouble *right);

#### Parameters

entry | A GimpNumberPairEntry widget. |
left | Pointer of where to put left value. |
right | Pointer of where to put right value. |

Since: GIMP 2.4

### gimp_number_pair_entry_set_values ()

    void
    gimp_number_pair_entry_set_values (GimpNumberPairEntry *entry,
                                       gdouble left,
                                       gdouble right);

Forces setting the numbers displayed by a GimpNumberPairEntry, ignoring if the user has set his/her own value. The state of user-override will not be changed.

#### Parameters

entry | A GimpNumberPairEntry widget. |
left | Left number in the entry. |
right | Right number in the entry. |

Since: GIMP 2.4

### gimp_number_pair_entry_get_values ()

    void
    gimp_number_pair_entry_get_values (GimpNumberPairEntry *entry,
                                       gdouble *left,
                                       gdouble *right);

Gets the numbers displayed by a GimpNumberPairEntry.

#### Parameters

entry | A GimpNumberPairEntry widget. |
left | Pointer of where to store the left number (may be `NULL`). |
right | Pointer of to store the right number (may be `NULL`). |

Since: GIMP 2.4

### gimp_number_pair_entry_get_aspect ()

    GimpAspectType
    gimp_number_pair_entry_get_aspect (GimpNumberPairEntry *entry);

Gets the aspect of the ratio displayed by a GimpNumberPairEntry.

#### Parameters

entry | A GimpNumberPairEntry widget. |

#### Returns

The entry's current aspect.

Since: GIMP 2.4

### gimp_number_pair_entry_set_aspect ()

    void
    gimp_number_pair_entry_set_aspect (GimpNumberPairEntry *entry,
                                       GimpAspectType aspect);

Sets the aspect of the ratio by swapping the left_number and right_number if necessary (or setting them to 1.0 in case that `aspect` is `GIMP_ASPECT_SQUARE`).

#### Parameters

entry | A GimpNumberPairEntry widget. |
aspect | The new aspect. |

Since: GIMP 2.4

### gimp_number_pair_entry_get_ratio ()

    gdouble
    gimp_number_pair_entry_get_ratio (GimpNumberPairEntry *entry);

Retrieves the ratio of the numbers displayed by a GimpNumberPairEntry.

#### Parameters

entry | A GimpNumberPairEntry widget. |

#### Returns

The ratio value.

Since: GIMP 2.4

### gimp_number_pair_entry_set_ratio ()

    void
    gimp_number_pair_entry_set_ratio (GimpNumberPairEntry *entry,
                                      gdouble ratio);

Sets the numbers of the GimpNumberPairEntry to have the desired ratio. If the new ratio is different than the previous ratio, the "ratio-changed" signal is emitted.

An attempt is made to convert the decimal number into a fraction with left_number and right_number < 1000.

#### Parameters

entry | A GimpNumberPairEntry widget. |
ratio | Ratio to set in the widget. |

Since: GIMP 2.4

### gimp_number_pair_entry_get_user_override ()

    gboolean
    gimp_number_pair_entry_get_user_override
                                   (GimpNumberPairEntry *entry);

#### Parameters

entry | A GimpNumberPairEntry widget. |

#### Returns

Wether or not the the widget is in user overridden mode.

Since: GIMP 2.4

### gimp_number_pair_entry_set_user_override ()

    void
    gimp_number_pair_entry_set_user_override
                                   (GimpNumberPairEntry *entry,
                                    gboolean user_override);

When the entry is not in user overridden mode, the values will change when the default values are changed. When in user overridden mode, setting default values will not affect the active values.

#### Parameters

entry | A GimpNumberPairEntry widget. |
user_override | `TRUE` sets the entry in user overridden mode, `FALSE` disables. |

Since: GIMP 2.4

### gimp_number_pair_entry_get_default_text ()

    const gchar *
    gimp_number_pair_entry_get_default_text
                                   (GimpNumberPairEntry *entry);

#### Parameters

entry | A GimpNumberPairEntry widget. |

#### Returns

the string manully set to be shown, or `NULL` if values are shown in a normal fashion.

Since: GIMP 2.4

### gimp_number_pair_entry_set_default_text ()

    void
    gimp_number_pair_entry_set_default_text
                                   (GimpNumberPairEntry *entry,
                                    const gchar *string);

Causes the entry to show a given string when in automatic mode, instead of the default numbers. The only thing this does is making the GimpNumberPairEntry showing this string, the internal state and API calls are not affected.

Set the default string to `NULL` to display default values as normal.

#### Parameters

entry | A GimpNumberPairEntry widget. |
string | Default string. |

Since: GIMP 2.4

## Types and Values

### GimpNumberPairEntry

    typedef struct _GimpNumberPairEntry GimpNumberPairEntry;

### enum GimpAspectType

Aspect ratios.

#### Members

GIMP_ASPECT_SQUARE | it's a 1:1 square |
GIMP_ASPECT_PORTRAIT | it's higher than it's wide |
GIMP_ASPECT_LANDSCAPE | it's wider than it's high |

## Property Details

### The `“allow-simplification”` property

      “allow-simplification”     gboolean

Whether to allow simplification.

Flags: Read / Write

Default value: FALSE

### The `“aspect”` property

      “aspect”                   GimpAspectType

Flags: Read / Write

Default value: GIMP_ASPECT_SQUARE

### The `“default-left-number”` property

      “default-left-number”      gdouble

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 100

### The `“default-right-number”` property

      “default-right-number”     gdouble

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 100

### The `“default-text”` property

      “default-text”             gchar *

String to show when in automatic mode.

Flags: Read / Write

Default value: NULL

### The `“left-number”` property

      “left-number”              gdouble

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 100

### The `“max-valid-value”` property

      “max-valid-value”          gdouble

Maximum value valid when parsing input.

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 1.79769e+308

### The `“min-valid-value”` property

      “min-valid-value”          gdouble

Minimum value valid when parsing input.

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 2.22507e-308

### The `“ratio”` property

      “ratio”                    gdouble

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 1

### The `“right-number”` property

      “right-number”             gdouble

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 100

### The `“separators”` property

      “separators”               gchar *

A string of valid separators.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“user-override”` property

      “user-override”            gboolean

Whether the widget is in 'user override' mode.

Flags: Read / Write

Default value: FALSE

## Signal Details

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

    void
    user_function (GimpNumberPairEntry *gimpnumberpairentry,
                   gpointer             user_data)

Flags: Run First

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

    void
    user_function (GimpNumberPairEntry *gimpnumberpairentry,
                   gpointer             user_data)

Flags: Run First