Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * vim: set expandtab shiftwidth=2 tabstop=2: */ |
michael@0 | 3 | |
michael@0 | 4 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef __GTK_XTBIN_H__ |
michael@0 | 9 | #define __GTK_XTBIN_H__ |
michael@0 | 10 | |
michael@0 | 11 | #include <gtk/gtk.h> |
michael@0 | 12 | #if (MOZ_WIDGET_GTK == 3) |
michael@0 | 13 | #include <gtk/gtkx.h> |
michael@0 | 14 | #endif |
michael@0 | 15 | #include <X11/Intrinsic.h> |
michael@0 | 16 | #include <X11/Xutil.h> |
michael@0 | 17 | #include <X11/Xlib.h> |
michael@0 | 18 | #ifdef MOZILLA_CLIENT |
michael@0 | 19 | #include "nscore.h" |
michael@0 | 20 | #ifdef _IMPL_GTKXTBIN_API |
michael@0 | 21 | #define GTKXTBIN_API(type) NS_EXPORT_(type) |
michael@0 | 22 | #else |
michael@0 | 23 | #define GTKXTBIN_API(type) NS_IMPORT_(type) |
michael@0 | 24 | #endif |
michael@0 | 25 | #else |
michael@0 | 26 | #define GTKXTBIN_API(type) type |
michael@0 | 27 | #endif |
michael@0 | 28 | |
michael@0 | 29 | #ifdef __cplusplus |
michael@0 | 30 | extern "C" { |
michael@0 | 31 | #endif /* __cplusplus */ |
michael@0 | 32 | |
michael@0 | 33 | typedef struct _GtkXtBin GtkXtBin; |
michael@0 | 34 | typedef struct _GtkXtBinClass GtkXtBinClass; |
michael@0 | 35 | |
michael@0 | 36 | #define GTK_TYPE_XTBIN (gtk_xtbin_get_type ()) |
michael@0 | 37 | #define GTK_XTBIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ |
michael@0 | 38 | GTK_TYPE_XTBIN, GtkXtBin)) |
michael@0 | 39 | #define GTK_XTBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ |
michael@0 | 40 | GTK_TYPE_XTBIN, GtkXtBinClass)) |
michael@0 | 41 | #define GTK_IS_XTBIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ |
michael@0 | 42 | GTK_TYPE_XTBIN)) |
michael@0 | 43 | #define GTK_IS_XTBIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ |
michael@0 | 44 | GTK_TYPE_XTBIN)) |
michael@0 | 45 | typedef struct _XtClient XtClient; |
michael@0 | 46 | |
michael@0 | 47 | struct _XtClient { |
michael@0 | 48 | Display *xtdisplay; |
michael@0 | 49 | Widget top_widget; /* The toplevel widget */ |
michael@0 | 50 | Widget child_widget; /* The embedded widget */ |
michael@0 | 51 | Visual *xtvisual; |
michael@0 | 52 | int xtdepth; |
michael@0 | 53 | Colormap xtcolormap; |
michael@0 | 54 | Window oldwindow; |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | struct _GtkXtBin |
michael@0 | 58 | { |
michael@0 | 59 | GtkSocket gsocket; |
michael@0 | 60 | GdkWindow *parent_window; |
michael@0 | 61 | Display *xtdisplay; /* Xt Toolkit Display */ |
michael@0 | 62 | |
michael@0 | 63 | Window xtwindow; /* Xt Toolkit XWindow */ |
michael@0 | 64 | XtClient xtclient; /* Xt Client for XEmbed */ |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | struct _GtkXtBinClass |
michael@0 | 68 | { |
michael@0 | 69 | GtkSocketClass parent_class; |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | GTKXTBIN_API(GType) gtk_xtbin_get_type (void); |
michael@0 | 73 | GTKXTBIN_API(GtkWidget *) gtk_xtbin_new (GdkWindow *parent_window, String *f); |
michael@0 | 74 | |
michael@0 | 75 | typedef struct _XtTMRec { |
michael@0 | 76 | XtTranslations translations; /* private to Translation Manager */ |
michael@0 | 77 | XtBoundActions proc_table; /* procedure bindings for actions */ |
michael@0 | 78 | struct _XtStateRec *current_state; /* Translation Manager state ptr */ |
michael@0 | 79 | unsigned long lastEventTime; |
michael@0 | 80 | } XtTMRec, *XtTM; |
michael@0 | 81 | |
michael@0 | 82 | typedef struct _CorePart { |
michael@0 | 83 | Widget self; /* pointer to widget itself */ |
michael@0 | 84 | WidgetClass widget_class; /* pointer to Widget's ClassRec */ |
michael@0 | 85 | Widget parent; /* parent widget */ |
michael@0 | 86 | XrmName xrm_name; /* widget resource name quarkified */ |
michael@0 | 87 | Boolean being_destroyed; /* marked for destroy */ |
michael@0 | 88 | XtCallbackList destroy_callbacks; /* who to call when widget destroyed */ |
michael@0 | 89 | XtPointer constraints; /* constraint record */ |
michael@0 | 90 | Position x, y; /* window position */ |
michael@0 | 91 | Dimension width, height; /* window dimensions */ |
michael@0 | 92 | Dimension border_width; /* window border width */ |
michael@0 | 93 | Boolean managed; /* is widget geometry managed? */ |
michael@0 | 94 | Boolean sensitive; /* is widget sensitive to user events*/ |
michael@0 | 95 | Boolean ancestor_sensitive; /* are all ancestors sensitive? */ |
michael@0 | 96 | XtEventTable event_table; /* private to event dispatcher */ |
michael@0 | 97 | XtTMRec tm; /* translation management */ |
michael@0 | 98 | XtTranslations accelerators; /* accelerator translations */ |
michael@0 | 99 | Pixel border_pixel; /* window border pixel */ |
michael@0 | 100 | Pixmap border_pixmap; /* window border pixmap or NULL */ |
michael@0 | 101 | WidgetList popup_list; /* list of popups */ |
michael@0 | 102 | Cardinal num_popups; /* how many popups */ |
michael@0 | 103 | String name; /* widget resource name */ |
michael@0 | 104 | Screen *screen; /* window's screen */ |
michael@0 | 105 | Colormap colormap; /* colormap */ |
michael@0 | 106 | Window window; /* window ID */ |
michael@0 | 107 | Cardinal depth; /* number of planes in window */ |
michael@0 | 108 | Pixel background_pixel; /* window background pixel */ |
michael@0 | 109 | Pixmap background_pixmap; /* window background pixmap or NULL */ |
michael@0 | 110 | Boolean visible; /* is window mapped and not occluded?*/ |
michael@0 | 111 | Boolean mapped_when_managed;/* map window if it's managed? */ |
michael@0 | 112 | } CorePart; |
michael@0 | 113 | |
michael@0 | 114 | typedef struct _WidgetRec { |
michael@0 | 115 | CorePart core; |
michael@0 | 116 | } WidgetRec, CoreRec; |
michael@0 | 117 | |
michael@0 | 118 | /* Exported functions, used by Xt plugins */ |
michael@0 | 119 | void xt_client_create(XtClient * xtclient, Window embeder, int height, int width); |
michael@0 | 120 | void xt_client_unrealize(XtClient* xtclient); |
michael@0 | 121 | void xt_client_destroy(XtClient* xtclient); |
michael@0 | 122 | void xt_client_init(XtClient * xtclient, Visual *xtvisual, Colormap xtcolormap, int xtdepth); |
michael@0 | 123 | void xt_client_xloop_create(void); |
michael@0 | 124 | void xt_client_xloop_destroy(void); |
michael@0 | 125 | Display * xt_client_get_display(void); |
michael@0 | 126 | |
michael@0 | 127 | #ifdef __cplusplus |
michael@0 | 128 | } |
michael@0 | 129 | #endif /* __cplusplus */ |
michael@0 | 130 | #endif /* __GTK_XTBIN_H__ */ |
michael@0 | 131 |