]> code.delx.au - gnu-emacs/blob - src/w32gui.h
*** empty log message ***
[gnu-emacs] / src / w32gui.h
1 /* Definitions and headers for communication on the Microsoft W32 API.
2 Copyright (C) 1995, 2002, 2003, 2004, 2005,
3 2006 Free Software Foundation, Inc.
4
5 This file is part of GNU Emacs.
6
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 2, or (at your option)
10 any later version.
11
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.
16
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. */
21
22 #ifndef EMACS_W32GUI_H
23 #define EMACS_W32GUI_H
24 #include <windows.h>
25
26 #include "w32bdf.h"
27
28 /* Emulate XCharStruct. */
29 typedef struct _XCharStruct
30 {
31 short rbearing;
32 short lbearing;
33 short width;
34 short ascent;
35 short descent;
36 } XCharStruct;
37
38 enum w32_char_font_type
39 {
40 UNKNOWN_FONT = 0 /* FONT_TYPE_UNKNOWN */,
41 ANSI_FONT,
42 UNICODE_FONT,
43 BDF_1D_FONT,
44 BDF_2D_FONT
45 };
46
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;
58
59 typedef struct W32FontStruct XFontStruct;
60
61 /* Emulate X GC's by keeping color and font info in a structure. */
62 typedef struct _XGCValues
63 {
64 COLORREF foreground;
65 COLORREF background;
66 XFontStruct * font;
67 } XGCValues;
68
69 #define GCForeground 0x01
70 #define GCBackground 0x02
71 #define GCFont 0x03
72
73 typedef HBITMAP Pixmap;
74 typedef HBITMAP Bitmap;
75
76 typedef char * XrmDatabase;
77
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;
84
85 #define No_Cursor (0)
86
87 #define XChar2b wchar_t
88
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))))
92
93 #define XCHAR2B_BYTE1(chp) \
94 (((*chp) & 0xff00) >> 8)
95
96 #define XCHAR2B_BYTE2(chp) \
97 ((*chp) & 0x00ff)
98
99
100 /* Windows equivalent of XImage. */
101 typedef struct _XImage
102 {
103 unsigned char * data;
104 BITMAPINFO info;
105 /* Optional RGBQUAD array for palette follows (see BITMAPINFO docs). */
106 } XImage;
107
108 #define FACE_DEFAULT (~0)
109
110 extern HINSTANCE hinst;
111 extern HINSTANCE hprevinst;
112 extern LPSTR lpCmdLine;
113 extern int nCmdShow;
114
115 /* Bit Gravity */
116
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
128
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
137
138 #define USPosition (1L << 0) /* user specified x, y */
139 #define USSize (1L << 1) /* user specified width, height */
140
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 */
149
150 extern int XParseGeometry ();
151
152
153 typedef struct {
154 int x, y;
155 unsigned width, height;
156 } XRectangle;
157
158 #define NativeRectangle RECT
159
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))
165
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))
171
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)))
177
178
179 #endif /* EMACS_W32GUI_H */
180
181 /* arch-tag: 9172e5fb-45a5-4684-afd9-ca0e81324604
182 (do not change this comment) */