michael@0: /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim:expandtab:shiftwidth=4:tabstop=4: michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __MOZ_CONTAINER_H__ michael@0: #define __MOZ_CONTAINER_H__ michael@0: michael@0: #include michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif /* __cplusplus */ michael@0: michael@0: /* michael@0: * MozContainer michael@0: * michael@0: * This class serves two purposes in the nsIWidget implementation. michael@0: * michael@0: * - It provides objects to receive signals from GTK for events on native michael@0: * windows. michael@0: * michael@0: * - It provides a container parent for GtkWidgets. The only GtkWidgets michael@0: * that need this in Mozilla are the GtkSockets for windowed plugins (Xt michael@0: * and XEmbed). michael@0: * michael@0: * Note that the window hierarchy in Mozilla differs from conventional michael@0: * GtkWidget hierarchies. michael@0: * michael@0: * Mozilla's hierarchy exists through the GdkWindow hierarchy, and all child michael@0: * GdkWindows (within a child nsIWidget hierarchy) belong to one MozContainer michael@0: * GtkWidget. If the MozContainer is unrealized or its GdkWindows are michael@0: * destroyed for some other reason, then the hierarchy no longer exists. (In michael@0: * conventional GTK clients, the hierarchy is recorded by the GtkWidgets, and michael@0: * so can be re-established after destruction of the GdkWindows.) michael@0: * michael@0: * One consequence of this is that the MozContainer does not know which of its michael@0: * GdkWindows should parent child GtkWidgets. (Conventional GtkContainers michael@0: * determine which GdkWindow to assign child GtkWidgets.) michael@0: * michael@0: * Therefore, when adding a child GtkWidget to a MozContainer, michael@0: * gtk_widget_set_parent_window should be called on the child GtkWidget before michael@0: * it is realized. michael@0: */ michael@0: michael@0: #define MOZ_CONTAINER_TYPE (moz_container_get_type()) michael@0: #define MOZ_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOZ_CONTAINER_TYPE, MozContainer)) michael@0: #define MOZ_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOZ_CONTAINER_TYPE, MozContainerClass)) michael@0: #define IS_MOZ_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOZ_CONTAINER_TYPE)) michael@0: #define IS_MOZ_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOZ_CONTAINER_TYPE)) michael@0: #define MOZ_CONAINTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZ_CONTAINER_TYPE, MozContainerClass)) michael@0: michael@0: typedef struct _MozContainer MozContainer; michael@0: typedef struct _MozContainerClass MozContainerClass; michael@0: michael@0: struct _MozContainer michael@0: { michael@0: GtkContainer container; michael@0: GList *children; michael@0: }; michael@0: michael@0: struct _MozContainerClass michael@0: { michael@0: GtkContainerClass parent_class; michael@0: }; michael@0: michael@0: GType moz_container_get_type (void); michael@0: GtkWidget *moz_container_new (void); michael@0: void moz_container_put (MozContainer *container, michael@0: GtkWidget *child_widget, michael@0: gint x, michael@0: gint y); michael@0: void moz_container_move (MozContainer *container, michael@0: GtkWidget *child_widget, michael@0: gint x, michael@0: gint y, michael@0: gint width, michael@0: gint height); michael@0: michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif /* __cplusplus */ michael@0: michael@0: #endif /* __MOZ_CONTAINER_H__ */