2005-02-09 [colin] 1.0.1cvs1.1
[claws.git] / src / mimeview.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2003 Hiroyuki Yamamoto
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef MIMEVIEW_H
21 #define MIMEVIEW_H
22
23 typedef struct _MimeView                MimeView;
24 typedef struct _MimeViewerFactory       MimeViewerFactory;
25 typedef struct _MimeViewer              MimeViewer;
26
27 #include <glib.h>
28 #include <gdk/gdk.h>
29 #include <gtk/gtkwidget.h>
30 #include <gtk/gtkctree.h>
31 #include <gtk/gtktooltips.h>
32
33 #include "textview.h"
34 #include "messageview.h"
35 #include "procmime.h"
36 #include "noticeview.h"
37
38 typedef enum
39 {
40         MIMEVIEW_TEXT,
41         MIMEVIEW_VIEWER,
42 } MimeViewType;
43
44 struct _MimeView
45 {
46         GtkWidget *hbox;
47         GtkWidget *paned;
48         GtkWidget *scrolledwin;
49         GtkWidget *ctree;
50         GtkWidget *mime_notebook;
51         GtkWidget *ctree_mainbox;
52         GtkWidget *icon_scroll;
53         GtkWidget *icon_vbox;
54         GtkWidget *icon_mainbox;
55         GtkWidget *mime_toggle;
56
57         MimeViewType type;
58
59         GtkWidget *popupmenu;
60         GtkItemFactory *popupfactory;
61
62         GtkCTreeNode *opened;
63
64         TextView *textview;
65         MimeViewer *mimeviewer;
66
67         MessageView *messageview;
68
69         MimeInfo *mimeinfo;
70
71         gchar *file;
72
73         GSList *viewers;
74
75         GtkTargetList *target_list; /* DnD */
76
77         gint icon_count;
78         MainWindow *mainwin;
79         GtkTooltips *tooltips;
80         gint oldsize;
81
82         NoticeView *siginfoview;
83         MimeInfo *siginfo;
84 };
85
86 struct _MimeViewerFactory
87 {
88         /**
89          * Array of supported content types.
90          * Must be NULL terminated and lower case
91          */
92         gchar **content_types;
93         gint priority;
94         
95         MimeViewer *(*create_viewer) (void);
96 };
97
98 struct _MimeViewer
99 {
100         MimeViewerFactory *factory;
101     
102         GtkWidget       *(*get_widget)          (MimeViewer *);
103         void            (*show_mimepart)        (MimeViewer *, const gchar *infile, MimeInfo *);
104         void            (*clear_viewer)         (MimeViewer *);
105         void            (*destroy_viewer)       (MimeViewer *);
106 };
107
108 #ifdef __cplusplus
109 extern "C" {
110 #endif /* __cplusplus */
111
112
113 MimeView *mimeview_create       (MainWindow     *mainwin);
114 void mimeview_init              (MimeView       *mimeview);
115 void mimeview_show_message      (MimeView       *mimeview,
116                                  MimeInfo       *mimeinfo,
117                                  const gchar    *file);
118 gboolean mimeview_show_part     (MimeView       *mimeview, 
119                                  MimeInfo       *partinfo);
120 void mimeview_destroy           (MimeView       *mimeview);
121 void mimeview_update            (MimeView       *mimeview);
122 void mimeview_clear             (MimeView       *mimeview);
123
124 MimeInfo *mimeview_get_selected_part    (MimeView       *mimeview);
125
126 void mimeview_check_signature           (MimeView       *mimeview);
127 void mimeview_pass_key_press_event      (MimeView       *mimeview,
128                                          GdkEventKey    *event);
129
130 void mimeview_register_viewer_factory   (MimeViewerFactory *factory);
131 void mimeview_unregister_viewer_factory (MimeViewerFactory *factory);
132
133
134 #ifdef __cplusplus
135 }
136 #endif /* __cplusplus */
137
138 #endif /* __MIMEVIEW_H__ */