remove `declare' macro
[bpt/emacs.git] / src / nsgui.h
CommitLineData
edfda783 1/* Definitions and headers for communication on the NeXT/Open/GNUstep API.
ba318903 2 Copyright (C) 1995, 2005, 2008-2014 Free Software Foundation, Inc.
edfda783
AR
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
edfda783
AR
30#endif /* NS_IMPL_COCOA */
31
a63e0781
JD
32#undef verify
33
edfda783
AR
34#import <AppKit/AppKit.h>
35
edfda783
AR
36#ifdef NS_IMPL_COCOA
37#undef Cursor
edfda783
AR
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
a63e0781
JD
47#undef verify
48#undef _GL_VERIFY_H
49#include <verify.h>
edfda783 50
edfda783
AR
51/* Emulate XCharStruct. */
52typedef struct _XCharStruct
53{
54 int rbearing;
55 int lbearing;
56 int width;
57 int ascent;
58 int descent;
59} XCharStruct;
60
ee7683eb 61/* Fake structure from Xlib.h to represent two-byte characters. */
edfda783
AR
62#ifndef __OBJC__
63typedef unsigned short unichar;
64#endif
65typedef unichar XChar2b;
66
67#define STORE_XCHAR2B(chp, b1, b2) \
68 (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
69
70#define XCHAR2B_BYTE1(chp) \
71 (((*chp) & 0xff00) >> 8)
72
73#define XCHAR2B_BYTE2(chp) \
74 ((*chp) & 0x00ff)
75
edfda783 76
df2142db
AR
77/* XXX: xfaces requires these structures, but the question is are we
78 forced to use them? */
edfda783
AR
79typedef struct _XGCValues
80{
15034960
AR
81 unsigned long foreground;
82 unsigned long background;
edfda783 83#ifdef __OBJC__
edfda783
AR
84 struct ns_font *font;
85#else
edfda783
AR
86 void *font;
87#endif
88} XGCValues;
89
90typedef XGCValues * GC;
91
92#define GCForeground 0x01
93#define GCBackground 0x02
94#define GCFont 0x03
95
96#ifdef __OBJC__
97typedef id Pixmap;
98#else
99typedef void *Pixmap;
100#endif
101
102#ifdef __OBJC__
103typedef NSCursor * Cursor;
104#else
105typedef void *Cursor;
106#endif
107
108#define No_Cursor (0)
109
110#ifdef __OBJC__
111typedef NSColor * Color;
112#else
113typedef void * Color;
114#endif
115typedef int Window;
116typedef int Display;
117
118/* Xism */
119typedef Lisp_Object XrmDatabase;
120
121
3fe53a83
AR
122/* some sort of attempt to normalize rectangle handling.. seems a bit much
123 for what is accomplished */
edfda783
AR
124typedef struct {
125 int x, y;
126 unsigned width, height;
127} XRectangle;
128
129#ifndef __OBJC__
5e617bc2 130#if defined (__LP64__) && __LP64__
9094eb48
AR
131typedef double CGFloat;
132#else
133typedef float CGFloat;
edfda783 134#endif
9094eb48
AR
135typedef struct _NSPoint { CGFloat x, y; } NSPoint;
136typedef struct _NSSize { CGFloat width, height; } NSSize;
137typedef struct _NSRect { NSPoint origin; NSSize size; } NSRect;
138#endif /* NOT OBJC */
edfda783 139
9094eb48 140#define NativeRectangle NSRect
edfda783
AR
141
142#define CONVERT_TO_XRECT(xr, nr) \
143 ((xr).x = (nr).origin.x, \
144 (xr).y = (nr).origin.y, \
145 (xr).width = (nr).size.width, \
146 (xr).height = (nr).size.height)
147
148#define CONVERT_FROM_XRECT(xr, nr) \
149 ((nr).origin.x = (xr).x, \
150 (nr).origin.y = (xr).y, \
151 (nr).size.width = (xr).width, \
152 (nr).size.height = (xr).height)
153
154#define STORE_NATIVE_RECT(nr, px, py, pwidth, pheight) \
155 ((nr).origin.x = (px), \
156 (nr).origin.y = (py), \
157 (nr).size.width = (pwidth), \
158 (nr).size.height = (pheight))
159
160
161
162
163/* This stuff needed by frame.c. */
164#define ForgetGravity 0
165#define NorthWestGravity 1
166#define NorthGravity 2
167#define NorthEastGravity 3
168#define WestGravity 4
169#define CenterGravity 5
170#define EastGravity 6
171#define SouthWestGravity 7
172#define SouthGravity 8
173#define SouthEastGravity 9
174#define StaticGravity 10
175
176#define NoValue 0x0000
177#define XValue 0x0001
178#define YValue 0x0002
179#define WidthValue 0x0004
180#define HeightValue 0x0008
181#define AllValues 0x000F
182#define XNegative 0x0010
183#define YNegative 0x0020
184
185#define USPosition (1L << 0) /* user specified x, y */
186#define USSize (1L << 1) /* user specified width, height */
187
188#define PPosition (1L << 2) /* program specified position */
189#define PSize (1L << 3) /* program specified size */
190#define PMinSize (1L << 4) /* program specified minimum size */
191#define PMaxSize (1L << 5) /* program specified maximum size */
192#define PResizeInc (1L << 6) /* program specified resize increments */
193#define PAspect (1L << 7) /* program specified min, max aspect ratios */
194#define PBaseSize (1L << 8) /* program specified base for incrementing */
195#define PWinGravity (1L << 9) /* program specified window gravity */
196
197#endif /* __NSGUI_H__ */