GimpNumberPairEntry

GimpNumberPairEntry — A GtkEntry subclass to enter ratios.

Functions

Properties

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

Signals

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

Types and Values

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

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

Since: 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: 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 manually set to be shown, or NULL if values are shown in a normal fashion.

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

Owner: GimpNumberPairEntry

Flags: Read / Write

Default value: FALSE


The “aspect” property

  “aspect”                   GimpAspectType

The value as aspect.

Owner: GimpNumberPairEntry

Flags: Read / Write

Default value: GIMP_ASPECT_SQUARE


The “default-left-number” property

  “default-left-number”      double

The default left number.

Owner: GimpNumberPairEntry

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 100


The “default-right-number” property

  “default-right-number”     double

The default right number.

Owner: GimpNumberPairEntry

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 100


The “default-text” property

  “default-text”             char *

String to show when in automatic mode.

Owner: GimpNumberPairEntry

Flags: Read / Write

Default value: NULL


The “left-number” property

  “left-number”              double

The left number.

Owner: GimpNumberPairEntry

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 100


The “max-valid-value” property

  “max-valid-value”          double

Maximum value valid when parsing input.

Owner: GimpNumberPairEntry

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 1.79769e+308


The “min-valid-value” property

  “min-valid-value”          double

Minimum value valid when parsing input.

Owner: GimpNumberPairEntry

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 2.22507e-308


The “ratio” property

  “ratio”                    double

The value as ratio.

Owner: GimpNumberPairEntry

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 1


The “right-number” property

  “right-number”             double

The right number.

Owner: GimpNumberPairEntry

Flags: Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 100


The “separators” property

  “separators”               char *

A string of valid separators.

Owner: GimpNumberPairEntry

Flags: Read / Write / Construct Only

Default value: NULL


The “user-override” property

  “user-override”            gboolean

Whether the widget is in 'user override' mode.

Owner: GimpNumberPairEntry

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