(Fontsets): Fix typos.
[emacs.git] / src / w32gui.h
blobe712aa30873b5973e001cd72c82620e34cbd14ea
1 /* Definitions and headers for communication on the Microsoft W32 API.
2 Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005,
3 2006, 2007, 2008 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef EMACS_W32GUI_H
21 #define EMACS_W32GUI_H
22 #include <windows.h>
24 #include "w32bdf.h"
26 /* Emulate XCharStruct. */
27 typedef struct _XCharStruct
29 short rbearing;
30 short lbearing;
31 short width;
32 short ascent;
33 short descent;
34 } XCharStruct;
36 enum w32_char_font_type
38 UNKNOWN_FONT = 0 /* FONT_TYPE_UNKNOWN */,
39 ANSI_FONT,
40 UNICODE_FONT,
41 BDF_1D_FONT,
42 BDF_2D_FONT
45 typedef struct W32FontStruct {
46 enum w32_char_font_type font_type;
47 TEXTMETRIC tm;
48 HFONT hfont;
49 bdffont *bdf;
50 int double_byte_p;
51 XCharStruct max_bounds;
52 XCharStruct scratch;
53 /* Only store info for ascii chars, if not fixed pitch. */
54 XCharStruct * per_char;
55 } W32FontStruct;
57 typedef struct W32FontStruct XFontStruct;
59 /* Emulate X GC's by keeping color and font info in a structure. */
60 typedef struct _XGCValues
62 COLORREF foreground;
63 COLORREF background;
64 #if OLD_FONT
65 XFontStruct * font;
66 #endif
67 struct font *font;
68 } XGCValues;
70 #define GCForeground 0x01
71 #define GCBackground 0x02
72 #define GCFont 0x03
74 typedef HBITMAP Pixmap;
75 typedef HBITMAP Bitmap;
77 typedef char * XrmDatabase;
79 typedef XGCValues * GC;
80 typedef COLORREF Color;
81 typedef DWORD Time;
82 typedef HWND Window;
83 typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
84 typedef HCURSOR Cursor;
86 #define No_Cursor (0)
88 #define XChar2b wchar_t
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))))
94 #define XCHAR2B_BYTE1(chp) \
95 (((*chp) & 0xff00) >> 8)
97 #define XCHAR2B_BYTE2(chp) \
98 ((*chp) & 0x00ff)
101 /* Windows equivalent of XImage. */
102 typedef struct _XImage
104 unsigned char * data;
105 BITMAPINFO info;
106 /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */
107 } XImage;
109 #define FACE_DEFAULT (~0)
111 extern HINSTANCE hinst;
112 extern HINSTANCE hprevinst;
113 extern LPSTR lpCmdLine;
114 extern int nCmdShow;
116 /* Bit Gravity */
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
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
139 #define USPosition (1L << 0) /* user specified x, y */
140 #define USSize (1L << 1) /* user specified width, height */
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 */
151 extern int XParseGeometry ();
154 typedef struct {
155 int x, y;
156 unsigned width, height;
157 } XRectangle;
159 #define NativeRectangle RECT
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))
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))
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)))
180 #endif /* EMACS_W32GUI_H */
182 /* arch-tag: 9172e5fb-45a5-4684-afd9-ca0e81324604
183 (do not change this comment) */