2005-12-28 [wwp] 1.9.100cvs110
[claws.git] / src / mainwindow.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2004 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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         M_NOT_NEWS            = 1 << 15
52 } SensitiveCond;
53
54 typedef enum
55 {
56         SEPARATE_NONE    = 0,
57         SEPARATE_FOLDER  = 1 << 0,
58         SEPARATE_MESSAGE = 1 << 1,
59         SEPARATE_BOTH    = (SEPARATE_FOLDER | SEPARATE_MESSAGE)
60 } SeparateType;
61
62 typedef enum
63 {
64         TOOLBAR_NONE            = 0,
65         TOOLBAR_ICON            = 1,
66         TOOLBAR_TEXT            = 2,
67         TOOLBAR_BOTH            = 3,
68         TOOLBAR_BOTH_HORIZ      = 4
69 } ToolbarStyle;
70
71 struct _MainWindow
72 {
73         SeparateType type;
74
75         union CompositeWin {
76                 struct 
77                 {
78                         GtkWidget *hpaned;
79                         GtkWidget *vpaned;
80                 } sep_none;
81                 struct {
82                         GtkWidget *folderwin;
83                         GtkWidget *vpaned;
84                 } sep_folder;
85                 struct {
86                         GtkWidget *messagewin;
87                         GtkWidget *hpaned;
88                 } sep_message;
89                 struct {
90                         GtkWidget *folderwin;
91                         GtkWidget *messagewin;
92                 } sep_both;
93         } win;
94
95         GtkWidget *window;
96         GtkWidget *vbox;
97         GtkWidget *menubar;
98
99         GtkItemFactory *menu_factory;
100
101         /* Toolbar handlebox */
102         GtkWidget *handlebox;
103         Toolbar *toolbar;
104
105         /* body */
106         GtkWidget *vbox_body;
107         GtkWidget *hbox_stat;
108         GtkWidget *statusbar;
109         GtkWidget *progressbar;
110         GtkWidget *statuslabel;
111         GtkWidget *ac_button;
112         GtkWidget *ac_label;
113         GtkWidget *ac_menu;
114         GtkWidget *online_switch;
115         GtkWidget *offline_switch;
116         GtkWidget *online_pixmap;
117         GtkWidget *offline_pixmap;
118
119         /* context IDs for status bar */
120         gint mainwin_cid;
121         gint folderview_cid;
122         gint summaryview_cid;
123         gint messageview_cid;
124
125         ToolbarStyle toolbar_style;
126
127         guint lock_count;
128         guint menu_lock_count;
129         guint cursor_count;
130
131         FolderView      *folderview;
132         SummaryView     *summaryview;
133         MessageView     *messageview;
134         LogWindow       *logwin;
135
136         gint    progressindicator_hook;
137 };
138
139 MainWindow *main_window_create          (SeparateType    type);
140
141 void main_window_destroy                (MainWindow *mainwin);
142
143 void main_window_update_actions_menu    (MainWindow     *mainwin);
144
145 void main_window_cursor_wait            (MainWindow     *mainwin);
146 void main_window_cursor_normal          (MainWindow     *mainwin);
147
148 void main_window_lock                   (MainWindow     *mainwin);
149 void main_window_unlock                 (MainWindow     *mainwin);
150
151 void main_window_reflect_prefs_all_real         (gboolean pixmap_theme_changed);
152 void main_window_reflect_prefs_all      (void);
153 void main_window_set_summary_column     (void);
154 void main_window_set_folder_column      (void);
155 void main_window_set_account_menu       (GList          *account_list);
156 void main_window_set_account_menu_only_toolbar  (GList          *account_list);
157
158 GtkWidget *main_window_get_folder_window        (MainWindow     *mainwin);
159 GtkWidget *main_window_get_message_window       (MainWindow     *mainwin);
160
161 void main_window_separation_change      (MainWindow     *mainwin,
162                                          SeparateType    type);
163
164 void main_window_toggle_message_view    (MainWindow *mainwin);
165
166 void main_window_get_size               (MainWindow     *mainwin);
167 void main_window_get_position           (MainWindow     *mainwin);
168
169 void main_window_progress_on            (MainWindow     *mainwin);
170 void main_window_progress_off           (MainWindow     *mainwin);
171 void main_window_progress_set           (MainWindow     *mainwin,
172                                          gint            cur,
173                                          gint            total);
174
175 void main_window_empty_trash            (MainWindow     *mainwin,
176                                          gboolean        confirm);
177 void main_window_add_mailbox            (MainWindow     *mainwin);
178
179 void main_window_set_menu_sensitive     (MainWindow     *mainwin);
180
181
182 void main_window_show                   (MainWindow     *mainwin);
183 void main_window_hide                   (MainWindow     *mainwin);
184 void main_window_popup                  (MainWindow     *mainwin);
185
186 void main_window_toolbar_set_compose_button     (MainWindow *mainwin, 
187                                                  ComposeButtonType compose_btn_type);
188
189 SensitiveCond main_window_get_current_state   (MainWindow *mainwin);
190
191 void toolbar_set_compose_button               (Toolbar           *toolbar, 
192                                                ComposeButtonType  compose_btn_type);
193 void main_window_destroy_all                  (void);
194
195 void main_window_toggle_work_offline          (MainWindow        *mainwin, 
196                                                gboolean           offline,
197                                                gboolean           ask_sync);
198
199 /* public so it can be disabled from summaryview */
200 gboolean mainwindow_key_pressed               (GtkWidget         *widget, 
201                                                GdkEventKey       *event,
202                                                gpointer           data);
203 MainWindow *mainwindow_get_mainwindow         (void);
204 #endif /* __MAINWINDOW_H__ */