XEmacs 21.2.29 "Hestia".
[chise/xemacs-chise.git.1] / src / glyphs-x.h
1 /* X-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 XEmacs.
8
9 XEmacs is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the
11 Free Software Foundation; either version 2, or (at your option) any
12 later version.
13
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with XEmacs; see the file COPYING.  If not, write to
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.  */
23
24 /* Synched up with:  Not in FSF. */
25
26 #ifndef INCLUDED_glyphs_x_h_
27 #define INCLUDED_glyphs_x_h_
28
29 #include "glyphs.h"
30
31 #ifdef HAVE_X_WINDOWS
32
33 #include "xintrinsic.h"
34 #include "../lwlib/lwlib.h"
35
36 /****************************************************************************
37  *                         Image-Instance Object                            *
38  ****************************************************************************/
39
40 struct x_image_instance_data
41 {
42   Pixmap* pixmaps;
43   Cursor cursor;
44
45   /* If depth>0, then that means that other colors were allocated when
46      this pixmap was loaded.  These are they; we need to free them when
47      finalizing the image instance. */
48   Colormap colormap;
49   unsigned long *pixels;
50   int npixels;
51
52   /* Should we hang on to the extra info from the XpmAttributes, like
53      the textual color table and the comments?   Is that useful? */
54 };
55
56 #define X_IMAGE_INSTANCE_DATA(i) ((struct x_image_instance_data *) (i)->data)
57
58 #define IMAGE_INSTANCE_X_PIXMAP(i) (X_IMAGE_INSTANCE_DATA (i)->pixmaps[0])
59 #define IMAGE_INSTANCE_X_PIXMAP_SLICE(i,slice) \
60      (X_IMAGE_INSTANCE_DATA (i)->pixmaps[slice])
61 #define IMAGE_INSTANCE_X_PIXMAP_SLICES(i) \
62      (X_IMAGE_INSTANCE_DATA (i)->pixmaps)
63 #define IMAGE_INSTANCE_X_MASK(i) \
64         (Pixmap)(IMAGE_INSTANCE_PIXMAP_MASK (i))
65 #define IMAGE_INSTANCE_X_CURSOR(i) (X_IMAGE_INSTANCE_DATA (i)->cursor)
66 #define IMAGE_INSTANCE_X_COLORMAP(i) (X_IMAGE_INSTANCE_DATA (i)->colormap)
67 #define IMAGE_INSTANCE_X_PIXELS(i) (X_IMAGE_INSTANCE_DATA (i)->pixels)
68 #define IMAGE_INSTANCE_X_NPIXELS(i) (X_IMAGE_INSTANCE_DATA (i)->npixels)
69
70 #define XIMAGE_INSTANCE_X_PIXMAP(i) \
71   IMAGE_INSTANCE_X_PIXMAP (XIMAGE_INSTANCE (i))
72 #define XIMAGE_INSTANCE_X_PIXMAP_SLICES(i) \
73   IMAGE_INSTANCE_X_PIXMAP_SLICES (XIMAGE_INSTANCE (i))
74 #define XIMAGE_INSTANCE_X_PIXMAP_SLICE(i) \
75   IMAGE_INSTANCE_X_PIXMAP_SLICE (XIMAGE_INSTANCE (i))
76 #define XIMAGE_INSTANCE_X_MASK(i) \
77   IMAGE_INSTANCE_X_MASK (XIMAGE_INSTANCE (i))
78 #define XIMAGE_INSTANCE_X_CURSOR(i) \
79   IMAGE_INSTANCE_X_CURSOR (XIMAGE_INSTANCE (i))
80 #define XIMAGE_INSTANCE_X_PIXELS(i) \
81   IMAGE_INSTANCE_X_PIXELS (XIMAGE_INSTANCE (i))
82 #define XIMAGE_INSTANCE_X_NPIXELS(i) \
83   IMAGE_INSTANCE_X_NPIXELS (XIMAGE_INSTANCE (i))
84
85 /****************************************************************************
86  *                            Subwindow Object                              *
87  ****************************************************************************/
88
89 struct x_subwindow_data
90 {
91   union
92   {
93     struct
94     {
95       Display *display;
96       Window parent_window;
97       Window clip_window;
98     } sub;
99     struct 
100     {
101       Widget clip_window;
102       Position x_offset;
103       Position y_offset;
104       LWLIB_ID  id;
105     } wid;
106   } data;
107 };
108
109 #define X_SUBWINDOW_INSTANCE_DATA(i) ((struct x_subwindow_data *) (i)->data)
110
111 #define IMAGE_INSTANCE_X_SUBWINDOW_DISPLAY(i) \
112   (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.display)
113 #define IMAGE_INSTANCE_X_SUBWINDOW_PARENT(i) \
114   (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.parent_window)
115 #define IMAGE_INSTANCE_X_CLIPWINDOW(i) \
116   (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.clip_window)
117 #define IMAGE_INSTANCE_X_WIDGET_XOFFSET(i) \
118   (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.x_offset)
119 #define IMAGE_INSTANCE_X_WIDGET_YOFFSET(i) \
120   (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.y_offset)
121 #define IMAGE_INSTANCE_X_WIDGET_LWID(i) \
122   (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.id)
123 #define IMAGE_INSTANCE_X_CLIPWIDGET(i) \
124   (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.clip_window)
125 #define XIMAGE_INSTANCE_X_SUBWINDOW_PARENT(i) \
126   IMAGE_INSTANCE_X_SUBWINDOW_PARENT (XIMAGE_INSTANCE (i))
127 #define XIMAGE_INSTANCE_X_SUBWINDOW_DISPLAY(i) \
128   IMAGE_INSTANCE_X_SUBWINDOW_DISPLAY (XIMAGE_INSTANCE (i))
129 #define XIMAGE_INSTANCE_X_WIDGET_XOFFSET(i) \
130   IMAGE_INSTANCE_X_WIDGET_XOFFSET (XIMAGE_INSTANCE (i))
131 #define XIMAGE_INSTANCE_X_WIDGET_YOFFSET(i) \
132   IMAGE_INSTANCE_X_WIDGET_YOFFSET (XIMAGE_INSTANCE (i))
133 #define XIMAGE_INSTANCE_X_WIDGET_LWID(i) \
134   IMAGE_INSTANCE_X_WIDGET_LWID (XIMAGE_INSTANCE (i))
135 #define XIMAGE_INSTANCE_X_CLIPWIDGET(i) \
136   IMAGE_INSTANCE_X_CLIPWIDGET (XIMAGE_INSTANCE (i))
137 #define XIMAGE_INSTANCE_X_CLIPWINDOW(i) \
138   IMAGE_INSTANCE_X_CLIPWINDOW (XIMAGE_INSTANCE (i))
139 #define IMAGE_INSTANCE_X_SUBWINDOW_ID(i) \
140   (* (Window *) & IMAGE_INSTANCE_SUBWINDOW_ID (i))
141 #define IMAGE_INSTANCE_X_WIDGET_ID(i) \
142   (* (Widget *) & IMAGE_INSTANCE_SUBWINDOW_ID (i))
143
144 #endif /* HAVE_X_WINDOWS */
145 #endif /* INCLUDED_glyphs_x_h_ */