widget/gtk/mozcontainer.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/gtk/mozcontainer.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,86 @@
     1.4 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* vim:expandtab:shiftwidth=4:tabstop=4:
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#ifndef __MOZ_CONTAINER_H__
    1.12 +#define __MOZ_CONTAINER_H__
    1.13 +
    1.14 +#include <gtk/gtk.h>
    1.15 +
    1.16 +#ifdef __cplusplus
    1.17 +extern "C" {
    1.18 +#endif /* __cplusplus */
    1.19 +
    1.20 +/*
    1.21 + * MozContainer
    1.22 + *
    1.23 + * This class serves two purposes in the nsIWidget implementation.
    1.24 + *
    1.25 + *   - It provides objects to receive signals from GTK for events on native
    1.26 + *     windows.
    1.27 + *
    1.28 + *   - It provides a container parent for GtkWidgets.  The only GtkWidgets
    1.29 + *     that need this in Mozilla are the GtkSockets for windowed plugins (Xt
    1.30 + *     and XEmbed).
    1.31 + *
    1.32 + * Note that the window hierarchy in Mozilla differs from conventional
    1.33 + * GtkWidget hierarchies.
    1.34 + *
    1.35 + * Mozilla's hierarchy exists through the GdkWindow hierarchy, and all child
    1.36 + * GdkWindows (within a child nsIWidget hierarchy) belong to one MozContainer
    1.37 + * GtkWidget.  If the MozContainer is unrealized or its GdkWindows are
    1.38 + * destroyed for some other reason, then the hierarchy no longer exists.  (In
    1.39 + * conventional GTK clients, the hierarchy is recorded by the GtkWidgets, and
    1.40 + * so can be re-established after destruction of the GdkWindows.)
    1.41 + *
    1.42 + * One consequence of this is that the MozContainer does not know which of its
    1.43 + * GdkWindows should parent child GtkWidgets.  (Conventional GtkContainers
    1.44 + * determine which GdkWindow to assign child GtkWidgets.)
    1.45 + *
    1.46 + * Therefore, when adding a child GtkWidget to a MozContainer,
    1.47 + * gtk_widget_set_parent_window should be called on the child GtkWidget before
    1.48 + * it is realized.
    1.49 + */
    1.50 + 
    1.51 +#define MOZ_CONTAINER_TYPE            (moz_container_get_type())
    1.52 +#define MOZ_CONTAINER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOZ_CONTAINER_TYPE, MozContainer))
    1.53 +#define MOZ_CONTAINER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MOZ_CONTAINER_TYPE, MozContainerClass))
    1.54 +#define IS_MOZ_CONTAINER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOZ_CONTAINER_TYPE))
    1.55 +#define IS_MOZ_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOZ_CONTAINER_TYPE))
    1.56 +#define MOZ_CONAINTER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZ_CONTAINER_TYPE, MozContainerClass))
    1.57 +
    1.58 +typedef struct _MozContainer      MozContainer;
    1.59 +typedef struct _MozContainerClass MozContainerClass;
    1.60 +
    1.61 +struct _MozContainer
    1.62 +{
    1.63 +    GtkContainer   container;
    1.64 +    GList         *children;
    1.65 +};
    1.66 +
    1.67 +struct _MozContainerClass
    1.68 +{
    1.69 +    GtkContainerClass parent_class;
    1.70 +};
    1.71 +
    1.72 +GType      moz_container_get_type (void);
    1.73 +GtkWidget *moz_container_new      (void);
    1.74 +void       moz_container_put      (MozContainer *container,
    1.75 +                                   GtkWidget    *child_widget,
    1.76 +                                   gint          x,
    1.77 +                                   gint          y);
    1.78 +void       moz_container_move          (MozContainer *container,
    1.79 +                                        GtkWidget    *child_widget,
    1.80 +                                        gint          x,
    1.81 +                                        gint          y,
    1.82 +                                        gint          width,
    1.83 +                                        gint          height);
    1.84 +
    1.85 +#ifdef __cplusplus
    1.86 +}
    1.87 +#endif /* __cplusplus */
    1.88 +
    1.89 +#endif /* __MOZ_CONTAINER_H__ */

mercurial