Gnome User Interface Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GtkDial

## Name

GtkDial -- Analog dial widget for number selection.

## Synopsis

    #include <gnome.h>

    struct      GtkDial;
    GtkWidget*  gtk_dial_new                    (GtkAdjustment *adjustment);
    GtkAdjustment* gtk_dial_get_adjustment      (GtkDial *dial);
    void        gtk_dial_set_update_policy      (GtkDial *dial,
                                                 GtkUpdateType policy);
    void        gtk_dial_set_adjustment         (GtkDial *dial,
                                                 GtkAdjustment *adjustment);
    gfloat      gtk_dial_set_percentage         (GtkDial *dial,
                                                 gfloat percent);
    gfloat      gtk_dial_get_percentage         (GtkDial *dial);
    gfloat      gtk_dial_set_value              (GtkDial *dial,
                                                 gfloat value);
    gfloat      gtk_dial_get_value              (GtkDial *dial);
    void        gtk_dial_set_view_only          (GtkDial *dial,
                                                 gboolean view_only);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GtkDial

## Description

This widget provides an analog dial widget, similar to, for example, a physical volume control on a stereo. Dial values can be changable or read-only for value reporting.

## Details

### struct GtkDial

    struct GtkDial;

### gtk_dial_new ()

    GtkWidget*  gtk_dial_new                    (GtkAdjustment *adjustment);

This function creates a new GtkDial widget, and ties it to a specified GtkAdjustment. When the dial is moved, the adjustment is updated, and vice-versa.

`adjustment` : | Pointer to GtkAdjustment object
Returns : | Pointer to new GtkDial widget.

### gtk_dial_get_adjustment ()

    GtkAdjustment* gtk_dial_get_adjustment      (GtkDial *dial);

Retrieves the GtkAdjustment associated with the GtkDial `dial`.

`dial` : | Pointer to GtkDial widget
Returns : | Pointer to GtkAdjustment object.

### gtk_dial_set_update_policy ()

    void        gtk_dial_set_update_policy      (GtkDial *dial,
                                                 GtkUpdateType policy);

Sets the update policy of the GtkDial `dial` to one of either `GTK_UPDATE_CONTINUOUS`, `GTK_UPDATE_DISCONTINUOUS`, or `GTK_UPDATE_DELAYED`. Please see Gtk+ documentation for an explanation of these values.

`dial` : | Pointer to GtkDial widget
`policy` : | New policy type

### gtk_dial_set_adjustment ()

    void        gtk_dial_set_adjustment         (GtkDial *dial,
                                                 GtkAdjustment *adjustment);

Associates a new GtkAdjustment with GtkDial `dial` widget. The old adjustment is removed and replaced with the new.

`dial` : | Pointer to GtkDial widget
`adjustment` : | Pointer to GtkAdjustment object

### gtk_dial_set_percentage ()

    gfloat      gtk_dial_set_percentage         (GtkDial *dial,
                                                 gfloat percent);

Sets the GtkDial's value to `percent` of `dial`->adjustment->upper. The upper value is set when the GtkAdjustment is created.

`dial` : | Pointer to GtkDial widget
`percent` : | New percentage
Returns : | New value of adjustment.

### gtk_dial_get_percentage ()

    gfloat      gtk_dial_get_percentage         (GtkDial *dial);

Retrieves the current percentage held in the dial widget.

`dial` : | Pointer to GtkDial widget
Returns : | Current percentage.

### gtk_dial_set_value ()

    gfloat      gtk_dial_set_value              (GtkDial *dial,
                                                 gfloat value);

Sets the current value held in the GtkDial's adjustment object to `value`.

`dial` : | Pointer to GtkDial widget
`value` : | New value
Returns : | New percentage of value to the adjustment's upper limit.

### gtk_dial_get_value ()

    gfloat      gtk_dial_get_value              (GtkDial *dial);

Retrieves the current value helt in the dial widget.

`dial` : | Pointer to GtkDial widget
Returns : | Current value

### gtk_dial_set_view_only ()

    void        gtk_dial_set_view_only          (GtkDial *dial,
                                                 gboolean view_only);

Specifies whether or not the user is to be able to edit the value represented by the dial widget. If `view_only` is TRUE, the dial will be set to view-only mode, and the user will not be able to edit it. If `view_only` is FALSE, the user will be able to change the value represented.

`dial` : | Pointer to GtkDial widget
`view_only` : | TRUE to set dial to read-only, FALSE to edit.

## See Also

GnomeNumberEntry

<<< Previous Page | Home | Up | Next Page >>>
GtkTed | GtkPixmapMenuItem