Commit | Line | Data |
---|---|---|
b46a6a83 | 1 | /* Definitions and headers for communication on the Microsoft Windows API. |
ab422c4d | 2 | Copyright (C) 1995, 2001-2013 Free Software Foundation, Inc. |
ee78dc32 GV |
3 | |
4 | This file is part of GNU Emacs. | |
5 | ||
b9b1cc14 | 6 | GNU Emacs is free software: you can redistribute it and/or modify |
ee78dc32 | 7 | it under the terms of the GNU General Public License as published by |
b9b1cc14 GM |
8 | the Free Software Foundation, either version 3 of the License, or |
9 | (at your option) any later version. | |
ee78dc32 GV |
10 | |
11 | GNU Emacs is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
b9b1cc14 | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
ee78dc32 | 18 | |
3b15de48 JR |
19 | #ifndef EMACS_W32GUI_H |
20 | #define EMACS_W32GUI_H | |
ee78dc32 | 21 | #include <windows.h> |
c86a4064 | 22 | |
1a1f3366 PE |
23 | #include "systime.h" /* for Time */ |
24 | ||
607db0aa JR |
25 | /* Local memory management for menus. */ |
26 | #define local_heap (GetProcessHeap ()) | |
27 | #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n))) | |
28 | #define local_free(p) (HeapFree (local_heap, 0, ((LPVOID) (p)))) | |
29 | ||
30 | #define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value))) | |
31 | #define free_widget_value(wv) (local_free ((wv))) | |
32 | ||
5a048001 JR |
33 | /* Emulate X GC's by keeping color and font info in a structure. */ |
34 | typedef struct _XGCValues | |
35 | { | |
36 | COLORREF foreground; | |
37 | COLORREF background; | |
bce485cc | 38 | struct font *font; |
5a048001 JR |
39 | } XGCValues; |
40 | ||
41 | #define GCForeground 0x01 | |
42 | #define GCBackground 0x02 | |
43 | #define GCFont 0x03 | |
44 | ||
ee78dc32 GV |
45 | typedef HBITMAP Pixmap; |
46 | typedef HBITMAP Bitmap; | |
5a048001 | 47 | |
574bdd83 KS |
48 | typedef char * XrmDatabase; |
49 | ||
5a048001 | 50 | typedef XGCValues * GC; |
ee78dc32 | 51 | typedef COLORREF Color; |
ee78dc32 | 52 | typedef HWND Window; |
f9aaed00 | 53 | typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ |
ee78dc32 GV |
54 | typedef HCURSOR Cursor; |
55 | ||
d165fbde KS |
56 | #define No_Cursor (0) |
57 | ||
e83074af KS |
58 | #define XChar2b wchar_t |
59 | ||
60 | /* Dealing with bits of wchar_t as if they were an XChar2b. */ | |
61 | #define STORE_XCHAR2B(chp, byte1, byte2) \ | |
0269bd90 | 62 | ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff)))) |
e83074af KS |
63 | |
64 | #define XCHAR2B_BYTE1(chp) \ | |
0269bd90 | 65 | (((*(chp)) & 0xff00) >> 8) |
e83074af KS |
66 | |
67 | #define XCHAR2B_BYTE2(chp) \ | |
0269bd90 | 68 | ((*(chp)) & 0x00ff) |
e83074af KS |
69 | |
70 | ||
73e66133 JR |
71 | /* Windows equivalent of XImage. */ |
72 | typedef struct _XImage | |
73 | { | |
74 | unsigned char * data; | |
75 | BITMAPINFO info; | |
76 | /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */ | |
77 | } XImage; | |
56f508dd | 78 | |
ee78dc32 GV |
79 | #define FACE_DEFAULT (~0) |
80 | ||
81 | extern HINSTANCE hinst; | |
ee78dc32 GV |
82 | |
83 | /* Bit Gravity */ | |
84 | ||
85 | #define ForgetGravity 0 | |
86 | #define NorthWestGravity 1 | |
87 | #define NorthGravity 2 | |
88 | #define NorthEastGravity 3 | |
89 | #define WestGravity 4 | |
90 | #define CenterGravity 5 | |
91 | #define EastGravity 6 | |
92 | #define SouthWestGravity 7 | |
93 | #define SouthGravity 8 | |
94 | #define SouthEastGravity 9 | |
95 | #define StaticGravity 10 | |
96 | ||
97 | #define NoValue 0x0000 | |
98 | #define XValue 0x0001 | |
99 | #define YValue 0x0002 | |
100 | #define WidthValue 0x0004 | |
101 | #define HeightValue 0x0008 | |
102 | #define AllValues 0x000F | |
103 | #define XNegative 0x0010 | |
104 | #define YNegative 0x0020 | |
105 | ||
106 | #define USPosition (1L << 0) /* user specified x, y */ | |
107 | #define USSize (1L << 1) /* user specified width, height */ | |
108 | ||
109 | #define PPosition (1L << 2) /* program specified position */ | |
110 | #define PSize (1L << 3) /* program specified size */ | |
111 | #define PMinSize (1L << 4) /* program specified minimum size */ | |
112 | #define PMaxSize (1L << 5) /* program specified maximum size */ | |
113 | #define PResizeInc (1L << 6) /* program specified resize increments */ | |
114 | #define PAspect (1L << 7) /* program specified min and max aspect ratios */ | |
115 | #define PBaseSize (1L << 8) /* program specified base for incrementing */ | |
116 | #define PWinGravity (1L << 9) /* program specified window gravity */ | |
117 | ||
d165fbde KS |
118 | typedef struct { |
119 | int x, y; | |
120 | unsigned width, height; | |
121 | } XRectangle; | |
122 | ||
123 | #define NativeRectangle RECT | |
124 | ||
125 | #define CONVERT_TO_XRECT(xr,nr) \ | |
126 | ((xr).x = (nr).left, \ | |
127 | (xr).y = (nr).top, \ | |
128 | (xr).width = ((nr).right - (nr).left), \ | |
129 | (xr).height = ((nr).bottom - (nr).top)) | |
130 | ||
131 | #define CONVERT_FROM_XRECT(xr,nr) \ | |
132 | ((nr).left = (xr).x, \ | |
133 | (nr).top = (xr).y, \ | |
134 | (nr).right = ((xr).x + (xr).width), \ | |
135 | (nr).bottom = ((xr).y + (xr).height)) | |
136 | ||
137 | #define STORE_NATIVE_RECT(nr,x,y,width,height) \ | |
138 | ((nr).left = (x), \ | |
139 | (nr).top = (y), \ | |
140 | (nr).right = ((nr).left + (width)), \ | |
141 | (nr).bottom = ((nr).top + (height))) | |
142 | ||
143 | ||
3b15de48 | 144 | #endif /* EMACS_W32GUI_H */ |