* src/utils.c
[claws.git] / src / compose.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 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 __COMPOSE_H__
21 #define __COMPOSE_H__
22
23 #include <glib.h>
24 #include <gtk/gtkwidget.h>
25 #include <gtk/gtkitemfactory.h>
26
27 typedef struct _Compose         Compose;
28 typedef struct _AttachInfo      AttachInfo;
29
30 #include "procmsg.h"
31 #include "procmime.h"
32 #include "addressbook.h"
33 #include "prefs_account.h"
34 #include "undo.h"
35
36 #ifdef USE_PSPELL
37 #include "gtkspell.h"
38 #endif
39
40 typedef enum
41 {
42         COMPOSE_TO,
43         COMPOSE_CC,
44         COMPOSE_BCC,
45         COMPOSE_REPLYTO,
46         COMPOSE_NEWSGROUPS,
47         COMPOSE_FOLLOWUPTO
48 } ComposeEntryType;
49
50 typedef enum
51 {
52         COMPOSE_REPLY,
53         COMPOSE_REPLY_WITH_QUOTE,
54         COMPOSE_REPLY_WITHOUT_QUOTE,
55         COMPOSE_REPLY_TO_SENDER,
56         COMPOSE_FOLLOWUP_AND_REPLY_TO,
57         COMPOSE_REPLY_TO_SENDER_WITH_QUOTE,
58         COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
59         COMPOSE_REPLY_TO_ALL,
60         COMPOSE_REPLY_TO_ALL_WITH_QUOTE,
61         COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
62         COMPOSE_FORWARD,
63         COMPOSE_FORWARD_AS_ATTACH,
64         COMPOSE_FORWARD_INLINE,
65         COMPOSE_NEW,
66         COMPOSE_REDIRECT,
67         COMPOSE_REEDIT
68 } ComposeMode;
69
70 typedef struct {
71         guint headernum;
72         Compose *compose;
73         GtkWidget *combo;
74         GtkWidget *entry;
75 } ComposeHeaderEntry;
76
77 struct _Compose
78 {
79         GtkWidget *window;
80         GtkWidget *vbox;
81         GtkWidget *menubar;
82
83         GtkWidget *handlebox;
84         GtkWidget *toolbar;
85         GtkWidget *send_btn;
86         GtkWidget *sendl_btn;
87         GtkWidget *draft_btn;
88         GtkWidget *insert_btn;
89         GtkWidget *attach_btn;
90         GtkWidget *sig_btn;
91         GtkWidget *exteditor_btn;
92         GtkWidget *linewrap_btn;
93         GtkWidget *addrbook_btn;
94
95         GtkWidget *vbox2;
96
97         /* Header */
98         GtkWidget *table_vbox;
99         GtkWidget *table;
100 /*
101         GtkWidget *to_hbox;
102         GtkWidget *to_entry;
103         GtkWidget *newsgroups_hbox;
104         GtkWidget *newsgroups_entry;
105 */
106         GtkWidget *subject_entry;
107 /*
108         GtkWidget *cc_hbox;
109         GtkWidget *cc_entry;
110         GtkWidget *bcc_hbox;
111         GtkWidget *bcc_entry;
112         GtkWidget *reply_hbox;
113         GtkWidget *reply_entry;
114         GtkWidget *followup_hbox;
115         GtkWidget *followup_entry;
116 */
117         GtkWidget *paned;
118
119         /* Attachments */
120         GtkWidget *attach_scrwin;
121         GtkWidget *attach_clist;
122
123         /* Others */
124         GtkWidget *savemsg_checkbtn;
125         GtkWidget *savemsg_entry;
126
127         /* Textedit */
128         GtkWidget *edit_vbox;
129         GtkWidget *ruler_hbox;
130         GtkWidget *ruler;
131         GtkWidget *scrolledwin;
132         GtkWidget *text;
133
134         GtkWidget *focused_editable;
135
136         GtkWidget *popupmenu;
137
138         GtkItemFactory *popupfactory;
139
140         GtkWidget *tmpl_menu;
141
142         ComposeMode mode;
143
144         MsgInfo *targetinfo;
145         MsgInfo *replyinfo;
146
147         GtkWidget *header_table;
148         GSList    *header_list;
149         guint      header_nextrow;
150         ComposeHeaderEntry *header_last;
151
152         gchar   *replyto;
153         gchar   *cc;
154         gchar   *bcc;
155         gchar   *newsgroups;
156         gchar   *followup_to;
157         gchar   *mailinglist;
158
159         gchar   *inreplyto;
160         gchar   *references;
161         gchar   *msgid;
162         gchar   *boundary;
163
164         gboolean use_to;
165         gboolean use_cc;
166         gboolean use_bcc;
167         gboolean use_replyto;
168         gboolean use_followupto;
169         gboolean use_mailinglist;
170         gboolean use_attach;
171
172         /* privacy settings */
173         gboolean use_signing;
174         gboolean use_encryption;
175
176         gboolean modified;
177
178         gboolean return_receipt;
179         gboolean paste_as_quotation;
180
181         GSList *to_list;
182         GSList *newsgroup_list;
183
184         PrefsAccount *account;
185         PrefsAccount *orig_account;
186
187         UndoMain *undostruct;
188
189         /* external editor */
190         gchar *exteditor_file;
191         pid_t  exteditor_pid;
192         gint   exteditor_readdes;
193         gint   exteditor_tag;
194
195 #if USE_PSPELL
196         /* Pspell spell checker */
197         GtkPspell *gtkpspell;
198 #endif
199
200         /* Priority */
201         gint priority;
202
203         gchar *redirect_filename;
204 };
205
206 struct _AttachInfo
207 {
208         gchar *file;
209         gchar *content_type;
210         EncodingType encoding;
211         gchar *name;
212         off_t size;
213 };
214
215 Compose *compose_new                    (PrefsAccount   *account,
216                                          const gchar    *mailto,
217                                          GPtrArray      *attach_files);
218
219 Compose *compose_new_with_folderitem    (PrefsAccount   *account,
220                                          FolderItem     *item);
221
222 void compose_followup_and_reply_to      (MsgInfo        *msginfo,
223                                          gboolean        quote,
224                                          gboolean        to_all,
225                                          gboolean        ignore_replyto,
226                                          const gchar    *body);
227 void compose_reply                      (MsgInfo        *msginfo,
228                                          gboolean        quote,
229                                          gboolean        to_all,
230                                          gboolean        ignore_replyto,
231                                          const gchar    *body);
232 Compose *compose_forward                (PrefsAccount *account,
233                                          MsgInfo        *msginfo,
234                                          gboolean        as_attach,
235                                          const gchar    *body);
236 Compose *compose_forward_multiple       (PrefsAccount   *account, 
237                                          GSList         *msginfo_list);
238 Compose *compose_redirect               (PrefsAccount   *account,
239                                          MsgInfo        *msginfo);
240 void compose_reedit                     (MsgInfo        *msginfo);
241
242 GList *compose_get_compose_list         (void);
243
244 void compose_entry_append               (Compose          *compose,
245                                          const gchar      *address,
246                                          ComposeEntryType  type);
247
248 void compose_entry_select               (Compose          *compose,
249                                          const gchar      *address);
250
251 gint compose_send                       (Compose          *compose);
252
253 void compose_reflect_prefs_all                  (void);
254 void compose_reflect_prefs_pixmap_theme (void);
255
256 #endif /* __COMPOSE_H__ */