|
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* vim:expandtab:shiftwidth=4:tabstop=4: |
|
3 */ |
|
4 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
7 |
|
8 #ifndef __MOZ_CONTAINER_H__ |
|
9 #define __MOZ_CONTAINER_H__ |
|
10 |
|
11 #include <gtk/gtk.h> |
|
12 |
|
13 #ifdef __cplusplus |
|
14 extern "C" { |
|
15 #endif /* __cplusplus */ |
|
16 |
|
17 /* |
|
18 * MozContainer |
|
19 * |
|
20 * This class serves two purposes in the nsIWidget implementation. |
|
21 * |
|
22 * - It provides objects to receive signals from GTK for events on native |
|
23 * windows. |
|
24 * |
|
25 * - It provides a container parent for GtkWidgets. The only GtkWidgets |
|
26 * that need this in Mozilla are the GtkSockets for windowed plugins (Xt |
|
27 * and XEmbed). |
|
28 * |
|
29 * Note that the window hierarchy in Mozilla differs from conventional |
|
30 * GtkWidget hierarchies. |
|
31 * |
|
32 * Mozilla's hierarchy exists through the GdkWindow hierarchy, and all child |
|
33 * GdkWindows (within a child nsIWidget hierarchy) belong to one MozContainer |
|
34 * GtkWidget. If the MozContainer is unrealized or its GdkWindows are |
|
35 * destroyed for some other reason, then the hierarchy no longer exists. (In |
|
36 * conventional GTK clients, the hierarchy is recorded by the GtkWidgets, and |
|
37 * so can be re-established after destruction of the GdkWindows.) |
|
38 * |
|
39 * One consequence of this is that the MozContainer does not know which of its |
|
40 * GdkWindows should parent child GtkWidgets. (Conventional GtkContainers |
|
41 * determine which GdkWindow to assign child GtkWidgets.) |
|
42 * |
|
43 * Therefore, when adding a child GtkWidget to a MozContainer, |
|
44 * gtk_widget_set_parent_window should be called on the child GtkWidget before |
|
45 * it is realized. |
|
46 */ |
|
47 |
|
48 #define MOZ_CONTAINER_TYPE (moz_container_get_type()) |
|
49 #define MOZ_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOZ_CONTAINER_TYPE, MozContainer)) |
|
50 #define MOZ_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOZ_CONTAINER_TYPE, MozContainerClass)) |
|
51 #define IS_MOZ_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOZ_CONTAINER_TYPE)) |
|
52 #define IS_MOZ_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOZ_CONTAINER_TYPE)) |
|
53 #define MOZ_CONAINTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZ_CONTAINER_TYPE, MozContainerClass)) |
|
54 |
|
55 typedef struct _MozContainer MozContainer; |
|
56 typedef struct _MozContainerClass MozContainerClass; |
|
57 |
|
58 struct _MozContainer |
|
59 { |
|
60 GtkContainer container; |
|
61 GList *children; |
|
62 }; |
|
63 |
|
64 struct _MozContainerClass |
|
65 { |
|
66 GtkContainerClass parent_class; |
|
67 }; |
|
68 |
|
69 GType moz_container_get_type (void); |
|
70 GtkWidget *moz_container_new (void); |
|
71 void moz_container_put (MozContainer *container, |
|
72 GtkWidget *child_widget, |
|
73 gint x, |
|
74 gint y); |
|
75 void moz_container_move (MozContainer *container, |
|
76 GtkWidget *child_widget, |
|
77 gint x, |
|
78 gint y, |
|
79 gint width, |
|
80 gint height); |
|
81 |
|
82 #ifdef __cplusplus |
|
83 } |
|
84 #endif /* __cplusplus */ |
|
85 |
|
86 #endif /* __MOZ_CONTAINER_H__ */ |