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