update.
[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 #include "../lwlib/lwlib-utils.h"
36
37 /****************************************************************************
38  *                         Image-Instance Object                            *
39  ****************************************************************************/
40
41 struct x_image_instance_data
42 {
43   Pixmap* pixmaps;
44   Cursor cursor;
45
46   /* If depth>0, then that means that other colors were allocated when
47      this pixmap was loaded.  These are they; we need to free them when
48      finalizing the image instance. */
49   Colormap colormap;
50   unsigned long *pixels;
51   int npixels;
52
53   /* Should we hang on to the extra info from the XpmAttributes, like
54      the textual color table and the comments?   Is that useful? */
55 };
56
57 #define X_IMAGE_INSTANCE_DATA(i) ((struct x_image_instance_data *) (i)->data)
58
59 #define IMAGE_INSTANCE_X_PIXMAP(i) (X_IMAGE_INSTANCE_DATA (i)->pixmaps[0])
60 #define IMAGE_INSTANCE_X_PIXMAP_SLICE(i,slice) \
61      (X_IMAGE_INSTANCE_DATA (i)->pixmaps[slice])
62 #define IMAGE_INSTANCE_X_PIXMAP_SLICES(i) \
63      (X_IMAGE_INSTANCE_DATA (i)->pixmaps)
64 #define IMAGE_INSTANCE_X_MASK(i) \
65         (Pixmap)(IMAGE_INSTANCE_PIXMAP_MASK (i))
66 #define IMAGE_INSTANCE_X_CURSOR(i) (X_IMAGE_INSTANCE_DATA (i)->cursor)
67 #define IMAGE_INSTANCE_X_COLORMAP(i) (X_IMAGE_INSTANCE_DATA (i)->colormap)
68 #define IMAGE_INSTANCE_X_PIXELS(i) (X_IMAGE_INSTANCE_DATA (i)->pixels)
69 #define IMAGE_INSTANCE_X_NPIXELS(i) (X_IMAGE_INSTANCE_DATA (i)->npixels)
70
71 #define XIMAGE_INSTANCE_X_PIXMAP(i) \
72   IMAGE_INSTANCE_X_PIXMAP (XIMAGE_INSTANCE (i))
73 #define XIMAGE_INSTANCE_X_PIXMAP_SLICES(i) \
74   IMAGE_INSTANCE_X_PIXMAP_SLICES (XIMAGE_INSTANCE (i))
75 #define XIMAGE_INSTANCE_X_PIXMAP_SLICE(i) \
76   IMAGE_INSTANCE_X_PIXMAP_SLICE (XIMAGE_INSTANCE (i))
77 #define XIMAGE_INSTANCE_X_MASK(i) \
78   IMAGE_INSTANCE_X_MASK (XIMAGE_INSTANCE (i))
79 #define XIMAGE_INSTANCE_X_CURSOR(i) \
80   IMAGE_INSTANCE_X_CURSOR (XIMAGE_INSTANCE (i))
81 #define XIMAGE_INSTANCE_X_PIXELS(i) \
82   IMAGE_INSTANCE_X_PIXELS (XIMAGE_INSTANCE (i))
83 #define XIMAGE_INSTANCE_X_NPIXELS(i) \
84   IMAGE_INSTANCE_X_NPIXELS (XIMAGE_INSTANCE (i))
85
86 /****************************************************************************
87  *                            Subwindow Object                              *
88  ****************************************************************************/
89
90 struct x_subwindow_data
91 {
92   union
93   {
94     struct
95     {
96       Display *display;
97       Window parent_window;
98       Window clip_window;
99     } sub;
100     struct
101     {
102       Widget clip_window;
103       Position x_offset;
104       Position y_offset;
105       LWLIB_ID  id;
106     } wid;
107   } data;
108 };
109
110 #define X_SUBWINDOW_INSTANCE_DATA(i) ((struct x_subwindow_data *) (i)->data)
111
112 #define IMAGE_INSTANCE_X_SUBWINDOW_DISPLAY(i) \
113   (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.display)
114 #define IMAGE_INSTANCE_X_SUBWINDOW_PARENT(i) \
115   (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.parent_window)
116 #define IMAGE_INSTANCE_X_CLIPWINDOW(i) \
117   (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.clip_window)
118 #define IMAGE_INSTANCE_X_WIDGET_XOFFSET(i) \
119   (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.x_offset)
120 #define IMAGE_INSTANCE_X_WIDGET_YOFFSET(i) \
121   (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.y_offset)
122 #define IMAGE_INSTANCE_X_WIDGET_LWID(i) \
123   (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.id)
124 #define IMAGE_INSTANCE_X_CLIPWIDGET(i) \
125   (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.clip_window)
126 #define IMAGE_INSTANCE_X_SUBWINDOW_ID(i) \
127   (* (Window *) & IMAGE_INSTANCE_SUBWINDOW_ID (i))
128 #define IMAGE_INSTANCE_X_WIDGET_ID(i) \
129   (* (Widget *) & IMAGE_INSTANCE_SUBWINDOW_ID (i))
130
131 #define XIMAGE_INSTANCE_X_SUBWINDOW_PARENT(i) \
132   IMAGE_INSTANCE_X_SUBWINDOW_PARENT (XIMAGE_INSTANCE (i))
133 #define XIMAGE_INSTANCE_X_SUBWINDOW_DISPLAY(i) \
134   IMAGE_INSTANCE_X_SUBWINDOW_DISPLAY (XIMAGE_INSTANCE (i))
135 #define XIMAGE_INSTANCE_X_WIDGET_XOFFSET(i) \
136   IMAGE_INSTANCE_X_WIDGET_XOFFSET (XIMAGE_INSTANCE (i))
137 #define XIMAGE_INSTANCE_X_WIDGET_YOFFSET(i) \
138   IMAGE_INSTANCE_X_WIDGET_YOFFSET (XIMAGE_INSTANCE (i))
139 #define XIMAGE_INSTANCE_X_WIDGET_LWID(i) \
140   IMAGE_INSTANCE_X_WIDGET_LWID (XIMAGE_INSTANCE (i))
141 #define XIMAGE_INSTANCE_X_CLIPWIDGET(i) \
142   IMAGE_INSTANCE_X_CLIPWIDGET (XIMAGE_INSTANCE (i))
143 #define XIMAGE_INSTANCE_X_CLIPWINDOW(i) \
144   IMAGE_INSTANCE_X_CLIPWINDOW (XIMAGE_INSTANCE (i))
145 #define XIMAGE_INSTANCE_X_WIDGET_ID(i) \
146   IMAGE_INSTANCE_X_WIDGET_ID (XIMAGE_INSTANCE (i))
147
148 #define DOMAIN_X_WIDGET(domain) \
149   ((IMAGE_INSTANCEP (domain) && \
150   X_SUBWINDOW_INSTANCE_DATA (XIMAGE_INSTANCE (domain))) ? \
151    XIMAGE_INSTANCE_X_WIDGET_ID (domain) : \
152    FRAME_X_CONTAINER_WIDGET (f) (DOMAIN_XFRAME (domain)))
153
154 #endif /* HAVE_X_WINDOWS */
155 #endif /* INCLUDED_glyphs_x_h_ */