* Migration to GtkUIManager almost completed
[modest] / src / modest-widget-factory.h
1 /* Copyright (c) 2006, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  *   notice, this list of conditions and the following disclaimer in the
12  *   documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Nokia Corporation nor the names of its
14  *   contributors may be used to endorse or promote products derived from
15  *   this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #ifndef __MODEST_WIDGET_FACTORY_H__
31 #define __MODEST_WIDGET_FACTORY_H__
32
33 #include "modest-account-mgr.h"
34 #include "modest-tny-account-store.h"
35 #include "widgets/modest-header-view.h"
36 #include "widgets/modest-folder-view.h"
37 #include "widgets/modest-msg-view.h"
38 #include "widgets/modest-account-view.h"
39 #include "widgets/modest-combo-box.h"
40
41 G_BEGIN_DECLS
42
43 /* convenience macros */
44 #define MODEST_TYPE_WIDGET_FACTORY             (modest_widget_factory_get_type())
45 #define MODEST_WIDGET_FACTORY(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WIDGET_FACTORY,ModestWidgetFactory))
46 #define MODEST_WIDGET_FACTORY_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WIDGET_FACTORY,GObject))
47 #define MODEST_IS_WIDGET_FACTORY(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WIDGET_FACTORY))
48 #define MODEST_IS_WIDGET_FACTORY_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WIDGET_FACTORY))
49 #define MODEST_WIDGET_FACTORY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WIDGET_FACTORY,ModestWidgetFactoryClass))
50
51 typedef struct _ModestWidgetFactory      ModestWidgetFactory;
52 typedef struct _ModestWidgetFactoryClass ModestWidgetFactoryClass;
53
54 struct _ModestWidgetFactory {
55          GObject parent;
56         /* insert public members, if any */
57 };
58
59 struct _ModestWidgetFactoryClass {
60         GObjectClass parent_class;
61         /* insert signal callback declarations, eg. */
62         /* void (* my_event) (ModestWidgetFactory* obj); */
63 };
64
65
66 typedef enum _ModestComboBoxType {
67         MODEST_COMBO_BOX_TYPE_STORE_PROTOS,
68         MODEST_COMBO_BOX_TYPE_TRANSPORT_PROTOS,
69         MODEST_COMBO_BOX_TYPE_SECURITY_PROTOS,
70         MODEST_COMBO_BOX_TYPE_AUTH_PROTOS,
71         MODEST_COMBO_BOX_TYPE_TRANSPORTS
72 } ModestComboBoxType;
73
74
75 /**
76  * modest_widget_factory_get_type
77  *
78  * get the GType for ModestWidgetFactory
79  *
80  * Returns: the GType
81  */
82 GType        modest_widget_factory_get_type    (void) G_GNUC_CONST;
83
84
85 /**
86  * modest_widget_factory_new
87  *
88  * instantiates a ModestWidgetFactory
89  *
90  * Returns: a new ModestWidgetFactory, or NULL in case of error
91  */
92 ModestWidgetFactory*      modest_widget_factory_new   (void);
93 /**
94  * modest_widget_factory_get_folder_view
95  * @self: a ModestWidgetFactory instance
96  * 
97  * return the folder tree widget (ie. the widget with the list of folders);
98  *
99  * This factory will always return the
100  * same widget, and takes care of its lifetime - users should *not* destroy it.
101  *
102  * Returns: a folder tree view, or NULL in case of error
103  */
104 ModestFolderView*    modest_widget_factory_get_folder_view (ModestWidgetFactory *self);
105
106
107 /**
108  * modest_widget_factory_get_header_view
109  * @self: a ModestWidgetFactory instance
110  * 
111  * return the header tree widget (ie. the widget with the list of headers);
112  *
113  * This factory will always return the
114  * same widget, and takes care of its lifetime - users should *not* destroy it.
115  *
116  * Returns: a header tree view, or NULL in case of error
117  */
118 ModestHeaderView*    modest_widget_factory_get_header_view (ModestWidgetFactory *self);
119
120
121 /**
122  * modest_widget_factory_get_msg_preview
123  * @self: a ModestWidgetFactory instance
124  * 
125  * return the message preview widget (ie. the widget with shows the currently selected message);
126  *
127  * This factory will always return the
128  * same widget, and takes care of its lifetime - users should *not* destroy it.
129  *
130  * Returns: a header tree view, or NULL in case of error
131  */
132 ModestMsgView*           modest_widget_factory_get_msg_preview (ModestWidgetFactory *self);
133
134
135 /**
136  * modest_widget_factory_get_account_view
137  * @self: a ModestWidgetFactory instance
138  * 
139  * return an account view widget (ie. the widget that shows a list of accounts)
140  *
141  * This factory will always return the
142  * same widget, and takes care of its lifetime - users should *not* destroy it.
143  *
144  * Returns: the account view, or NULL in case of error
145  */
146 ModestAccountView*    modest_widget_factory_get_account_view (ModestWidgetFactory *self);
147
148
149 /**
150  * modest_widget_factory_get_progress_bar
151  * @self: a ModestWidgetFactory instance
152  * 
153  * return an progress bar widget 
154  * if the widget factory was created with 'auto_connect', then this progress bar
155  * will automatically update for changes in the other widgets
156  * NOTE the naming inconsistency: GtkProgressBar vs GtkStatusbar 
157  * 
158  * This factory will always return the
159  * same widget, and takes care of its lifetime - users should *not* destroy it.
160  *
161  * Returns: the progress bar widget
162  */
163 GtkWidget*       modest_widget_factory_get_progress_bar (ModestWidgetFactory *self);
164
165
166
167 /**
168  * modest_widget_factory_get_status_bar
169  * @self: a ModestWidgetFactory instance
170  * 
171  * return an status bar widget 
172  * if the widget factory was created with 'auto_connect', then this status bar
173  * will automatically update for changes in the other widgets
174  * NOTE the naming inconsistency: GtkProgressBar vs GtkStatusbar 
175  * 
176  * This factory will always return the
177  * same widget, and takes care of its lifetime - users should *not* destroy it.
178  *
179  * Returns: the status bar widget
180  */
181 GtkWidget*     modest_widget_factory_get_status_bar (ModestWidgetFactory *self);
182
183 /**
184  * modest_widget_factory_get_store
185  * @self: a ModestWidgetFactory instance
186  * @type: the type of items we want a combo box for
187  * 
188  * return a combobox with with the given items
189  *  
190  * Returns: the combo box
191  */
192 GtkWidget*     modest_widget_factory_get_combo_box (ModestWidgetFactory *self,
193                                                     ModestComboBoxType type);
194
195 /**
196  * modest_widget_factory_get_online_toggle
197  * @self: a ModestWidgetFactory instance
198  *
199  * return a toggle which with one can see whether online/offline mode is active.
200  * In case of auto-connect, this will automatically be sync'd with the
201  * account_store / device
202  *
203  * Returns: the toggle button
204  */
205 GtkWidget*  modest_widget_factory_get_online_toggle (ModestWidgetFactory *self);
206
207 /**
208  * modest_widget_factory_get_folder_info_label
209  * @self: a ModestWidgetFactory instance
210  *
211  * return a label with the number of items, unread items in the current folder
212  *
213  * Returns: the label
214  */
215 GtkWidget*  modest_widget_factory_get_folder_info_label (ModestWidgetFactory *self);
216
217 G_END_DECLS
218
219 #endif /* __MODEST_WIDGET_FACTORY_H__ */
220