1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2016 Maxime DOYEN
4 * This file is part of HomeBank.
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * HomeBank 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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __GTK_CHART_H__
21 #define __GTK_CHART_H__
23 #include "gtk-chart-colors.h"
26 #define GTK_TYPE_CHART (gtk_chart_get_type ())
27 #define GTK_CHART(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CHART, GtkChart))
28 #define GTK_CHART_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHART, GtkChartClass)
29 #define GTK_IS_CHART(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CHART))
30 #define GTK_IS_CHART_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHART))
31 #define GTK_CHART_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CHART, GtkChartClass))
33 typedef struct _GtkChart GtkChart
;
34 typedef struct _GtkChartClass GtkChartClass
;
35 //typedef struct _GtkChartPrivate GtkChartPrivate;
37 typedef struct _ChartItem ChartItem
;
38 typedef gchar (* GtkChartPrintIntFunc
) (gint value
, gboolean minor
);
39 typedef gchar (* GtkChartPrintDoubleFunc
) (gdouble value
, gboolean minor
);
41 /* = = = = = = = = = = */
42 /* = = = = = = = = = = = = = = = = = = = = */
43 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
44 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
47 #define PHI 1.61803399
50 /* default zoomx for charts */
51 #define GTK_CHART_BARW 24
53 #define GTK_CHART_MINBARW 4
54 #define GTK_CHART_MAXBARW 128
56 #define GTK_CHART_MINRADIUS 64
59 #define CHART_BUFFER_LENGTH 128
62 #define PIE_LINE_SLICE 0
65 #define CHART_PIE_DONUT 1
69 #define CHART_MARGIN 18 //standard a4 margin
70 #define CHART_SPACING 6
72 //#define PROP_SHOW_MINOR 6
73 //#define PROP_SHOW_LEGEND 7
106 double angle2
; /* rate for pie */
107 double height
; /* for column */
116 //GtkChartPrivate *priv;
119 /* all below should be in priv normally */
123 GtkAdjustment
*adjustment
;
124 GtkWidget
*scrollbar
;
126 GtkWidget
*scrollwin
;
128 GtkTreeModel
*legend
;
137 /* chart properties */
151 GtkColorScheme color_scheme
;
153 /* cairo default value */
154 PangoFontDescription
*pfd
;
158 cairo_surface_t
*surface
;
160 /* draw area coordinates */
161 double l
, t
, b
, r
, w
, h
;
162 /* our drawing rectangle with margin */
168 double subtitle_zh
, subtitle_y
;
172 gint lastx
, lasty
, lastactive
;
173 gint lastpress_x
, lastpress_y
;
179 gint rayon
, left
, top
;
182 double rawmin
, rawmax
, range
, min
, max
, unit
, minimum
;
188 double scale_x
, scale_y
, scale_w
, scale_h
;
189 double graph_x
, graph_y
, graph_width
, graph_height
; //graph dimension
190 double barw
, blkw
, posbarh
, negbarh
;
192 gchar buffer1
[CHART_BUFFER_LENGTH
];
193 gchar buffer2
[CHART_BUFFER_LENGTH
];
196 struct _GtkChartClass
198 GtkBoxClass parent_class
;
200 /* Padding for future expansion */
201 void (*_gtk_reserved1
) (void);
202 void (*_gtk_reserved2
) (void);
203 void (*_gtk_reserved3
) (void);
204 void (*_gtk_reserved4
) (void);
207 GType
gtk_chart_get_type (void) G_GNUC_CONST
;
209 /* public function */
210 GtkWidget
*gtk_chart_new(gint type
);
212 void gtk_chart_set_type(GtkChart
*chart
, gint type
);
213 void gtk_chart_set_color_scheme(GtkChart
* chart
, gint colorscheme
);
215 void gtk_chart_queue_redraw(GtkChart
*chart
);
217 void gtk_chart_set_datas(GtkChart
*chart
, GtkTreeModel
*model
, guint column
, gchar
*title
, gchar
*subtitle
);
218 void gtk_chart_set_dualdatas(GtkChart
*chart
, GtkTreeModel
*model
, guint column1
, guint column2
, gchar
*title
, gchar
*subtitle
);
220 void gtk_chart_set_minor_prefs(GtkChart
* chart
, gdouble rate
, gchar
*symbol
);
221 void gtk_chart_set_currency(GtkChart
* chart
, guint32 kcur
);
223 void gtk_chart_set_overdrawn(GtkChart
* chart
, gdouble minimum
);
224 void gtk_chart_set_every_xval(GtkChart
* chart
, gint decay
);
225 void gtk_chart_set_barw(GtkChart
* chart
, gdouble barw
);
226 void gtk_chart_set_showmono(GtkChart
* chart
, gboolean mono
);
228 void gtk_chart_show_legend(GtkChart
* chart
, gboolean visible
, gboolean showextracol
);
229 void gtk_chart_show_overdrawn(GtkChart
* chart
, gboolean visible
);
230 void gtk_chart_show_xval(GtkChart
* chart
, gboolean visible
);
231 void gtk_chart_show_minor(GtkChart
* chart
, gboolean minor
);
232 void gtk_chart_set_absolute(GtkChart
* chart
, gboolean abs
);
235 #endif /* __GTK_CHART_H__ */