997c5c772376ab73282883f882443006d228ce87
[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 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26
27 #include <glib.h>
28 #include <gdk/gdk.h>
29 #include <gtk/gtkwidget.h>
30 #include <gtk/gtkctree.h>
31
32 typedef struct _MimeView                MimeView;
33 typedef struct _MimeViewerFactory       MimeViewerFactory;
34 typedef struct _MimeViewer              MimeViewer;
35
36 #include "textview.h"
37 #include "messageview.h"
38 #include "procmime.h"
39
40 typedef enum
41 {
42         MIMEVIEW_TEXT,
43         MIMEVIEW_VIEWER,
44 } MimeViewType;
45
46 struct _MimeView
47 {
48         GtkWidget *notebook;
49         GtkWidget *vbox;
50
51         GtkWidget *paned;
52         GtkWidget *scrolledwin;
53         GtkWidget *ctree;
54         GtkWidget *mime_notebook;
55
56         MimeViewType type;
57
58         GtkWidget *popupmenu;
59         GtkItemFactory *popupfactory;
60
61         GtkCTreeNode *opened;
62
63         TextView *textview;
64         MimeViewer *mimeviewer;
65
66         MessageView *messageview;
67
68         MimeInfo *mimeinfo;
69
70         gchar *file;
71
72         GSList *viewers;
73
74         GtkTargetList *target_list; /* DnD */
75 };
76
77 struct _MimeViewerFactory
78 {
79         /**
80          * Array of supported content types.
81          * Must be NULL terminated and lower case
82          */
83         gchar **content_types;
84         gint priority;
85         
86         MimeViewer *(*create_viewer) (void);
87 };
88
89 struct _MimeViewer
90 {
91         MimeViewerFactory *factory;
92     
93         GtkWidget       *(*get_widget)          (MimeViewer *);
94         void            (*show_mimepart)        (MimeViewer *, const gchar *infile, MimeInfo *);
95         void            (*clear_viewer)         (MimeViewer *);
96         void            (*destroy_viewer)       (MimeViewer *);
97 };
98
99 MimeView *mimeview_create       (MainWindow     *mainwin);
100 void mimeview_init              (MimeView       *mimeview);
101 void mimeview_show_message      (MimeView       *mimeview,
102                                  MimeInfo       *mimeinfo,
103                                  const gchar    *file);
104 void mimeview_destroy           (MimeView       *mimeview);
105
106 MimeInfo *mimeview_get_selected_part    (MimeView       *mimeview);
107
108 #if USE_GPGME
109 void mimeview_check_signature   (MimeView       *mimeview);
110 #endif
111 void mimeview_pass_key_press_event      (MimeView       *mimeview,
112                                          GdkEventKey    *event);
113
114 void mimeview_register_viewer_factory   (MimeViewerFactory *factory);
115 void mimeview_unregister_viewer_factory (MimeViewerFactory *factory);
116
117 #ifdef __cplusplus
118 }
119 #endif /* __cplusplus */
120
121 #endif /* __MIMEVIEW_H__ */