Trailing whitespace deleted.
[bpt/emacs.git] / src / macgui.h
1 /* Definitions and headers for communication on the Mac OS.
2 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
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 2, or (at your option)
9 any later version.
10
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.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* Contributed by Andrew Choi (akochoi@mac.com). */
22
23 #ifndef EMACS_MACGUI_H
24 #define EMACS_MACGUI_H
25
26 typedef int Pixmap;
27 typedef int Bitmap;
28
29 typedef int Display; /* fix later */
30
31 typedef unsigned long Time;
32
33 #if MAC_OSX
34 typedef struct OpaqueWindowPtr* Window;
35 #else
36 #include <QuickDraw.h>
37 typedef WindowPtr Window;
38 #endif
39
40 #define FACE_DEFAULT (~0)
41
42
43 /* Emulate XCharStruct. */
44 typedef struct _XCharStruct
45 {
46 int rbearing;
47 int lbearing;
48 int width;
49 int ascent;
50 int descent;
51 } XCharStruct;
52
53 struct MacFontStruct {
54 char *fontname;
55
56 short mac_fontnum; /* font number of font used in this window */
57 int mac_fontsize; /* size of font */
58 short mac_fontface; /* plain, bold, italics, etc. */
59 short mac_scriptcode; /* Mac OS script code for font used */
60
61 #if 0
62 SInt16 mFontNum; /* font number of font used in this window */
63 short mScriptCode; /* Mac OS script code for font used */
64 int mFontSize; /* size of font */
65 Style mFontFace; /* plain, bold, italics, etc. */
66 int mHeight; /* height of one line of text in pixels */
67 int mWidth; /* width of one character in pixels */
68 int mAscent;
69 int mDescent;
70 int mLeading;
71 char mTwoByte; /* true for two-byte font */
72 #endif /* 0 */
73
74 /* from Xlib.h */
75 #if 0
76 XExtData *ext_data; /* hook for extension to hang data */
77 Font fid; /* Font id for this font */
78 unsigned direction; /* hint about the direction font is painted */
79 #endif /* 0 */
80 unsigned min_char_or_byte2;/* first character */
81 unsigned max_char_or_byte2;/* last character */
82 unsigned min_byte1; /* first row that exists */
83 unsigned max_byte1; /* last row that exists */
84 #if 0
85 Bool all_chars_exist; /* flag if all characters have nonzero size */
86 unsigned default_char; /* char to print for undefined character */
87 int n_properties; /* how many properties there are */
88 XFontProp *properties; /* pointer to array of additional properties */
89 #endif /* 0 */
90 XCharStruct min_bounds; /* minimum bounds over all existing char */
91 XCharStruct max_bounds; /* maximum bounds over all existing char */
92 XCharStruct *per_char; /* first_char to last_char information */
93 int ascent; /* logical extent above baseline for spacing */
94 int descent; /* logical decent below baseline for spacing */
95 };
96
97 typedef struct MacFontStruct MacFontStruct;
98 typedef struct MacFontStruct XFontStruct;
99
100
101 /* Emulate X GC's by keeping color and font info in a structure. */
102 typedef struct _XGCValues
103 {
104 unsigned long foreground;
105 unsigned long background;
106 XFontStruct *font;
107 } XGCValues;
108
109 typedef XGCValues *GC;
110
111 extern XGCValues *
112 XCreateGC (void *, Window, unsigned long, XGCValues *);
113
114 #define GCForeground 0x01
115 #define GCBackground 0x02
116 #define GCFont 0x03
117 #define GCGraphicsExposures 0
118
119 /* Bit Gravity */
120
121 #define ForgetGravity 0
122 #define NorthWestGravity 1
123 #define NorthGravity 2
124 #define NorthEastGravity 3
125 #define WestGravity 4
126 #define CenterGravity 5
127 #define EastGravity 6
128 #define SouthWestGravity 7
129 #define SouthGravity 8
130 #define SouthEastGravity 9
131 #define StaticGravity 10
132
133 #define NoValue 0x0000
134 #define XValue 0x0001
135 #define YValue 0x0002
136 #define WidthValue 0x0004
137 #define HeightValue 0x0008
138 #define AllValues 0x000F
139 #define XNegative 0x0010
140 #define YNegative 0x0020
141
142 #define USPosition (1L << 0) /* user specified x, y */
143 #define USSize (1L << 1) /* user specified width, height */
144
145 #define PPosition (1L << 2) /* program specified position */
146 #define PSize (1L << 3) /* program specified size */
147 #define PMinSize (1L << 4) /* program specified minimum size */
148 #define PMaxSize (1L << 5) /* program specified maximum size */
149 #define PResizeInc (1L << 6) /* program specified resize increments */
150 #define PAspect (1L << 7) /* program specified min and max aspect ratios */
151 #define PBaseSize (1L << 8) /* program specified base for incrementing */
152 #define PWinGravity (1L << 9) /* program specified window gravity */
153
154 extern int XParseGeometry ();
155
156 #endif /* EMACS_MACGUI_H */
157