Convert consecutive FSF copyright years to ranges.
[bpt/emacs.git] / src / w32gui.h
CommitLineData
de31b97a 1/* Definitions and headers for communication on the Microsoft W32 API.
73b0cd50 2 Copyright (C) 1995, 2001-2011 Free Software Foundation, Inc.
ee78dc32
GV
3
4This file is part of GNU Emacs.
5
b9b1cc14 6GNU Emacs is free software: you can redistribute it and/or modify
ee78dc32 7it under the terms of the GNU General Public License as published by
b9b1cc14
GM
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
ee78dc32
GV
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
b9b1cc14 17along 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
607db0aa
JR
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))))
27
28#define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value)))
29#define free_widget_value(wv) (local_free ((wv)))
30
5a048001
JR
31/* Emulate X GC's by keeping color and font info in a structure. */
32typedef struct _XGCValues
33{
34 COLORREF foreground;
35 COLORREF background;
bce485cc 36 struct font *font;
5a048001
JR
37} XGCValues;
38
39#define GCForeground 0x01
40#define GCBackground 0x02
41#define GCFont 0x03
42
ee78dc32
GV
43typedef HBITMAP Pixmap;
44typedef HBITMAP Bitmap;
5a048001 45
574bdd83
KS
46typedef char * XrmDatabase;
47
5a048001 48typedef XGCValues * GC;
ee78dc32
GV
49typedef COLORREF Color;
50typedef DWORD Time;
51typedef HWND Window;
f9aaed00 52typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
ee78dc32
GV
53typedef HCURSOR Cursor;
54
d165fbde
KS
55#define No_Cursor (0)
56
e83074af
KS
57#define XChar2b wchar_t
58
59/* Dealing with bits of wchar_t as if they were an XChar2b. */
60#define STORE_XCHAR2B(chp, byte1, byte2) \
0269bd90 61 ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
e83074af
KS
62
63#define XCHAR2B_BYTE1(chp) \
0269bd90 64 (((*(chp)) & 0xff00) >> 8)
e83074af
KS
65
66#define XCHAR2B_BYTE2(chp) \
0269bd90 67 ((*(chp)) & 0x00ff)
e83074af
KS
68
69
73e66133
JR
70/* Windows equivalent of XImage. */
71typedef struct _XImage
72{
73 unsigned char * data;
74 BITMAPINFO info;
75 /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */
76} XImage;
56f508dd 77
ee78dc32
GV
78#define FACE_DEFAULT (~0)
79
80extern HINSTANCE hinst;
81extern HINSTANCE hprevinst;
82extern LPSTR lpCmdLine;
83extern int nCmdShow;
84
85/* Bit Gravity */
86
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
98
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
107
108#define USPosition (1L << 0) /* user specified x, y */
109#define USSize (1L << 1) /* user specified width, height */
110
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 */
119
361358ea 120extern int XParseGeometry (char *, int *, int *, unsigned *, unsigned *);
ee78dc32 121
d165fbde
KS
122
123typedef struct {
124 int x, y;
125 unsigned width, height;
126} XRectangle;
127
128#define NativeRectangle RECT
129
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))
135
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))
141
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)))
147
148
3b15de48 149#endif /* EMACS_W32GUI_H */
ab5796a9 150