gtk2xtbin.h 5.3 KB

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