GimpRatioEntry

GimpRatioEntry

Synopsis




                    GimpRatioEntry;
enum                GimpAspectType;
GtkWidget*          gimp_ratio_entry_new                (void);
void                gimp_ratio_entry_set_fraction       (GimpRatioEntry *entry,
                                                         gdouble numerator,
                                                         gdouble denominator);
void                gimp_ratio_entry_get_fraction       (GimpRatioEntry *entry,
                                                         gdouble *numerator,
                                                         gdouble *denominator);
void                gimp_ratio_entry_set_ratio          (GimpRatioEntry *entry,
                                                         gdouble ratio);
gdouble             gimp_ratio_entry_get_ratio          (GimpRatioEntry *entry);
void                gimp_ratio_entry_set_aspect         (GimpRatioEntry *entry,
                                                         GimpAspectType aspect);
GimpAspectType      gimp_ratio_entry_get_aspect         (GimpRatioEntry *entry);

Object Hierarchy


  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkEntry
                           +----GimpRatioEntry

Implemented Interfaces

GimpRatioEntry implements AtkImplementorIface, GtkEditable and GtkCellEditable.

Properties


  "aspect"                   GimpAspectType        : Read / Write
  "denominator"              gdouble               : Read / Write
  "numerator"                gdouble               : Read / Write
  "ratio"                    gdouble               : Read / Write

Signals


  "ratio-changed"                                  : Run First

Description

Details

GimpRatioEntry

typedef struct _GimpRatioEntry GimpRatioEntry;


enum GimpAspectType

typedef enum
{
  GIMP_ASPECT_SQUARE,    /*< desc="Square"    >*/
  GIMP_ASPECT_PORTRAIT,  /*< desc="Portrait"  >*/
  GIMP_ASPECT_LANDSCAPE  /*< desc="Landscape" >*/
} GimpAspectType;


gimp_ratio_entry_new ()

GtkWidget*          gimp_ratio_entry_new                (void);

Returns : a new GimpRatioEntry widget

Since GIMP 2.4


gimp_ratio_entry_set_fraction ()

void                gimp_ratio_entry_set_fraction       (GimpRatioEntry *entry,
                                                         gdouble numerator,
                                                         gdouble denominator);

Sets the fraction displayed by a GimpRatioEntry. If the resulting ratio is different to the previously set ratio, the "ratio-changed" signal is emitted.

If the denominator is zero, the GimpRatioEntry will silently convert it to 1.0.

entry : a GimpRatioEntry widget
numerator : numerator of the fraction to set in the widget
denominator : denominator of the fraction to set in the widget

Since GIMP 2.4


gimp_ratio_entry_get_fraction ()

void                gimp_ratio_entry_get_fraction       (GimpRatioEntry *entry,
                                                         gdouble *numerator,
                                                         gdouble *denominator);

Gets the fraction displayed by a GimpRatioEntry.

The denominator may be zero if the GimpRatioEntry shows just a single value. You can use gimp_ratio_entry_get_ratio to retrieve the ratio as a single decimal value.

entry : a GimpRatioEntry widget
numerator : pointer to store the numerator of the fraction
denominator : pointer to store the denominator of the fraction

Since GIMP 2.4


gimp_ratio_entry_set_ratio ()

void                gimp_ratio_entry_set_ratio          (GimpRatioEntry *entry,
                                                         gdouble ratio);

Sets the ratio displayed by a GimpRatioEntry. 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 numerator and denominator < 1000.

entry : a GimpRatioEntry widget
ratio : ratio to set in the widget

Since GIMP 2.4


gimp_ratio_entry_get_ratio ()

gdouble             gimp_ratio_entry_get_ratio          (GimpRatioEntry *entry);

Retrieves the ratio value displayed by a GimpRatioEntry.

entry : a GimpRatioEntry widget
Returns : The ratio value.

Since GIMP 2.4


gimp_ratio_entry_set_aspect ()

void                gimp_ratio_entry_set_aspect         (GimpRatioEntry *entry,
                                                         GimpAspectType aspect);

Sets the aspect of the ratio by swapping the numerator and denominator (or setting them to 1.0 in case that aspect is GIMP_ASPECT_SQUARE).

entry : a GimpRatioEntry widget
aspect : the new aspect

Since GIMP 2.4


gimp_ratio_entry_get_aspect ()

GimpAspectType      gimp_ratio_entry_get_aspect         (GimpRatioEntry *entry);

Gets the aspect of the ratio displayed by a GimpRatioEntry.

entry : a GimpRatioEntry widget
Returns : The entry's current aspect.

Since GIMP 2.4

Property Details

The "aspect" property

  "aspect"                   GimpAspectType        : Read / Write

Default value: GIMP_ASPECT_SQUARE


The "denominator" property

  "denominator"              gdouble               : Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 1


The "numerator" property

  "numerator"                gdouble               : Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 1


The "ratio" property

  "ratio"                    gdouble               : Read / Write

Allowed values: >= G_MINDOUBLE

Default value: 1

Signal Details

The "ratio-changed" signal

void                user_function                      (GimpRatioEntry *gimpratioentry,
                                                        gpointer        user_data)           : Run First

gimpratioentry : the object which received the signal.
user_data : user data set when the signal handler was connected.