~ubuntu-branches/ubuntu/intrepid/osmo/intrepid-proposed

« back to all changes in this revision

Viewing changes to src/calendar_widget.h

  • Committer: Bazaar Package Importer
  • Author(s): Eike Nicklas
  • Date: 2008-02-09 12:49:42 UTC
  • Revision ID: james.westby@ubuntu.com-20080209124942-7f8x8oro11pzkiws
Tags: upstream-0.2.0
ImportĀ upstreamĀ versionĀ 0.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GTK - The GIMP Toolkit
 
2
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 
3
 *
 
4
 * GTK Calendar Widget
 
5
 * Copyright (C) 1998 Cesar Miquel and Shawn T. Amundson
 
6
 *
 
7
 * This library is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser 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.
 
11
 *
 
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
 * Lesser General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU Lesser 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.
 
20
 */
 
21
 
 
22
/*
 
23
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
 
24
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 
25
 * files for a list of changes.  These files are distributed with
 
26
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
 
27
 */
 
28
 
 
29
/*
 
30
 * Some minor modifications and adaptation to OSMO - a handy personal
 
31
 * manager by pasp@users.sourceforge.net
 
32
 */
 
33
 
 
34
#ifndef _CALENDAR_WIDGET_H
 
35
#define _CALENDAR_WIDGET_H
 
36
 
 
37
#include <gdk/gdk.h>
 
38
#include <gtk/gtkwidget.h>
 
39
 
 
40
/* Not needed, retained for compatibility -Yosh */
 
41
#include <gtk/gtksignal.h>
 
42
 
 
43
 
 
44
G_BEGIN_DECLS
 
45
 
 
46
#define GUI_TYPE_CALENDAR                  (gui_calendar_get_type ())
 
47
#define GUI_CALENDAR(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GUI_TYPE_CALENDAR, GuiCalendar))
 
48
#define GUI_CALENDAR_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GUI_TYPE_CALENDAR, GuiCalendarClass))
 
49
#define GUI_IS_CALENDAR(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUI_TYPE_CALENDAR))
 
50
#define GUI_IS_CALENDAR_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GUI_TYPE_CALENDAR))
 
51
#define GUI_CALENDAR_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GUI_TYPE_CALENDAR, GuiCalendarClass))
 
52
 
 
53
 
 
54
typedef struct _GuiCalendar             GuiCalendar;
 
55
typedef struct _GuiCalendarClass       GuiCalendarClass;
 
56
 
 
57
typedef struct _GuiCalendarPrivate     GuiCalendarPrivate;
 
58
 
 
59
typedef enum {
 
60
    GUI_CALENDAR_SHOW_HEADING       = 1 << 0,
 
61
    GUI_CALENDAR_SHOW_DAY_NAMES     = 1 << 1,
 
62
    GUI_CALENDAR_NO_MONTH_CHANGE    = 1 << 2,
 
63
    GUI_CALENDAR_SHOW_WEEK_NUMBERS  = 1 << 3,
 
64
    GUI_CALENDAR_WEEK_START_MONDAY  = 1 << 4
 
65
} GuiCalendarDisplayOptions;
 
66
 
 
67
enum {
 
68
    CURSOR_BLOCK = 0,
 
69
    CURSOR_FRAME
 
70
};
 
71
 
 
72
struct _GuiCalendar {
 
73
    GtkWidget widget;
 
74
 
 
75
    GtkStyle  *header_style;
 
76
    GtkStyle  *label_style;
 
77
 
 
78
    gint month;
 
79
    gint year;
 
80
    gint selected_day;
 
81
 
 
82
    gint day_month[6][7];
 
83
    gint day[6][7];
 
84
 
 
85
    gint tc_num_marked_dates;
 
86
    gint tc_marked_date[31];
 
87
 
 
88
    gint num_marked_dates;
 
89
    gint marked_date[31];
 
90
    GuiCalendarDisplayOptions  display_flags;
 
91
    GdkColor marked_date_color[31];
 
92
 
 
93
    GdkColor header_color;
 
94
    GdkColor weekend_color;
 
95
    GdkColor selector_color;
 
96
    GdkColor tc_mark_color;
 
97
 
 
98
    gunichar mark_sign;
 
99
    gint cursor_type;
 
100
    gint frame_cursor_thickness;
 
101
 
 
102
    gboolean enable_cursor;
 
103
 
 
104
    GdkGC *gc;          /* unused */
 
105
    GdkGC *xor_gc;      /* unused */
 
106
 
 
107
    gint focus_row;
 
108
    gint focus_col;
 
109
 
 
110
    gint highlight_row;
 
111
    gint highlight_col;
 
112
 
 
113
    GuiCalendarPrivate *priv;
 
114
    gchar grow_space [32];
 
115
 
 
116
    /* Padding for future expansion */
 
117
    void (*_gtk_reserved1) (void);
 
118
    void (*_gtk_reserved2) (void);
 
119
    void (*_gtk_reserved3) (void);
 
120
    void (*_gtk_reserved4) (void);
 
121
};
 
