GwyAxis

GwyAxis — Widget for drawing axis

Synopsis




            GwyAxisActiveAreaSpecs;
            GwyAxisTick;
            GwyAxisLabeledTick;
            GwyAxisParams;
            GwyAxis;
            GwyAxisClass;
GtkWidget*  gwy_axis_new                    (gint orientation,
                                             gdouble min,
                                             gdouble max,
                                             const gchar *label);
void        gwy_axis_set_logarithmic        (GwyAxis *axis,
                                             gboolean is_logarithmic);
void        gwy_axis_set_visible            (GwyAxis *axis,
                                             gboolean is_visible);
void        gwy_axis_set_auto               (GwyAxis *axis,
                                             gboolean is_auto);
void        gwy_axis_set_req                (GwyAxis *axis,
                                             gdouble min,
                                             gdouble max);
void        gwy_axis_set_style              (GwyAxis *axis,
                                             GwyAxisParams style);
gdouble     gwy_axis_get_maximum            (GwyAxis *axis);
gdouble     gwy_axis_get_minimum            (GwyAxis *axis);
gdouble     gwy_axis_get_reqmaximum         (GwyAxis *axis);
gdouble     gwy_axis_get_reqminimum         (GwyAxis *axis);
gdouble     gwy_axis_get_magnification      (GwyAxis *axis);
GString*    gwy_axis_get_magnification_string
                                            (GwyAxis *axis);
void        gwy_axis_set_label              (GwyAxis *axis,
                                             GString *label_text);
GString*    gwy_axis_get_label              (GwyAxis *axis);
void        gwy_axis_set_unit               (GwyAxis *axis,
                                             GwySIUnit *unit);
void        gwy_axis_enable_label_edit      (GwyAxis *axis,
                                             gboolean enable);
void        gwy_axis_signal_rescaled        (GwyAxis *axis);
void        gwy_axis_draw_on_drawable       (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             gint xmin,
                                             gint ymin,
                                             gint width,
                                             gint height,
                                             GwyAxis *axis);
GString*    gwy_axis_export_vector          (GwyAxis *axis,
                                             gint xmin,
                                             gint ymin,
                                             gint width,
                                             gint height,
                                             gint fontsize);
void        gwy_axis_set_grid_data          (GwyAxis *axis,
                                             GArray *array);

Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GwyAxis

Implemented Interfaces

GwyAxis implements AtkImplementorIface.

Signal Prototypes


"label-updated"
            void        user_function      (GwyAxis *gwyaxis,
                                            gpointer user_data);
"rescaled"  void        user_function      (GwyAxis *gwyaxis,
                                            gpointer user_data);

Description

This widget is used for drawing axis. It is namely used within GwyGraph widget, byt it can be also used separately. It plots a horizontal or vertical axis with amjor and minor ticks, with ranges in the requested interval.

Details

GwyAxisActiveAreaSpecs

typedef struct {
    gint xmin;         /*x offset of the active area with respect to drawable left border*/
    gint ymin;         /*y offset of the active area with respect to drawable top border*/
    gint height;       /*active area height*/
    gint width;        /*active area width*/
} GwyAxisActiveAreaSpecs;


GwyAxisTick

typedef struct {
    gdouble value;      /*tick value*/
    gint scrpos;        /*precomputed tick screen position*/
} GwyAxisTick;


GwyAxisLabeledTick

typedef struct {
    GwyAxisTick t;
    GString *ttext;
} GwyAxisLabeledTick;


GwyAxisParams

typedef struct {
    gint major_length;
    gint major_thickness;
    gint major_maxticks;
    GwyAxisScaleFormat major_printmode;

    gint minor_length;
    gint minor_thickness;
    gint minor_division;          /*minor division*/

    gint line_thickness;

    PangoFontDescription *major_font;
    PangoFontDescription *label_font;
} GwyAxisParams;


GwyAxis

typedef struct _GwyAxis GwyAxis;


GwyAxisClass

typedef struct {
    GtkWidgetClass parent_class;

    void (*label_updated)(GwyAxis *axis);
    void (*rescaled)(GwyAxis *axis);
        
    gpointer reserved1;
    gpointer reserved2;
} GwyAxisClass;


gwy_axis_new ()

GtkWidget*  gwy_axis_new                    (gint orientation,
                                             gdouble min,
                                             gdouble max,
                                             const gchar *label);

Creates new axis.

orientation : axis orientation
min : minimum value
max : maximum value
label : axis label
Returns : new axis

