GtkDatabox A set of GTK+ widgets to display large amounts of numerical data quickly and easily.

- Main Page
- Data Structures
- Files

- File List
- Globals

Data Structures | Enumerations | Functions
gtk/gtkdatabox.c File Reference
`#include <gtkdatabox.h>`
`#include <gtkdatabox_marshal.h>`
`#include <gtk/gtkhscrollbar.h>`
`#include <gtk/gtkvscrollbar.h>`
`#include <gtkdatabox_ruler.h>`
`#include <gtk/gtktable.h>`
`#include <gtk/gtkgc.h>`
`#include <math.h>`
Include dependency graph for gtkdatabox.c:

## Data Structures

struct | _GtkDataboxPrivate

## Enumerations

enum | { ZOOMED_SIGNAL, SELECTION_STARTED_SIGNAL, SELECTION_CHANGED_SIGNAL, SELECTION_FINALIZED_SIGNAL, SELECTION_CANCELED_SIGNAL, LAST_SIGNAL }
enum | { ENABLE_SELECTION = 1, ENABLE_ZOOM, ADJUSTMENT_X, ADJUSTMENT_Y, RULER_X, RULER_Y, SCALE_TYPE_X, SCALE_TYPE_Y, BOX_SHADOW, LAST_PROPERTY }

## Functions

GtkWidget * | gtk_databox_new (void)
void | gtk_databox_set_enable_selection (GtkDatabox *box, gboolean enable)
void | gtk_databox_set_enable_zoom (GtkDatabox *box, gboolean enable)
void | gtk_databox_set_adjustment_x (GtkDatabox *box, GtkAdjustment *adj)
void | gtk_databox_set_adjustment_y (GtkDatabox *box, GtkAdjustment *adj)
void | gtk_databox_set_ruler_x (GtkDatabox *box, GtkDataboxRuler *ruler)
void | gtk_databox_set_ruler_y (GtkDatabox *box, GtkDataboxRuler *ruler)
void | gtk_databox_set_scale_type_x (GtkDatabox *box, GtkDataboxScaleType scale_type)
void | gtk_databox_set_scale_type_y (GtkDatabox *box, GtkDataboxScaleType scale_type)
void | gtk_databox_set_box_shadow (GtkDatabox *box, GtkShadowType which_shadow)
gboolean | gtk_databox_get_enable_selection (GtkDatabox *box)
gboolean | gtk_databox_get_enable_zoom (GtkDatabox *box)
GtkAdjustment * | gtk_databox_get_adjustment_x (GtkDatabox *box)
GtkAdjustment * | gtk_databox_get_adjustment_y (GtkDatabox *box)
GtkDataboxRuler * | gtk_databox_get_ruler_x (GtkDatabox *box)
GtkDataboxRuler * | gtk_databox_get_ruler_y (GtkDatabox *box)
GtkDataboxScaleType | gtk_databox_get_scale_type_x (GtkDatabox *box)
GtkDataboxScaleType | gtk_databox_get_scale_type_y (GtkDatabox *box)
GtkShadowType | gtk_databox_get_box_shadow (GtkDatabox *box)
GdkPixmap * | gtk_databox_get_backing_pixmap (GtkDatabox *box)
void | gtk_databox_zoom_to_selection (GtkDatabox *box)
void | gtk_databox_zoom_out (GtkDatabox *box)
void | gtk_databox_zoom_home (GtkDatabox *box)
gint | gtk_databox_auto_rescale (GtkDatabox *box, gfloat border)
gint | gtk_databox_calculate_extrema (GtkDatabox *box, gfloat *min_x, gfloat *max_x, gfloat *min_y, gfloat *max_y)
void | gtk_databox_set_total_limits (GtkDatabox *box, gfloat left, gfloat right, gfloat top, gfloat bottom)
void | gtk_databox_set_visible_limits (GtkDatabox *box, gfloat left, gfloat right, gfloat top, gfloat bottom)
void | gtk_databox_get_total_limits (GtkDatabox *box, gfloat *left, gfloat *right, gfloat *top, gfloat *bottom)
void | gtk_databox_get_visible_limits (GtkDatabox *box, gfloat *left, gfloat *right, gfloat *top, gfloat *bottom)
gint | gtk_databox_graph_add (GtkDatabox *box, GtkDataboxGraph *graph)
gint | gtk_databox_graph_add_front (GtkDatabox *box, GtkDataboxGraph *graph)
gint | gtk_databox_graph_remove (GtkDatabox *box, GtkDataboxGraph *graph)
gint | gtk_databox_graph_remove_all (GtkDatabox *box)
void | gtk_databox_values_to_pixels (GtkDatabox *box, guint len, const gfloat *values_x, const gfloat *values_y, GdkPoint *pixels)
gint16 | gtk_databox_value_to_pixel_x (GtkDatabox *box, gfloat value)
gint16 | gtk_databox_value_to_pixel_y (GtkDatabox *box, gfloat value)
gfloat | gtk_databox_pixel_to_value_x (GtkDatabox *box, gint16 pixel)
gfloat | gtk_databox_pixel_to_value_y (GtkDatabox *box, gint16 pixel)
void | gtk_databox_create_box_with_scrollbars_and_rulers (GtkWidget **p_box, GtkWidget **p_table, gboolean scrollbar_x, gboolean scrollbar_y, gboolean ruler_x, gboolean ruler_y)
void | gtk_databox_create_box_with_scrollbars_and_rulers_positioned (GtkWidget **p_box, GtkWidget **p_table, gboolean scrollbar_x, gboolean scrollbar_y, gboolean ruler_x, gboolean ruler_y, gboolean ruler_x_top, gboolean ruler_y_left)

