]> git.sur5r.net Git - glabels/blob - glabels2/src/bonobo-mdi-child.h
Initial revision
[glabels] / glabels2 / src / bonobo-mdi-child.h
1 /*
2  * bonobo-mdi-child.h - definition of a BonoboMDI object
3  *
4  * Copyright (C) 2001-2002 Free Software Foundation
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, 
19  * Boston, MA 02111-1307, USA.
20  *
21  * Author: Paolo Maggi 
22  */
23
24 #ifndef _BONOBO_MDI_CHILD_H_
25 #define _BONOBO_MDI_CHILD_H_
26
27 #include <gtk/gtk.h>
28 #include <bonobo/bonobo-window.h>
29
30 #define BONOBO_TYPE_MDI_CHILD            (bonobo_mdi_child_get_type ())
31 #define BONOBO_MDI_CHILD(obj)            (GTK_CHECK_CAST ((obj), BONOBO_TYPE_MDI_CHILD, BonoboMDIChild))
32 #define BONOBO_MDI_CHILD_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_MDI_CHILD, BonoboMDIChildClass))
33 #define BONOBO_IS_MDI_CHILD(obj)         (GTK_CHECK_TYPE ((obj), BONOBO_TYPE_MDI_CHILD))
34 #define BONOBO_IS_MDI_CHILD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), BONOBO_TYPE_MDI_CHILD))
35 #define BONOBO_MDI_CHILD_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), BONOBO_TYPE_MDI_CHILD, BonoboMDIChildClass))
36
37 /* BonoboMDIChild
38  * is an abstract class. In order to use it, you have to either derive a
39  * new class from it and set the proper virtual functions in its parent
40  * BonoboMDIChildClass structure or use the BonoboMDIGenericChild class
41  * that allows to specify the relevant functions on a per-instance basis
42  * and can directly be used with BonoboMDI.
43  */
44
45 typedef struct _BonoboMDIChildPrivate BonoboMDIChildPrivate;
46
47 typedef struct
48 {
49         GObject object;
50
51         BonoboMDIChildPrivate *priv;
52 } BonoboMDIChild;
53
54
55 typedef GtkWidget *(*BonoboMDIChildViewCreator) (BonoboMDIChild *, gpointer);
56 typedef GList     *(*BonoboMDIChildMenuCreator) (BonoboMDIChild *, GtkWidget *, gpointer);
57 typedef gchar     *(*BonoboMDIChildConfigFunc)  (BonoboMDIChild *, gpointer);
58 typedef GtkWidget *(*BonoboMDIChildLabelFunc)   (BonoboMDIChild *, GtkWidget *, gpointer);
59
60 /* 
61  * Note that if you override the set_label virtual function, it should return
62  * a new widget if its GtkWidget* parameter is NULL and modify and return the
63  * old widget otherwise.
64  * (see bonobo-mdi-child.c/bonobo_mdi_child_set_book_label() for an example).
65  */
66
67 typedef struct
68 {
69         GObjectClass parent_class;
70
71         /* Virtual functions */
72         BonoboMDIChildViewCreator create_view;
73         BonoboMDIChildConfigFunc  get_config_string;
74         BonoboMDIChildLabelFunc   set_label;
75
76         void (* name_changed)           (BonoboMDIChild *mdi_child, gchar* old_name);
77
78 } BonoboMDIChildClass;
79
80 GType         bonobo_mdi_child_get_type         (void) G_GNUC_CONST;
81
82 GtkWidget    *bonobo_mdi_child_add_view         (BonoboMDIChild *mdi_child);
83 void          bonobo_mdi_child_remove_view      (BonoboMDIChild *mdi_child, 
84                                                  GtkWidget *view);
85
86 GList        *bonobo_mdi_child_get_views        (const BonoboMDIChild *mdi_child);
87
88 void          bonobo_mdi_child_set_name         (BonoboMDIChild *mdi_child, 
89                                                  const gchar *name);
90 gchar        *bonobo_mdi_child_get_name         (const BonoboMDIChild *mdi_child);
91
92 void          bonobo_mdi_child_set_parent       (BonoboMDIChild *mdi_child, 
93                                                  GObject *parent);
94 GObject      *bonobo_mdi_child_get_parent       (const BonoboMDIChild *mdi_child);
95
96 G_END_DECLS
97
98 #endif /* _BONOBO_MDI_CHILD_H_ */
99
100
101