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 #ifndef GTK_API_VERSION_2
     45 #include <gtk/gtkx.h>
     46 #endif
     47 #include <X11/Intrinsic.h>
     48 #include <X11/Xutil.h>
     49 #include <X11/Xlib.h>
     50 #ifdef MOZILLA_CLIENT
     51 #include "nscore.h"
     52 #ifdef _IMPL_GTKXTBIN_API
     53 #define GTKXTBIN_API(type) NS_EXPORT_(type)
     54 #else
     55 #define GTKXTBIN_API(type) NS_IMPORT_(type)
     56 #endif
     57 #else
     58 #define GTKXTBIN_API(type) type
     59 #endif
     60 
     61 #ifdef __cplusplus
     62 extern "C" {
     63 #endif /* __cplusplus */
     64 
     65 typedef struct _GtkXtBin GtkXtBin;
     66 typedef struct _GtkXtBinClass GtkXtBinClass;
     67 
     68 #define GTK_TYPE_XTBIN                  (gtk_xtbin_get_type ())
     69 #define GTK_XTBIN(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
     70                                          GTK_TYPE_XTBIN, GtkXtBin))
     71 #define GTK_XTBIN_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), \
     72                                          GTK_TYPE_XTBIN, GtkXtBinClass))
     73 #define GTK_IS_XTBIN(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
     74                                          GTK_TYPE_XTBIN))
     75 #define GTK_IS_XTBIN_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), \
     76                                          GTK_TYPE_XTBIN))
     77 typedef struct _XtClient XtClient;
     78 
     79 struct _XtClient {
     80   Display	*xtdisplay;
     81   Widget	top_widget;    /* The toplevel widget */
     82   Widget	child_widget;  /* The embedded widget */
     83   Visual	*xtvisual;
     84   int		xtdepth;
     85   Colormap	xtcolormap;
     86   Window	oldwindow;
     87 };
     88 
     89 struct _GtkXtBin
     90 {
     91   GtkSocket      gsocket;
     92   GdkWindow     *parent_window;
     93   Display       *xtdisplay;        /* Xt Toolkit Display */
     94 
     95   Window         xtwindow;         /* Xt Toolkit XWindow */
     96   gint           x, y;
     97   gint           width, height;
     98   XtClient	 xtclient;         /* Xt Client for XEmbed */
     99 };
    100 
    101 struct _GtkXtBinClass
    102 {
    103   GtkSocketClass widget_class;
    104 };
    105 
    106 GTKXTBIN_API(GType)       gtk_xtbin_get_type (void);
    107 GTKXTBIN_API(GtkWidget *) gtk_xtbin_new (GtkWidget *parent_widget, String *f);
    108 GTKXTBIN_API(void)        gtk_xtbin_set_position (GtkXtBin *xtbin,
    109                                                   gint       x,
    110                                                   gint       y);
    111 GTKXTBIN_API(void)       gtk_xtbin_resize (GtkWidget *widget,
    112                                            gint       width,
    113                                            gint       height);
    114 
    115 typedef struct _XtTMRec {
    116     XtTranslations  translations;       /* private to Translation Manager    */
    117     XtBoundActions  proc_table;         /* procedure bindings for actions    */
    118     struct _XtStateRec *current_state;  /* Translation Manager state ptr     */
    119     unsigned long   lastEventTime;
    120 } XtTMRec, *XtTM;
    121 
    122 typedef struct _CorePart {
    123     Widget          self;               /* pointer to widget itself          */
    124     WidgetClass     widget_class;       /* pointer to Widget's ClassRec      */
    125     Widget          parent;             /* parent widget                     */
    126     XrmName         xrm_name;           /* widget resource name quarkified   */
    127     Boolean         being_destroyed;    /* marked for destroy                */
    128     XtCallbackList  destroy_callbacks;  /* who to call when widget destroyed */
    129     XtPointer       constraints;        /* constraint record                 */
    130     Position        x, y;               /* window position                   */
    131     Dimension       width, height;      /* window dimensions                 */
    132     Dimension       border_width;       /* window border width               */
    133     Boolean         managed;            /* is widget geometry managed?       */
    134     Boolean         sensitive;          /* is widget sensitive to user events*/
    135     Boolean         ancestor_sensitive; /* are all ancestors sensitive?      */
    136     XtEventTable    event_table;        /* private to event dispatcher       */
    137     XtTMRec         tm;                 /* translation management            */
    138     XtTranslations  accelerators;       /* accelerator translations          */
    139     Pixel           border_pixel;       /* window border pixel               */
    140     Pixmap          border_pixmap;      /* window border pixmap or NULL      */
    141     WidgetList      popup_list;         /* list of popups                    */
    142     Cardinal        num_popups;         /* how many popups                   */
    143     String          name;               /* widget resource name              */
    144     Screen          *screen;            /* window's screen                   */
    145     Colormap        colormap;           /* colormap                          */
    146     Window          window;             /* window ID                         */
    147     Cardinal        depth;              /* number of planes in window        */
    148     Pixel           background_pixel;   /* window background pixel           */
    149     Pixmap          background_pixmap;  /* window background pixmap or NULL  */
    150     Boolean         visible;            /* is window mapped and not occluded?*/
    151     Boolean         mapped_when_managed;/* map window if it's managed?       */
    152 } CorePart;
    153 
    154 typedef struct _WidgetRec {
    155     CorePart    core;
    156  } WidgetRec, CoreRec;
    157 
    158 #ifdef __cplusplus
    159 }
    160 #endif /* __cplusplus */
    161 #endif /* __GTK_XTBIN_H__ */
    162