FreeBASIC  0.91.0
fb_gfx_win32.h
Go to the documentation of this file.
1 /* common win32 internal definitions */
2 
3 #ifndef __FB_GFX_WIN32_H__
4 #define __FB_GFX_WIN32_H__
5 
6 #include <windows.h>
7 
8 /* see also fb_win32.window_class setup in fb_hWin32Init() */
9 #define WINDOW_CLASS_PREFIX "fbgfxclass_"
10 #define WINDOW_CLASS_SIZE (sizeof( WINDOW_CLASS_PREFIX ) + (sizeof( void * ) * 2))
11 
12 /* This must match the original FLASHWINFO from the Win32 headers.
13  MinGW-w64 declares it *all* the time, while MinGW does it only if the
14  proper _WIN32_WINNT was set, but we do not want to do that. And since we
15  cannot check for a struct using #ifdef, we have to use our own renamed
16  version of it. */
17 typedef struct {
18  UINT cbSize;
19  HWND hwnd;
21  UINT uCount;
24 
25 typedef BOOL (WINAPI *SETLAYEREDWINDOWATTRIBUTES)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
26 typedef HMONITOR (WINAPI *MONITORFROMWINDOW)(HWND hwnd, DWORD dwFlags);
27 typedef HMONITOR (WINAPI *MONITORFROMPOINT)(POINT pt, DWORD dwFlags);
28 typedef BOOL (WINAPI *FLASHWINDOWEX)(PFB_FLASHWINFO pwfi);
29 typedef BOOL (WINAPI *_TRACKMOUSEEVENT)(TRACKMOUSEEVENT *);
30 typedef BOOL (WINAPI *GETMONITORINFO)(HMONITOR hMonitor, LPMONITORINFO lpmi);
31 typedef LONG (WINAPI *CHANGEDISPLAYSETTINGSEX)(LPCTSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
32 
33 typedef struct {
34  int version;
35  HINSTANCE hinstance;
36  WNDCLASS wndclass;
37  HWND wnd;
38  int fullw, fullh; /* width/height including non-client area */
39  PALETTEENTRY palette[256];
41  HMONITOR monitor;
43  int w, h, depth, flags, refresh_rate;
44  char *window_title;
45  char window_class[WINDOW_CLASS_SIZE];
46  int (*init)(void);
47  void (*exit)(void);
48  void (*paint)(void);
49 #ifdef HOST_MINGW
50  unsigned int WINAPI (*thread)( void *param );
51 #else
52  DWORD WINAPI (*thread)( LPVOID param );
53 #endif
55 
56  /* user32 procs */
64 } WIN32DRIVER;
65 
66 extern WIN32DRIVER fb_win32;
67 #ifndef HOST_CYGWIN
69 #endif
72 
73 extern LRESULT CALLBACK fb_hWin32WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
74 extern void fb_hHandleMessages(void);
75 extern int fb_hInitWindow(DWORD style, DWORD ex_style, int x, int y, int w, int h);
76 extern int fb_hWin32Init(char *title, int w, int h, int depth, int refresh_rate, int flags);
77 extern void fb_hWin32Exit(void);
78 extern void fb_hWin32Lock(void);
79 extern void fb_hWin32Unlock(void);
80 extern void fb_hWin32SetPalette(int index, int r, int g, int b);
81 extern void fb_hWin32WaitVSync(void);
82 extern int fb_hWin32GetMouse(int *x, int *y, int *z, int *buttons, int *clip);
83 extern void fb_hWin32SetMouse(int x, int y, int cursor, int clip);
84 extern void fb_hWin32SetWindowTitle(char *title);
85 extern int fb_hWin32SetWindowPos(int x, int y);
86 
87 /* from the rtlib */
88 extern const unsigned char __fb_keytable[][3];
89 
90 #endif