(ibuffer-aif, ibuffer-awhen, ibuffer-save-marks)
[emacs.git] / src / w32gui.h
blobf0e07680475bbbdb8316a37648a28ecdb6d46966
1 /* Definitions and headers for communication on the Microsoft W32 API.
2 Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005,
3 2006, 2007, 2008 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
22 #ifndef EMACS_W32GUI_H
23 #define EMACS_W32GUI_H
24 #include <windows.h>
26 #include "w32bdf.h"
28 /* Emulate XCharStruct. */
29 typedef struct _XCharStruct
31 short rbearing;
32 short lbearing;
33 short width;
34 short ascent;
35 short descent;
36 } XCharStruct;
38 enum w32_char_font_type
40 UNKNOWN_FONT = 0 /* FONT_TYPE_UNKNOWN */,
41 ANSI_FONT,
42 UNICODE_FONT,
43 BDF_1D_FONT,
44 BDF_2D_FONT
47 typedef struct W32FontStruct {
48 enum w32_char_font_type font_type;
49 TEXTMETRIC tm;
50 HFONT hfont;
51 bdffont *bdf;
52 int double_byte_p;
53 XCharStruct max_bounds;
54 XCharStruct scratch;
55 /* Only store info for ascii chars, if not fixed pitch. */
56 XCharStruct * per_char;
57 } W32FontStruct;
59 typedef struct W32FontStruct XFontStruct;
61 /* Emulate X GC's by keeping color and font info in a structure. */
62 typedef struct _XGCValues
64 COLORREF foreground;
65 COLORREF background;
66 #if OLD_FONT
67 XFontStruct * font;
68 #endif
69 struct font *font;
70 } XGCValues;
72 #define GCForeground 0x01
73 #define GCBackground 0x02
74 #define GCFont 0x03
76 typedef HBITMAP Pixmap;
77 typedef HBITMAP Bitmap;
79 typedef char * XrmDatabase;
81 typedef XGCValues * GC;
82 typedef COLORREF Color;
83 typedef DWORD Time;
84 typedef HWND Window;
85 typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
86 typedef HCURSOR Cursor;
88 #define No_Cursor (0)
90 #define XChar2b wchar_t
92 /* Dealing with bits of wchar_t as if they were an XChar2b. */
93 #define STORE_XCHAR2B(chp, byte1, byte2) \
94 ((*chp) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
96 #define XCHAR2B_BYTE1(chp) \
97 (((*chp) & 0xff00) >> 8)
99 #define XCHAR2B_BYTE2(chp) \
100 ((*chp) & 0x00ff)
103 /* Windows equivalent of XImage. */
104 typedef struct _XImage
106 unsigned char * data;
107 BITMAPINFO info;
108 /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */
109 } XImage;
111 #define FACE_DEFAULT (~0)
113 extern HINSTANCE hinst;
114 extern HINSTANCE hprevinst;
115 extern LPSTR lpCmdLine;
116 extern int nCmdShow;
118 /* Bit Gravity */
120 #define ForgetGravity 0
121 #define NorthWestGravity 1
122 #define NorthGravity 2
123 #define NorthEastGravity 3
124 #define WestGravity 4
125 #define CenterGravity 5
126 #define EastGravity 6
127 #define SouthWestGravity 7
128 #define SouthGravity 8
129 #define SouthEastGravity 9
130 #define StaticGravity 10
132 #define NoValue 0x0000
133 #define XValue 0x0001
134 #define YValue 0x0002
135 #define WidthValue 0x0004
136 #define HeightValue 0x0008
137 #define AllValues 0x000F
138 #define XNegative 0x0010
139 #define YNegative 0x0020
141 #define USPosition (1L << 0) /* user specified x, y */
142 #define USSize (1L << 1) /* user specified width, height */
144 #define PPosition (1L << 2) /* program specified position */
145 #define PSize (1L << 3) /* program specified size */
146 #define PMinSize (1L << 4) /* program specified minimum size */
147 #define PMaxSize (1L << 5) /* program specified maximum size */
148 #define PResizeInc (1L << 6) /* program specified resize increments */
149 #define PAspect (1L << 7) /* program specified min and max aspect ratios */
150 #define PBaseSize (1L << 8) /* program specified base for incrementing */
151 #define PWinGravity (1L << 9) /* program specified window gravity */
153 extern int XParseGeometry ();
156 typedef struct {
157 int x, y;
158 unsigned width, height;
159 } XRectangle;
161 #define NativeRectangle RECT
163 #define CONVERT_TO_XRECT(xr,nr) \
164 ((xr).x = (nr).left, \
165 (xr).y = (nr).top, \
166 (xr).width = ((nr).right - (nr).left), \
167 (xr).height = ((nr).bottom - (nr).top))
169 #define CONVERT_FROM_XRECT(xr,nr) \
170 ((nr).left = (xr).x, \
171 (nr).top = (xr).y, \
172 (nr).right = ((xr).x + (xr).width), \
173 (nr).bottom = ((xr).y + (xr).height))
175 #define STORE_NATIVE_RECT(nr,x,y,width,height) \
176 ((nr).left = (x), \
177 (nr).top = (y), \
178 (nr).right = ((nr).left + (width)), \
179 (nr).bottom = ((nr).top + (height)))
182 #endif /* EMACS_W32GUI_H */
184 /* arch-tag: 9172e5fb-45a5-4684-afd9-ca0e81324604
185 (do not change this comment) */