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