NS cleanup: change 'PENDING' to 'FIXME'/'TODO'/'XXX'
[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
edfda783
AR
33#import <AppKit/AppKit.h>
34
edfda783
AR
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>
40
41#ifdef NS_IMPL_COCOA
42#include <AvailabilityMacros.h>
43#endif /* NS_IMPL_COCOA */
44
45#endif /* __OBJC__ */
46
47
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)))
52
53/* Emulate XCharStruct. */
54typedef struct _XCharStruct
55{
56 int rbearing;
57 int lbearing;
58 int width;
59 int ascent;
60 int descent;
61} XCharStruct;
62
63/* 23: Fake tructure from Xlib.h to represent two-byte characters. */
64#ifndef __OBJC__
65typedef unsigned short unichar;
66#endif
67typedef unichar XChar2b;
68
69#define STORE_XCHAR2B(chp, b1, b2) \
70 (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
71
72#define XCHAR2B_BYTE1(chp) \
73 (((*chp) & 0xff00) >> 8)
74
75#define XCHAR2B_BYTE2(chp) \
76 ((*chp) & 0x00ff)
77
78#define FACE_DEFAULT (~0)
79
80
df2142db
AR
81/* XXX: xfaces requires these structures, but the question is are we
82 forced to use them? */
edfda783
AR
83typedef struct _XGCValues
84{
85#ifdef __OBJC__
86 NSColor *foreground;
87 NSColor *background;
88 struct ns_font *font;
89#else
90 void *foreground;
91 void *background;
92 void *font;
93#endif
94} XGCValues;
95
96typedef XGCValues * GC;
97
98#define GCForeground 0x01
99#define GCBackground 0x02
100#define GCFont 0x03
101
102#ifdef __OBJC__
103typedef id Pixmap;
104#else
105typedef void *Pixmap;
106#endif
107
108#ifdef __OBJC__
109typedef NSCursor * Cursor;
110#else
111typedef void *Cursor;
112#endif
113
114#define No_Cursor (0)
115
116#ifdef __OBJC__
117typedef NSColor * Color;
118#else
119typedef void * Color;
120#endif
121typedef int Window;
122typedef int Display;
123
124/* Xism */
125typedef Lisp_Object XrmDatabase;
126
127
128/* 23: some sort of attempt to normalize rectangle handling.. seems a bit much
129 for what is accomplished */
130typedef struct {
131 int x, y;
132 unsigned width, height;
133} XRectangle;
134
135#ifndef __OBJC__
136typedef struct _NSPoint { float x, y; } NSPoint;
137typedef struct _NSSize { float width, height; } NSSize;
138typedef struct _NSRect { NSPoint origin; NSSize size; } NSRect;
139#endif
140
141#define NativeRectangle struct _NSRect
142
143#define CONVERT_TO_XRECT(xr, nr) \
144 ((xr).x = (nr).origin.x, \
145 (xr).y = (nr).origin.y, \
146 (xr).width = (nr).size.width, \
147 (xr).height = (nr).size.height)
148
149#define CONVERT_FROM_XRECT(xr, nr) \
150 ((nr).origin.x = (xr).x, \
151 (nr).origin.y = (xr).y, \
152 (nr).size.width = (xr).width, \
153 (nr).size.height = (xr).height)
154
155#define STORE_NATIVE_RECT(nr, px, py, pwidth, pheight) \
156 ((nr).origin.x = (px), \
157 (nr).origin.y = (py), \
158 (nr).size.width = (pwidth), \
159 (nr).size.height = (pheight))
160
161
162
163
164/* This stuff needed by frame.c. */
165#define ForgetGravity 0
166#define NorthWestGravity 1
167#define NorthGravity 2
168#define NorthEastGravity 3
169#define WestGravity 4
170#define CenterGravity 5
171#define EastGravity 6
172#define SouthWestGravity 7
173#define SouthGravity 8
174#define SouthEastGravity 9
175#define StaticGravity 10
176
177#define NoValue 0x0000
178#define XValue 0x0001
179#define YValue 0x0002
180#define WidthValue 0x0004
181#define HeightValue 0x0008
182#define AllValues 0x000F
183#define XNegative 0x0010
184#define YNegative 0x0020
185
186#define USPosition (1L << 0) /* user specified x, y */
187#define USSize (1L << 1) /* user specified width, height */
188
189#define PPosition (1L << 2) /* program specified position */
190#define PSize (1L << 3) /* program specified size */
191#define PMinSize (1L << 4) /* program specified minimum size */
192#define PMaxSize (1L << 5) /* program specified maximum size */
193#define PResizeInc (1L << 6) /* program specified resize increments */
194#define PAspect (1L << 7) /* program specified min, max aspect ratios */
195#define PBaseSize (1L << 8) /* program specified base for incrementing */
196#define PWinGravity (1L << 9) /* program specified window gravity */
197
198#endif /* __NSGUI_H__ */
0ae1e5e5
MB
199
200/* arch-tag: b2af3275-62c3-45b4-9335-4c9635c67e55
201 (do not change this comment) */