1 /* Copyright (c) 2006, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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.
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.
31 /* modest-window-mgr.h */
33 #ifndef __MODEST_WINDOW_MGR_H__
34 #define __MODEST_WINDOW_MGR_H__
36 #include <glib-object.h>
37 /* other include files */
41 /* convenience macros */
42 #define MODEST_TYPE_WINDOW_MGR (modest_window_mgr_get_type())
43 #define MODEST_WINDOW_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW_MGR,ModestWindowMgr))
44 #define MODEST_WINDOW_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WINDOW_MGR,GObject))
45 #define MODEST_IS_WINDOW_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WINDOW_MGR))
46 #define MODEST_IS_WINDOW_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WINDOW_MGR))
47 #define MODEST_WINDOW_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WINDOW_MGR,ModestWindowMgrClass))
50 MODEST_MAIN_WINDOW, /* the main window */
51 MODEST_EDIT_WINDOW, /* a window to edit a mail */
52 MODEST_ACCOUNT_WINDOW, /* a window to edit account information */
53 MODEST_VIEW_WINDOW /* a window to view mails */
55 typedef guint ModestWindowType;
58 typedef struct _ModestOpenWindow ModestOpenWindow;
59 struct _ModestOpenWindow {
61 ModestWindowType type;
66 typedef struct _ModestWindowMgr ModestWindowMgr;
67 typedef struct _ModestWindowMgrClass ModestWindowMgrClass;
69 struct _ModestWindowMgr {
73 struct _ModestWindowMgrClass {
74 GObjectClass parent_class;
76 void (* last_window_closed) (ModestWindowMgr* obj);
79 /* member functions */
80 GType modest_window_mgr_get_type (void) G_GNUC_CONST;
83 * modest_window_mgr_new:
85 * creates a new ModestWindowMgr instance
87 * Returns: a new ModestWindowMgr, or NULL in case of error
89 GObject* modest_window_mgr_new (void);
92 * modest_window_mgr_register:
93 * @self: a ModestWindowMgr instance
94 * @win: the GObject of the window to register
95 * @type: ModestWindowType of the window to register
96 * @window_id: a guint window_id of the window
98 * register a window with the ModestWindowMgr instance *self
100 * Returns: TRUE on success, else FALSE
102 gboolean modest_window_mgr_register (ModestWindowMgr *self, GObject *win,
103 ModestWindowType type, guint window_id);
106 * modest_window_mgr_unregister:
107 * @self: a ModestWindowMgr instance
108 * @win: the GObject of the window to register
110 * unregister a window from the ModestWindowMgr instance *self
112 * Returns: TRUE on success, else FALSE
114 gboolean modest_window_mgr_unregister (ModestWindowMgr *self, GObject *win);
117 * modest_window_mgr_find_by_type:
118 * @self: a ModestWindowMgr instance
119 * @type: the ModestWindowType to search for
121 * search for a window of type 'type' in the ModestWindowMgr instance *self
123 * Returns: the GObject of the window, else NULL
125 GObject* modest_window_mgr_find_by_type (ModestWindowMgr *self, ModestWindowType type);
128 * modest_window_mgr_find_by_id:
129 * @self: a ModestWindowMgr instance
130 * @window_id: the ModestWindowType to search for
132 * search for a window with a specific 'window_id' in the ModestWindowMgr instance *self
134 * Returns: the GObject of the window, else NULL
136 GObject* modest_window_mgr_find_by_id (ModestWindowMgr *self, gint window_id);
140 #endif /* __MODEST_WINDOW_MGR_H__ */