* lisp/comint.el: Clean up namespace
[emacs.git] / src / w32gui.h
blobddef433ff0bc5587ab5ba9d9045774e2f3cf4bd3
1 /* Definitions and headers for communication on the Microsoft Windows API.
2 Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or (at
9 your option) any later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
19 #ifndef EMACS_W32GUI_H
20 #define EMACS_W32GUI_H
21 #include <windows.h>
23 #include "systime.h" /* for Time */
25 /* FIXME: old 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))))
30 /* Emulate X GC's by keeping color and font info in a structure. */
31 typedef struct _XGCValues
33 COLORREF foreground;
34 COLORREF background;
35 struct font *font;
36 } XGCValues;
38 #define GCForeground 0x01
39 #define GCBackground 0x02
40 #define GCFont 0x03
42 typedef HBITMAP Pixmap;
43 typedef HBITMAP Bitmap;
45 typedef char * XrmDatabase;
47 typedef XGCValues * GC;
48 typedef COLORREF Color;
49 typedef HWND Window;
50 typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
51 typedef HCURSOR Cursor;
53 #define No_Cursor (0)
55 #define XChar2b wchar_t
57 /* Dealing with bits of wchar_t as if they were an XChar2b. */
58 #define STORE_XCHAR2B(chp, byte1, byte2) \
59 ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
61 #define XCHAR2B_BYTE1(chp) \
62 (((*(chp)) & 0xff00) >> 8)
64 #define XCHAR2B_BYTE2(chp) \
65 ((*(chp)) & 0x00ff)
68 /* Windows equivalent of XImage. */
69 typedef struct _XImage
71 unsigned char * data;
72 BITMAPINFO info;
73 /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */
74 } XImage;
76 #define FACE_DEFAULT (~0)
78 extern HINSTANCE hinst;
80 /* Bit Gravity */
82 #define ForgetGravity 0
83 #define NorthWestGravity 1
84 #define NorthGravity 2
85 #define NorthEastGravity 3
86 #define WestGravity 4
87 #define CenterGravity 5
88 #define EastGravity 6
89 #define SouthWestGravity 7
90 #define SouthGravity 8
91 #define SouthEastGravity 9
92 #define StaticGravity 10
94 #define NoValue 0x0000
95 #define XValue 0x0001
96 #define YValue 0x0002
97 #define WidthValue 0x0004
98 #define HeightValue 0x0008
99 #define AllValues 0x000F
100 #define XNegative 0x0010
101 #define YNegative 0x0020
103 #define USPosition (1L << 0) /* user specified x, y */
104 #define USSize (1L << 1) /* user specified width, height */
106 #define PPosition (1L << 2) /* program specified position */
107 #define PSize (1L << 3) /* program specified size */
108 #define PMinSize (1L << 4) /* program specified minimum size */
109 #define PMaxSize (1L << 5) /* program specified maximum size */
110 #define PResizeInc (1L << 6) /* program specified resize increments */
111 #define PAspect (1L << 7) /* program specified min and max aspect ratios */
112 #define PBaseSize (1L << 8) /* program specified base for incrementing */
113 #define PWinGravity (1L << 9) /* program specified window gravity */
115 typedef struct {
116 int x, y;
117 unsigned width, height;
118 } XRectangle;
120 #define NativeRectangle RECT
122 #define CONVERT_TO_XRECT(xr,nr) \
123 ((xr).x = (nr).left, \
124 (xr).y = (nr).top, \
125 (xr).width = ((nr).right - (nr).left), \
126 (xr).height = ((nr).bottom - (nr).top))
128 #define CONVERT_FROM_XRECT(xr,nr) \
129 ((nr).left = (xr).x, \
130 (nr).top = (xr).y, \
131 (nr).right = ((xr).x + (xr).width), \
132 (nr).bottom = ((xr).y + (xr).height))
134 #define STORE_NATIVE_RECT(nr,x,y,width,height) \
135 ((nr).left = (x), \
136 (nr).top = (y), \
137 (nr).right = ((nr).left + (width)), \
138 (nr).bottom = ((nr).top + (height)))
141 #endif /* EMACS_W32GUI_H */