## GwyRuler GwyRuler — Base class for GwyHRuler and GwyVRuler |

## Functions

void | gwy_ruler_set_range ()
void | gwy_ruler_draw_pos ()
void | gwy_ruler_get_range ()
void | gwy_ruler_set_si_unit ()
GwySIUnit * | gwy_ruler_get_si_unit ()
GwyUnitsPlacement | gwy_ruler_get_units_placement ()
void | gwy_ruler_set_units_placement ()

## Properties

double | lower | Read / Write
double | max-size | Read / Write
double | position | Read / Write
GwyUnitsPlacement | units-placement | Read / Write
double | upper | Read / Write

## Types and Values

struct | GwyRuler
struct | GwyRulerClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GwyRuler
                        ├── GwyHRuler
                        ╰── GwyVRuler

## Implemented Interfaces

GwyRuler implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <libgwydgets/gwydgets.h>

## Description

GwyRuler is a ruler similar to GtkRuler, but it is more suited for a scientific application. It is scale-independent and thus has no arbitrary limits on the ranges or interpretation of displayed values. It can display units on the ruler (this can be controlled with `gwy_ruler_set_units_placement()`) and cooperates with GwySIUnit (see `gwy_ruler_set_si_unit()`). It also better follows Gtk+ theme than GtkRuler.

## Functions

### gwy_ruler_set_range ()

    void
    gwy_ruler_set_range (GwyRuler *ruler,
                         gdouble lower,
                         gdouble upper,
                         gdouble position,
                         gdouble max_size);

Sets range and current value of a ruler.

#### Parameters

ruler | A GwyRuler |
lower | Lower limit of the ruler. |
upper | Upper limit of the ruler. |
position | Current position of the mark on the ruler. |
max_size | Maximum value used for calculating size of text labels. |

### gwy_ruler_draw_pos ()

    void
    gwy_ruler_draw_pos (GwyRuler *ruler);

Draws a position marker.

This method is intended primarily for subclass implementation.

#### Parameters

ruler | A GwyRuler. |

### gwy_ruler_get_range ()

    void
    gwy_ruler_get_range (GwyRuler *ruler,
                         gdouble *lower,
                         gdouble *upper,
                         gdouble *position,
                         gdouble *max_size);

Retrieves values indicating the range and current position of a GwyRuler. See `gwy_ruler_set_range()`.

#### Parameters

ruler | A GwyRuler |
lower | Location to store lower limit of the ruler, or `NULL` |
upper | Location to store upper limit of the ruler, or `NULL` |
position | Location to store the current position of the mark on 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`. |

### gwy_ruler_set_si_unit ()

    void
    gwy_ruler_set_si_unit (GwyRuler *ruler,
                           GwySIUnit *units);

Sets the base units a ruler displays.

Setting units to `NULL` effectively disables them.

#### Parameters

ruler | A GwyRuler. |
units | The base units this ruler should display. |

### gwy_ruler_get_si_unit ()

    GwySIUnit *
    gwy_ruler_get_si_unit (GwyRuler *ruler);

Returns the base units a ruler uses.

#### Parameters

ruler | A GwyRuler. |

#### Returns

The units the rules uses.

### gwy_ruler_get_units_placement ()

    GwyUnitsPlacement
    gwy_ruler_get_units_placement (GwyRuler *ruler);

Gets current units placement of ruler `ruler` .

#### Parameters

ruler | A GwyRuler |

#### Returns

The units placement.

### gwy_ruler_set_units_placement ()

    void
    gwy_ruler_set_units_placement (GwyRuler *ruler,
                                   GwyUnitsPlacement placement);

Sets whether and where units should be placed on the ruler.

#### Parameters

ruler | A GwyRuler |
placement | Units placement specification. |

## Types and Values

### struct GwyRuler

    struct GwyRuler;

### struct GwyRulerClass

    struct GwyRulerClass {
        GtkWidgetClass parent_class;

        /* Virtual methods */
        void (*prepare_sizes) (GwyRuler *ruler);
        void (*draw_frame) (GwyRuler *ruler);
        void (*draw_layout) (GwyRuler *ruler,
                             gint hpos,
                             gint vpos);
        void (*draw_tick) (GwyRuler *ruler,
                           gint pos,
                           gint length);
        void (*draw_pos)   (GwyRuler *ruler);

        void (*reserved1)(void);
        void (*reserved2)(void);
    };

## Property Details

### The `“lower”` property

      “lower”                    double

Lower limit of ruler.

Owner: GwyRuler

Flags: Read / Write

Default value: 0

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

      “max-size”                 double

Maximum size of the ruler.

Owner: GwyRuler

Flags: Read / Write

Default value: 0

### The `“position”` property

      “position”                 double

Position of mark on the ruler.

Owner: GwyRuler

Flags: Read / Write

Default value: 0

### The `“units-placement”` property

      “units-placement”          GwyUnitsPlacement

The placement of units on the ruler, if any.

Owner: GwyRuler

Flags: Read / Write

Default value: GWY_UNITS_PLACEMENT_NONE

### The `“upper”` property

      “upper”                    double

Upper limit of ruler.

Owner: GwyRuler

Flags: Read / Write

Default value: 0