* Changes in the autotools stuff affecting a lot of platform dependent
[modest] / src / widgets / modest-window.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_WINDOW_H__
31 #define __MODEST_WINDOW_H__
32
33 #include <glib-object.h>
34 #include <tny-account-store.h>
35
36 G_BEGIN_DECLS
37
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif /*HAVE_CONFIG_H*/
41
42 #include <gtk/gtk.h>
43  
44 /* 
45  * admittedly, the ifdefs for gtk and maemo are rather ugly; still
46  * this way is probably the easiest to maintain
47  */
48 #ifdef MODEST_TOOLKIT_GTK
49 #include <gtk/gtkwindow.h>
50 typedef GtkWindow      ModestWindowParent;
51 typedef GtkWindowClass ModestWindowParentClass;
52 #else
53 #if MODEST_HILDON_API == 0
54 #include <hildon-widgets/hildon-window.h>
55 #else
56 #include <hildon/hildon-window.h>
57 #endif /*MODEST_HILDON_API == 0*/
58 typedef HildonWindow      ModestWindowParent;
59 typedef HildonWindowClass ModestWindowParentClass;
60
61 #ifndef GTK_STOCK_FULLSCREEN
62 #define GTK_STOCK_FULLSCREEN ""
63 #endif /*GTK_STOCK_FULLSCREEN*/
64
65 #endif /*!MODEST_TOOLKIT_GTK */
66
67 /* Dimmed state variables */
68 typedef struct _DimmedState {   
69         guint    n_selected;
70         guint    already_opened_msg;
71         gboolean any_marked_as_deleted;
72         gboolean all_marked_as_deleted;
73         gboolean any_marked_as_seen;
74         gboolean all_marked_as_seen;
75         gboolean any_marked_as_cached;
76         gboolean all_marked_as_cached;
77         gboolean any_has_attachments;
78         gboolean all_has_attachments;
79         gboolean sent_in_progress;
80         gboolean all_selected;
81 } DimmedState;
82
83 /* convenience macros */
84 #define MODEST_TYPE_WINDOW             (modest_window_get_type())
85 #define MODEST_WINDOW(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW,ModestWindow))
86 #define MODEST_WINDOW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WINDOW,GObject))
87 #define MODEST_IS_WINDOW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WINDOW))
88 #define MODEST_IS_WINDOW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WINDOW))
89 #define MODEST_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WINDOW,ModestWindowClass))
90
91 typedef struct _ModestWindow      ModestWindow;
92 typedef struct _ModestWindowClass ModestWindowClass;
93
94 struct _ModestWindow {
95          ModestWindowParent parent;
96 };
97
98 struct _ModestWindowClass {
99         ModestWindowParentClass parent_class;
100
101         /* virtual methods */
102         void (*set_zoom_func) (ModestWindow *self, gdouble zoom);
103         gdouble (*get_zoom_func) (ModestWindow *self);
104         gboolean (*zoom_plus_func) (ModestWindow *self);
105         gboolean (*zoom_minus_func) (ModestWindow *self);
106         void (*show_toolbar_func) (ModestWindow *self, gboolean show_toolbar);
107         void (*save_state_func) (ModestWindow *self);
108         void (*disconnect_signals_func) (ModestWindow *self);
109 };
110
111 /**
112  * modest_window_get_type:
113  *
114  * get the #GType for #ModestWindow
115  * 
116  * Returns: the type
117  */     
118 GType        modest_window_get_type    (void) G_GNUC_CONST;
119
120
121 /**
122  * modest_window_get_active_account:
123  * @self: a modest window instance
124  * 
125  * get the name of the active account
126  * 
127  * Returns: the active account name as a constant string
128  */     
129 const gchar* modest_window_get_active_account (ModestWindow *self);
130
131
132
133 /**
134  * modest_window_set_active_account:
135  * @self: a modest window instance
136  * @active_account: a new active account name for this window
137  * 
138  * set the active account for this window.
139  * NOTE: this must be a valid, non-pseudo account.
140  * 
141  */     
142 void modest_window_set_active_account (ModestWindow *self, const gchar *active_account);
143
144 /**
145  * modest_window_set_zoom:
146  * @window: a #ModestWindow instance
147  * @zoom: the zoom level (1.0 is no zoom)
148  *
149  * sets the zoom level of the window
150  */
151 void            modest_window_set_zoom    (ModestWindow *window,
152                                            gdouble value);
153
154 /**
155  * modest_window_get_zoom:
156  * @window: a #ModestWindow instance
157  *
158  * gets the zoom of the window
159  *
160  * Returns: the current zoom value (1.0 is no zoom)
161  */
162 gdouble         modest_window_get_zoom    (ModestWindow *window);
163
164 /**
165  * modest_window_zoom_plus:
166  * @window: a #ModestWindow
167  *
168  * increases one level the zoom.
169  *
170  * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
171  */
172 gboolean modest_window_zoom_plus (ModestWindow *window);
173
174 /**
175  * modest_window_zoom_minus:
176  * @window: a #ModestWindow
177  *
178  * decreases one level the zoom.
179  *
180  * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
181  */
182 gboolean modest_window_zoom_minus (ModestWindow *window);
183
184
185 /**
186  * modest_window_show_toolbar:
187  * @window: 
188  * @view_toolbar: whether or not the toolbar should be shown
189  * 
190  * shows/hides the window toolbar
191  **/
192 void     modest_window_show_toolbar (ModestWindow *window, 
193                                      gboolean show_toolbar);
194                                      
195 /**
196  * modest_window_save_state:
197  * @window: 
198  * 
199  * Ask the window to save its settings for loading again later.
200  * This actually invokes the save_setting_func vfunc, which 
201  * derived windows should implement.
202  **/
203 void     modest_window_save_state (ModestWindow *window);
204
205
206 /**
207  * modest_window_set_dimming_state:
208  * @window: a #ModestWindow instance object
209  * @state: the #DimmedState state at specific time 
210  * 
211  * Set basic dimming variables from selected headers at
212  * specific moment.
213  **/
214 void
215 modest_window_set_dimming_state (ModestWindow *window,
216                                  DimmedState *state);
217
218 /**
219  * modest_window_set_dimming_state:
220  * @window: a #ModestWindow instance object
221  * 
222  * Set basic dimming variables from selected headers at
223  * specific moment.
224  * 
225  * @Returns: a  #DimmedState state saved previously. 
226  **/
227 const DimmedState *
228 modest_window_get_dimming_state (ModestWindow *window);
229                                 
230
231 /**
232  * modest_window_get_action:
233  * @window: a #ModestWindow instance object
234  * @action_path: the full path of required action.
235  * 
236  * Get an action from ui manager, using @action_path parameter,
237  * which represent the full path to the required action into UIManager 
238  * xml definition.
239  **/
240 GtkAction * modest_window_get_action (ModestWindow *window, const gchar *action_path); 
241
242 /**
243  * modest_window_get_action_widget:
244  * @window: a #ModestWindow instance object
245  * @action_path: the full path of required action.
246  * 
247  * Get action widget from ui manager, using @action_path parameter,
248  * which represent the full path to the required action into UIManager 
249  * xml definition.
250  **/
251 GtkWidget *modest_window_get_action_widget (ModestWindow *window, 
252                                             const gchar *action_path);
253
254 /**
255  * modest_window_check_dimming_rules:
256  * @self: a #ModestWindow instance object
257  * 
258  * Calls UI Dimming Manager of @self window to check all dimming rules.
259  * 
260  **/
261 void modest_window_check_dimming_rules (ModestWindow *self);
262
263 /**
264  * modest_window_check_dimming_rules:
265  * @self: a #ModestWindow instance object
266  * @group: a #ModestWindow instance object
267  * 
268  * Calls UI Dimming Manager of @self window to check @group_name specific
269  * dimming rules.
270  * 
271  **/
272 void modest_window_check_dimming_rules_group (ModestWindow *self,
273                                               const gchar *group_name);
274
275
276 /**
277  * modest_window_enable_dimming:
278  * @self: a #ModestWindow instance object
279  * 
280  * Enables UI dimming rules checking.
281  *
282  **/
283 void modest_window_enable_dimming (ModestWindow *self);
284
285
286 /**
287  * modest_window_disable_dimming:
288  * @self: a #ModestWindow instance object
289  * 
290  * Disables UI dimming rules checking.
291  *
292  **/
293 void modest_window_disable_dimming (ModestWindow *self);
294
295
296 void modest_window_disconnect_signals (ModestWindow *self);
297
298
299 G_END_DECLS
300
301 #endif /* __MODEST_WINDOW_H__ */