GimpRuler: GIMP Widgets Library Reference Manual

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

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

## Style Properties

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

## Types and Values

### GimpRuler

    typedef struct _GimpRuler GimpRuler;

## Property Details

### The `“lower”` property

      “lower”                    double

Lower limit of ruler.

Owner: GimpRuler

Flags: Read / Write

Default value: 0

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

      “max-size”                 double

Maximum size of the ruler.

Owner: GimpRuler

Flags: Read / Write

Default value: 0

### The `“orientation”` property

      “orientation”              GtkOrientation

The orientation of the ruler.

Owner: GimpRuler

Flags: Read / Write

Default value: GTK_ORIENTATION_HORIZONTAL

### The `“position”` property

      “position”                 double

Position of mark on the ruler.

Owner: GimpRuler

Flags: Read / Write

Default value: 0

### The `“unit”` property

      “unit”                     GimpUnit

Unit of ruler.

Owner: GimpRuler

Flags: Read / Write

Allowed values: [0,65535]

Default value: 0

### The `“upper”` property

      “upper”                    double

Upper limit of ruler.

Owner: GimpRuler

Flags: Read / Write

Default value: 0

## Style Property Details

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

      “font-scale”               double

The size of the used font.

Owner: GimpRuler

Flags: Read

Allowed values: >= 0

Default value: 0.833333