GTK eradication -- the build chain.
[sxemacs] / src / ui / Gtk / glyphs-gtk.h
1 /* Gtk-specific glyphs and related.
2    Copyright (C) 1993, 1994 Free Software Foundation, Inc.
3    Copyright (C) 1995 Board of Trustees, University of Illinois.
4    Copyright (C) 1995, 1996 Ben Wing
5    Copyright (C) 1995 Sun Microsystems, Inc.
6
7 This file is part of SXEmacs
8
9 SXEmacs is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 SXEmacs is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
21
22
23 /* Synched up with:  Not in FSF. */
24 /* Gtk version by William Perry */
25
26 #ifndef _XEMACS_GLYPHS_GTK_H_
27 #define _XEMACS_GLYPHS_GTK_H_
28
29 #include "ui/glyphs.h"
30
31 #ifdef HAVE_GTK
32
33 #include <gtk/gtk.h>
34
35 /****************************************************************************
36  *                         Image-Instance Object                            *
37  ****************************************************************************/
38
39 struct gtk_image_instance_data {
40         GdkPixmap **pixmaps;
41         GdkCursor *cursor;
42
43         /* If depth>0, then that means that other colors were allocated when
44            this pixmap was loaded.  These are they; we need to free them when
45            finalizing the image instance. */
46         GdkColormap *colormap;
47         unsigned long *pixels;
48         int npixels;
49
50         /* Should we hang on to the extra info from the XpmAttributes, like
51            the textual color table and the comments?   Is that useful? */
52 };
53
54 struct gtk_subwindow_data {
55         union {
56                 struct {
57                         GtkWidget *parent_window;
58                         GtkWidget *clip_window;
59                 } sub;
60                 struct {
61                         GtkWidget *clip_window;
62                         Lisp_Object widget;
63                         guint x_offset;
64                         guint y_offset;
65                         gboolean added_to_fixed;
66                 } wid;
67         } data;
68 };
69
70 void init_image_instance_from_gdk_pixmap(struct Lisp_Image_Instance *ii,
71                                          struct device *device,
72                                          GdkPixmap * gdk_pixmap,
73                                          int dest_mask,
74                                          Lisp_Object instantiator);
75
76 #define GTK_IMAGE_INSTANCE_DATA(i) ((struct gtk_image_instance_data *) (i)->data)
77
78 #define IMAGE_INSTANCE_GTK_PIXMAP(i) (GTK_IMAGE_INSTANCE_DATA (i)->pixmaps[0])
79 #define IMAGE_INSTANCE_GTK_PIXMAP_SLICE(i,slice) \
80      (GTK_IMAGE_INSTANCE_DATA (i)->pixmaps[slice])
81 #define IMAGE_INSTANCE_GTK_PIXMAP_SLICES(i) \
82      (GTK_IMAGE_INSTANCE_DATA (i)->pixmaps)
83 #define IMAGE_INSTANCE_GTK_MASK(i) (IMAGE_INSTANCE_PIXMAP_MASK (i))
84 #define IMAGE_INSTANCE_GTK_CURSOR(i) (GTK_IMAGE_INSTANCE_DATA (i)->cursor)
85 #define IMAGE_INSTANCE_GTK_COLORMAP(i) (GTK_IMAGE_INSTANCE_DATA (i)->colormap)
86 #define IMAGE_INSTANCE_GTK_PIXELS(i) (GTK_IMAGE_INSTANCE_DATA (i)->pixels)
87 #define IMAGE_INSTANCE_GTK_NPIXELS(i) (GTK_IMAGE_INSTANCE_DATA (i)->npixels)
88
89 #define XIMAGE_INSTANCE_GTK_PIXMAP(i) \
90   IMAGE_INSTANCE_GTK_PIXMAP (XIMAGE_INSTANCE (i))
91 #define XIMAGE_INSTANCE_GTK_PIXMAP_SLICE(i) \
92   IMAGE_INSTANCE_GTK_PIXMAP_SLICE (XIMAGE_INSTANCE (i))
93 #define XIMAGE_INSTANCE_GTK_PIXMAP_SLICES(i) \
94   IMAGE_INSTANCE_GTK_PIXMAP_SLICES (XIMAGE_INSTANCE (i))
95 #define XIMAGE_INSTANCE_GTK_MASK(i) \
96   IMAGE_INSTANCE_GTK_MASK (XIMAGE_INSTANCE (i))
97 #define XIMAGE_INSTANCE_GTK_CURSOR(i) \
98   IMAGE_INSTANCE_GTK_CURSOR (XIMAGE_INSTANCE (i))
99 #define XIMAGE_INSTANCE_GTK_PIXELS(i) \
100   IMAGE_INSTANCE_GTK_PIXELS (XIMAGE_INSTANCE (i))
101 #define XIMAGE_INSTANCE_GTK_NPIXELS(i) \
102   IMAGE_INSTANCE_GTK_NPIXELS (XIMAGE_INSTANCE (i))
103
104 /* Subwindow / widget stuff */
105 #define GTK_SUBWINDOW_INSTANCE_DATA(i) ((struct gtk_subwindow_data *) (i)->data)
106
107 #define IMAGE_INSTANCE_GTK_SUBWINDOW_PARENT(i) \
108   (GTK_SUBWINDOW_INSTANCE_DATA (i)->data.sub.parent_window)
109 #define IMAGE_INSTANCE_GTK_CLIPWINDOW(i) \
110   (GTK_SUBWINDOW_INSTANCE_DATA (i)->data.sub.clip_window)
111 #define IMAGE_INSTANCE_GTK_WIDGET_XOFFSET(i) \
112   (GTK_SUBWINDOW_INSTANCE_DATA (i)->data.wid.x_offset)
113 #define IMAGE_INSTANCE_GTK_WIDGET_YOFFSET(i) \
114   (GTK_SUBWINDOW_INSTANCE_DATA (i)->data.wid.y_offset)
115 #define IMAGE_INSTANCE_GTK_WIDGET_LWID(i) \
116   (GTK_SUBWINDOW_INSTANCE_DATA (i)->data.wid.id)
117 #define IMAGE_INSTANCE_GTK_CLIPWIDGET(i) \
118   (GTK_SUBWINDOW_INSTANCE_DATA (i)->data.wid.clip_window)
119 #define IMAGE_INSTANCE_GTK_ALREADY_PUT(i) \
120   (GTK_SUBWINDOW_INSTANCE_DATA (i)->data.wid.added_to_fixed)
121 #define IMAGE_INSTANCE_GTK_SUBWINDOW_ID(i) \
122   ((GdkWindow *) & IMAGE_INSTANCE_SUBWINDOW_ID (i))
123 #define IMAGE_INSTANCE_GTK_WIDGET_ID(i) \
124   ((GtkWidget *) & IMAGE_INSTANCE_SUBWINDOW_ID (i))
125
126 #define XIMAGE_INSTANCE_GTK_SUBWINDOW_PARENT(i) \
127   IMAGE_INSTANCE_GTK_SUBWINDOW_PARENT (XIMAGE_INSTANCE (i))
128 #define XIMAGE_INSTANCE_GTK_SUBWINDOW_DISPLAY(i) \
129   IMAGE_INSTANCE_GTK_SUBWINDOW_DISPLAY (XIMAGE_INSTANCE (i))
130 #define XIMAGE_INSTANCE_GTK_WIDGET_XOFFSET(i) \
131   IMAGE_INSTANCE_GTK_WIDGET_XOFFSET (XIMAGE_INSTANCE (i))
132 #define XIMAGE_INSTANCE_GTK_WIDGET_YOFFSET(i) \
133   IMAGE_INSTANCE_GTK_WIDGET_YOFFSET (XIMAGE_INSTANCE (i))
134 #define XIMAGE_INSTANCE_GTK_WIDGET_LWID(i) \
135   IMAGE_INSTANCE_GTK_WIDGET_LWID (XIMAGE_INSTANCE (i))
136 #define XIMAGE_INSTANCE_GTK_CLIPWIDGET(i) \
137   IMAGE_INSTANCE_GTK_CLIPWIDGET (XIMAGE_INSTANCE (i))
138 #define XIMAGE_INSTANCE_GTK_CLIPWINDOW(i) \
139   IMAGE_INSTANCE_GTK_CLIPWINDOW (XIMAGE_INSTANCE (i))
140 #define XIMAGE_INSTANCE_GTK_WIDGET_ID(i) \
141   IMAGE_INSTANCE_GTK_WIDGET_ID (XIMAGE_INSTANCE (i))
142
143 #define DOMAIN_GTK_WIDGET(domain) \
144   ((IMAGE_INSTANCEP (domain) && \
145   GTK_SUBWINDOW_INSTANCE_DATA (XIMAGE_INSTANCE (domain))) ? \
146    XIMAGE_INSTANCE_GTK_WIDGET_ID (domain) : \
147    FRAME_GTK_CONTAINER_WIDGET (f) (DOMAIN_XFRAME (domain)))
148
149 #endif                          /* HAVE_GTK */
150 #endif                          /* _XEMACS_GLYPHS_GTK_H_ */