aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-cal-view.h
blob: 0212e28006fb490311bf995b2137337e4f3953d0 (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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */

/* 
 * Author : 
 *  Rodrigo Moya <rodrigo@ximian.com>
 *
 * Copyright 2003, Ximian, Inc.
 *
 * This program is free software; you can redistribute it and/or 
 * modify it under the terms of version 2 of the GNU General Public 
 * License as published by the Free Software Foundation.
 *
 * 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */
#ifndef _E_CAL_VIEW_H_
#define _E_CAL_VIEW_H_

#include <cal-client/cal-client.h>
#include <gtk/gtktable.h>
#include "e-cal-model.h"
#include "gnome-cal.h"

G_BEGIN_DECLS

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

#define E_CAL_VIEW(obj)          GTK_CHECK_CAST (obj, e_cal_view_get_type (), ECalView)
#define E_CAL_VIEW_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, e_cal_view_get_type (), ECalViewClass)
#define E_IS_CAL_VIEW(obj)       GTK_CHECK_TYPE (obj, e_cal_view_get_type ())

typedef enum {
    E_CAL_VIEW_POS_OUTSIDE,
    E_CAL_VIEW_POS_NONE,
    E_CAL_VIEW_POS_EVENT,
    E_CAL_VIEW_POS_LEFT_EDGE,
    E_CAL_VIEW_POS_RIGHT_EDGE,
    E_CAL_VIEW_POS_TOP_EDGE,
    E_CAL_VIEW_POS_BOTTOM_EDGE
} ECalViewPosition;

#define E_CAL_VIEW_EVENT_FIELDS \
        GnomeCanvasItem *canvas_item; \
        ECalModelComponent *comp_data; \
        gboolean allocated_comp_data; \
        time_t start; \
        time_t end; \
        guint16 start_minute; \
        guint16 end_minute; \
        guint different_timezone : 1;

typedef struct {
    E_CAL_VIEW_EVENT_FIELDS
} ECalViewEvent;
        
typedef struct _ECalView        ECalView;
typedef struct _ECalViewClass   ECalViewClass;
typedef struct _ECalViewPrivate ECalViewPrivate;

struct _ECalView {
    GtkTable table;
    ECalViewPrivate *priv;
};

struct _ECalViewClass {
    GtkTableClass parent_class;

    /* Notification signals */
    void (* selection_changed) (ECalView *cal_view);
    void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
    void (* event_changed) (ECalView *day_view, ECalViewEvent *event);
    void (* event_added) (ECalView *day_view, ECalViewEvent *event);

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

GType          e_cal_view_get_type (void);

GnomeCalendar *e_cal_view_get_calendar (ECalView *cal_view);
void           e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar);
ECalModel     *e_cal_view_get_model (ECalView *cal_view);
void           e_cal_view_set_model (ECalView *cal_view, ECalModel *model);
icaltimezone  *e_cal_view_get_timezone (ECalView *cal_view);
void           e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone);
const char    *e_cal_view_get_default_category (ECalView *cal_view);
void           e_cal_view_set_default_category (ECalView *cal_view, const char *category);

void           e_cal_view_set_status_message (ECalView *cal_view, const gchar *message);

GList         *e_cal_view_get_selected_events (ECalView *cal_view);
void           e_cal_view_get_selected_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
void           e_cal_view_set_selected_time_range (ECalView *cal_view, time_t start_time, time_t end_time);
gboolean       e_cal_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time);
void           e_cal_view_update_query (ECalView *cal_view);

void           e_cal_view_cut_clipboard (ECalView *cal_view);
void           e_cal_view_copy_clipboard (ECalView *cal_view);
void           e_cal_view_paste_clipboard (ECalView *cal_view);
void           e_cal_view_delete_selected_event (ECalView *cal_view);
void           e_cal_view_delete_selected_events (ECalView *cal_view);
void           e_cal_view_delete_selected_occurrence (ECalView *cal_view);

GtkMenu       *e_cal_view_create_popup_menu (ECalView *cal_view);

void           e_cal_view_add_event (ECalView *cal_view, CalClient *client, time_t dtstart, 
                     icaltimezone *default_zone, icalcomponent *icalcomp, gboolean in_top_canvas);
void           e_cal_view_new_appointment_for (ECalView *cal_view,
                           time_t dtstart,
                           time_t dtend,
                           gboolean all_day,
                           gboolean meeting);
void           e_cal_view_new_appointment (ECalView *cal_view);
void           e_cal_view_edit_appointment (ECalView *cal_view,
                        CalClient *client,
                        icalcomponent *icalcomp,
                        gboolean meeting);

G_END_DECLS

#endif