1 /* 2 * gog-plot-impl.h : implementation details for the abstract 'plot' interface 3 * 4 * Copyright (C) 2003-2004 Jody Goldberg (jody@gnome.org) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of the 9 * License, or (at your option) version 3. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19 * USA 20 */ 21 22 #ifndef GOG_PLOT_IMPL_H 23 #define GOG_PLOT_IMPL_H 24 25 #include <goffice/goffice.h> 26 27 G_BEGIN_DECLS 28 29 struct _GogPlotDesc { 30 unsigned int num_series_max; 31 GogSeriesDesc series; 32 }; 33 34 struct _GogPlot { 35 GogObject base; 36 37 GSList *series; 38 unsigned int full_cardinality, visible_cardinality; 39 gboolean cardinality_valid; 40 unsigned int index_num; 41 gboolean vary_style_by_element; 42 GogPlotRenderingOrder rendering_order; 43 gchar *plot_group; 44 char *guru_hints; 45 46 GOLineInterpolation interpolation; 47 48 GogAxis *axis[GOG_AXIS_TYPES]; 49 50 /* Usually a copy from the class but it's here to allow a GogPlotType to 51 * override things without requiring a completely new class */ 52 GogPlotDesc desc; 53 }; 54 55 typedef struct { 56 GogObjectClass base; 57 58 GogPlotDesc desc; 59 GType series_type; 60 61 GogAxisSet axis_set; 62 63 /* Virtuals */ 64 65 GOData *(*axis_get_bounds) (GogPlot *plot, GogAxisType axis, 66 GogPlotBoundInfo *bounds); 67 68 gboolean (*supports_vary_style_by_element) (GogPlot const *plot); 69 70 /* %TRUE if the plot prefers to display series in reverse order for 71 * legends (e.g. stacked plots want top element to be the last series) */ 72 gboolean (*enum_in_reverse) (GogPlot const *plot); 73 74 void (*foreach_elem) (GogPlot *plot, gboolean only_visible, 75 GogEnumFunc handler, gpointer data); 76 77 void (*update_3d) (GogPlot *plot); 78 void (*guru_helper) (GogPlot *plot, char const *hint); 79 double (*get_percent) (GogPlot *plot, unsigned series, unsigned index); 80 } GogPlotClass; 81 82 #define GOG_PLOT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOG_TYPE_PLOT, GogPlotClass)) 83 #define GOG_IS_PLOT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOG_TYPE_PLOT)) 84 #define GOG_PLOT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOG_TYPE_PLOT, GogPlotClass)) 85 86 /* protected */ 87 88 /*****************************************************************************/ 89 90 #define GOG_TYPE_PLOT_VIEW (gog_plot_view_get_type ()) 91 #define GOG_PLOT_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_PLOT_VIEW, GogPlotView)) 92 #define GOG_IS_PLOT_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_PLOT_VIEW)) 93 #define GOG_PLOT_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOG_TYPE_PLOT_VIEW, GogPlotViewClass)) 94 95 struct _GogPlotView { 96 GogView base; 97 }; 98 typedef struct { 99 GogViewClass base; 100 int (*get_data_at_point) (GogPlotView *view, double x, double y, GogSeries **series); 101 } GogPlotViewClass; 102 GType gog_plot_view_get_type (void); 103 104 G_END_DECLS 105 106 #endif /* GOG_PLOT_GROUP_IMPL_H */ 107