122
 
 
123
struct _GuiCalendarClass {
 
124
    GtkWidgetClass parent_class;
 
125
 
 
126
    /* Signal handlers */
 
127
    void (* month_changed)                  (GuiCalendar *calendar);
 
128
    void (* day_selected)                       (GuiCalendar *calendar);
 
129
    void (* day_selected_double_click)      (GuiCalendar *calendar);
 
130
    void (* prev_month)                     (GuiCalendar *calendar);
 
131
    void (* next_month)                     (GuiCalendar *calendar);
 
132
    void (* prev_year)                      (GuiCalendar *calendar);
 
133
    void (* next_year)                      (GuiCalendar *calendar);
 
134
 
 
135
};
 
136
 
 
137
GType      gui_calendar_get_type            (void) G_GNUC_CONST;
 
138
GtkWidget* gui_calendar_new                 (void);
 
139
 
 
140
gboolean   gui_calendar_select_month        (GuiCalendar *calendar, guint month, guint year);
 
141
void       gui_calendar_select_day          (GuiCalendar *calendar, guint day);
 
142
 
 
143
gboolean   gui_calendar_mark_day            (GuiCalendar *calendar, guint day);
 
144
gboolean   gui_calendar_tc_mark_day         (GuiCalendar *calendar, guint day);
 
145
gboolean   gui_calendar_mark_day_color      (GuiCalendar *calendar, guint day, gchar *color_str);
 
146
gboolean   gui_calendar_unmark_day          (GuiCalendar *calendar, guint day);
 
147
gboolean   gui_calendar_tc_unmark_day       (GuiCalendar *calendar, guint day);
 
148
void       gui_calendar_clear_marks         (GuiCalendar *calendar);
 
149
void       gui_calendar_tc_clear_marks      (GuiCalendar *calendar);
 
150
 
 
151
 
 
152
void       gui_calendar_set_display_options (GuiCalendar *calendar, GuiCalendarDisplayOptions flags);
 
153
GuiCalendarDisplayOptions       gui_calendar_get_display_options (GuiCalendar *calendar);
 
154
 
 
155
void       gui_calendar_get_date            (GuiCalendar *calendar, guint *year, guint *month, guint *day);
 
156
 
 
157
void       gui_calendar_set_header_color    (GuiCalendar *calendar, const char *color);
 
158
void       gui_calendar_set_weekend_color   (GuiCalendar *calendar, const char *color);
 
159
void       gui_calendar_set_selector_color  (GuiCalendar *calendar, const char *color);
 
160
void       gui_calendar_set_tc_mark_color   (GuiCalendar *calendar, const gchar *color);
 
161
void       gui_calendar_set_mark_symbol     (GuiCalendar *calendar, const gchar *symbol);
 
162
 
 
163
void       gui_calendar_set_cursor_type     (GuiCalendar *calendar, gint cursor_type);
 
164
void       gui_calendar_set_frame_cursor_thickness (GuiCalendar *calendar, gint thickness);
 
165
void       gui_calendar_enable_cursor       (GuiCalendar *calendar, gboolean state);
 
166
 
 
167
guint      weeks_in_year                    (guint year);
 
168
guint      week_number                      (guint year, guint mm, guint dd);
 
169
guint      day_of_week                      (guint year, guint mm, guint dd);
 
170
 
 
171
G_END_DECLS
 
172
 
 
173
#endif /* _CALENDAR_WIDGET_H */
 
174