Remove experimental code inadvertently introduced when reverting the
[emacs.git] / src / nsgui.h
blob10bdd5be2afe1039da8b31150e998f38f2fe18c4
1 /* Definitions and headers for communication on the NeXT/Open/GNUstep API.
2 Copyright (C) 1995, 2005, 2008, 2009 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 #import <AppKit/AppKit.h>
35 #ifdef NS_IMPL_COCOA
36 #undef Cursor
37 #define init_process emacs_init_process
38 #endif /* NS_IMPL_COCOA */
39 #import <Foundation/NSDistantObject.h>
41 #ifdef NS_IMPL_COCOA
42 #include <AvailabilityMacros.h>
43 #endif /* NS_IMPL_COCOA */
45 #endif /* __OBJC__ */
48 /* menu-related */
49 #define free_widget_value(wv) xfree (wv)
50 #define malloc_widget_value() ((widget_value *) memset (xmalloc \
51 (sizeof (widget_value)), 0, sizeof (widget_value)))
53 /* Emulate XCharStruct. */
54 typedef struct _XCharStruct
56 int rbearing;
57 int lbearing;
58 int width;
59 int ascent;
60 int descent;
61 } XCharStruct;
63 /* 23: Fake tructure from Xlib.h to represent two-byte characters. */
64 #ifndef __OBJC__
65 typedef unsigned short unichar;
66 #endif
67 typedef unichar XChar2b;
69 #define STORE_XCHAR2B(chp, b1, b2) \
70 (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
72 #define XCHAR2B_BYTE1(chp) \
73 (((*chp) & 0xff00) >> 8)
75 #define XCHAR2B_BYTE2(chp) \
76 ((*chp) & 0x00ff)
79 /* XXX: xfaces requires these structures, but the question is are we
80 forced to use them? */
81 typedef struct _XGCValues
83 unsigned long foreground;
84 unsigned long background;
85 #ifdef __OBJC__
86 struct ns_font *font;
87 #else
88 void *font;
89 #endif
90 } XGCValues;
92 typedef XGCValues * GC;
94 #define GCForeground 0x01
95 #define GCBackground 0x02
96 #define GCFont 0x03
98 #ifdef __OBJC__
99 typedef id Pixmap;
100 #else
101 typedef void *Pixmap;
102 #endif
104 #ifdef __OBJC__
105 typedef NSCursor * Cursor;
106 #else
107 typedef void *Cursor;
108 #endif
110 #define No_Cursor (0)
112 #ifdef __OBJC__
113 typedef NSColor * Color;
114 #else
115 typedef void * Color;
116 #endif
117 typedef int Window;
118 typedef int Display;
120 /* Xism */
121 typedef Lisp_Object XrmDatabase;
124 /* 23: some sort of attempt to normalize rectangle handling.. seems a bit much
125 for what is accomplished */
126 typedef struct {
127 int x, y;
128 unsigned width, height;
129 } XRectangle;
131 #ifndef __OBJC__
132 typedef struct _NSPoint { float x, y; } NSPoint;
133 typedef struct _NSSize { float width, height; } NSSize;
134 typedef struct _NSRect { NSPoint origin; NSSize size; } NSRect;
135 #endif
137 #define NativeRectangle struct _NSRect
139 #define CONVERT_TO_XRECT(xr, nr) \
140 ((xr).x = (nr).origin.x, \
141 (xr).y = (nr).origin.y, \
142 (xr).width = (nr).size.width, \
143 (xr).height = (nr).size.height)
145 #define CONVERT_FROM_XRECT(xr, nr) \
146 ((nr).origin.x = (xr).x, \
147 (nr).origin.y = (xr).y, \
148 (nr).size.width = (xr).width, \
149 (nr).size.height = (xr).height)
151 #define STORE_NATIVE_RECT(nr, px, py, pwidth, pheight) \
152 ((nr).origin.x = (px), \
153 (nr).origin.y = (py), \
154 (nr).size.width = (pwidth), \
155 (nr).size.height = (pheight))
160 /* This stuff needed by frame.c. */
161 #define ForgetGravity 0
162 #define NorthWestGravity 1
163 #define NorthGravity 2
164 #define NorthEastGravity 3
165 #define WestGravity 4
166 #define CenterGravity 5
167 #define EastGravity 6
168 #define SouthWestGravity 7
169 #define SouthGravity 8
170 #define SouthEastGravity 9
171 #define StaticGravity 10
173 #define NoValue 0x0000
174 #define XValue 0x0001
175 #define YValue 0x0002
176 #define WidthValue 0x0004
177 #define HeightValue 0x0008
178 #define AllValues 0x000F
179 #define XNegative 0x0010
180 #define YNegative 0x0020
182 #define USPosition (1L << 0) /* user specified x, y */
183 #define USSize (1L << 1) /* user specified width, height */
185 #define PPosition (1L << 2) /* program specified position */
186 #define PSize (1L << 3) /* program specified size */
187 #define PMinSize (1L << 4) /* program specified minimum size */
188 #define PMaxSize (1L << 5) /* program specified maximum size */
189 #define PResizeInc (1L << 6) /* program specified resize increments */
190 #define PAspect (1L << 7) /* program specified min, max aspect ratios */
191 #define PBaseSize (1L << 8) /* program specified base for incrementing */
192 #define PWinGravity (1L << 9) /* program specified window gravity */
194 #endif /* __NSGUI_H__ */
196 /* arch-tag: b2af3275-62c3-45b4-9335-4c9635c67e55
197 (do not change this comment) */