src/xdisp.c (single_display_spec_string): Correct a FIXME comment.
[emacs.git] / src / w32gui.h
blob936709af1815a1f502b805da5dc024451fb34ffe
1 /* Definitions and headers for communication on the Microsoft W32 API.
2 Copyright (C) 1995, 2001-2011 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
9 (at 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 <http://www.gnu.org/licenses/>. */
19 #ifndef EMACS_W32GUI_H
20 #define EMACS_W32GUI_H
21 #include <windows.h>
23 /* Local memory management for menus. */
24 #define local_heap (GetProcessHeap ())
25 #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n)))
26 #define local_free(p) (HeapFree (local_heap, 0, ((LPVOID) (p))))
28 #define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value)))
29 #define free_widget_value(wv) (local_free ((wv)))
31 /* Emulate X GC's by keeping color and font info in a structure. */
32 typedef struct _XGCValues
34 COLORREF foreground;
35 COLORREF background;
36 struct font *font;
37 } XGCValues;
39 #define GCForeground 0x01
40 #define GCBackground 0x02
41 #define GCFont 0x03
43 typedef HBITMAP Pixmap;
44 typedef HBITMAP Bitmap;
46 typedef char * XrmDatabase;
48 typedef XGCValues * GC;
49 typedef COLORREF Color;
50 typedef DWORD Time;
51 typedef HWND Window;
52 typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
53 typedef HCURSOR Cursor;
55 #define No_Cursor (0)
57 #define XChar2b wchar_t
59 /* Dealing with bits of wchar_t as if they were an XChar2b. */
60 #define STORE_XCHAR2B(chp, byte1, byte2) \
61 ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
63 #define XCHAR2B_BYTE1(chp) \
64 (((*(chp)) & 0xff00) >> 8)
66 #define XCHAR2B_BYTE2(chp) \
67 ((*(chp)) & 0x00ff)
70 /* Windows equivalent of XImage. */
71 typedef struct _XImage
73 unsigned char * data;
74 BITMAPINFO info;
75 /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */
76 } XImage;
78 #define FACE_DEFAULT (~0)
80 extern HINSTANCE hinst;
81 extern HINSTANCE hprevinst;
82 extern LPSTR lpCmdLine;
83 extern int nCmdShow;
85 /* Bit Gravity */
87 #define ForgetGravity 0
88 #define NorthWestGravity 1
89 #define NorthGravity 2
90 #define NorthEastGravity 3
91 #define WestGravity 4
92 #define CenterGravity 5
93 #define EastGravity 6
94 #define SouthWestGravity 7
95 #define SouthGravity 8
96 #define SouthEastGravity 9
97 #define StaticGravity 10
99 #define NoValue 0x0000
100 #define XValue 0x0001
101 #define YValue 0x0002
102 #define WidthValue 0x0004
103 #define HeightValue 0x0008
104 #define AllValues 0x000F
105 #define XNegative 0x0010
106 #define YNegative 0x0020
108 #define USPosition (1L << 0) /* user specified x, y */
109 #define USSize (1L << 1) /* user specified width, height */
111 #define PPosition (1L << 2) /* program specified position */
112 #define PSize (1L << 3) /* program specified size */
113 #define PMinSize (1L << 4) /* program specified minimum size */
114 #define PMaxSize (1L << 5) /* program specified maximum size */
115 #define PResizeInc (1L << 6) /* program specified resize increments */
116 #define PAspect (1L << 7) /* program specified min and max aspect ratios */
117 #define PBaseSize (1L << 8) /* program specified base for incrementing */
118 #define PWinGravity (1L << 9) /* program specified window gravity */
120 extern int XParseGeometry (char *, int *, int *, unsigned *, unsigned *);
123 typedef struct {
124 int x, y;
125 unsigned width, height;
126 } XRectangle;
128 #define NativeRectangle RECT
130 #define CONVERT_TO_XRECT(xr,nr) \
131 ((xr).x = (nr).left, \
132 (xr).y = (nr).top, \
133 (xr).width = ((nr).right - (nr).left), \
134 (xr).height = ((nr).bottom - (nr).top))
136 #define CONVERT_FROM_XRECT(xr,nr) \
137 ((nr).left = (xr).x, \
138 (nr).top = (xr).y, \
139 (nr).right = ((xr).x + (xr).width), \
140 (nr).bottom = ((xr).y + (xr).height))
142 #define STORE_NATIVE_RECT(nr,x,y,width,height) \
143 ((nr).left = (x), \
144 (nr).top = (y), \
145 (nr).right = ((nr).left + (width)), \
146 (nr).bottom = ((nr).top + (height)))
149 #endif /* EMACS_W32GUI_H */