(diff-auto-refine-mode): Remove lighter, since it's
[emacs.git] / src / nsgui.h
blob54e336fdf3de7ef9b4af23cb43c8f2f3d2b1ba7d
1 /* Definitions and headers for communication on the NeXT/Open/GNUstep API.
2 Copyright (C) 1995, 2005, 2008 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)
78 #define FACE_DEFAULT (~0)
81 /* XXX: xfaces requires these structures, but the question is are we
82 forced to use them? */
83 typedef struct _XGCValues
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;
96 typedef XGCValues * GC;
98 #define GCForeground 0x01
99 #define GCBackground 0x02
100 #define GCFont 0x03
102 #ifdef __OBJC__
103 typedef id Pixmap;
104 #else
105 typedef void *Pixmap;
106 #endif
108 #ifdef __OBJC__
109 typedef NSCursor * Cursor;
110 #else
111 typedef void *Cursor;
112 #endif
114 #define No_Cursor (0)
116 #ifdef __OBJC__
117 typedef NSColor * Color;
118 #else
119 typedef void * Color;
120 #endif
121 typedef int Window;
122 typedef int Display;
124 /* Xism */
125 typedef Lisp_Object XrmDatabase;
128 /* 23: some sort of attempt to normalize rectangle handling.. seems a bit much
129 for what is accomplished */
130 typedef struct {
131 int x, y;
132 unsigned width, height;
133 } XRectangle;
135 #ifndef __OBJC__
136 typedef struct _NSPoint { float x, y; } NSPoint;
137 typedef struct _NSSize { float width, height; } NSSize;
138 typedef struct _NSRect { NSPoint origin; NSSize size; } NSRect;
139 #endif
141 #define NativeRectangle struct _NSRect
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)
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)
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))
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
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
186 #define USPosition (1L << 0) /* user specified x, y */
187 #define USSize (1L << 1) /* user specified width, height */
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 */
198 #endif /* __NSGUI_H__ */
200 /* arch-tag: b2af3275-62c3-45b4-9335-4c9635c67e55
201 (do not change this comment) */