Commit | Line | Data |
---|---|---|
edfda783 AR |
1 | /* Definitions and headers for communication on the NeXT/Open/GNUstep API. |
2 | Copyright (C) 1995, 2005, 2008 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GNU Emacs. | |
5 | ||
6 | GNU Emacs is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU Emacs is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Emacs; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
19 | Boston, MA 02110-1301, USA. */ | |
20 | ||
21 | #ifndef __NSGUI_H__ | |
22 | #define __NSGUI_H__ | |
23 | ||
24 | /* this gets included from a couple of the plain (non-NS) .c files */ | |
25 | #ifdef __OBJC__ | |
26 | ||
27 | #ifdef NS_IMPL_COCOA | |
28 | #ifdef Z | |
29 | #warning "Z is defined. If you get a later parse error in a header, check that buffer.h or other files #define-ing Z are not included." | |
30 | #endif /* Z */ | |
31 | #define Cursor FooFoo | |
32 | #undef init_process | |
33 | #endif /* NS_IMPL_COCOA */ | |
34 | ||
35 | #ifdef NS_IMPL_GNUSTEP | |
36 | #undef hash_remove | |
37 | #endif | |
38 | ||
39 | #import <AppKit/AppKit.h> | |
40 | ||
41 | #ifdef NS_IMPL_GNUSTEP | |
42 | #define hash_remove emacs_hash_remove | |
43 | #endif | |
44 | ||
45 | #ifdef NS_IMPL_COCOA | |
46 | #undef Cursor | |
47 | #define init_process emacs_init_process | |
48 | #endif /* NS_IMPL_COCOA */ | |
49 | #import <Foundation/NSDistantObject.h> | |
50 | ||
51 | #ifdef NS_IMPL_COCOA | |
52 | #include <AvailabilityMacros.h> | |
53 | #endif /* NS_IMPL_COCOA */ | |
54 | ||
55 | #endif /* __OBJC__ */ | |
56 | ||
57 | ||
58 | /* menu-related */ | |
59 | #define free_widget_value(wv) xfree (wv) | |
60 | #define malloc_widget_value() ((widget_value *) memset (xmalloc \ | |
61 | (sizeof (widget_value)), 0, sizeof (widget_value))) | |
62 | ||
63 | /* Emulate XCharStruct. */ | |
64 | typedef struct _XCharStruct | |
65 | { | |
66 | int rbearing; | |
67 | int lbearing; | |
68 | int width; | |
69 | int ascent; | |
70 | int descent; | |
71 | } XCharStruct; | |
72 | ||
73 | /* 23: Fake tructure from Xlib.h to represent two-byte characters. */ | |
74 | #ifndef __OBJC__ | |
75 | typedef unsigned short unichar; | |
76 | #endif | |
77 | typedef unichar XChar2b; | |
78 | ||
79 | #define STORE_XCHAR2B(chp, b1, b2) \ | |
80 | (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff)))) | |
81 | ||
82 | #define XCHAR2B_BYTE1(chp) \ | |
83 | (((*chp) & 0xff00) >> 8) | |
84 | ||
85 | #define XCHAR2B_BYTE2(chp) \ | |
86 | ((*chp) & 0x00ff) | |
87 | ||
88 | #define FACE_DEFAULT (~0) | |
89 | ||
90 | ||
91 | /* PENDING: xfaces requires these structures, but the question is are we | |
92 | forced to use them? */ | |
93 | typedef struct _XGCValues | |
94 | { | |
95 | #ifdef __OBJC__ | |
96 | NSColor *foreground; | |
97 | NSColor *background; | |
98 | struct ns_font *font; | |
99 | #else | |
100 | void *foreground; | |
101 | void *background; | |
102 | void *font; | |
103 | #endif | |
104 | } XGCValues; | |
105 | ||
106 | typedef XGCValues * GC; | |
107 | ||
108 | #define GCForeground 0x01 | |
109 | #define GCBackground 0x02 | |
110 | #define GCFont 0x03 | |
111 | ||
112 | #ifdef __OBJC__ | |
113 | typedef id Pixmap; | |
114 | #else | |
115 | typedef void *Pixmap; | |
116 | #endif | |
117 | ||
118 | #ifdef __OBJC__ | |
119 | typedef NSCursor * Cursor; | |
120 | #else | |
121 | typedef void *Cursor; | |
122 | #endif | |
123 | ||
124 | #define No_Cursor (0) | |
125 | ||
126 | #ifdef __OBJC__ | |
127 | typedef NSColor * Color; | |
128 | #else | |
129 | typedef void * Color; | |
130 | #endif | |
131 | typedef int Window; | |
132 | typedef int Display; | |
133 | ||
134 | /* Xism */ | |
135 | typedef Lisp_Object XrmDatabase; | |
136 | ||
137 | ||
138 | /* 23: some sort of attempt to normalize rectangle handling.. seems a bit much | |
139 | for what is accomplished */ | |
140 | typedef struct { | |
141 | int x, y; | |
142 | unsigned width, height; | |
143 | } XRectangle; | |
144 | ||
145 | #ifndef __OBJC__ | |
146 | typedef struct _NSPoint { float x, y; } NSPoint; | |
147 | typedef struct _NSSize { float width, height; } NSSize; | |
148 | typedef struct _NSRect { NSPoint origin; NSSize size; } NSRect; | |
149 | #endif | |
150 | ||
151 | #define NativeRectangle struct _NSRect | |
152 | ||
153 | #define CONVERT_TO_XRECT(xr, nr) \ | |
154 | ((xr).x = (nr).origin.x, \ | |
155 | (xr).y = (nr).origin.y, \ | |
156 | (xr).width = (nr).size.width, \ | |
157 | (xr).height = (nr).size.height) | |
158 | ||
159 | #define CONVERT_FROM_XRECT(xr, nr) \ | |
160 | ((nr).origin.x = (xr).x, \ | |
161 | (nr).origin.y = (xr).y, \ | |
162 | (nr).size.width = (xr).width, \ | |
163 | (nr).size.height = (xr).height) | |
164 | ||
165 | #define STORE_NATIVE_RECT(nr, px, py, pwidth, pheight) \ | |
166 | ((nr).origin.x = (px), \ | |
167 | (nr).origin.y = (py), \ | |
168 | (nr).size.width = (pwidth), \ | |
169 | (nr).size.height = (pheight)) | |
170 | ||
171 | ||
172 | ||
173 | ||
174 | /* This stuff needed by frame.c. */ | |
175 | #define ForgetGravity 0 | |
176 | #define NorthWestGravity 1 | |
177 | #define NorthGravity 2 | |
178 | #define NorthEastGravity 3 | |
179 | #define WestGravity 4 | |
180 | #define CenterGravity 5 | |
181 | #define EastGravity 6 | |
182 | #define SouthWestGravity 7 | |
183 | #define SouthGravity 8 | |
184 | #define SouthEastGravity 9 | |
185 | #define StaticGravity 10 | |
186 | ||
187 | #define NoValue 0x0000 | |
188 | #define XValue 0x0001 | |
189 | #define YValue 0x0002 | |
190 | #define WidthValue 0x0004 | |
191 | #define HeightValue 0x0008 | |
192 | #define AllValues 0x000F | |
193 | #define XNegative 0x0010 | |
194 | #define YNegative 0x0020 | |
195 | ||
196 | #define USPosition (1L << 0) /* user specified x, y */ | |
197 | #define USSize (1L << 1) /* user specified width, height */ | |
198 | ||
199 | #define PPosition (1L << 2) /* program specified position */ | |
200 | #define PSize (1L << 3) /* program specified size */ | |
201 | #define PMinSize (1L << 4) /* program specified minimum size */ | |
202 | #define PMaxSize (1L << 5) /* program specified maximum size */ | |
203 | #define PResizeInc (1L << 6) /* program specified resize increments */ | |
204 | #define PAspect (1L << 7) /* program specified min, max aspect ratios */ | |
205 | #define PBaseSize (1L << 8) /* program specified base for incrementing */ | |
206 | #define PWinGravity (1L << 9) /* program specified window gravity */ | |
207 | ||
208 | #endif /* __NSGUI_H__ */ | |
0ae1e5e5 MB |
209 | |
210 | /* arch-tag: b2af3275-62c3-45b4-9335-4c9635c67e55 | |
211 | (do not change this comment) */ |