GTK+ Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GtkRuler

## Name

GtkRuler -- Base class for horizontal or vertical rulers

## Synopsis

    #include <gtk/gtk.h>

    struct      GtkRuler;
    struct      GtkRulerMetric;
    void        gtk_ruler_set_metric            (GtkRuler *ruler,
                                                 GtkMetricType metric);
    void        gtk_ruler_set_range             (GtkRuler *ruler,
                                                 gfloat lower,
                                                 gfloat upper,
                                                 gfloat position,
                                                 gfloat max_size);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GtkRuler

## Description

The GTKRuler widget is a base class for horizontal and vertical rulers. Rulers are used to show the mouse pointer's location in a window. The ruler can either be horizontal or vertical on the window. Within the ruler a small triangle indicates the location of the mouse relative to the horixontal or vertical ruler. See GtkHRuler to learn how to create a new horizontal ruler. See GtkVRuler to learn how to create a new vertical ruler.

## Details

### struct GtkRuler

    struct GtkRuler;

All distances are in 1/72nd's of an inch. (According to Adobe thats a point, but points are really 1/72.27 in.)

### struct GtkRulerMetric

    struct GtkRulerMetric
    {
      gchar *metric_name;
      gchar *abbrev;
      /* This should be points_per_unit. This is the size of the unit
       * in 1/72nd's of an inch and has nothing to do with screen pixels */
      gfloat pixels_per_unit;
      gfloat ruler_scale[10];
      gint subdivide[5];        /* five possible modes of subdivision */
    };

This should be points_per_unit. This is the size of the unit in 1/72nd's of an inch and has nothing to do with screen pixels.

### gtk_ruler_set_metric ()

    void        gtk_ruler_set_metric            (GtkRuler *ruler,
                                                 GtkMetricType metric);

This calls the GTKMetricType to set the ruler to units defined. Available units are GTK_PIXELS, GTK_INCHES, or GTK_CENTIMETERS. The default unit of measurement is GTK_PIXELS.

`ruler` : | the gtkruler
`metric` : | the unit of measurement

### gtk_ruler_set_range ()

    void        gtk_ruler_set_range             (GtkRuler *ruler,
                                                 gfloat lower,
                                                 gfloat upper,
                                                 gfloat position,
                                                 gfloat max_size);

This sets the range of the ruler using gfloat lower, gfloat upper, gfloat position, and gfloat max_size.

`ruler` : | the gtkruler
`lower` : | the upper limit of the ruler
`upper` : | the lower limit of the ruler
`position` : | the mark on the ruler
`max_size` : | the maximum size of the ruler

## See Also

GtkHRuler, GtkVRuler

<<< Previous Page | Home | Up | Next Page >>>
GtkRange | GtkScale