## Enumeration Type Documentation

anonymous enum

Enumerator:

  ZOOMED_SIGNAL |
  SELECTION_STARTED_SIGNAL |
  SELECTION_CHANGED_SIGNAL |
  SELECTION_FINALIZED_SIGNAL |
  SELECTION_CANCELED_SIGNAL |
  LAST_SIGNAL |

anonymous enum

Enumerator:

  ENABLE_SELECTION |
  ENABLE_ZOOM |
  ADJUSTMENT_X |
  ADJUSTMENT_Y |
  RULER_X |
  RULER_Y |
  SCALE_TYPE_X |
  SCALE_TYPE_Y |
  BOX_SHADOW |
  LAST_PROPERTY |

## Function Documentation

gint gtk_databox_auto_rescale | ( | GtkDatabox * | box,
|  | gfloat | border
| ) |  |

gtk_databox_auto_rescale: : A GtkDatabox widget : Relative border width (e.g. 0.1 means that the border on each side is 10% of the data area).

This function is similar to gtk_databox_set_total_limits(). It sets the total limits to match the data extrema (see gtk_databox_calculate_extrema()). If you do not like data pixels exactly at the widget's border, you can add modify the limits using the border parameter: The limits are extended by *(max-min) if max!=min. If max==min, they are extended by *max (otherwise the data could not be scaled to the pixel realm).

After calling this function, x values grow from left to right, y values grow from bottom to top.

Return value: 0 on success, -1 if is no GtkDatabox widget, -2 if no datasets are available

Here is the call graph for this function:

gint gtk_databox_calculate_extrema | ( | GtkDatabox * | box,
|  | gfloat * | min_x,
|  | gfloat * | max_x,
|  | gfloat * | min_y,
|  | gfloat * | max_y
| ) |  |

gtk_databox_calculate_extrema: : A GtkDatabox widget : Will be filled with the lowest x value of all datasets : Will be filled with the highest x value of all datasets : Will be filled with the lowest y value of all datasets : Will be filled with the highest y value of all datasets

Determines the minimum and maximum x and y values of all GtkDataboxGraph objects which have been added to the GtkDatabox widget via gtk_databox_graph_add().

Return value: 0 on success, -1 if is no GtkDatabox widget, -2 if no datasets are available

Here is the call graph for this function:

Here is the caller graph for this function:

