GtkDatabox
A set of GTK+ widgets to display large amounts of numerical data quickly and easily.
gtk/gtkdatabox_ruler.c File Reference
#include <gtkdatabox_ruler.h>
#include <math.h>
#include <glib/gprintf.h>
#include <string.h>
Include dependency graph for gtkdatabox_ruler.c:

Data Structures

struct  _GtkDataboxRulerPrivate

Defines

#define RULER_SIZE   14
#define ROUND(x)   ((int) ((x) + 0.5))
#define FORMAT_LENGTH   20 /* the length of the label format string */
#define LINEAR_FORMAT_MARKUP   "%%-+%dg"
#define LOG_FORMAT_MARKUP   "%%-%dg"
#define __GTK_DATABOX_RULER_C__

Enumerations

enum  {
  PROP_0, PROP_LOWER, PROP_UPPER, PROP_POSITION,
  PROP_DRAW_POSITION, PROP_MAX_LENGTH, PROP_ORIENTATION, PROP_TEXT_ORIENTATION,
  PROP_TEXT_ALIGNMENT, PROP_TEXT_HOFFSET, PROP_DRAW_TICKS, PROP_DRAW_SUBTICKS,
  PROP_MANUAL_TICKS, PROP_MANUAL_TICK_CNT, PROP_MANUAL_TICK_LABELS, PROP_INVERT_EDGE,
  PROP_LINEAR_LABEL_FORMAT, PROP_LOG_LABEL_FORMAT, PROP_BOX_SHADOW, PROP_END_OF_LIST
}

Functions

