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: Rodrigo Novo <rodrigo.novo@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_DISABLE_DEPRECATED
37
38
#ifndef                                         __HILDON_CALENDAR_H__
39
#define                                         __HILDON_CALENDAR_H__
40
41
#include                                        <gtk/gtk.h>
42
43
G_BEGIN_DECLS
44
45
#define                                         HILDON_TYPE_CALENDAR \
46
                                                (hildon_calendar_get_type ())
47
48
#define                                         HILDON_CALENDAR(obj) \
49
                                                (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
50
                                                HILDON_TYPE_CALENDAR, HildonCalendar))
51
52
#define                                         HILDON_CALENDAR_CLASS(klass) \
53
                                                (G_TYPE_CHECK_CLASS_CAST ((klass), \
54
                                                HILDON_TYPE_CALENDAR, HildonCalendarClass))
55
56
#define                                         HILDON_IS_CALENDAR(obj) \
57
                                                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_TYPE_CALENDAR))
58
59
#define                                         HILDON_IS_CALENDAR_CLASS(klass) \
60
                                                (G_TYPE_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_CALENDAR))
61
62
#define                                         HILDON_CALENDAR_GET_CLASS(obj) \
63
                                                (G_TYPE_INSTANCE_GET_CLASS ((obj), HILDON_TYPE_CALENDAR, HildonCalendarClass))
64
65
typedef struct                                  _HildonCalendar HildonCalendar;
66
67
typedef struct                                  _HildonCalendarClass HildonCalendarClass;
68
69
typedef enum
70
{
71
    HILDON_CALENDAR_SHOW_HEADING                = 1 << 0,
72
    HILDON_CALENDAR_SHOW_DAY_NAMES              = 1 << 1,
73
    HILDON_CALENDAR_NO_MONTH_CHANGE             = 1 << 2,
74
    HILDON_CALENDAR_SHOW_WEEK_NUMBERS           = 1 << 3,
75
    HILDON_CALENDAR_WEEK_START_MONDAY           = 1 << 4
76
} HildonCalendarDisplayOptions;
77
78
struct                                          _HildonCalendar
79
{
80
    GtkWidget widget;
81
82
    GtkStyle  *header_style;
83
    GtkStyle  *label_style;
84
85
    gint month;
86
    gint year;
87
    gint selected_day;
88
89
    gint day_month[6][7];
90
    gint day[6][7];
91
92
    gint num_marked_dates;
93
    gint marked_date[31];
94
    HildonCalendarDisplayOptions  display_flags;
95
    GdkColor marked_date_color[31];
96
97
    GdkGC *gc;
98
    GdkGC *xor_gc;
99
100
    gint focus_row;
101
    gint focus_col;
102
103
    gint highlight_row;
104
    gint highlight_col;
105
106
    gpointer private_data;
107
    gchar grow_space [32];
108
109
    /* Padding for future expansion */
110
    void (*_gtk_reserved1) (void);
111
    void (*_gtk_reserved2) (void);
112
    void (*_gtk_reserved3) (void);
113
    void (*_gtk_reserved4) (void);
114
};
115
116
struct                                          _HildonCalendarClass
117
{
118
    GtkWidgetClass parent_class;
119
120
    /* Signal handlers */
121
    void (* month_changed)                      (HildonCalendar *calendar);
122
    void (* day_selected)                       (HildonCalendar *calendar);
123
    void (* day_selected_double_click)          (HildonCalendar *calendar);
124
    void (* prev_month)                         (HildonCalendar *calendar);
125
    void (* next_month)                         (HildonCalendar *calendar);
126
    void (* prev_year)                          (HildonCalendar *calendar);
127
    void (* next_year)                          (HildonCalendar *calendar);
128
};
129
130
131
GType G_GNUC_CONST
132
hildon_calendar_get_type                        (void);
133
134
GtkWidget* 
135
hildon_calendar_new                             (void);
136
137
gboolean   
138
hildon_calendar_select_month                    (HildonCalendar *calendar, 
139
                                                 guint month,
140
                                                 guint year);
141
142
void       
143
hildon_calendar_select_day                      (HildonCalendar *calendar,
144
                                                 guint day);
145
146
gboolean   
147
hildon_calendar_mark_day                        (HildonCalendar *calendar,
148
                                                 guint day);
149
150
gboolean   
151
hildon_calendar_unmark_day                      (HildonCalendar *calendar,
152
                                                 guint day);
153
154
void    
155
hildon_calendar_clear_marks                     (HildonCalendar *calendar);
156
157
void       
158
hildon_calendar_set_display_options             (HildonCalendar *calendar,
159
                                                 HildonCalendarDisplayOptions flags);
160
161
HildonCalendarDisplayOptions
162
hildon_calendar_get_display_options             (HildonCalendar *calendar);
163
164
void       
165
hildon_calendar_get_date                        (HildonCalendar *calendar, 
166
                                                 guint *year,
167
                                                 guint *month,
168
                                                 guint *day);
169
170
void      
171
hildon_calendar_freeze                          (HildonCalendar *calendar);
172
173
void    
174
hildon_calendar_thaw                            (HildonCalendar *calendar);
175
176
G_END_DECLS
177
178
#endif                                          /* __HILDON_CALENDAR_H__ */
179
180
#endif                                          /* HILDON_DISABLE_DEPRECATED */