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