void gtk_databox_create_box_with_scrollbars_and_rulers | ( | GtkWidget ** | p_box,
|  | GtkWidget ** | p_table,
|  | gboolean | scrollbar_x,
|  | gboolean | scrollbar_y,
|  | gboolean | ruler_x,
|  | gboolean | ruler_y
| ) |  |

gtk_databox_create_box_with_scrollbars_and_rulers: : Will contain a pointer to a GtkDatabox widget : Will contain a pointer to a #GtkTable widget : Whether to attach a horizontal scrollbar : Whether to attach a vertical scrollbar : Whether to attach a horizontal ruler : Whether to attach a vertical ruler

This is a convenience function which creates a GtkDatabox widget in a GtkTable widget optionally accompanied by scrollbars and rulers. You only have to fill in the data (gtk_databox_graph_add()) and adjust the limits (gtk_databox_set_total_limits() or gtk_databox_auto_rescale()).

This function produces the default databox with rulers at the top left and scroll bars at the bottom right.

: gtk_databox_new(), gtk_databox_set_adjustment_x(), gtk_databox_set_adjustment_y(), gtk_databox_set_ruler_x(), gtk_databox_set_ruler_y()

Here is the call graph for this function:

void gtk_databox_create_box_with_scrollbars_and_rulers_positioned | ( | GtkWidget ** | p_box,
|  | GtkWidget ** | p_table,
|  | gboolean | scrollbar_x,
|  | gboolean | scrollbar_y,
|  | gboolean | ruler_x,
|  | gboolean | ruler_y,
|  | gboolean | ruler_x_top,
|  | gboolean | ruler_y_left
| ) |  |

gtk_databox_create_box_with_scrollbars_and_rulers_positioned: : Will contain a pointer to a GtkDatabox widget : Will contain a pointer to a #GtkTable widget : Whether to attach a horizontal scrollbar : Whether to attach a vertical scrollbar : Whether to attach a horizontal ruler : Whether to attach a vertical ruler : Whether to put the ruler_x up the top : Whether to put the ruler_y on the left

This is a convenience function which creates a GtkDatabox widget in a GtkTable widget optionally accompanied by scrollbars and rulers. You only have to fill in the data (gtk_databox_graph_add()) and adjust the limits (gtk_databox_set_total_limits() or gtk_databox_auto_rescale()).

This function produces the default databox with rulers at the top left and scroll bars at the bottom right.

: gtk_databox_new(), gtk_databox_set_adjustment_x(), gtk_databox_set_adjustment_y(), gtk_databox_set_ruler_x(), gtk_databox_set_ruler_y(), gtk_databox_create_box_with_scrollbars_and_rulers()

Here is the call graph for this function:

Here is the caller graph for this function:

GtkAdjustment* gtk_databox_get_adjustment_x | ( | GtkDatabox * | box | ) |

gtk_databox_get_adjustment_x : A GtkDatabox widget.

Getter function for the GtkDatabox:adjustment-x property.

Return value: The GtkDatabox:adjustment-x property value.

GtkAdjustment* gtk_databox_get_adjustment_y | ( | GtkDatabox * | box | ) |

gtk_databox_get_adjustment_y : A GtkDatabox widget.

Getter function for the GtkDatabox:adjustment-y property.

Return value: The GtkDatabox:adjustment-y property value.

GdkPixmap* gtk_databox_get_backing_pixmap | ( | GtkDatabox * | box | ) |

gtk_databox_get_backing_pixmap: : A GtkDatabox widget

This function returns the pixmap which is used by and its GtkDataboxGraph objects for drawing operations before copying the result to the screen.

The function is typically called by the GtkDataboxGraph objects.

Return value: Backing pixmap

GtkShadowType gtk_databox_get_box_shadow | ( | GtkDatabox * | box | ) |

gtk_databox_get_box_shadow: : a GtkDatabox widget

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.

gboolean gtk_databox_get_enable_selection | ( | GtkDatabox * | box | ) |

gtk_databox_get_enable_selection : A GtkDatabox widget.

Getter function for the GtkDatabox:enable-selection property.

Return value: The GtkDatabox:enable-selection property value.

