1 /* © 2010 David Given.
2  * WordGrinder is licensed under the MIT open source license. See the COPYING
3  * file in this distribution for the full text.
4  *
5  * $Id: dpy.c 159 2009-12-13 13:11:03Z dtrg $
6  * $URL: https://wordgrinder.svn.sf.net/svnroot/wordgrinder/wordgrinder/src/c/arch/win32/console/dpy.c $
7  */
8 
9 #ifndef GDI_H
10 #define GDI_H
11 
12 #include "utils/uthash.h"
13 
14 #define VKM_SHIFT      0x100
15 #define VKM_CTRL       0x200
16 #define VKM_CTRLASCII  0x400
17 #define VK_RESIZE     0x1000
18 #define VK_TIMEOUT    0x1001
19 #define VK_REDRAW     0x1002
20 
21 #define TIMEOUT_TIMER_ID 1
22 
23 struct glyph
24 {
25 	unsigned int id;              /* id of this glyph */
26 	HDC dc;                       /* Memory DC this glyph is drawn to */
27 	HBITMAP bitmap;               /* Backing store for memory DC */
28 	int width;                    /* Width of cell for this glyph */
29 	int xoffset, yoffset;         /* Draw offset */
30 	int realwidth, realheight;    /* Actual size of glyph bitmap */
31 	UT_hash_handle hh;
32 };
33 
34 extern void glyphcache_init(HDC dc, LOGFONT* defaultfont);
35 extern void glyphcache_deinit(void);
36 extern void glyphcache_getfontsize(int* w, int* h);
37 
38 extern void glyphcache_flush(void);
39 extern struct glyph* glyphcache_getglyph(unsigned int id, HDC dc);
40 
41 extern void dpy_queuekey(uni_t key);
42 extern void dpy_flushkeys(void);
43 
44 extern HWND window;
45 
46 enum {
47 	COLOUR_BLACK,
48 	COLOUR_DIM,
49 	COLOUR_NORMAL,
50 	COLOUR_BRIGHT,
51 	COLOUR__NUM
52 };
53 
54 extern COLORREF colourmap[COLOUR__NUM];
55 
56 #endif
57