1 | // |
---|
2 | // "$Id: win32.h 4571 2005-09-16 08:02:58Z spitzak $" |
---|
3 | // |
---|
4 | // _WIN32 header file for the Fast Light Tool Kit (FLTK). |
---|
5 | // |
---|
6 | // Copyright 1998-2003 by Bill Spitzak and others. |
---|
7 | // |
---|
8 | // This library is free software; you can redistribute it and/or |
---|
9 | // modify it under the terms of the GNU Library General Public |
---|
10 | // License as published by the Free Software Foundation; either |
---|
11 | // version 2 of the License, or (at your option) any later version. |
---|
12 | // |
---|
13 | // This library is distributed in the hope that it will be useful, |
---|
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | // Library General Public License for more details. |
---|
17 | // |
---|
18 | // You should have received a copy of the GNU Library General Public |
---|
19 | // License along with this library; if not, write to the Free Software |
---|
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
21 | // USA. |
---|
22 | // |
---|
23 | // Please report all bugs and problems to "fltk-bugs@fltk.org". |
---|
24 | // |
---|
25 | |
---|
26 | // Do not directly include this file, instead use <fltk/x.h>. It will |
---|
27 | // include this file if _WIN32 is defined. This is to encourage |
---|
28 | // portability of even the system-specific code... |
---|
29 | |
---|
30 | #ifndef FL_WIN32_H |
---|
31 | #define FL_WIN32_H |
---|
32 | |
---|
33 | #include <windows.h> |
---|
34 | #include <winuser.h> |
---|
35 | # undef OPAQUE |
---|
36 | # undef DELETE |
---|
37 | # undef ERROR |
---|
38 | # undef IN |
---|
39 | # undef OUT |
---|
40 | # undef POINT |
---|
41 | //# undef far |
---|
42 | # undef max |
---|
43 | # undef min |
---|
44 | //# undef near |
---|
45 | // In some of the distributions, the gcc header files are missing some stuff: |
---|
46 | #ifndef LPMINMAXINFO |
---|
47 | # define LPMINMAXINFO MINMAXINFO* |
---|
48 | #endif |
---|
49 | #ifndef VK_LWIN |
---|
50 | # define VK_LWIN 0x5B |
---|
51 | # define VK_RWIN 0x5C |
---|
52 | # define VK_APPS 0x5D |
---|
53 | #endif |
---|
54 | |
---|
55 | extern "C" { |
---|
56 | |
---|
57 | // Function pointer declarations |
---|
58 | |
---|
59 | typedef HWND (WINAPI *pfCreateWindowExW)(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam); |
---|
60 | typedef HMODULE (WINAPI *pfLoadLibraryW)(LPCWSTR lpFileName); |
---|
61 | typedef BOOL (WINAPI *pfPeekMessage)(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg); |
---|
62 | typedef BOOL (WINAPI *pfGetMessage)(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax); |
---|
63 | typedef LRESULT (WINAPI *pfDispatchMessage)(const MSG *lpmsg); |
---|
64 | typedef BOOL (WINAPI *pfSetWindowTextW)(HWND hWnd, LPCWSTR lpString); |
---|
65 | typedef LRESULT (WINAPI *pfDefWindowProc)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); |
---|
66 | typedef BOOL (WINAPI *pfPostMessage)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); |
---|
67 | typedef int (WINAPI *pfMessageBoxW)(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType); |
---|
68 | |
---|
69 | typedef HFONT (WINAPI *pfCreateFontIndirectW)(CONST LOGFONTW *); |
---|
70 | typedef BOOL (WINAPI *pfGetTextMetricsW)(HDC, LPTEXTMETRICW); |
---|
71 | |
---|
72 | extern pfCreateWindowExW __CreateWindowExW; |
---|
73 | extern pfLoadLibraryW __LoadLibraryW; |
---|
74 | extern pfPeekMessage __PeekMessage; |
---|
75 | extern pfGetMessage __GetMessage; |
---|
76 | extern pfDispatchMessage __DispatchMessage; |
---|
77 | extern pfSetWindowTextW __SetWindowTextW; |
---|
78 | extern pfDefWindowProc __DefWindowProc; |
---|
79 | extern pfPostMessage __PostMessage; |
---|
80 | extern pfMessageBoxW __MessageBoxW; |
---|
81 | |
---|
82 | extern pfCreateFontIndirectW __CreateFontIndirectW; |
---|
83 | extern pfGetTextMetricsW __GetTextMetricsW; |
---|
84 | |
---|
85 | }; /* extern "C" */ |
---|
86 | |
---|
87 | namespace fltk { |
---|
88 | |
---|
89 | //////////////////////////////////////////////////////////////// |
---|
90 | // constant information about the display: |
---|
91 | |
---|
92 | extern FL_API void open_display(); |
---|
93 | extern FL_API void close_display(); |
---|
94 | extern FL_API HINSTANCE xdisplay; |
---|
95 | extern FL_API HPALETTE xpalette; // non-zero only on 8-bit displays! |
---|
96 | |
---|
97 | //////////////////////////////////////////////////////////////// |
---|
98 | // event handling: |
---|
99 | |
---|
100 | extern FL_API MSG msg; |
---|
101 | |
---|
102 | //////////////////////////////////////////////////////////////// |
---|
103 | // drawing functions: |
---|
104 | |
---|
105 | extern FL_API HDC dc; |
---|
106 | extern FL_API HDC getDC(); |
---|
107 | extern FL_API HFONT xfont(); |
---|
108 | extern FL_API TEXTMETRICW* textmetric(); |
---|
109 | extern FL_API COLORREF current_xpixel; |
---|
110 | extern FL_API COLORREF xpixel(Color i); |
---|
111 | extern FL_API HPEN setpen(); |
---|
112 | extern FL_API HBRUSH setbrush(); |
---|
113 | extern FL_API void clip_region(HRGN); |
---|
114 | extern FL_API HRGN clip_region(); |
---|
115 | |
---|
116 | extern FL_API void draw_into(HBITMAP, int w, int h); |
---|
117 | extern FL_API void stop_drawing(HBITMAP); |
---|
118 | extern FL_API void stop_drawing(HWND); |
---|
119 | |
---|
120 | //////////////////////////////////////////////////////////////// |
---|
121 | #ifdef fltk_Window_h // only include this if <fltk/Fl_Window.h> was included |
---|
122 | |
---|
123 | // When fltk tells X about a window, one of these objects is created. |
---|
124 | // Warning: this object is highly subject to change! It's definition |
---|
125 | // is only here so that fl_xid can be declared inline: |
---|
126 | |
---|
127 | class FL_API CreatedWindow { |
---|
128 | public: |
---|
129 | HWND xid; |
---|
130 | HDC dc; |
---|
131 | HBITMAP backbuffer; |
---|
132 | HDC bdc; |
---|
133 | Window* window; |
---|
134 | HRGN region; |
---|
135 | void expose(const Rectangle&); |
---|
136 | CreatedWindow* next; |
---|
137 | bool wait_for_expose; |
---|
138 | bool backbuffer_bad; // used for XDBE |
---|
139 | bool overlay; // true if redraw_overlay was called |
---|
140 | HCURSOR cursor; |
---|
141 | const Widget* cursor_for; |
---|
142 | static CreatedWindow* first; |
---|
143 | static CreatedWindow* find(const Window* window) {return window->i;} |
---|
144 | void set_minmax(LPMINMAXINFO minmax); |
---|
145 | static void create(Window*); |
---|
146 | }; |
---|
147 | |
---|
148 | // convert xid <-> Window: |
---|
149 | inline HWND xid(const Window*w) {return CreatedWindow::find(w)->xid;} |
---|
150 | Window* find(HWND xid); |
---|
151 | |
---|
152 | extern FL_API HCURSOR default_cursor; |
---|
153 | |
---|
154 | #endif //Fl_Window_H |
---|
155 | //////////////////////////////////////////////////////////////// |
---|
156 | |
---|
157 | } |
---|
158 | |
---|
159 | #endif |
---|
160 | |
---|
161 | // |
---|
162 | // End of "$Id: win32.h 4571 2005-09-16 08:02:58Z spitzak $". |
---|
163 | // |
---|