Put function name in the changelog.
[hildon] / src / hildon-calendar.h
1 /*
2  * This file is a part of hildon
3  *
4  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
5  *
6  * GTK Calendar Widget
7  * Copyright (C) 1998 Cesar Miquel and Shawn T. Amundson
8
9  * HldonCalendar modifications
10  * Copyright (C) 2005, 2006 Nokia Corporation. 
11  *
12  * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version. or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this library; if not, write to the Free
26  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28
29 /*
30  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
31  * file for a list of people on the GTK+ Team.  See the ChangeLog
32  * files for a list of changes.  These files are distributed with
33  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
34  */
35
36 #ifndef                                         __HILDON_CALENDAR_H__
37 #define                                         __HILDON_CALENDAR_H__
38
39 #include                                        <gdk/gdk.h>
40 #include                                        <gtk/gtkwidget.h>
41
42 /* Not needed, retained for compatibility -Yosh */
43 #include                                        <gtk/gtksignal.h>
44
45 G_BEGIN_DECLS
46
47 #define                                         HILDON_TYPE_CALENDAR \
48                                                 (hildon_calendar_get_type ())
49
50 #define                                         HILDON_CALENDAR(obj) \
51                                                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
52                                                 HILDON_TYPE_CALENDAR, HildonCalendar))
53
54 #define                                         HILDON_CALENDAR_CLASS(klass) \
55                                                 (G_TYPE_CHECK_CLASS_CAST ((klass), \
56                                                 HILDON_TYPE_CALENDAR, HildonCalendarClass))
57
58 #define                                         HILDON_IS_CALENDAR(obj) \
59                                                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_TYPE_CALENDAR))
60
61 #define                                         HILDON_IS_CALENDAR_CLASS(klass) \
62                                                 (G_TYPE_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_CALENDAR))
63
64 #define                                         HILDON_CALENDAR_GET_CLASS(obj) \
65                                                 (G_TYPE_INSTANCE_GET_CLASS ((obj), HILDON_TYPE_CALENDAR, HildonCalendarClass))
66
67 typedef struct                                  _HildonCalendar HildonCalendar;
68
69 typedef struct                                  _HildonCalendarClass HildonCalendarClass;
70
71 typedef enum
72 {
73     HILDON_CALENDAR_SHOW_HEADING                = 1 << 0,
74     HILDON_CALENDAR_SHOW_DAY_NAMES              = 1 << 1,
75     HILDON_CALENDAR_NO_MONTH_CHANGE             = 1 << 2,
76     HILDON_CALENDAR_SHOW_WEEK_NUMBERS           = 1 << 3,
77     HILDON_CALENDAR_WEEK_START_MONDAY           = 1 << 4
78 } HildonCalendarDisplayOptions;
79
80 struct                                          _HildonCalendar
81 {
82     GtkWidget widget;
83
84     GtkStyle  *header_style;
85     GtkStyle  *label_style;
86
87     gint month;
88     gint year;
89     gint selected_day;
90
91     gint day_month[6][7];
92     gint day[6][7];
93
94     gint num_marked_dates;
95     gint marked_date[31];
96     HildonCalendarDisplayOptions  display_flags;
97     GdkColor marked_date_color[31];
98
99     GdkGC *gc;
100     GdkGC *xor_gc;
101
102     gint focus_row;
103     gint focus_col;
104
105     gint highlight_row;
106     gint highlight_col;
107
108     gpointer private_data;
109     gchar grow_space [32];
110
111     /* Padding for future expansion */
112     void (*_gtk_reserved1) (void);
113     void (*_gtk_reserved2) (void);
114     void (*_gtk_reserved3) (void);
115     void (*_gtk_reserved4) (void);
116 };
117
118 struct                                          _HildonCalendarClass
119 {
120     GtkWidgetClass parent_class;
121
122     /* Signal handlers */
123     void (* month_changed)                      (HildonCalendar *calendar);
124     void (* day_selected)                       (HildonCalendar *calendar);
125     void (* day_selected_double_click)          (HildonCalendar *calendar);
126     void (* prev_month)                         (HildonCalendar *calendar);
127     void (* next_month)                         (HildonCalendar *calendar);
128     void (* prev_year)                          (HildonCalendar *calendar);
129     void (* next_year)                          (HildonCalendar *calendar);
130 };
131
132
133 GType G_GNUC_CONST
134 hildon_calendar_get_type                        (void);
135
136 GtkWidget* 
137 hildon_calendar_new                             (void);
138
139 gboolean   
140 hildon_calendar_select_month                    (HildonCalendar *calendar, 
141                                                  guint month,
142                                                  guint year);
143
144 void       
145 hildon_calendar_select_day                      (HildonCalendar *calendar,
146                                                  guint day);
147
148 gboolean   
149 hildon_calendar_mark_day                        (HildonCalendar *calendar,
150                                                  guint day);
151
152 gboolean   
153 hildon_calendar_unmark_day                      (HildonCalendar *calendar,
154                                                  guint day);
155
156 void    
157 hildon_calendar_clear_marks                     (HildonCalendar *calendar);
158
159 void       
160 hildon_calendar_set_display_options             (HildonCalendar *calendar,
161                                                  HildonCalendarDisplayOptions flags);
162
163 HildonCalendarDisplayOptions
164 hildon_calendar_get_display_options             (HildonCalendar *calendar);
165
166 void       
167 hildon_calendar_get_date                        (HildonCalendar *calendar, 
168                                                  guint *year,
169                                                  guint *month,
170                                                  guint *day);
171
172 void      
173 hildon_calendar_freeze                          (HildonCalendar *calendar);
174
175 void    
176 hildon_calendar_thaw                            (HildonCalendar *calendar);
177
178 G_END_DECLS
179
180 #endif                                          /* __HILDON_CALENDAR_H__ */