## GimpRuler

GimpRuler — A ruler widget with configurable unit and orientation.

## Synopsis

                        GimpRuler;
    GtkWidget *         gimp_ruler_new                      (GtkOrientation orientation);
    void                gimp_ruler_set_unit                 (GimpRuler *ruler,
                                                             GimpUnit unit);
    GimpUnit            gimp_ruler_get_unit                 (GimpRuler *ruler);
    void                gimp_ruler_set_position             (GimpRuler *ruler,
                                                             gdouble position);
    gdouble             gimp_ruler_get_position             (GimpRuler *ruler);
    void                gimp_ruler_set_range                (GimpRuler *ruler,
                                                             gdouble lower,
                                                             gdouble upper,
                                                             gdouble max_size);
    void                gimp_ruler_get_range                (GimpRuler *ruler,
                                                             gdouble *lower,
                                                             gdouble *upper,
                                                             gdouble *max_size);
    void                gimp_ruler_add_track_widget         (GimpRuler *ruler,
                                                             GtkWidget *widget);
    void                gimp_ruler_remove_track_widget      (GimpRuler *ruler,
                                                             GtkWidget *widget);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GimpRuler

## Implemented Interfaces

GimpRuler implements AtkImplementorIface and GtkBuildable.

## Properties

      "lower"                    gdouble               : Read / Write
      "max-size"                 gdouble               : Read / Write
      "orientation"              GtkOrientation        : Read / Write
      "position"                 gdouble               : Read / Write
      "unit"                     GimpUnit              : Read / Write
      "upper"                    gdouble               : Read / Write

## Style Properties

      "font-scale"               gdouble               : Read

## Description

A ruler widget with configurable unit and orientation.

## Details

### GimpRuler

    typedef struct _GimpRuler GimpRuler;

### gimp_ruler_new ()

    GtkWidget *         gimp_ruler_new                      (GtkOrientation orientation);

Creates a new ruler.

`orientation` : | the ruler's orientation.
Returns : | a new GimpRuler widget.

Since GIMP 2.8

### gimp_ruler_set_unit ()

    void                gimp_ruler_set_unit                 (GimpRuler *ruler,
                                                             GimpUnit unit);

This sets the unit of the ruler.

`ruler` : | a GimpRuler
`unit` : | the GimpUnit to set the ruler to

Since GIMP 2.8

### gimp_ruler_get_unit ()

    GimpUnit            gimp_ruler_get_unit                 (GimpRuler *ruler);

`ruler` : | a GimpRuler
Returns : | the unit currently used in the `ruler` widget.

Since GIMP 2.8

### gimp_ruler_set_position ()

    void                gimp_ruler_set_position             (GimpRuler *ruler,
                                                             gdouble position);

This sets the position of the ruler.

`ruler` : | a GimpRuler
`position` : | the position to set the ruler to

Since GIMP 2.8

### gimp_ruler_get_position ()

    gdouble             gimp_ruler_get_position             (GimpRuler *ruler);

`ruler` : | a GimpRuler
Returns : | the current position of the `ruler` widget.

Since GIMP 2.8

### gimp_ruler_set_range ()

    void                gimp_ruler_set_range                (GimpRuler *ruler,
                                                             gdouble lower,
                                                             gdouble upper,
                                                             gdouble max_size);

This sets the range of the ruler.

`ruler` : | a GimpRuler
`lower` : | the lower limit of the ruler
`upper` : | the upper limit of the ruler
`max_size` : | the maximum size of the ruler used when calculating the space to leave for the text

Since GIMP 2.8

### gimp_ruler_get_range ()

    void                gimp_ruler_get_range                (GimpRuler *ruler,
                                                             gdouble *lower,
                                                             gdouble *upper,
                                                             gdouble *max_size);

Retrieves values indicating the range and current position of a GimpRuler. See `gimp_ruler_set_range()`.

`ruler` : | a GimpRuler
`lower` : | location to store lower limit of the ruler, or `NULL`
`upper` : | location to store upper limit of the ruler, or `NULL`
`max_size` : | location to store the maximum size of the ruler used when calculating the space to leave for the text, or `NULL`.

Since GIMP 2.8

### gimp_ruler_add_track_widget ()

    void                gimp_ruler_add_track_widget         (GimpRuler *ruler,
                                                             GtkWidget *widget);

Adds a "track widget" to the ruler. The ruler will connect to GtkWidget:motion-notify-event: on the track widget and update its position marker accordingly. The marker is correctly updated also for the track widget's children, regardless of whether they are ordinary children of off-screen children.

`ruler` : | a GimpRuler
`widget` : | the track widget to add

Since GIMP 2.8

### gimp_ruler_remove_track_widget ()

    void                gimp_ruler_remove_track_widget      (GimpRuler *ruler,
                                                             GtkWidget *widget);

Removes a previously added track widget from the ruler. See `gimp_ruler_add_track_widget()`.

`ruler` : | a GimpRuler
`widget` : | the track widget to remove

Since GIMP 2.8

## Property Details

### The `"lower"` property

      "lower"                    gdouble               : Read / Write

Lower limit of ruler.

Default value: 0

### The `"max-size"` property

      "max-size"                 gdouble               : Read / Write

Maximum size of the ruler.

Default value: 0

### The `"orientation"` property

      "orientation"              GtkOrientation        : Read / Write

The orientation of the ruler.

Default value: GTK_ORIENTATION_HORIZONTAL

### The `"position"` property

      "position"                 gdouble               : Read / Write

Position of mark on the ruler.

Default value: 0

### The `"unit"` property

      "unit"                     GimpUnit              : Read / Write

Unit of ruler.

Allowed values: [0,65535]

Default value: 0

### The `"upper"` property

      "upper"                    gdouble               : Read / Write

Upper limit of ruler.

Default value: 0

## Style Property Details

### The `"font-scale"` style property

      "font-scale"               gdouble               : Read

Allowed values: >= 0

Default value: 0.833333