(XChar2b): Move typedef here for consolidation.
[bpt/emacs.git] / src / macgui.h
CommitLineData
1a578e9b 1/* Definitions and headers for communication on the Mac OS.
e0f712ba 2 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
1a578e9b
AC
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
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
17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
e0f712ba 21/* Contributed by Andrew Choi (akochoi@mac.com). */
1a578e9b
AC
22
23#ifndef EMACS_MACGUI_H
24#define EMACS_MACGUI_H
25
1a578e9b
AC
26typedef int Pixmap;
27typedef int Bitmap;
28
29typedef int Display; /* fix later */
30
31typedef unsigned long Time;
e0f712ba
AC
32
33#if MAC_OSX
34typedef struct OpaqueWindowPtr* Window;
35#else
36#include <QuickDraw.h>
1a578e9b 37typedef WindowPtr Window;
e0f712ba 38#endif
1a578e9b
AC
39
40#define FACE_DEFAULT (~0)
41
42
43/* Emulate XCharStruct. */
44typedef struct _XCharStruct
45{
46 int rbearing;
47 int lbearing;
48 int width;
49 int ascent;
50 int descent;
51} XCharStruct;
52
53struct MacFontStruct {
54 char *fontname;
55
e0f712ba 56 short mac_fontnum; /* font number of font used in this window */
1a578e9b 57 int mac_fontsize; /* size of font */
e0f712ba 58 short mac_fontface; /* plain, bold, italics, etc. */
1a578e9b
AC
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 */
e0f712ba 72#endif /* 0 */
1a578e9b
AC
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 */
e0f712ba 79#endif /* 0 */
1a578e9b
AC
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 */
e0f712ba 89#endif /* 0 */
1a578e9b
AC
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
97typedef struct MacFontStruct MacFontStruct;
98typedef struct MacFontStruct XFontStruct;
99
ec480ce0
KS
100/* Structure borrowed from Xlib.h to represent two-byte characters. */
101
102typedef struct {
103 unsigned char byte1;
104 unsigned char byte2;
105} XChar2b;
106
107#define STORE_XCHAR2B(chp, b1, b2) \
108 ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
109
110#define XCHAR2B_BYTE1(chp) \
111 ((chp)->byte1)
112
113#define XCHAR2B_BYTE2(chp) \
114 ((chp)->byte2)
115
1a578e9b
AC
116
117/* Emulate X GC's by keeping color and font info in a structure. */
118typedef struct _XGCValues
119{
120 unsigned long foreground;
121 unsigned long background;
122 XFontStruct *font;
123} XGCValues;
124
125typedef XGCValues *GC;
126
127extern XGCValues *
128XCreateGC (void *, Window, unsigned long, XGCValues *);
129
130#define GCForeground 0x01
131#define GCBackground 0x02
132#define GCFont 0x03
133#define GCGraphicsExposures 0
134
135/* Bit Gravity */
136
137#define ForgetGravity 0
138#define NorthWestGravity 1
139#define NorthGravity 2
140#define NorthEastGravity 3
141#define WestGravity 4
142#define CenterGravity 5
143#define EastGravity 6
144#define SouthWestGravity 7
145#define SouthGravity 8
146#define SouthEastGravity 9
147#define StaticGravity 10
148
149#define NoValue 0x0000
150#define XValue 0x0001
151#define YValue 0x0002
152#define WidthValue 0x0004
153#define HeightValue 0x0008
154#define AllValues 0x000F
155#define XNegative 0x0010
156#define YNegative 0x0020
157
158#define USPosition (1L << 0) /* user specified x, y */
159#define USSize (1L << 1) /* user specified width, height */
160
161#define PPosition (1L << 2) /* program specified position */
162#define PSize (1L << 3) /* program specified size */
163#define PMinSize (1L << 4) /* program specified minimum size */
164#define PMaxSize (1L << 5) /* program specified maximum size */
165#define PResizeInc (1L << 6) /* program specified resize increments */
166#define PAspect (1L << 7) /* program specified min and max aspect ratios */
167#define PBaseSize (1L << 8) /* program specified base for incrementing */
168#define PWinGravity (1L << 9) /* program specified window gravity */
169
170extern int XParseGeometry ();
171
172#endif /* EMACS_MACGUI_H */
173