gboolean gtk_databox_get_enable_zoom | ( | GtkDatabox * | box | ) |

gtk_databox_get_enable_zoom : A GtkDatabox widget.

Getter function for the GtkDatabox:enable-zoom property.

Return value: The GtkDatabox:enable-zoom property value.

GtkDataboxRuler* gtk_databox_get_ruler_x | ( | GtkDatabox * | box | ) |

gtk_databox_get_ruler_x : A GtkDatabox widget.

Getter function for the GtkDatabox:ruler-x property.

Return value: The GtkDatabox:ruler-x property value.

GtkDataboxRuler* gtk_databox_get_ruler_y | ( | GtkDatabox * | box | ) |

gtk_databox_get_ruler_y : A GtkDatabox widget.

Getter function for the GtkDatabox:ruler-y property.

Return value: The GtkDatabox:ruler-y property value.

GtkDataboxScaleType gtk_databox_get_scale_type_x | ( | GtkDatabox * | box | ) |

gtk_databox_get_scale_type_x : A GtkDatabox widget.

Getter function for the GtkDatabox:scale-type-x property.

Return value: The GtkDatabox:scale-type-x property value.

GtkDataboxScaleType gtk_databox_get_scale_type_y | ( | GtkDatabox * | box | ) |

gtk_databox_get_scale_type_y : A GtkDatabox widget.

Getter function for the GtkDatabox:scale-type-y property.

Return value: The GtkDatabox:scale-type-y property value.

void gtk_databox_get_total_limits | ( | GtkDatabox * | box,
|  | gfloat * | left,
|  | gfloat * | right,
|  | gfloat * | top,
|  | gfloat * | bottom
| ) |  |

gtk_databox_get_total_limits: : A GtkDatabox widget : Space for total left value or #NULL : Space for total right value or #NULL : Space for total top value or #NULL : Space for total bottom value or #NULL

Gives the total limits (as set by gtk_databox_auto_rescale() or gtk_databox_set_total_limits()).

void gtk_databox_get_visible_limits | ( | GtkDatabox * | box,
|  | gfloat * | left,
|  | gfloat * | right,
|  | gfloat * | top,
|  | gfloat * | bottom
| ) |  |

gtk_databox_get_visible_limits: : A GtkDatabox widget : Space for visible left value or #NULL : Space for visible right value or #NULL : Space for visible top value or #NULL : Space for visible bottom value or #NULL

Gives the current visible limits. These differ from those given by gtk_databox_get_total_limits() if you zoomed into the data for instance by gtk_databox_zoom_to_selection() or gtk_databox_set_visible_limits() (these values can be changed by scrolling, of course).

gint gtk_databox_graph_add | ( | GtkDatabox * | box,
|  | GtkDataboxGraph * | graph
| ) |  |

gtk_databox_graph_add: : A GtkDatabox widget : A graph, e.g. a GtkDataboxPoints or a GtkDataboxGrid object

Adds the to the . The next time the is re-drawn, the graph will be shown.

It might be becessary to modify the total_limits in order for the graph to be displayed properly (see gtk_databox_set_total_limits()).

Return value: 0 on success, -1 otherwise

gint gtk_databox_graph_add_front | ( | GtkDatabox * | box,
|  | GtkDataboxGraph * | graph
| ) |  |

gtk_databox_graph_add_front: : A GtkDatabox widget : A graph, e.g. a GtkDataboxPoints or a GtkDataboxGrid object

Adds the to the and will be plotted on top. The next time the is re-drawn, the graph will be shown.

It might be becessary to modify the total_limits in order for the graph to be displayed properly (see gtk_databox_set_total_limits()).

Return value: 0 on success, -1 otherwise

gint gtk_databox_graph_remove | ( | GtkDatabox * | box,
|  | GtkDataboxGraph * | graph
| ) |  |

gtk_databox_graph_remove: : A GtkDatabox widget : A graph, e.g. a GtkDataboxPoints or a GtkDataboxGrid object

Removes the from the once. The next time the is re-drawn, the graph will not be shown (unless it was added more than once).

Return value: 0 on success, -1 otherwise