gwy_axis_set_logarithmic ()

void        gwy_axis_set_logarithmic        (GwyAxis *axis,
                                             gboolean is_logarithmic);

Sets logarithmic mode. Untested.

axis : axis
is_logarithmic : logarithimc mode

gwy_axis_set_visible ()

void        gwy_axis_set_visible            (GwyAxis *axis,
                                             gboolean is_visible);

Sets visibility of axis.

axis : axis widget
is_visible : visibility

gwy_axis_set_auto ()

void        gwy_axis_set_auto               (GwyAxis *axis,
                                             gboolean is_auto);

Sets the auto property. If TRUE, axis changes fonts and ticks sizes to produce reasonable output at different widget sizes.

axis : axis widget
is_auto : auto preperty

gwy_axis_set_req ()

void        gwy_axis_set_req                (GwyAxis *axis,
                                             gdouble min,
                                             gdouble max);

Set requisition of axis boundaries. Axis will fix the boundaries to satisfy requisition but still have reasonable tick values and spacing.

axis : axis widget
min : minimum requisistion
max : maximum requisition

gwy_axis_set_style ()

void        gwy_axis_set_style              (GwyAxis *axis,
                                             GwyAxisParams style);

Set axis style. The style affects used tick sizes, fonts etc.

axis : axis widget
style : axis style

gwy_axis_get_maximum ()

gdouble     gwy_axis_get_maximum            (GwyAxis *axis);

axis : axis widget
Returns : real maximum of axis

gwy_axis_get_minimum ()

gdouble     gwy_axis_get_minimum            (GwyAxis *axis);

axis : axis widget
Returns : real minimum of axis

gwy_axis_get_reqmaximum ()

gdouble     gwy_axis_get_reqmaximum         (GwyAxis *axis);

axis : axis widget
Returns : axis requisition maximum

gwy_axis_get_reqminimum ()

gdouble     gwy_axis_get_reqminimum         (GwyAxis *axis);

axis : axis widget
Returns : axis requisition minimum

gwy_axis_get_magnification ()

gdouble     gwy_axis_get_magnification      (GwyAxis *axis);

axis :
Returns :

gwy_axis_get_magnification_string ()

GString*    gwy_axis_get_magnification_string
                                            (GwyAxis *axis);

axis :
Returns :

gwy_axis_set_label ()

void        gwy_axis_set_label              (GwyAxis *axis,
                                             GString *label_text);

sets the label text

axis : axis widget
label_text : label to be set

gwy_axis_get_label ()

GString*    gwy_axis_get_label              (GwyAxis *axis);

axis : axis widget
Returns : axis label string

gwy_axis_set_unit ()

void        gwy_axis_set_unit               (GwyAxis *axis,
                                             GwySIUnit *unit);

Sets the axis unit. This will be added automatically to the label.

axis : axis widget
unit : axis unit

gwy_axis_enable_label_edit ()

void        gwy_axis_enable_label_edit      (GwyAxis *axis,
                                             gboolean enable);

Enables/disables user to change axis label by clicking on axis widget.

axis : Axis widget
enable : enable/disable user to change axis label

Since 1.3.


gwy_axis_signal_rescaled ()

void        gwy_axis_signal_rescaled        (GwyAxis *axis);

axis :

gwy_axis_draw_on_drawable ()

void        gwy_axis_draw_on_drawable       (GdkDrawable *drawable,
                                             GdkGC *gc,
                                             gint xmin,
                                             gint ymin,
                                             gint width,
                                             gint height,
                                             GwyAxis *axis);

drawable :
gc :
xmin :
ymin :
width :
height :
axis :

gwy_axis_export_vector ()

GString*    gwy_axis_export_vector          (GwyAxis *axis,
                                             gint xmin,
                                             gint ymin,
                                             gint width,
                                             gint height,
                                             gint fontsize);

axis :
xmin :
ymin :
width :
height :
fontsize :
Returns :

gwy_axis_set_grid_data ()

void        gwy_axis_set_grid_data          (GwyAxis *axis,
                                             GArray *array);

axis :
array :

Signals

The "label-updated" signal

void        user_function                  (GwyAxis *gwyaxis,
                                            gpointer user_data);

gwyaxis : the object which received the signal.
user_data : user data set when the signal handler was connected.

The "rescaled" signal

void        user_function                  (GwyAxis *gwyaxis,
                                            gpointer user_data);

gwyaxis : the object which received the signal.
user_data : user data set when the signal handler was connected.