* lisp/cus-edit.el (customize-unsaved, customize-saved): Doc fix.
[emacs.git] / src / nsgui.h
blob0c9a8a01e6965dcb045736f6372bd6b8b8e333b8
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/>. */
19 #ifndef __NSGUI_H__
20 #define __NSGUI_H__
22 /* this gets included from a couple of the plain (non-NS) .c files */
23 #ifdef __OBJC__
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
30 #undef init_process
31 #endif /* NS_IMPL_COCOA */
33 #undef verify
35 #import <AppKit/AppKit.h>
37 #ifdef NS_IMPL_COCOA
38 #undef Cursor
39 #define init_process emacs_init_process
40 #endif /* NS_IMPL_COCOA */
41 #import <Foundation/NSDistantObject.h>
43 #ifdef NS_IMPL_COCOA
44 #include <AvailabilityMacros.h>
45 #endif /* NS_IMPL_COCOA */
47 #endif /* __OBJC__ */
49 #undef verify
50 #undef _GL_VERIFY_H
51 #include <verify.h>
53 /* menu-related */
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
61 int rbearing;
62 int lbearing;
63 int width;
64 int ascent;
65 int descent;
66 } XCharStruct;
68 /* Fake structure from Xlib.h to represent two-byte characters. */
69 #ifndef __OBJC__
70 typedef unsigned short unichar;
71 #endif
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) \
81 ((*chp) & 0x00ff)
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;
90 #ifdef __OBJC__
91 struct ns_font *font;
92 #else
93 void *font;
94 #endif
95 } XGCValues;
97 typedef XGCValues * GC;
99 #define GCForeground 0x01
100 #define GCBackground 0x02
101 #define GCFont 0x03
103 #ifdef __OBJC__
104 typedef id Pixmap;
105 #else
106 typedef void *Pixmap;
107 #endif
109 #ifdef __OBJC__
110 typedef NSCursor * Cursor;
111 #else
112 typedef void *Cursor;
113 #endif
115 #define No_Cursor (0)
117 #ifdef __OBJC__
118 typedef NSColor * Color;
119 #else
120 typedef void * Color;
121 #endif
122 typedef int Window;
123 typedef int Display;
125 /* Xism */
126 typedef Lisp_Object XrmDatabase;
129 /* some sort of attempt to normalize rectangle handling.. seems a bit much
130 for what is accomplished */
131 typedef struct {
132 int x, y;
133 unsigned width, height;
134 } XRectangle;
136 #ifndef __OBJC__
137 #if defined (__LP64__) && __LP64__
138 typedef double CGFloat;
139 #else
140 typedef float CGFloat;
141 #endif
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__ */