aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-calendar-view.h
blob: 63e3c149fdea8e205ee2a003ec01ac9369154078 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>  
 *
 *
 * Authors:
 *      Rodrigo Moya <rodrigo@ximian.com>
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

#ifndef _E_CALENDAR_VIEW_H_
#define _E_CALENDAR_VIEW_H_

#include <libecal/e-cal.h>
#include <gtk/gtk.h>
#include "e-cal-model.h"
#include "gnome-cal.h"
#include "e-activity-handler.h"

G_BEGIN_DECLS

/*
 * EView - base widget class for the calendar views.
 */

#define E_TYPE_CALENDAR_VIEW          (e_calendar_view_get_type ())
#define E_CALENDAR_VIEW(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, e_calendar_view_get_type (), ECalendarView)
#define E_CALENDAR_VIEW_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, e_calendar_view_get_type (), ECalendarViewClass)
#define E_IS_CALENDAR_VIEW(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, e_calendar_view_get_type ())

typedef enum {
    E_CALENDAR_VIEW_POS_OUTSIDE,
    E_CALENDAR_VIEW_POS_NONE,
    E_CALENDAR_VIEW_POS_EVENT,
    E_CALENDAR_VIEW_POS_LEFT_EDGE,
    E_CALENDAR_VIEW_POS_RIGHT_EDGE,
    E_CALENDAR_VIEW_POS_TOP_EDGE,
    E_CALENDAR_VIEW_POS_BOTTOM_EDGE
} ECalendarViewPosition;

typedef enum {
    E_CAL_VIEW_MOVE_UP,
    E_CAL_VIEW_MOVE_DOWN,
    E_CAL_VIEW_MOVE_LEFT,
    E_CAL_VIEW_MOVE_RIGHT,
    E_CAL_VIEW_MOVE_PAGE_UP,
    E_CAL_VIEW_MOVE_PAGE_DOWN
} ECalViewMoveDirection;

#define E_CALENDAR_VIEW_EVENT_FIELDS \
        GnomeCanvasItem *canvas_item; \
        ECalModelComponent *comp_data; \
        time_t start; \
        time_t end; \
        guint16 start_minute; \
        guint16 end_minute; \
        guint different_timezone : 1; \
    GtkWidget *tooltip; \
    gint    timeout; \
    GdkColor *color; \
    gint x,y;

typedef struct {
    E_CALENDAR_VIEW_EVENT_FIELDS
} ECalendarViewEvent;

typedef struct _ECalendarView        ECalendarView;
typedef struct _ECalendarViewClass   ECalendarViewClass;
typedef struct _ECalendarViewPrivate ECalendarViewPrivate;

struct _ECalendarView {
    GtkTable table;

    gboolean in_focus;
    ECalendarViewPrivate *priv;
};

typedef struct {
    ECalendarViewEvent * (* get_view_event) (ECalendarView *view, int day, int event_num);
    ECalendarView *cal_view;
    int day;
    int event_num;
} ECalendarViewEventData;

struct _ECalendarViewClass {
    GtkTableClass parent_class;

    /* Notification signals */
    void (* selection_changed) (ECalendarView *cal_view);
    void (* selected_time_changed) (ECalendarView *cal_view);
    void (* timezone_changed) (ECalendarView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
    void (* event_changed) (ECalendarView *day_view, ECalendarViewEvent *event);
    void (* event_added) (ECalendarView *day_view, ECalendarViewEvent *event);
    void (* user_created) (ECalendarView *cal_view);

    /* Virtual methods */
    GList * (* get_selected_events) (ECalendarView *cal_view); /* a GList of ECalendarViewEvent's */
    gboolean (* get_selected_time_range) (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
    void (* set_selected_time_range) (ECalendarView *cal_view, time_t start_time, time_t end_time);
    gboolean (* get_visible_time_range) (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
    void (* update_query) (ECalendarView *cal_view);
    void (* open_event) (ECalendarView *cal_view);
    void (* paste_text) (ECalendarView *cal_view);
};

GType          e_calendar_view_get_type (void);

GnomeCalendar *e_calendar_view_get_calendar (ECalendarView *cal_view);
void           e_calendar_view_set_calendar (ECalendarView *cal_view, GnomeCalendar *calendar);
ECalModel     *e_calendar_view_get_model (ECalendarView *cal_view);
void           e_calendar_view_set_model (ECalendarView *cal_view, ECalModel *model);
icaltimezone  *e_calendar_view_get_timezone (ECalendarView *cal_view);
void           e_calendar_view_set_timezone (ECalendarView *cal_view, icaltimezone *zone);
const char    *e_calendar_view_get_default_category (ECalendarView *cal_view);
void           e_calendar_view_set_default_category (ECalendarView *cal_view, const char *category);
gboolean       e_calendar_view_get_use_24_hour_format (ECalendarView *view);
void           e_calendar_view_set_use_24_hour_format (ECalendarView *view, gboolean use_24_hour);

void           e_calendar_view_set_activity_handler (ECalendarView *cal_view, EActivityHandler *activity_handler);
void           e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message, int percent);

GList         *e_calendar_view_get_selected_events (ECalendarView *cal_view);
gboolean       e_calendar_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
void           e_calendar_view_set_selected_time_range (ECalendarView *cal_view, time_t start_time, time_t end_time);
gboolean       e_calendar_view_get_visible_time_range (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
void           e_calendar_view_update_query (ECalendarView *cal_view);

void           e_calendar_view_cut_clipboard (ECalendarView *cal_view);
void           e_calendar_view_copy_clipboard (ECalendarView *cal_view);
void           e_calendar_view_paste_clipboard (ECalendarView *cal_view);
void           e_calendar_view_delete_selected_event (ECalendarView *cal_view);
void           e_calendar_view_delete_selected_events (ECalendarView *cal_view);
void           e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view);

GtkMenu       *e_calendar_view_create_popup_menu (ECalendarView *cal_view);

void           e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart,
                     icaltimezone *default_zone, icalcomponent *icalcomp, gboolean in_top_canvas);
void           e_calendar_view_new_appointment_for (ECalendarView *cal_view,
                            time_t dtstart,
                            time_t dtend,
                            gboolean all_day,
                            gboolean meeting);
void           e_calendar_view_new_appointment_full (ECalendarView *cal_view,
                             gboolean all_day,
                             gboolean meeting,
                             gboolean no_past_date);
void           e_calendar_view_new_appointment (ECalendarView *cal_view);
void           e_calendar_view_edit_appointment (ECalendarView *cal_view,
                        ECal *client,
                        icalcomponent *icalcomp,
                        gboolean meeting);
void           e_calendar_view_open_event (ECalendarView *cal_view);
void           e_calendar_view_modify_and_send (ECalComponent *comp,
                           ECal *client,
                           CalObjModType mod,
                           GtkWindow *toplevel,
                           gboolean new);
void e_calendar_utils_show_error_silent (struct _GtkWidget *widget);
void e_calendar_utils_show_info_silent(struct _GtkWidget *widget);

gboolean    e_calendar_view_get_tooltips (ECalendarViewEventData *data);

void           e_calendar_view_move_tip (GtkWidget *widget, int x, int y);

const gchar *e_calendar_view_get_icalcomponent_summary (ECal *ecal, icalcomponent *icalcomp, gboolean *free_text);
char *e_calendar_view_get_attendees_status_info (ECalComponent *comp, ECal *client);

void           draw_curved_rectangle (cairo_t *cr,
                                      double x0,
                                      double y0,
                                      double rect_width,
                                      double rect_height,
                                      double radius);

G_END_DECLS

#endif