1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
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/. */
8 #ifndef __MOZ_CONTAINER_H__
9 #define __MOZ_CONTAINER_H__
15 #endif /* __cplusplus */
20 * This class serves two purposes in the nsIWidget implementation.
22 * - It provides objects to receive signals from GTK for events on native
25 * - It provides a container parent for GtkWidgets. The only GtkWidgets
26 * that need this in Mozilla are the GtkSockets for windowed plugins (Xt
29 * Note that the window hierarchy in Mozilla differs from conventional
30 * GtkWidget hierarchies.
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.)
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.)
43 * Therefore, when adding a child GtkWidget to a MozContainer,
44 * gtk_widget_set_parent_window should be called on the child GtkWidget before
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))
55 typedef struct _MozContainer MozContainer
;
56 typedef struct _MozContainerClass MozContainerClass
;
60 GtkContainer container
;
64 struct _MozContainerClass
66 GtkContainerClass parent_class
;
69 GType
moz_container_get_type (void);
70 GtkWidget
*moz_container_new (void);
71 void moz_container_put (MozContainer
*container
,
72 GtkWidget
*child_widget
,
75 void moz_container_move (MozContainer
*container
,
76 GtkWidget
*child_widget
,
84 #endif /* __cplusplus */
86 #endif /* __MOZ_CONTAINER_H__ */