Make building under stricter warning flags somewhat cleaner.
[bpt/emacs.git] / src / w32gui.h
CommitLineData
de31b97a 1/* Definitions and headers for communication on the Microsoft W32 API.
429ab54e 2 Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005,
114f9c96 3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
ee78dc32
GV
4
5This file is part of GNU Emacs.
6
b9b1cc14 7GNU Emacs is free software: you can redistribute it and/or modify
ee78dc32 8it under the terms of the GNU General Public License as published by
b9b1cc14
GM
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
ee78dc32
GV
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
b9b1cc14 18along 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
607db0aa
JR
24/* Local memory management for menus. */
25#define local_heap (GetProcessHeap ())
26#define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n)))
27#define local_free(p) (HeapFree (local_heap, 0, ((LPVOID) (p))))
28
29#define malloc_widget_value() ((widget_value *) local_alloc (sizeof (widget_value)))
30#define free_widget_value(wv) (local_free ((wv)))
31
5a048001
JR
32/* Emulate X GC's by keeping color and font info in a structure. */
33typedef struct _XGCValues
34{
35 COLORREF foreground;
36 COLORREF background;
bce485cc 37 struct font *font;
5a048001
JR
38} XGCValues;
39
40#define GCForeground 0x01
41#define GCBackground 0x02
42#define GCFont 0x03
43
ee78dc32
GV
44typedef HBITMAP Pixmap;
45typedef HBITMAP Bitmap;
5a048001 46
574bdd83
KS
47typedef char * XrmDatabase;
48
5a048001 49typedef XGCValues * GC;
ee78dc32
GV
50typedef COLORREF Color;
51typedef DWORD Time;
52typedef HWND Window;
f9aaed00 53typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
ee78dc32
GV
54typedef 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) \
62 ((*chp) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
63
64#define XCHAR2B_BYTE1(chp) \
65 (((*chp) & 0xff00) >> 8)
66
67#define XCHAR2B_BYTE2(chp) \
68 ((*chp) & 0x00ff)
69
70
73e66133
JR
71/* Windows equivalent of XImage. */
72typedef 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
81extern HINSTANCE hinst;
82extern HINSTANCE hprevinst;
83extern LPSTR lpCmdLine;
84extern int nCmdShow;
85
86/* Bit Gravity */
87
88#define ForgetGravity 0
89#define NorthWestGravity 1
90#define NorthGravity 2
91#define NorthEastGravity 3
92#define WestGravity 4
93#define CenterGravity 5
94#define EastGravity 6
95#define SouthWestGravity 7
96#define SouthGravity 8
97#define SouthEastGravity 9
98#define StaticGravity 10
99
100#define NoValue 0x0000
101#define XValue 0x0001
102#define YValue 0x0002
103#define WidthValue 0x0004
104#define HeightValue 0x0008
105#define AllValues 0x000F
106#define XNegative 0x0010
107#define YNegative 0x0020
108
109#define USPosition (1L << 0) /* user specified x, y */
110#define USSize (1L << 1) /* user specified width, height */
111
112#define PPosition (1L << 2) /* program specified position */
113#define PSize (1L << 3) /* program specified size */
114#define PMinSize (1L << 4) /* program specified minimum size */
115#define PMaxSize (1L << 5) /* program specified maximum size */
116#define PResizeInc (1L << 6) /* program specified resize increments */
117#define PAspect (1L << 7) /* program specified min and max aspect ratios */
118#define PBaseSize (1L << 8) /* program specified base for incrementing */
119#define PWinGravity (1L << 9) /* program specified window gravity */
120
361358ea 121extern int XParseGeometry (char *, int *, int *, unsigned *, unsigned *);
ee78dc32 122
d165fbde
KS
123
124typedef struct {
125 int x, y;
126 unsigned width, height;
127} XRectangle;
128
129#define NativeRectangle RECT
130
131#define CONVERT_TO_XRECT(xr,nr) \
132 ((xr).x = (nr).left, \
133 (xr).y = (nr).top, \
134 (xr).width = ((nr).right - (nr).left), \
135 (xr).height = ((nr).bottom - (nr).top))
136
137#define CONVERT_FROM_XRECT(xr,nr) \
138 ((nr).left = (xr).x, \
139 (nr).top = (xr).y, \
140 (nr).right = ((xr).x + (xr).width), \
141 (nr).bottom = ((xr).y + (xr).height))
142
143#define STORE_NATIVE_RECT(nr,x,y,width,height) \
144 ((nr).left = (x), \
145 (nr).top = (y), \
146 (nr).right = ((nr).left + (width)), \
147 (nr).bottom = ((nr).top + (height)))
148
149
3b15de48 150#endif /* EMACS_W32GUI_H */
ab5796a9
MB
151
152/* arch-tag: 9172e5fb-45a5-4684-afd9-ca0e81324604
153 (do not change this comment) */