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