Home | History | Annotate | Download | only in gtk
      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      2  * vim: set expandtab shiftwidth=2 tabstop=2: */
      3 
      4 /* ***** BEGIN LICENSE BLOCK *****
      5  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
      6  *
      7  * The contents of this file are subject to the Mozilla Public License Version
      8  * 1.1 (the "License"); you may not use this file except in compliance with
      9  * the License. You may obtain a copy of the License at
     10  * http://www.mozilla.org/MPL/
     11  *
     12  * Software distributed under the License is distributed on an "AS IS" basis,
     13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
     14  * for the specific language governing rights and limitations under the
     15  * License.
     16  *
     17  * The Original Code is the Gtk2XtBin Widget Implementation.
     18  *
     19  * The Initial Developer of the Original Code is
     20  * Sun Microsystems, Inc.
     21  * Portions created by the Initial Developer are Copyright (C) 2002
     22  * the Initial Developer. All Rights Reserved.
     23  *
     24  * Contributor(s):
     25  *
     26  * Alternatively, the contents of this file may be used under the terms of
     27  * either the GNU General Public License Version 2 or later (the "GPL"), or
     28  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
     29  * in which case the provisions of the GPL or the LGPL are applicable instead
     30  * of those above. If you wish to allow use of your version of this file only
     31  * under the terms of either the GPL or the LGPL, and not to allow others to
     32  * use your version of this file under the terms of the MPL, indicate your
     33  * decision by deleting the provisions above and replace them with the notice
     34  * and other provisions required by the GPL or the LGPL. If you do not delete
     35  * the provisions above, a recipient may use your version of this file under
     36  * the terms of any one of the MPL, the GPL or the LGPL.
     37  *
     38  * ***** END LICENSE BLOCK ***** */
     39 
     40 #ifndef __GTK_XTBIN_H__
     41 #define __GTK_XTBIN_H__
     42 
     43 #include <gtk/gtk.h>
     44 #include <X11/Intrinsic.h>
     45 #include <X11/Xutil.h>
     46 #include <X11/Xlib.h>
     47 #ifdef MOZILLA_CLIENT
     48 #include "nscore.h"
     49 #ifdef _IMPL_GTKXTBIN_API
     50 #define GTKXTBIN_API(type) NS_EXPORT_(type)
     51 #else
     52 #define GTKXTBIN_API(type) NS_IMPORT_(type)
     53 #endif
     54 #else
     55 #define GTKXTBIN_API(type) type
     56 #endif
     57 
     58 #ifdef __cplusplus
     59 extern "C" {
     60 #endif /* __cplusplus */
     61 
     62 typedef struct _GtkXtBin GtkXtBin;
     63 typedef struct _GtkXtBinClass GtkXtBinClass;
     64 
     65 #define GTK_TYPE_XTBIN                  (gtk_xtbin_get_type ())
     66 #define GTK_XTBIN(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
     67                                          GTK_TYPE_XTBIN, GtkXtBin))
     68 #define GTK_XTBIN_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), \
     69                                          GTK_TYPE_XTBIN, GtkXtBinClass))
     70 #define GTK_IS_XTBIN(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
     71                                          GTK_TYPE_XTBIN))
     72 #define GTK_IS_XTBIN_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), \
     73                                          GTK_TYPE_XTBIN))
     74 typedef struct _XtClient XtClient;
     75 
     76 struct _XtClient {
     77   Display	*xtdisplay;
     78   Widget	top_widget;    /* The toplevel widget */
     79   Widget	child_widget;  /* The embedded widget */
     80   Visual	*xtvisual;
     81   int		xtdepth;
     82   Colormap	xtcolormap;
     83   Window	oldwindow;
     84 };
     85 
     86 struct _GtkXtBin
     87 {
     88   GtkSocket      gsocket;
     89   GdkWindow     *parent_window;
     90   Display       *xtdisplay;        /* Xt Toolkit Display */
     91 
     92   Window         xtwindow;         /* Xt Toolkit XWindow */
     93   gint           x, y;
     94   gint           width, height;
     95   XtClient	 xtclient;         /* Xt Client for XEmbed */
     96 };
     97 
     98 struct _GtkXtBinClass
     99 {
    100   GtkSocketClass widget_class;
    101 };
    102 
    103 GTKXTBIN_API(GType)       gtk_xtbin_get_type (void);
    104 GTKXTBIN_API(GtkWidget *) gtk_xtbin_new (GdkWindow *parent_window, String *f);
    105 GTKXTBIN_API(void)        gtk_xtbin_set_position (GtkXtBin *xtbin,
    106                                                   gint       x,
    107                                                   gint       y);
    108 GTKXTBIN_API(void)       gtk_xtbin_resize (GtkWidget *widget,
    109                                            gint       width,
    110                                            gint       height);
    111 
    112 typedef struct _XtTMRec {
    113     XtTranslations  translations;       /* private to Translation Manager    */
    114     XtBoundActions  proc_table;         /* procedure bindings for actions    */
    115     struct _XtStateRec *current_state;  /* Translation Manager state ptr     */
    116     unsigned long   lastEventTime;
    117 } XtTMRec, *XtTM;
    118 
    119 typedef struct _CorePart {
    120     Widget          self;               /* pointer to widget itself          */
    121     WidgetClass     widget_class;       /* pointer to Widget's ClassRec      */
    122     Widget          parent;             /* parent widget                     */
    123     XrmName         xrm_name;           /* widget resource name quarkified   */
    124     Boolean         being_destroyed;    /* marked for destroy                */
    125     XtCallbackList  destroy_callbacks;  /* who to call when widget destroyed */
    126     XtPointer       constraints;        /* constraint record                 */
    127     Position        x, y;               /* window position                   */
    128     Dimension       width, height;      /* window dimensions                 */
    129     Dimension       border_width;       /* window border width               */
    130     Boolean         managed;            /* is widget geometry managed?       */
    131     Boolean         sensitive;          /* is widget sensitive to user events*/
    132     Boolean         ancestor_sensitive; /* are all ancestors sensitive?      */
    133     XtEventTable    event_table;        /* private to event dispatcher       */
    134     XtTMRec         tm;                 /* translation management            */
    135     XtTranslations  accelerators;       /* accelerator translations          */
    136     Pixel           border_pixel;       /* window border pixel               */
    137     Pixmap          border_pixmap;      /* window border pixmap or NULL      */
    138     WidgetList      popup_list;         /* list of popups                    */
    139     Cardinal        num_popups;         /* how many popups                   */
    140     String          name;               /* widget resource name              */
    141     Screen          *screen;            /* window's screen                   */
    142     Colormap        colormap;           /* colormap                          */
    143     Window          window;             /* window ID                         */
    144     Cardinal        depth;              /* number of planes in window        */
    145     Pixel           background_pixel;   /* window background pixel           */
    146     Pixmap          background_pixmap;  /* window background pixmap or NULL  */
    147     Boolean         visible;            /* is window mapped and not occluded?*/
    148     Boolean         mapped_when_managed;/* map window if it's managed?       */
    149 } CorePart;
    150 
    151 typedef struct _WidgetRec {
    152     CorePart    core;
    153  } WidgetRec, CoreRec;
    154 
    155 #ifdef __cplusplus
    156 }
    157 #endif /* __cplusplus */
    158 #endif /* __GTK_XTBIN_H__ */
    159