Commit | Line | Data |
---|---|---|
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 | |
5 | This file is part of GNU Emacs. | |
6 | ||
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 | |
684d6f5b | 9 | the Free Software Foundation; either version 3, or (at your option) |
ee78dc32 GV |
10 | any later version. |
11 | ||
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. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GNU Emacs; see the file COPYING. If not, write to | |
4fc5845f LK |
19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | Boston, 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. */ |
29 | typedef struct _XCharStruct | |
30 | { | |
31 | short rbearing; | |
32 | short lbearing; | |
33 | short width; | |
34 | short ascent; | |
35 | short descent; | |
36 | } XCharStruct; | |
37 | ||
38 | enum 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 | 47 | typedef 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 |
59 | typedef struct W32FontStruct XFontStruct; |
60 | ||
61 | /* Emulate X GC's by keeping color and font info in a structure. */ | |
62 | typedef struct _XGCValues | |
63 | { | |
64 | COLORREF foreground; | |
65 | COLORREF background; | |
66 | XFontStruct * font; | |
67 | } XGCValues; | |
68 | ||
69 | #define GCForeground 0x01 | |
70 | #define GCBackground 0x02 | |
71 | #define GCFont 0x03 | |
72 | ||
ee78dc32 GV |
73 | typedef HBITMAP Pixmap; |
74 | typedef HBITMAP Bitmap; | |
5a048001 | 75 | |
574bdd83 KS |
76 | typedef char * XrmDatabase; |
77 | ||
5a048001 | 78 | typedef XGCValues * GC; |
ee78dc32 GV |
79 | typedef COLORREF Color; |
80 | typedef DWORD Time; | |
81 | typedef HWND Window; | |
f9aaed00 | 82 | typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ |
ee78dc32 GV |
83 | typedef HCURSOR Cursor; |
84 | ||
d165fbde KS |
85 | #define No_Cursor (0) |
86 | ||
e83074af KS |
87 | #define XChar2b wchar_t |
88 | ||
89 | /* Dealing with bits of wchar_t as if they were an XChar2b. */ | |
90 | #define STORE_XCHAR2B(chp, byte1, byte2) \ | |
91 | ((*chp) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff)))) | |
92 | ||
93 | #define XCHAR2B_BYTE1(chp) \ | |
94 | (((*chp) & 0xff00) >> 8) | |
95 | ||
96 | #define XCHAR2B_BYTE2(chp) \ | |
97 | ((*chp) & 0x00ff) | |
98 | ||
99 | ||
73e66133 JR |
100 | /* Windows equivalent of XImage. */ |
101 | typedef struct _XImage | |
102 | { | |
103 | unsigned char * data; | |
104 | BITMAPINFO info; | |
105 | /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */ | |
106 | } XImage; | |
56f508dd | 107 | |
ee78dc32 GV |
108 | #define FACE_DEFAULT (~0) |
109 | ||
110 | extern HINSTANCE hinst; | |
111 | extern HINSTANCE hprevinst; | |
112 | extern LPSTR lpCmdLine; | |
113 | extern int nCmdShow; | |
114 | ||
115 | /* Bit Gravity */ | |
116 | ||
117 | #define ForgetGravity 0 | |
118 | #define NorthWestGravity 1 | |
119 | #define NorthGravity 2 | |
120 | #define NorthEastGravity 3 | |
121 | #define WestGravity 4 | |
122 | #define CenterGravity 5 | |
123 | #define EastGravity 6 | |
124 | #define SouthWestGravity 7 | |
125 | #define SouthGravity 8 | |
126 | #define SouthEastGravity 9 | |
127 | #define StaticGravity 10 | |
128 | ||
129 | #define NoValue 0x0000 | |
130 | #define XValue 0x0001 | |
131 | #define YValue 0x0002 | |
132 | #define WidthValue 0x0004 | |
133 | #define HeightValue 0x0008 | |
134 | #define AllValues 0x000F | |
135 | #define XNegative 0x0010 | |
136 | #define YNegative 0x0020 | |
137 | ||
138 | #define USPosition (1L << 0) /* user specified x, y */ | |
139 | #define USSize (1L << 1) /* user specified width, height */ | |
140 | ||
141 | #define PPosition (1L << 2) /* program specified position */ | |
142 | #define PSize (1L << 3) /* program specified size */ | |
143 | #define PMinSize (1L << 4) /* program specified minimum size */ | |
144 | #define PMaxSize (1L << 5) /* program specified maximum size */ | |
145 | #define PResizeInc (1L << 6) /* program specified resize increments */ | |
146 | #define PAspect (1L << 7) /* program specified min and max aspect ratios */ | |
147 | #define PBaseSize (1L << 8) /* program specified base for incrementing */ | |
148 | #define PWinGravity (1L << 9) /* program specified window gravity */ | |
149 | ||
150 | extern int XParseGeometry (); | |
151 | ||
d165fbde KS |
152 | |
153 | typedef struct { | |
154 | int x, y; | |
155 | unsigned width, height; | |
156 | } XRectangle; | |
157 | ||
158 | #define NativeRectangle RECT | |
159 | ||
160 | #define CONVERT_TO_XRECT(xr,nr) \ | |
161 | ((xr).x = (nr).left, \ | |
162 | (xr).y = (nr).top, \ | |
163 | (xr).width = ((nr).right - (nr).left), \ | |
164 | (xr).height = ((nr).bottom - (nr).top)) | |
165 | ||
166 | #define CONVERT_FROM_XRECT(xr,nr) \ | |
167 | ((nr).left = (xr).x, \ | |
168 | (nr).top = (xr).y, \ | |
169 | (nr).right = ((xr).x + (xr).width), \ | |
170 | (nr).bottom = ((xr).y + (xr).height)) | |
171 | ||
172 | #define STORE_NATIVE_RECT(nr,x,y,width,height) \ | |
173 | ((nr).left = (x), \ | |
174 | (nr).top = (y), \ | |
175 | (nr).right = ((nr).left + (width)), \ | |
176 | (nr).bottom = ((nr).top + (height))) | |
177 | ||
178 | ||
3b15de48 | 179 | #endif /* EMACS_W32GUI_H */ |
ab5796a9 MB |
180 | |
181 | /* arch-tag: 9172e5fb-45a5-4684-afd9-ca0e81324604 | |
182 | (do not change this comment) */ |