gint gtk_databox_graph_remove_all | ( | GtkDatabox * | box | ) |

gtk_databox_graph_remove_all: : A GtkDatabox widget

Removes all graphs from the . The next time the is re-drawn, no graphs will be shown.

Return value: 0 on success, -1 otherwise

GtkWidget* gtk_databox_new | ( | void |  | ) |

gtk_databox_new

Creates a new GtkDatabox widget.

Return value: The new GtkDatabox widget.

Here is the caller graph for this function:

gfloat gtk_databox_pixel_to_value_x | ( | GtkDatabox * | box,
|  | gint16 | pixel
| ) |  |

gtk_databox_pixel_to_value_x: : A GtkDatabox widget : A horizontal pixel coordinate

Calculates the x value which is represented by the horizontal coordinate. Pixel coordinates are relative to the top-left corner of the which is equivalent to (0,0).

Return value: x value

gfloat gtk_databox_pixel_to_value_y | ( | GtkDatabox * | box,
|  | gint16 | pixel
| ) |  |

gtk_databox_pixel_to_value_y: : A GtkDatabox widget : A vertical pixel coordinate

Calculates the y value which is represented by the vertical coordinate. Pixel coordinates are relative to the top-left corner of the which is equivalent to (0,0).

Return value: y value

void gtk_databox_set_adjustment_x | ( | GtkDatabox * | box,
|  | GtkAdjustment * | adj
| ) |  |

gtk_databox_set_adjustment_x : A GtkDatabox widget : A #GtkAdjustment object

Setter function for the GtkDatabox:adjustment-x property. Normally, it should not be required to use this function, see property documentation.

Here is the caller graph for this function:

void gtk_databox_set_adjustment_y | ( | GtkDatabox * | box,
|  | GtkAdjustment * | adj
| ) |  |

gtk_databox_set_adjustment_y : A GtkDatabox widget : A #GtkAdjustment object

Setter function for the GtkDatabox:adjustment-y property. Normally, it should not be required to use this function, see property documentation.

Here is the caller graph for this function:

void gtk_databox_set_box_shadow | ( | GtkDatabox * | box,
|  | GtkShadowType | which_shadow
| ) |  |

gtk_databox_set_box_shadow: : a GtkDatabox widget. : How to render the box shadow on the GtkDatabox edges.

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

void gtk_databox_set_enable_selection | ( | GtkDatabox * | box,
|  | gboolean | enable
| ) |  |

gtk_databox_set_enable_selection : A GtkDatabox widget : Whether selection via mouse is enabled or not.

Setter function for the GtkDatabox:enable-selection property.

void gtk_databox_set_enable_zoom | ( | GtkDatabox * | box,
|  | gboolean | enable
| ) |  |

gtk_databox_set_enable_zoom : A GtkDatabox widget : Whether zoom via mouse is enabled or not.

Setter function for the GtkDatabox:enable-zoom property.

void gtk_databox_set_ruler_x | ( | GtkDatabox * | box,
|  | GtkDataboxRuler * | ruler
| ) |  |

gtk_databox_set_ruler_x : A GtkDatabox widget : A GtkDataboxRuler object

Setter function for the GtkDatabox:ruler-x property.

Here is the call graph for this function:

Here is the caller graph for this function:

void gtk_databox_set_ruler_y | ( | GtkDatabox * | box,
|  | GtkDataboxRuler * | ruler
| ) |  |

gtk_databox_set_ruler_y : A GtkDatabox widget : An GtkDataboxRuler object

Setter function for the GtkDatabox:ruler-y property.

Here is the call graph for this function:

Here is the caller graph for this function:

void gtk_databox_set_scale_type_x | ( | GtkDatabox * | box,
|  | GtkDataboxScaleType | scale_type
| ) |  |

gtk_databox_set_scale_type_x : A GtkDatabox widget : An GtkDataboxScaleType (linear or logarithmic)

Setter function for the GtkDatabox:scale-type-x property.

Here is the call graph for this function:

void gtk_databox_set_scale_type_y | ( | GtkDatabox * | box,
|  | GtkDataboxScaleType | scale_type
| ) |  |

