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