1 /* Definitions and headers for communication on the NeXT/Open/GNUstep API.
2 Copyright (C) 1995, 2005, 2008-2012 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
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 of the License, or
9 (at your option) any later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 /* this gets included from a couple of the plain (non-NS) .c files */
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."
31 #endif /* NS_IMPL_COCOA */
35 #import <AppKit/AppKit.h>
39 #define init_process emacs_init_process
40 #endif /* NS_IMPL_COCOA */
41 #import <Foundation/NSDistantObject.h>
44 #include <AvailabilityMacros.h>
45 #endif /* NS_IMPL_COCOA */
54 #define free_widget_value(wv) xfree (wv)
55 #define malloc_widget_value() ((widget_value *) memset (xmalloc \
56 (sizeof (widget_value)), 0, sizeof (widget_value)))
58 /* Emulate XCharStruct. */
59 typedef struct _XCharStruct
68 /* Fake structure from Xlib.h to represent two-byte characters. */
70 typedef unsigned short unichar
;
72 typedef unichar XChar2b
;
74 #define STORE_XCHAR2B(chp, b1, b2) \
75 (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
77 #define XCHAR2B_BYTE1(chp) \
78 (((*chp) & 0xff00) >> 8)
80 #define XCHAR2B_BYTE2(chp) \
84 /* XXX: xfaces requires these structures, but the question is are we
85 forced to use them? */
86 typedef struct _XGCValues
88 unsigned long foreground
;
89 unsigned long background
;
97 typedef XGCValues
* GC
;
99 #define GCForeground 0x01
100 #define GCBackground 0x02
106 typedef void *Pixmap
;
110 typedef NSCursor
* Cursor
;
112 typedef void *Cursor
;
115 #define No_Cursor (0)
118 typedef NSColor
* Color
;
120 typedef void * Color
;
126 typedef Lisp_Object XrmDatabase
;
129 /* some sort of attempt to normalize rectangle handling.. seems a bit much
130 for what is accomplished */
133 unsigned width
, height
;
137 #if defined (__LP64__) && __LP64__
138 typedef double CGFloat
;
140 typedef float CGFloat
;
142 typedef struct _NSPoint
{ CGFloat x
, y
; } NSPoint
;
143 typedef struct _NSSize
{ CGFloat width
, height
; } NSSize
;
144 typedef struct _NSRect
{ NSPoint origin
; NSSize size
; } NSRect
;
145 #endif /* NOT OBJC */
147 #define NativeRectangle NSRect
149 #define CONVERT_TO_XRECT(xr, nr) \
150 ((xr).x = (nr).origin.x, \
151 (xr).y = (nr).origin.y, \
152 (xr).width = (nr).size.width, \
153 (xr).height = (nr).size.height)
155 #define CONVERT_FROM_XRECT(xr, nr) \
156 ((nr).origin.x = (xr).x, \
157 (nr).origin.y = (xr).y, \
158 (nr).size.width = (xr).width, \
159 (nr).size.height = (xr).height)
161 #define STORE_NATIVE_RECT(nr, px, py, pwidth, pheight) \
162 ((nr).origin.x = (px), \
163 (nr).origin.y = (py), \
164 (nr).size.width = (pwidth), \
165 (nr).size.height = (pheight))
170 /* This stuff needed by frame.c. */
171 #define ForgetGravity 0
172 #define NorthWestGravity 1
173 #define NorthGravity 2
174 #define NorthEastGravity 3
175 #define WestGravity 4
176 #define CenterGravity 5
177 #define EastGravity 6
178 #define SouthWestGravity 7
179 #define SouthGravity 8
180 #define SouthEastGravity 9
181 #define StaticGravity 10
183 #define NoValue 0x0000
184 #define XValue 0x0001
185 #define YValue 0x0002
186 #define WidthValue 0x0004
187 #define HeightValue 0x0008
188 #define AllValues 0x000F
189 #define XNegative 0x0010
190 #define YNegative 0x0020
192 #define USPosition (1L << 0) /* user specified x, y */
193 #define USSize (1L << 1) /* user specified width, height */
195 #define PPosition (1L << 2) /* program specified position */
196 #define PSize (1L << 3) /* program specified size */
197 #define PMinSize (1L << 4) /* program specified minimum size */
198 #define PMaxSize (1L << 5) /* program specified maximum size */
199 #define PResizeInc (1L << 6) /* program specified resize increments */
200 #define PAspect (1L << 7) /* program specified min, max aspect ratios */
201 #define PBaseSize (1L << 8) /* program specified base for incrementing */
202 #define PWinGravity (1L << 9) /* program specified window gravity */
204 #endif /* __NSGUI_H__ */