]> Dogcows Code - chaz/homebank/blob - src/gtk-chart-stack.h
add editorconfig file
[chaz/homebank] / src / gtk-chart-stack.h
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2018 Maxime DOYEN
3 *
4 * This file is part of HomeBank.
5 *
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.
10 *
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.
15 *
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/>.
18 */
19
20 #ifndef __CHARTSTACK_H__
21 #define __CHARTSTACK_H__
22
23 #include "gtk-chart-colors.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29
30 /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
31 * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
32 */
33 #define GTK_TYPE_CHARTSTACK (ui_chart_stack_get_type ())
34 #define GTK_CHARTSTACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CHARTSTACK, ChartStack))
35 #define GTK_CHARTSTACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHARTSTACK, ChartStackClass)
36 #define GTK_IS_CHARTSTACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CHARTSTACK))
37 #define GTK_IS_CHARTSTACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHARTSTACK))
38 #define GTK_CHARTSTACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CHARTSTACK, ChartStackClass))
39
40 typedef struct _ChartStack ChartStack;
41 typedef struct _ChartStackClass ChartStackClass;
42
43 typedef struct _StackItem StackItem;
44
45 typedef gchar (* ChartStackPrintIntFunc) (gint value, gboolean minor);
46 typedef gchar (* ChartStackPrintDoubleFunc) (gdouble value, gboolean minor);
47
48 /* = = = = = = = = = = */
49 /* = = = = = = = = = = = = = = = = = = = = */
50 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
51 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
52
53 #define GTK_CHARTSTACK_BARW 32
54 #define CHART_BUFFER_LENGTH 128
55
56
57 #define DEFAULT_DELAY 500 /* Default delay in ms */
58
59
60 #define CHART_MARGIN 18 //standard a4 margin
61 #define CHART_SPACING 6
62
63
64
65 struct _StackItem
66 {
67 /* data part */
68 gchar *label;
69 gdouble spent;
70 gdouble budget;
71 gdouble result;
72 gchar *status;
73
74 /* draw stuffs */
75 gdouble rate;
76 gboolean warn;
77
78 /* tmp datas */
79 gdouble rawrate;
80
81 };
82
83
84
85 /* you should access only the entry and list fields directly */
86 struct _ChartStack
87 {
88 /*< private >*/
89 GtkBox hbox;
90
91 GtkWidget *drawarea;
92 GtkAdjustment *adjustment;
93 GtkWidget *scrollbar;
94
95 /* data storage */
96 gint nb_items;
97 GArray *items;
98
99 /*gchar **titles;
100 gdouble *spent;
101 gdouble *budget;*/
102
103 gchar *title;
104 gchar *subtitle;
105
106 gchar *budget_title;
107 gchar *result_title;
108
109 gboolean minor;
110 guint32 kcur;
111 gdouble minor_rate;
112 gchar *minor_symbol;
113
114
115
116 /* color datas */
117 GtkColorScheme color_scheme;
118
119 /* cairo default value */
120 PangoFontDescription *pfd;
121 gint pfd_size;
122
123 /* buffer surface */
124 cairo_surface_t *surface;
125
126
127 double barw, blkw;
128
129 /* draw area coordinates */
130 double l, t, b, r, w, h;
131
132 /* zones height */
133 double title_zh;
134 double subtitle_zh, subtitle_y;
135 double header_zh, header_y;
136 double item_zh;
137
138 /* column width */
139 double cat_col_w;
140 double bud_col_w;
141 double res_col_w;
142 double rel_col_w;
143
144
145 double graph_width, graph_height; //graph dimension
146 gint visible;
147
148 gint active, lastactive;
149
150 gchar buffer[CHART_BUFFER_LENGTH];
151
152 };
153
154
155 struct _ChartStackClass {
156 GtkBoxClass parent_class;
157
158 /* Padding for future expansion */
159 void (*_gtk_reserved1) (void);
160 void (*_gtk_reserved2) (void);
161 void (*_gtk_reserved3) (void);
162 void (*_gtk_reserved4) (void);
163 };
164
165
166 GType ui_chart_stack_get_type (void);
167
168
169 /* public function */
170 GtkWidget *ui_chart_stack_new(void);
171
172 void ui_chart_stack_set_color_scheme(ChartStack * chart, gint colorscheme);
173 void ui_chart_stack_set_dualdatas(ChartStack *chart, GtkTreeModel *model, gchar *coltitle1, gchar *coltitle2, gchar *title, gchar *subtitle);
174 void ui_chart_stack_set_title(ChartStack * chart, gchar *title);
175 void ui_chart_stack_set_subtitle(ChartStack * chart, gchar *subtitle);
176 void ui_chart_stack_set_barw(ChartStack * chart, gdouble barw);
177 void ui_chart_stack_show_minor(ChartStack * chart, gboolean minor);
178
179 void ui_chart_stack_set_minor_prefs(ChartStack * chart, gdouble rate, gchar *symbol);
180 void ui_chart_stack_set_currency(ChartStack * chart, guint32 kcur);
181
182 #ifdef __cplusplus
183 }
184 #endif /* __cplusplus */
185
186 #endif /* __CHARTSTACK_H__ */
This page took 0.035557 seconds and 4 git commands to generate.