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