GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-dense-cal.h
1 /********************************************************************\
2  * gnc-dense-cal.h : a custom densely-dispalyed calendar widget *
3  * Copyright (C) 2002,2006 Joshua Sled <[email protected]> *
4  * *
5  * This program is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public License as *
7  * published by the Free Software Foundation, under version 2 and/or version 3 of *
8  * the License. *
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 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, contact: *
17  * *
18  * Free Software Foundation Voice: +1-617-542-5942 *
19  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
20  * Boston, MA 02110-1301, USA [email protected] *
21 \********************************************************************/
22 
23 #ifndef _GNC_DENSE_CAL_H
24 #define _GNC_DENSE_CAL_H
25 
26 #include "config.h"
27 
28 #include <glib.h>
29 #include "gnc-dense-cal-model.h"
30 #include <gtk/gtk.h>
31 
32 G_BEGIN_DECLS
33 
34 #define GNC_TYPE_DENSE_CAL (gnc_dense_cal_get_type ())
35 #define GNC_DENSE_CAL(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gnc_dense_cal_get_type (), GncDenseCal)
36 #define GNC_DENSE_CAL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gnc_dense_cal_get_type (), GncDenseCalClass)
37 #define GNC_IS_DENSE_CAL(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gnc_dense_cal_get_type ())
38 
39 typedef struct _GncDenseCal GncDenseCal;
40 typedef struct _GncDenseCalClass GncDenseCalClass;
41 
42 typedef struct _gdc_month_coords
43 {
44  gint x, y;
46 
47 enum GDC_COLORS
48 {
49  MONTH_THIS = 0,
50  MONTH_THAT,
51  MAX_COLORS
52 };
53 
55 {
56  GtkVBox widget;
57 
58  GtkComboBox *view_options;
59  GtkDrawingArea *cal_drawing_area;
60 
61  GdkPixmap *drawbuf;
62 
63  gboolean initialized;
64 
65  gboolean showPopup;
66  GtkWindow *transPopup;
67 
68  gint min_x_scale;
69  gint min_y_scale;
70 
71  gint x_scale;
72  gint y_scale;
73 
74  gint numMonths;
75  gint monthsPerCol;
76  gint num_weeks; /* computed */
77 
78  GDateMonth month;
79  gint year;
80  gint firstOfMonthOffset;
81 
82  gint leftPadding;
83  gint topPadding;
84 
85  gdc_month_coords monthPositions[12];
86 
87  GdkColor weekColors[MAX_COLORS];
88 
89  guint label_width;
90  guint label_height;
91  gint dayLabelHeight;
92 
93  GncDenseCalModel *model;
94 
95  guint lastMarkTag;
96 
97  gint week_starts_monday;
98 
102  GList *markData;
103  int numMarks;
104  /* array of GList*s of per-cell markings. */
105  GList **marks;
106 
107  int disposed; /* private */
108 };
109 
111 {
112  GtkVBoxClass parent_class;
113 };
114 
115 typedef struct _gdc_mark_data
116 {
117  gchar *name;
118  gchar *info;
119  guint tag;
123  GList *ourMarks;
124 } gdc_mark_data;
125 
126 GtkWidget* gnc_dense_cal_new (void);
127 GtkWidget* gnc_dense_cal_new_with_model (GncDenseCalModel *model);
128 GType gnc_dense_cal_get_type (void);
129 
130 void gnc_dense_cal_set_model(GncDenseCal *cal, GncDenseCalModel *model);
131 
132 void gnc_dense_cal_set_month(GncDenseCal *dcal, GDateMonth mon);
133 GDateMonth gnc_dense_cal_get_month( GncDenseCal *dcal );
137 void gnc_dense_cal_set_year( GncDenseCal *dcal, guint year );
138 GDateYear gnc_dense_cal_get_year( GncDenseCal *dcal );
139 
140 void gnc_dense_cal_set_num_months( GncDenseCal *dcal, guint num_months );
141 guint gnc_dense_cal_get_num_months( GncDenseCal *dcal );
142 
143 void gnc_dense_cal_set_months_per_col( GncDenseCal *dcal, guint monthsPerCol );
144 
145 G_END_DECLS
146 
147 #endif /* _GNC_DENSE_CAL_H */
GList * markData