gtk_databox_set_scale_type_y : A GtkDatabox widget : An GtkDataboxScaleType (linear or logarithmic)

Setter function for the GtkDatabox:scale-type-y property.

Here is the call graph for this function:

void gtk_databox_set_total_limits | ( | GtkDatabox * | box,
|  | gfloat | left,
|  | gfloat | right,
|  | gfloat | top,
|  | gfloat | bottom
| ) |  |

gtk_databox_set_total_limits: : A GtkDatabox widget : Left total limit : Right total limit : Top total limit : Bottom total limit

This function is used to set the limits of the total display area of . This function can be used to invert the orientation of the displayed graphs, e.g. =-1000 and =0.

Side effect: The also internally calls gtk_databox_set_visible_limits() with the same values.

Here is the call graph for this function:

Here is the caller graph for this function:

void gtk_databox_set_visible_limits | ( | GtkDatabox * | box,
|  | gfloat | left,
|  | gfloat | right,
|  | gfloat | top,
|  | gfloat | bottom
| ) |  |

gtk_databox_set_visible_limits: : A GtkDatabox widget : Left visible limit : Right visible limit : Top visible limit : Bottom visible limit

This function is used to set the limits of the visible display area of . The visible display area can be section of the total area, i.e. the zooms in, showing only a part of the complete picture.

The orientation of the values have to be the same as in gtk_databox_set_total_limits() and the visible limits have to be within the total limits. The values will not be used otherwise.

Side effect: The emits #GtkDatabox::zoomed.

Here is the caller graph for this function:

gint16 gtk_databox_value_to_pixel_x | ( | GtkDatabox * | box,
|  | gfloat | value
| ) |  |

gtk_databox_value_to_pixel_x: : A GtkDatabox widget : An x value

Calculates the horizontal pixel coordinate which represents the x . Pixel coordinates are relative to the top-left corner of the which is equivalent to (0,0).

Return value: Pixel coordinate

gint16 gtk_databox_value_to_pixel_y | ( | GtkDatabox * | box,
|  | gfloat | value
| ) |  |

gtk_databox_value_to_pixel_y: : A GtkDatabox widget : A y value

Calculates the vertical pixel coordinate which represents the y . Pixel coordinates are relative to the top-left corner of the which is equivalent to (0,0).

Return value: Pixel coordinate

void gtk_databox_values_to_pixels | ( | GtkDatabox * | box,
|  | guint | len,
|  | const gfloat * | values_x,
|  | const gfloat * | values_y,
|  | GdkPoint * | pixels
| ) |  |

gtk_databox_values_to_pixels: : A GtkDatabox widget : Number of values/pixels : Array of X values (length >= len) : Array of Y values (length >= len) : Array of pixel coordinates (length >= len)

Calculates the pixel equivalents of the given X/Y values and stores them in the array.

void gtk_databox_zoom_home | ( | GtkDatabox * | box | ) |

gtk_databox_zoom_home: : A GtkDatabox widget

This is equivalent to shift right-clicking into the .

This function works, if the attribute #enable-zoom is set to #TRUE. It is equivalent to calling the gtk_databox_set_visible_limits() with the total limits.

Here is the call graph for this function:

void gtk_databox_zoom_out | ( | GtkDatabox * | box | ) |

gtk_databox_zoom_out: : A GtkDatabox widget

This is equivalent to right-clicking into the .

This function works, if the attribute #enable-zoom is set to #TRUE. Calling the function then zooms out by a factor of 2 in both dimensions (the maximum is defined by the total limits, see gtk_databox_set_total_limits()).

Side effect: The emits #GtkDatabox::zoomed.

void gtk_databox_zoom_to_selection | ( | GtkDatabox * | box | ) |

gtk_databox_zoom_to_selection: : A GtkDatabox widget

This is equivalent to left-clicking into the selected area.

This function works, if the attribute #enable-zoom is set to #TRUE. Calling the function then zooms to the area selected with the mouse.

Side effect: The emits #GtkDatabox::zoomed.

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines