1 /* 2 * gog-series-impl.h : 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 GO_SERIES_IMPL_H 23 #define GO_SERIES_IMPL_H 24 25 #include <goffice/goffice.h> 26 27 G_BEGIN_DECLS 28 29 typedef struct { 30 GogStyledObject base; 31 32 unsigned int index; 33 } GogSeriesElement; 34 35 typedef struct { 36 GogStyledObjectClass base; 37 38 /* Virtuals */ 39 gpointer (*gse_populate_editor) (GogObject *gobj, 40 GOEditor *editor, 41 GOCmdContext *cc); 42 } GogSeriesElementClass; 43 44 #define GOG_SERIES_ELEMENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOG_TYPE_SERIES_ELEMENT, GogSeriesElementClass)) 45 46 typedef enum { 47 GOG_SERIES_REQUIRED, /* it must be there */ 48 GOG_SERIES_SUGGESTED, /* allocator will fill it in, but use need not */ 49 GOG_SERIES_OPTIONAL, 50 GOG_SERIES_ERRORS 51 } GogSeriesPriority; 52 53 #define GOG_SERIES_ACCEPT_TREND_LINE 1 54 55 struct _GogSeriesDimDesc { 56 char const *name; 57 GogSeriesPriority priority; 58 gboolean is_shared; 59 GogDimType val_type; 60 GogMSDimType ms_type; 61 }; 62 63 struct _GogSeriesDesc { 64 unsigned int style_fields; 65 unsigned int num_dim; 66 GogSeriesDimDesc const *dim; 67 }; 68 69 struct _GogSeries { 70 GogStyledObject base; 71 72 int index; 73 unsigned manual_index : 1; 74 unsigned is_valid : 1; 75 unsigned needs_recalc : 1; 76 unsigned acceptable_children : 1; 77 78 GogPlot *plot; 79 GogDatasetElement *values; 80 gboolean has_legend; 81 unsigned int num_elements; 82 GogSeriesFillType fill_type; 83 GList *overrides; /* GogSeriesElement (individual points) */ 84 85 GOLineInterpolation interpolation; 86 gboolean interpolation_skip_invalid; 87 /* data related to data labels */ 88 GogSeriesLabelsPos default_pos; 89 unsigned int allowed_pos; /* if 0, no data labels can be addded */ 90 }; 91 92 typedef struct { 93 GogStyledObjectClass base; 94 95 gboolean has_interpolation; 96 gboolean has_fill_type; 97 98 GogSeriesFillType const *valid_fill_type_list; 99 100 GType series_element_type; 101 102 /* Virtuals */ 103 void (*dim_changed) (GogSeries *series, int dim_i); 104 unsigned (*get_xy_data) (GogSeries const *series, 105 double const **x, double const **y); 106 GogDataset *(*get_interpolation_params) (GogSeries const *series); 107 108 } GogSeriesClass; 109 110 #define GOG_SERIES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOG_TYPE_SERIES, GogSeriesClass)) 111 #define GOG_IS_SERIES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOG_TYPE_SERIES)) 112 #define GOG_SERIES_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOG_TYPE_SERIES, GogSeriesClass)) 113 114 /* protected */ 115 void gog_series_check_validity (GogSeries *series); 116 GogSeriesElement *gog_series_get_element (GogSeries const *series, int index); 117 118 G_END_DECLS 119 120 #endif /* GO_SERIES_IMPL_H */ 121