Add bug-reference.el, goto-address.el.
[emacs.git] / src / w32gui.h
blobb0faa3e597d6017ad7e1365573986ca570007caa
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 XFontStruct * font;
67 } XGCValues;
69 #define GCForeground 0x01
70 #define GCBackground 0x02
71 #define GCFont 0x03
73 typedef HBITMAP Pixmap;
74 typedef HBITMAP Bitmap;
76 typedef char * XrmDatabase;
78 typedef XGCValues * GC;
79 typedef COLORREF Color;
80 typedef DWORD Time;
81 typedef HWND Window;
82 typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
83 typedef HCURSOR Cursor;
85 #define No_Cursor (0)
87 #define XChar2b wchar_t
89 /* Dealing with bits of wchar_t as if they were an XChar2b. */
90 #define STORE_XCHAR2B(chp, byte1, byte2) \
91 ((*chp) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
93 #define XCHAR2B_BYTE1(chp) \
94 (((*chp) & 0xff00) >> 8)
96 #define XCHAR2B_BYTE2(chp) \
97 ((*chp) & 0x00ff)
100 /* Windows equivalent of XImage. */
101 typedef struct _XImage
103 unsigned char * data;
104 BITMAPINFO info;
105 /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */
106 } XImage;
108 #define FACE_DEFAULT (~0)
110 extern HINSTANCE hinst;
111 extern HINSTANCE hprevinst;
112 extern LPSTR lpCmdLine;
113 extern int nCmdShow;
115 /* Bit Gravity */
117 #define ForgetGravity 0
118 #define NorthWestGravity 1
119 #define NorthGravity 2
120 #define NorthEastGravity 3
121 #define WestGravity 4
122 #define CenterGravity 5
123 #define EastGravity 6
124 #define SouthWestGravity 7
125 #define SouthGravity 8
126 #define SouthEastGravity 9
127 #define StaticGravity 10
129 #define NoValue 0x0000
130 #define XValue 0x0001
131 #define YValue 0x0002
132 #define WidthValue 0x0004
133 #define HeightValue 0x0008
134 #define AllValues 0x000F
135 #define XNegative 0x0010
136 #define YNegative 0x0020
138 #define USPosition (1L << 0) /* user specified x, y */
139 #define USSize (1L << 1) /* user specified width, height */
141 #define PPosition (1L << 2) /* program specified position */
142 #define PSize (1L << 3) /* program specified size */
143 #define PMinSize (1L << 4) /* program specified minimum size */
144 #define PMaxSize (1L << 5) /* program specified maximum size */
145 #define PResizeInc (1L << 6) /* program specified resize increments */
146 #define PAspect (1L << 7) /* program specified min and max aspect ratios */
147 #define PBaseSize (1L << 8) /* program specified base for incrementing */
148 #define PWinGravity (1L << 9) /* program specified window gravity */
150 extern int XParseGeometry ();
153 typedef struct {
154 int x, y;
155 unsigned width, height;
156 } XRectangle;
158 #define NativeRectangle RECT
160 #define CONVERT_TO_XRECT(xr,nr) \
161 ((xr).x = (nr).left, \
162 (xr).y = (nr).top, \
163 (xr).width = ((nr).right - (nr).left), \
164 (xr).height = ((nr).bottom - (nr).top))
166 #define CONVERT_FROM_XRECT(xr,nr) \
167 ((nr).left = (xr).x, \
168 (nr).top = (xr).y, \
169 (nr).right = ((xr).x + (xr).width), \
170 (nr).bottom = ((xr).y + (xr).height))
172 #define STORE_NATIVE_RECT(nr,x,y,width,height) \
173 ((nr).left = (x), \
174 (nr).top = (y), \
175 (nr).right = ((nr).left + (width)), \
176 (nr).bottom = ((nr).top + (height)))
179 #endif /* EMACS_W32GUI_H */
181 /* arch-tag: 9172e5fb-45a5-4684-afd9-ca0e81324604
182 (do not change this comment) */