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