GimpRuler

## GimpRuler GimpRuler — A ruler widget with configurable unit and orientation. |

## Functions

GtkWidget * | gimp_ruler_new ()
void | gimp_ruler_set_unit ()
GimpUnit | gimp_ruler_get_unit ()
void | gimp_ruler_set_position ()
gdouble | gimp_ruler_get_position ()
void | gimp_ruler_set_range ()
void | gimp_ruler_get_range ()
void | gimp_ruler_add_track_widget ()
void | gimp_ruler_remove_track_widget ()

## Properties

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

## Style Properties

gdouble | font-scale | Read

## Types and Values

| GimpRuler

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GimpRuler

## Implemented Interfaces

GimpRuler implements AtkImplementorIface and GtkBuildable.

## Description

A ruler widget with configurable unit and orientation.

## Functions

### gimp_ruler_new ()

    GtkWidget *
    gimp_ruler_new (GtkOrientation orientation);

Creates a new ruler.

#### Parameters

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.

#### Parameters

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);

#### Parameters

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.

#### Parameters

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);

#### Parameters

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.

#### Parameters

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()`.

#### Parameters

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.

#### Parameters

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()`.

#### Parameters

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

Since: GIMP 2.8

## Types and Values

### GimpRuler

    typedef struct _GimpRuler GimpRuler;

## Property Details

### The `“lower”` property

      “lower”                    gdouble

Lower limit of ruler.

Flags: Read / Write

Default value: 0

### The `“max-size”` property

      “max-size”                 gdouble

Maximum size of the ruler.

Flags: Read / Write

Default value: 0

### The `“orientation”` property

      “orientation”              GtkOrientation

The orientation of the ruler.

Flags: Read / Write

Default value: GTK_ORIENTATION_HORIZONTAL

### The `“position”` property

      “position”                 gdouble

Position of mark on the ruler.

Flags: Read / Write

Default value: 0

### The `“unit”` property

      “unit”                     GimpUnit

Unit of ruler.

Flags: Read / Write

Allowed values: [0,65535]

Default value: 0

### The `“upper”` property

      “upper”                    gdouble

Upper limit of ruler.

Flags: Read / Write

Default value: 0

## Style Property Details

### The `“font-scale”` style property

      “font-scale”               gdouble

Flags: Read

Allowed values: >= 0

Default value: 0.833333