(Qfont_spec, Qfont_entity, Qfont_object): Extern them.
[bpt/emacs.git] / src / w32gui.h
CommitLineData
de31b97a 1/* Definitions and headers for communication on the Microsoft W32 API.
429ab54e 2 Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005,
8cabe764 3 2006, 2007, 2008 Free Software Foundation, Inc.
ee78dc32
GV
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
684d6f5b 9the Free Software Foundation; either version 3, or (at your option)
ee78dc32
GV
10any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs; see the file COPYING. If not, write to
4fc5845f
LK
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */
ee78dc32 21
3b15de48
JR
22#ifndef EMACS_W32GUI_H
23#define EMACS_W32GUI_H
ee78dc32 24#include <windows.h>
c86a4064 25
640ea3c5 26#include "w32bdf.h"
ee78dc32 27
78229cf1
AI
28/* Emulate XCharStruct. */
29typedef struct _XCharStruct
30{
31 short rbearing;
32 short lbearing;
33 short width;
34 short ascent;
35 short descent;
36} XCharStruct;
37
38enum w32_char_font_type
39{
e83074af 40 UNKNOWN_FONT = 0 /* FONT_TYPE_UNKNOWN */,
78229cf1
AI
41 ANSI_FONT,
42 UNICODE_FONT,
43 BDF_1D_FONT,
44 BDF_2D_FONT
45};
46
ee78dc32 47typedef struct W32FontStruct {
78229cf1 48 enum w32_char_font_type font_type;
ee78dc32
GV
49 TEXTMETRIC tm;
50 HFONT hfont;
640ea3c5 51 bdffont *bdf;
af3a6785 52 int double_byte_p;
78229cf1
AI
53 XCharStruct max_bounds;
54 XCharStruct scratch;
55 /* Only store info for ascii chars, if not fixed pitch. */
56 XCharStruct * per_char;
ee78dc32
GV
57} W32FontStruct;
58
5a048001
JR
59typedef struct W32FontStruct XFontStruct;
60
61/* Emulate X GC's by keeping color and font info in a structure. */
62typedef struct _XGCValues
63{
64 COLORREF foreground;
65 COLORREF background;
bce485cc 66#if OLD_FONT
5a048001 67 XFontStruct * font;
bce485cc
KH
68#endif
69 struct font *font;
5a048001
JR
70} XGCValues;
71
72#define GCForeground 0x01
73#define GCBackground 0x02
74#define GCFont 0x03
75
ee78dc32
GV
76typedef HBITMAP Pixmap;
77typedef HBITMAP Bitmap;
5a048001 78
574bdd83
KS
79typedef char * XrmDatabase;
80
5a048001 81typedef XGCValues * GC;
ee78dc32
GV
82typedef COLORREF Color;
83typedef DWORD Time;
84typedef HWND Window;
f9aaed00 85typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
ee78dc32
GV
86typedef HCURSOR Cursor;
87
d165fbde
KS
88#define No_Cursor (0)
89
e83074af
KS
90#define XChar2b wchar_t
91
92/* Dealing with bits of wchar_t as if they were an XChar2b. */
93#define STORE_XCHAR2B(chp, byte1, byte2) \
94 ((*chp) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
95
96#define XCHAR2B_BYTE1(chp) \
97 (((*chp) & 0xff00) >> 8)
98
99#define XCHAR2B_BYTE2(chp) \
100 ((*chp) & 0x00ff)
101
102
73e66133
JR
103/* Windows equivalent of XImage. */
104typedef struct _XImage
105{
106 unsigned char * data;
107 BITMAPINFO info;
108 /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */
109} XImage;
56f508dd 110
ee78dc32
GV
111#define FACE_DEFAULT (~0)
112
113extern HINSTANCE hinst;
114extern HINSTANCE hprevinst;
115extern LPSTR lpCmdLine;
116extern int nCmdShow;
117
118/* Bit Gravity */
119
120#define ForgetGravity 0
121#define NorthWestGravity 1
122#define NorthGravity 2
123#define NorthEastGravity 3
124#define WestGravity 4
125#define CenterGravity 5
126#define EastGravity 6
127#define SouthWestGravity 7
128#define SouthGravity 8
129#define SouthEastGravity 9
130#define StaticGravity 10
131
132#define NoValue 0x0000
133#define XValue 0x0001
134#define YValue 0x0002
135#define WidthValue 0x0004
136#define HeightValue 0x0008
137#define AllValues 0x000F
138#define XNegative 0x0010
139#define YNegative 0x0020
140
141#define USPosition (1L << 0) /* user specified x, y */
142#define USSize (1L << 1) /* user specified width, height */
143
144#define PPosition (1L << 2) /* program specified position */
145#define PSize (1L << 3) /* program specified size */
146#define PMinSize (1L << 4) /* program specified minimum size */
147#define PMaxSize (1L << 5) /* program specified maximum size */
148#define PResizeInc (1L << 6) /* program specified resize increments */
149#define PAspect (1L << 7) /* program specified min and max aspect ratios */
150#define PBaseSize (1L << 8) /* program specified base for incrementing */
151#define PWinGravity (1L << 9) /* program specified window gravity */
152
153extern int XParseGeometry ();
154
d165fbde
KS
155
156typedef struct {
157 int x, y;
158 unsigned width, height;
159} XRectangle;
160
161#define NativeRectangle RECT
162
163#define CONVERT_TO_XRECT(xr,nr) \
164 ((xr).x = (nr).left, \
165 (xr).y = (nr).top, \
166 (xr).width = ((nr).right - (nr).left), \
167 (xr).height = ((nr).bottom - (nr).top))
168
169#define CONVERT_FROM_XRECT(xr,nr) \
170 ((nr).left = (xr).x, \
171 (nr).top = (xr).y, \
172 (nr).right = ((xr).x + (xr).width), \
173 (nr).bottom = ((xr).y + (xr).height))
174
175#define STORE_NATIVE_RECT(nr,x,y,width,height) \
176 ((nr).left = (x), \
177 (nr).top = (y), \
178 (nr).right = ((nr).left + (width)), \
179 (nr).bottom = ((nr).top + (height)))
180
181
3b15de48 182#endif /* EMACS_W32GUI_H */
ab5796a9
MB
183
184/* arch-tag: 9172e5fb-45a5-4684-afd9-ca0e81324604
185 (do not change this comment) */