80cd4b790138851ef33acf94c7f764106453b1e6
[modest] / src / modest-window-mgr.h
1 /* modest-window-mgr.h */
2 /* insert (c)/licensing information) */
3
4 #ifndef __MODEST_WINDOW_MGR_H__
5 #define __MODEST_WINDOW_MGR_H__
6
7 #include <glib-object.h>
8 /* other include files */
9
10 G_BEGIN_DECLS
11
12 /* convenience macros */
13 #define MODEST_TYPE_WINDOW_MGR             (modest_window_mgr_get_type())
14 #define MODEST_WINDOW_MGR(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW_MGR,ModestWindowMgr))
15 #define MODEST_WINDOW_MGR_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WINDOW_MGR,GObject))
16 #define MODEST_IS_WINDOW_MGR(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WINDOW_MGR))
17 #define MODEST_IS_WINDOW_MGR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WINDOW_MGR))
18 #define MODEST_WINDOW_MGR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WINDOW_MGR,ModestWindowMgrClass))
19
20 enum {
21         MODEST_MAIN_WINDOW,        /* the main window */
22         MODEST_EDIT_WINDOW,        /* a window to edit a mail */
23         MODEST_ACCOUNT_WINDOW,     /* a window to edit account information */
24         MODEST_VIEW_WINDOW         /* a window to view mails */
25 };
26 typedef guint ModestWindowType;
27
28
29 typedef struct _ModestOpenWindow ModestOpenWindow;
30 struct _ModestOpenWindow {
31         GObject          *win;
32         ModestWindowType type;
33         guint            id;
34 };
35
36
37 typedef struct _ModestWindowMgr      ModestWindowMgr;
38 typedef struct _ModestWindowMgrClass ModestWindowMgrClass;
39
40 struct _ModestWindowMgr {
41         GObject parent;
42 };
43
44 struct _ModestWindowMgrClass {
45         GObjectClass parent_class;
46         
47         void (* last_window_closed) (ModestWindowMgr* obj);
48 };
49
50 /* member functions */
51 GType        modest_window_mgr_get_type    (void) G_GNUC_CONST;
52
53 /**
54  * modest_window_mgr_new:
55  *
56  * creates a new ModestWindowMgr instance
57  *
58  * Returns: a new ModestWindowMgr, or NULL in case of error
59  */
60 GObject*    modest_window_mgr_new         (void);
61
62 /**
63  * modest_window_mgr_register:
64  * @self: a ModestWindowMgr instance
65  * @win: the GObject of the window to register
66  * @type: ModestWindowType of the window to register
67  * @window_id: a guint window_id of the window
68  *
69  * register a window with the ModestWindowMgr instance *self
70  *
71  * Returns: TRUE on success, else FALSE
72  */
73 gboolean    modest_window_mgr_register   (ModestWindowMgr *self, GObject *win,
74                                           ModestWindowType type, guint window_id);
75
76 /**
77  * modest_window_mgr_unregister:
78  * @self: a ModestWindowMgr instance
79  * @win: the GObject of the window to register
80  *
81  * unregister a window from the ModestWindowMgr instance *self
82  *
83  * Returns: TRUE on success, else FALSE
84  */
85 gboolean    modest_window_mgr_unregister (ModestWindowMgr *self, GObject *win);
86
87 /**
88  * modest_window_mgr_find_by_type:
89  * @self: a ModestWindowMgr instance
90  * @type: the ModestWindowType to search for
91  *
92  * search for a window of type 'type' in the ModestWindowMgr instance *self
93  *
94  * Returns: the GObject of the window, else NULL
95  */
96 GObject*    modest_window_mgr_find_by_type (ModestWindowMgr *self, ModestWindowType type);
97
98 /**
99  * modest_window_mgr_find_by_id:
100  * @self: a ModestWindowMgr instance
101  * @window_id: the ModestWindowType to search for
102  *
103  * search for a window with a specific 'window_id' in the ModestWindowMgr instance *self
104  *
105  * Returns: the GObject of the window, else NULL
106  */
107 GObject*    modest_window_mgr_find_by_id (ModestWindowMgr *self, gint window_id);
108
109 G_END_DECLS
110
111 #endif /* __MODEST_WINDOW_MGR_H__ */
112