1 /* $Id: gtkdatabox.h 3 2008-06-22 08:45:45Z rbock $ */ 2 /* GtkDatabox - An extension to the gtk+ library 3 * Copyright (C) 1998 - 2008 Dr. Roland Bock 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public License 7 * as published by the Free Software Foundation; either version 2.1 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef __GTK_DATABOX_H__ 21 #define __GTK_DATABOX_H__ 22 23 #include <gtkdatabox_typedefs.h> 24 #include <gtkdatabox_graph.h> 25 #include <gtkdatabox_ruler.h> 26 #include <gtk/gtk.h> 27 28 /** 29 * SECTION:gtkdatabox 30 * @short_description: A GTK+ widget to display large amounts of numerical data quickly and easily. 31 * @include: gtkdatabox.h 32 * @see_also: #GtkDataboxGraph, #GtkDataboxPoints, #GtkDataboxLines, #GtkDataboxMarkers, #GtkDataboxGrid 33 * 34 * #GtkDatabox is a widget for the GTK+ library designed to display 35 * large amounts of numerical data quickly and easily. It allows 36 * for one or more data sets of thousands of data points (X and Y coordinates) 37 * to be displayed and updated in split seconds. 38 * 39 * It offers the ability to zoom into and out of the data, and to navigate 40 * through your data by scrolling. 41 * 42 * In addition to rulers and a simple 43 * coordinate cross, it allows you to add one (or even more) configurable grids 44 * like on an oscilloscope. 45 * 46 * Data may be presented as dots, lines connecting the data, 47 * or vertical bars. The widget allows you to easily transform pixel 48 * coordinates into data coordinates, thus allowing you to easily create 49 * powerful applications for data analysis. 50 * 51 **/ 52 53 G_BEGIN_DECLS 54 #define GTK_TYPE_DATABOX (gtk_databox_get_type ()) 55 #define GTK_DATABOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 56 GTK_TYPE_DATABOX, \ 57 GtkDatabox)) 58 #define GTK_DATABOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ 59 GTK_TYPE_DATABOX, \ 60 GtkDataboxClass)) 61 #define GTK_IS_DATABOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ 62 GTK_TYPE_DATABOX)) 63 #define GTK_IS_DATABOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 64 GTK_TYPE_DATABOX)) 65 #define GTK_DATABOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ 66 GTK_TYPE_DATABOX, \ 67 GtkDataboxClass)) 68 #define GTK_DATABOX_GET_PRIVATE(obj) \ 69 G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_DATABOX, GtkDataboxPrivate) 70 71 typedef struct _GtkDataboxClass GtkDataboxClass; 72 73 typedef struct 74 { 75 gfloat x1; 76 gfloat x2; 77 gfloat y1; 78 gfloat y2; 79 } GtkDataboxValueRectangle; 80 81 /** 82 * _GtkDatabox 83 * @box: The parent object 84 * 85 * Implementation of #GtkDatabox. 86 * 87 **/ 88 struct _GtkDatabox 89 { 90 /*< private >*/ 91 GtkWidget box; 92 }; 93 94 struct _GtkDataboxClass 95 { 96 GtkWidgetClass parent_class; 97 98 void (*zoomed) (GtkDatabox * box); 99 void (*selection_started) (GtkDatabox * box, 100 GtkDataboxValueRectangle * selectionValues); 101 void (*selection_changed) (GtkDatabox * box, 102 GtkDataboxValueRectangle * selectionValues); 103 void (*selection_finalized) (GtkDatabox * box, 104 GtkDataboxValueRectangle * 105 selectionValues); 106 void (*selection_canceled) (GtkDatabox * box); 107 }; 108 109 gchar * gtk_databox_background (gchar *setcolor); 110 111 GType gtk_databox_get_type (void); 112 113 GtkWidget *gtk_databox_new (void); 114 115 GList * gtk_databox_get_graphs (GtkDatabox *); 116 117 gint gtk_databox_graph_add (GtkDatabox * box, GtkDataboxGraph * graph); 118 gint gtk_databox_graph_add_front (GtkDatabox * box, GtkDataboxGraph * graph); 119 120 gint gtk_databox_graph_remove (GtkDatabox * box, GtkDataboxGraph * graph); 121 gint gtk_databox_graph_remove_all (GtkDatabox * box); 122 123 gint gtk_databox_auto_rescale (GtkDatabox * box, gfloat border); 124 gint gtk_databox_calculate_extrema (GtkDatabox * box, 125 gfloat * min_x, gfloat * max_x, 126 gfloat * min_y, gfloat * max_y); 127 128 void gtk_databox_set_total_limits (GtkDatabox * box, 129 gfloat left, gfloat right, 130 gfloat top, gfloat bottom); 131 void gtk_databox_set_visible_limits (GtkDatabox * box, 132 gfloat left, gfloat right, 133 gfloat top, gfloat bottom); 134 void gtk_databox_get_total_limits (GtkDatabox * box, 135 gfloat * left, gfloat * right, 136 gfloat * top, gfloat * bottom); 137 void gtk_databox_get_visible_limits (GtkDatabox * box, 138 gfloat * left, gfloat * right, 139 gfloat * top, gfloat * bottom); 140 141 void gtk_databox_set_adjustment_x (GtkDatabox * box, GtkAdjustment * adj); 142 void gtk_databox_set_adjustment_y (GtkDatabox * box, GtkAdjustment * adj); 143 GtkAdjustment *gtk_databox_get_adjustment_x (GtkDatabox * box); 144 GtkAdjustment *gtk_databox_get_adjustment_y (GtkDatabox * box); 145 146 void gtk_databox_set_ruler_x (GtkDatabox * box, GtkDataboxRuler * ruler); 147 void gtk_databox_set_ruler_y (GtkDatabox * box, GtkDataboxRuler * ruler); 148 GtkDataboxRuler *gtk_databox_get_ruler_x (GtkDatabox * box); 149 GtkDataboxRuler *gtk_databox_get_ruler_y (GtkDatabox * box); 150 151 void gtk_databox_set_scale_type_x (GtkDatabox * box, 152 GtkDataboxScaleType scale_type); 153 void gtk_databox_set_scale_type_y (GtkDatabox * box, 154 GtkDataboxScaleType scale_type); 155 GtkDataboxScaleType gtk_databox_get_scale_type_x (GtkDatabox * box); 156 GtkDataboxScaleType gtk_databox_get_scale_type_y (GtkDatabox * box); 157 158 void gtk_databox_set_enable_selection (GtkDatabox * box, gboolean enable); 159 void gtk_databox_set_enable_zoom (GtkDatabox * box, gboolean enable); 160 void gtk_databox_set_box_shadow(GtkDatabox * box, GtkShadowType which_shadow); 161 162 gboolean gtk_databox_get_enable_selection (GtkDatabox * box); 163 gboolean gtk_databox_get_enable_zoom (GtkDatabox * box); 164 GtkShadowType gtk_databox__get_box_shadow(GtkDatabox * box); 165 166 void gtk_databox_zoom_to_selection (GtkDatabox * box); 167 void gtk_databox_zoom_out (GtkDatabox * box); 168 void gtk_databox_zoom_home (GtkDatabox * box); 169 170 gint16 gtk_databox_value_to_pixel_x (GtkDatabox * box, gfloat value); 171 gint16 gtk_databox_value_to_pixel_y (GtkDatabox * box, gfloat value); 172 gfloat gtk_databox_pixel_to_value_x (GtkDatabox * box, gint16 pixel); 173 gfloat gtk_databox_pixel_to_value_y (GtkDatabox * box, gint16 pixel); 174 void gtk_databox_values_to_xpixels (GtkDatabox *box, gint16 *pixels, 175 void *values, GType vtype, guint size, guint start, guint stride, guint len); 176 void gtk_databox_values_to_ypixels (GtkDatabox *box, gint16 *pixels, 177 void *values, GType vtype, guint size, guint start, guint stride, guint len); 178 179 void gtk_databox_create_box_with_scrollbars_and_rulers (GtkWidget ** 180 p_box, 181 GtkWidget ** 182 p_table, 183 gboolean scrollbar_x, 184 gboolean scrollbar_y, 185 gboolean ruler_x, 186 gboolean ruler_y); 187 188 void 189 gtk_databox_create_box_with_scrollbars_and_rulers_positioned (GtkWidget ** p_box, 190 GtkWidget ** p_table, 191 gboolean scrollbar_x, 192 gboolean scrollbar_y, 193 gboolean ruler_x, 194 gboolean ruler_y, 195 gboolean ruler_x_top, 196 gboolean ruler_y_left); 197 198 /* Used by graph objects */ 199 cairo_surface_t* gtk_databox_get_backing_surface(GtkDatabox * box); 200 201 G_END_DECLS 202 #endif /* __GTK_DATABOX_H__ */ 203