1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
5 * Copyright (C) 1998 Cesar Miquel and Shawn T. Amundson
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef __GTK_CALENDAR_H__
23 #define __GTK_CALENDAR_H__
26 #include <gtk/gtksignal.h>
27 #include <gtk/gtkwidget.h>
28 #include <gtk/gtkfeatures.h>
32 #endif /* __cplusplus */
34 #define GTK_CALENDAR(obj) GTK_CHECK_CAST (obj, gtk_calendar_get_type (), GtkCalendar)
35 #define GTK_CALENDAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_calendar_get_type (), GtkCalendarClass)
36 #define GTK_IS_CALENDAR(obj) GTK_CHECK_TYPE (obj, gtk_calendar_get_type ())
38 typedef struct _GtkCalendar GtkCalendar;
39 typedef struct _GtkCalendarClass GtkCalendarClass;
43 GTK_CALENDAR_SHOW_HEADING = 1 << 0,
44 GTK_CALENDAR_SHOW_DAY_NAMES = 1 << 1,
45 GTK_CALENDAR_NO_MONTH_CHANGE = 1 << 2,
46 GTK_CALENDAR_SHOW_WEEK_NUMBERS = 1 << 3,
47 GTK_CALENDAR_WEEK_START_MONDAY = 1 << 4
48 } GtkCalendarDisplayOptions;
52 /* This widget is derived from GtkWidget */
55 GdkWindow *header_win, *day_name_win, *main_win, *week_win;
56 gint header_h, day_name_h, main_h;
58 GtkStyle *header_style;
59 GtkStyle *label_style;
68 gint num_marked_dates;
70 GtkCalendarDisplayOptions display_flags;
71 GdkColor marked_date_color[31];
73 /* Header Information */
74 GdkWindow *arrow_win[4];
81 gint calstarty, calnumrows;
83 /* Style parameters for this widget */
89 GdkRectangle header_button[4];
90 GdkRectangle rect_days[6][7];
96 gint max_day_char_width;
97 gint max_day_char_ascent;
98 gint max_day_char_descent;
99 gint max_label_char_ascent;
100 gint max_label_char_descent;
101 gint max_week_char_width;
103 unsigned int dirty_header:1;
104 unsigned int dirty_day_names:1;
105 unsigned int dirty_main:1;
106 unsigned int dirty_week:1;
110 gint font_width_day_name, font_width_day;
111 char grow_space [32];
114 struct _GtkCalendarClass
116 GtkWidgetClass parent_class;
118 /* Signal handlers */
119 void (* gtk_calendar_month_changed) (GtkCalendarClass *);
120 void (* gtk_calendar_day_selected) (GtkCalendarClass *);
121 void (* gtk_calendar_day_selected_double_click) (GtkCalendarClass *);
122 void (* gtk_calendar_prev_month) (GtkCalendarClass *);
123 void (* gtk_calendar_next_month) (GtkCalendarClass *);
124 void (* gtk_calendar_prev_year) (GtkCalendarClass *);
125 void (* gtk_calendar_next_year) (GtkCalendarClass *);
130 guint gtk_calendar_get_type (void);
131 GtkWidget* gtk_calendar_new (void);
133 gint gtk_calendar_select_month (GtkCalendar *calendar,
134 gint month, gint year);
135 void gtk_calendar_select_day (GtkCalendar *calendar, gint day);
137 gint gtk_calendar_mark_day (GtkCalendar *calendar, gint day);
138 gint gtk_calendar_unmark_day (GtkCalendar *calendar, gint day);
139 void gtk_calendar_clear_marks (GtkCalendar *calendar);
142 void gtk_calendar_display_options (GtkCalendar *calendar,
143 GtkCalendarDisplayOptions flags);
145 void gtk_calendar_get_date (GtkCalendar *calendar,
146 gint *year, gint *month, gint *day);
147 void gtk_calendar_freeze (GtkCalendar *calendar);
148 void gtk_calendar_thaw (GtkCalendar *calendar);
151 #endif /* __cplusplus */
153 #endif /* __GTK_CALENDAR_H__ */