271b2d8d640f17a12f5ec5e2d7d3cb2c492f5262
[claws.git] / src / mainwindow.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2001 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 __MAINWINDOW_H__
21 #define __MAINWINDOW_H__
22
23 #include <glib.h>
24
25 typedef struct _MainWindow  MainWindow;
26
27 #include "folderview.h"
28 #include "summaryview.h"
29 #include "headerview.h"
30 #include "messageview.h"
31 #include "logwindow.h"
32 #include "toolbar.h"
33
34 typedef enum
35 {
36         M_UNLOCKED            = 1 << 0,
37         M_MSG_EXIST           = 1 << 1,
38         M_TARGET_EXIST        = 1 << 2,
39         M_SINGLE_TARGET_EXIST = 1 << 3,
40         M_EXEC                = 1 << 4,
41         M_ALLOW_REEDIT        = 1 << 5,
42         M_HAVE_ACCOUNT        = 1 << 6,
43         M_THREADED            = 1 << 7,
44         M_UNTHREADED          = 1 << 8,
45         M_ALLOW_DELETE        = 1 << 9,
46         M_INC_ACTIVE          = 1 << 10,
47         M_NEWS                = 1 << 11,
48         M_HAVE_NEWS_ACCOUNT   = 1 << 12,
49         M_HIDE_READ_MSG       = 1 << 13,
50         M_DELAY_EXEC          = 1 << 14
51 } SensitiveCond;
52
53 typedef enum
54 {
55         SEPARATE_NONE    = 0,
56         SEPARATE_FOLDER  = 1 << 0,
57         SEPARATE_MESSAGE = 1 << 1,
58         SEPARATE_BOTH    = (SEPARATE_FOLDER | SEPARATE_MESSAGE)
59 } SeparateType;
60
61 typedef enum
62 {
63         TOOLBAR_NONE    = 0,
64         TOOLBAR_ICON    = 1,
65         TOOLBAR_TEXT    = 2,
66         TOOLBAR_BOTH    = 3
67 } ToolbarStyle;
68
69 struct _MainWindow
70 {
71         SeparateType type;
72
73         union CompositeWin {
74                 struct 
75                 {
76                         GtkWidget *hpaned;
77                         GtkWidget *vpaned;
78                 } sep_none;
79                 struct {
80                         GtkWidget *folderwin;
81                         GtkWidget *vpaned;
82                 } sep_folder;
83                 struct {
84                         GtkWidget *messagewin;
85                         GtkWidget *hpaned;
86                 } sep_message;
87                 struct {
88                         GtkWidget *folderwin;
89                         GtkWidget *messagewin;
90                 } sep_both;
91         } win;
92
93         GtkWidget *window;
94         GtkWidget *vbox;
95         GtkWidget *menubar;
96
97         GtkItemFactory *menu_factory;
98         
99         /* Toolbar handlebox */
100         GtkWidget *handlebox;
101         
102         MainToolbar *toolbar;
103
104         /* body */
105         GtkWidget *vbox_body;
106         GtkWidget *hbox_stat;
107         GtkWidget *statusbar;
108         GtkWidget *progressbar;
109         GtkWidget *statuslabel;
110         GtkWidget *ac_button;
111         GtkWidget *ac_label;
112         GtkWidget *ac_menu;
113         GtkWidget *online_switch;
114         GtkWidget *offline_switch;
115
116         /* context IDs for status bar */
117         gint mainwin_cid;
118         gint folderview_cid;
119         gint summaryview_cid;
120
121         ToolbarStyle toolbar_style;
122
123         guint lock_count;
124         guint menu_lock_count;
125         guint cursor_count;
126
127         FolderView      *folderview;
128         SummaryView     *summaryview;
129         MessageView     *messageview;
130         LogWindow       *logwin;
131 };
132
133 MainWindow *main_window_create          (SeparateType    type);
134
135 void main_window_cursor_wait            (MainWindow     *mainwin);
136 void main_window_cursor_normal          (MainWindow     *mainwin);
137
138 void main_window_lock                   (MainWindow     *mainwin);
139 void main_window_unlock                 (MainWindow     *mainwin);
140
141 void main_window_reflect_prefs_all_real         (gboolean pixmap_theme_changed);
142 void main_window_reflect_prefs_all      (void);
143 void main_window_set_summary_column     (void);
144 void main_window_set_account_menu       (GList          *account_list);
145 void main_window_separation_change      (MainWindow     *mainwin,
146                                          SeparateType    type);
147
148 void main_window_toggle_message_view    (MainWindow *mainwin);
149
150 void main_window_get_size               (MainWindow     *mainwin);
151 void main_window_get_position           (MainWindow     *mainwin);
152
153 void main_window_empty_trash            (MainWindow     *mainwin,
154                                          gboolean        confirm);
155 void main_window_add_mailbox            (MainWindow     *mainwin);
156
157 void main_window_set_menu_sensitive     (MainWindow     *mainwin);
158
159
160 void main_window_popup                  (MainWindow     *mainwin);
161
162 void main_window_toolbar_set_compose_button     (MainWindow *mainwin, 
163                                          ComposeButtonType compose_btn_type);
164
165 SensitiveCond main_window_get_current_state   (MainWindow *mainwin);
166
167 void reply_cb                             (MainWindow   *mainwin,
168                                          guint           action,
169                                          GtkWidget      *widget);
170
171 void inc_mail_cb                                  (MainWindow   *mainwin,
172                                          guint           action,
173                                          GtkWidget      *widget);
174
175 void inc_all_account_mail_cb              (MainWindow   *mainwin,
176                                          guint           action,
177                                          GtkWidget      *widget);
178
179 void send_queue_cb                        (MainWindow   *mainwin,
180                                          guint           action,
181                                          GtkWidget      *widget);
182
183 void compose_mail_cb                          (MainWindow       *mainwin, 
184                                          guint action,
185                                            GtkWidget         *widget);
186
187 void compose_news_cb                          (MainWindow       *mainwin, 
188                                          guint action,
189                                            GtkWidget         *widget);
190
191 void next_unread_cb                        (MainWindow  *mainwin,
192                                           guint          action,
193                                           GtkWidget     *widget);
194
195 #endif /* __MAINWINDOW_H__ */