GtkWidget * gtk_databox_ruler_new (GtkOrientation orientation)
void gtk_databox_ruler_set_range (GtkDataboxRuler *ruler, gdouble lower, gdouble upper, gdouble position)
void gtk_databox_ruler_set_max_length (GtkDataboxRuler *ruler, guint max_length)
void gtk_databox_ruler_set_scale_type (GtkDataboxRuler *ruler, GtkDataboxScaleType scale_type)
void gtk_databox_ruler_set_orientation (GtkDataboxRuler *ruler, GtkOrientation orientation)
GtkOrientation gtk_databox_ruler_get_orientation (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_text_orientation (GtkDataboxRuler *ruler, GtkOrientation orientation)
GtkOrientation gtk_databox_ruler_get_text_orientation (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_text_alignment (GtkDataboxRuler *ruler, PangoAlignment alignment)
PangoAlignment gtk_databox_ruler_get_text_alignment (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_text_hoffset (GtkDataboxRuler *ruler, gint offset)
gint gtk_databox_ruler_get_text_hoffset (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_draw_position (GtkDataboxRuler *ruler, gboolean draw)
gboolean gtk_databox_ruler_get_draw_position (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_draw_ticks (GtkDataboxRuler *ruler, gboolean draw)
gboolean gtk_databox_ruler_get_draw_ticks (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_draw_subticks (GtkDataboxRuler *ruler, gboolean draw)
gboolean gtk_databox_ruler_get_draw_subticks (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_manual_ticks (GtkDataboxRuler *ruler, gfloat *manual_ticks)
gfloat * gtk_databox_ruler_get_manual_ticks (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_manual_tick_cnt (GtkDataboxRuler *ruler, guint manual_tick_cnt)
guint gtk_databox_ruler_get_manual_tick_cnt (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_manual_tick_labels (GtkDataboxRuler *ruler, gchar **manual_tick_labels)
gchar ** gtk_databox_ruler_get_manual_tick_labels (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_invert_edge (GtkDataboxRuler *ruler, gboolean invert)
gboolean gtk_databox_ruler_get_invert_edge (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_linear_label_format (GtkDataboxRuler *ruler, gchar *format)
gchar * gtk_databox_ruler_get_linear_label_format (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_log_label_format (GtkDataboxRuler *ruler, gchar *format)
gchar * gtk_databox_ruler_get_log_label_format (GtkDataboxRuler *ruler)
void gtk_databox_ruler_get_range (GtkDataboxRuler *ruler, gdouble *lower, gdouble *upper, gdouble *position)
guint gtk_databox_ruler_get_max_length (GtkDataboxRuler *ruler)
GtkDataboxScaleType gtk_databox_ruler_get_scale_type (GtkDataboxRuler *ruler)
void gtk_databox_ruler_set_box_shadow (GtkDataboxRuler *ruler, GtkShadowType which_shadow)
GtkShadowType gtk_databox_ruler_get_box_shadow (GtkDataboxRuler *ruler)

Define Documentation

#define FORMAT_LENGTH   20 /* the length of the label format string */
#define LINEAR_FORMAT_MARKUP   "%%-+%dg"
#define LOG_FORMAT_MARKUP   "%%-%dg"
#define ROUND (   x)    ((int) ((x) + 0.5))
#define RULER_SIZE   14

Enumeration Type Documentation

anonymous enum
Enumerator:
PROP_0 
PROP_LOWER 
PROP_UPPER 
PROP_POSITION 
PROP_DRAW_POSITION 
PROP_MAX_LENGTH 
PROP_ORIENTATION 
PROP_TEXT_ORIENTATION 
PROP_TEXT_ALIGNMENT 
PROP_TEXT_HOFFSET 
PROP_DRAW_TICKS 
PROP_DRAW_SUBTICKS 
PROP_MANUAL_TICKS 
PROP_MANUAL_TICK_CNT 
PROP_MANUAL_TICK_LABELS 
PROP_INVERT_EDGE 
PROP_LINEAR_LABEL_FORMAT 
PROP_LOG_LABEL_FORMAT 
PROP_BOX_SHADOW 
PROP_END_OF_LIST 

Function Documentation

gtk_databox_ruler_get_box_shadow: : a GtkDataboxRuler

Gets the type of shadow being rendered to the (GTK_SHADOW_NONE, GTK_SHADOW_IN, GTK_SHADOW_OUT, GTK_SHADOW_ETCHED_IN, GTK_SHADOW_ETCHED_OUT).

Return value: The currently used shadow type of the , -1 on failure.

gtk_databox_ruler_get_draw_position: : a GtkDataboxRuler

Gets the draw position arrows option from the (horizontal or vertical).

Return value: Position drawing option of the .

gtk_databox_ruler_get_draw_subticks: : a GtkDataboxRuler

Gets the draw subticks option from the (horizontal or vertical).

Return value: Subtick drawing option of the .

gtk_databox_ruler_get_draw_ticks: : a GtkDataboxRuler

Gets the draw ticks option from the (horizontal or vertical).

Return value: Tick drawing option of the .

gtk_databox_ruler_get_invert_edge: : a GtkDataboxRuler

Gets the invert edge option from the (horizontal or vertical).

Return value: Edge inversion option of the .

gtk_databox_ruler_get_linear_label_format: : a GtkDataboxRuler

Gets the linear label meta format of the (horizontal or vertical).

Return value: The string meta format the NULL on failure.

gtk_databox_ruler_get_log_label_format: : a GtkDataboxRuler

Gets the log label meta format of the (horizontal or vertical).

Return value: The string meta format the , NULL on failure.

gtk_databox_grid_get_manual_tick_cnt: : a GtkDataboxRuler

Gets the number manual tick values for the .

Return value: The number of manual tick values for the .

gtk_databox_grid_get_manual_tick_labels: : a GtkDataboxRuler

Gets the pointer to the manual tick labels for the .

Return value: Pointer to the manual tick labels for the .

gtk_databox_grid_get_manual_ticks: : a GtkDataboxRuler

Gets the pointer to the manual tick values for the .

Return value: Pointer to the manual tick values for the .

gtk_databox_ruler_get_max_length: : A GtkDataboxRuler widget

This function returns the maximum number of digits to be used for each tick label of the .

Return value: The maximum length of the tick labels.

gtk_databox_ruler_get_orientation: : a GtkDataboxRuler

Gets the orientation of the (horizontal or vertical).

Return value: Orientation of the .

Here is the caller graph for this function:

void gtk_databox_ruler_get_range ( GtkDataboxRuler ruler,
gdouble *  lower,
gdouble *  upper,
gdouble *  position 
)

gtk_databox_ruler_get_range: : a GtkDataboxRuler : location to store lower limit of the ruler, or NULL : location to store upper limit of the ruler, or NULL : location to store the current position of the mark on the ruler, or NULL

Retrieves values indicating the range and current position of a GtkDataboxRuler. See gtk_databox_ruler_set_range().

gtk_databox_ruler_get_scale_type: : A GtkDataboxRuler widget

This function returns the scale type of the (linear or logarithmic).

Return value: The scale type (linear or logarithmic)

gtk_databox_ruler_get_text_alignment: : a GtkDataboxRuler

Gets the text alignment of the (vertical). Vertical rulers with vertical text do not use this flag

Return value: Text alignment of the .

gtk_databox_ruler_get_text_hoffset: : a GtkDataboxRuler

Gets the text x (horizontal) offset of the .

Return value: Text horizontal (x) offset of the .

gtk_databox_ruler_get_text_orientation: : a GtkDataboxRuler

Gets the text orientation of the (horizontal or vertical). Horizontal rulers always have horizontal text

Return value: Text orientation of the .

GtkWidget* gtk_databox_ruler_new ( GtkOrientation  orientation)

gtk_databox_ruler_new: : orientation of the ruler

Creates a new GtkDataboxRuler widget with the given (horizontal or vertical).

Return value: A new GtkDataboxRuler

Here is the caller graph for this function:

void gtk_databox_ruler_set_box_shadow ( GtkDataboxRuler ruler,
GtkShadowType  which_shadow 
)

gtk_databox_ruler_set_box_shadow: : a GtkDataboxRuler : How to render the box shadow on the ruler edges.

Sets the shadow type when using gtk_paint_box. This will draw the desired edge shadow.

void gtk_databox_ruler_set_draw_position ( GtkDataboxRuler ruler,
gboolean  draw 
)

gtk_databox_ruler_set_draw_position: : a GtkDataboxRuler : whether to draw the position arrows on the ruler at all

Sets the option for drawing the position arrows. If false, don't draw any arrows, If true draw arrows.

void gtk_databox_ruler_set_draw_subticks ( GtkDataboxRuler ruler,
gboolean  draw 
)

gtk_databox_ruler_set_draw_subticks: : a GtkDataboxRuler : whether to draw the subticks on the ruler

Sets the option for drawing the subticks

void gtk_databox_ruler_set_draw_ticks ( GtkDataboxRuler ruler,
gboolean  draw 
)

gtk_databox_ruler_set_draw_ticks: : a GtkDataboxRuler : whether to draw the ticks on the ruler at all

Sets the option for drawing the ticks. If false, don't draw any ticks, If true draw major ticks and subticks if the draw_subticks boolean is set.

void gtk_databox_ruler_set_invert_edge ( GtkDataboxRuler ruler,
gboolean  invert 
)

gtk_databox_ruler_set_invert_edge: : a GtkDataboxRuler : whether to draw the ruler detail with the edge inverted

Sets the option for drawing the ruler detail on the opposite edge

Here is the caller graph for this function:

void gtk_databox_ruler_set_linear_label_format ( GtkDataboxRuler ruler,
gchar *  format 
)

gtk_databox_ruler_set_linear_label_format: : a GtkDataboxRuler : How to format the labels for linear rulers

Sets the meta format string for the labels of linear rulers, for example "%%+-%dg" will become "%+-#g" where # is the int variable

void gtk_databox_ruler_set_log_label_format ( GtkDataboxRuler ruler,
gchar *  format 
)

gtk_databox_ruler_set_log_label_format: : a GtkDataboxRuler : How to format the labels for log scaled rulers

Sets the meta format string for the labels of log scaled rulers, for example "%%-%dg" will become "%-#g" where # is the int variable

void gtk_databox_ruler_set_manual_tick_cnt ( GtkDataboxRuler ruler,
guint  manual_tick_cnt 
)

gtk_databox_grid_set_manual_tick_cnt: : a GtkDataboxRuler : sets the number of manual ticks for the

Sets the number of manual ticks for the (horizontal or vertical).

void gtk_databox_ruler_set_manual_tick_labels ( GtkDataboxRuler ruler,
gchar **  manual_tick_labels 
)

gtk_databox_grid_set_manual_tick_labels: : a GtkDataboxRuler : sets the pointer to the labels for the ticks on the

Note: This function should be preceeded by calls to gtk_databox_ruler_set_manual_ticks() and gtk_databox_ruler_set_manual_tick_cnt(). The number of tick labels should match gtk_databox_ruler_get_manual_tick_cnt().

Sets the tick labels of the (horizontal or vertical).

void gtk_databox_ruler_set_manual_ticks ( GtkDataboxRuler ruler,
gfloat *  manual_ticks 
)

gtk_databox_grid_set_manual_ticks: : a GtkDataboxRuler : sets the pointer to the hline values for the

Sets the ticks for the (horizontal or vertical).

void gtk_databox_ruler_set_max_length ( GtkDataboxRuler ruler,
guint  max_length 
)

gtk_databox_ruler_set_max_length: : A GtkDataboxRuler widget : Maximum length (digits) of tick labels

This function sets the maximum number of digits to be used for each tick label of the .

The cannot be smaller than 2 and not bigger than GTK_DATABOX_RULER_MAX_MAX_LENGTH.

void gtk_databox_ruler_set_orientation ( GtkDataboxRuler ruler,
GtkOrientation  orientation 
)

gtk_databox_ruler_set_orientation: : a GtkDataboxRuler : new orientation of the ruler

Sets the orientation of the (horizontal or vertical).

void gtk_databox_ruler_set_range ( GtkDataboxRuler ruler,
gdouble  lower,
gdouble  upper,
gdouble  position 
)

gtk_databox_ruler_set_range: : a GtkDataboxRuler : lower limit of the ruler : upper limit of the ruler : current position of the mark on the ruler

Sets values indicating the range and current position of a GtkDataboxRuler.

See gtk_databox_ruler_get_range().

gtk_databox_ruler_set_scale_type: : A GtkDataboxRuler widget : The new scale type for (linear or logarithmic)

This function sets the scale type of the .

Here is the caller graph for this function:

void gtk_databox_ruler_set_text_alignment ( GtkDataboxRuler ruler,
PangoAlignment  alignment 
)

gtk_databox_ruler_set_text_alignment: : a GtkDataboxRuler : new alignment of the tick label in the vertical ruler when horizontal text is set

Sets the text alignment of the (vertical with horizontal text).

void gtk_databox_ruler_set_text_hoffset ( GtkDataboxRuler ruler,
gint  offset 
)

gtk_databox_ruler_set_text_hoffset: : a GtkDataboxRuler : new x offset of the tick label in the ruler

Sets the text x (horizontal) offset of the .

void gtk_databox_ruler_set_text_orientation ( GtkDataboxRuler ruler,
GtkOrientation  orientation 
)

gtk_databox_ruler_set_text_orientation: : a GtkDataboxRuler : new orientation of the tick marks in the vertical ruler

Sets the text orientation of the (vertical).

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines