source: NonGTP/FLTK/include/fltk/win32.h @ 773

Revision 773, 5.2 KB checked in by gumbau, 19 years ago (diff)

FLTK imported to SVN repository to be linked agains the GeoTool? application

Line 
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
55extern "C" {
56
57// Function pointer declarations
58
59typedef 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);
60typedef HMODULE (WINAPI *pfLoadLibraryW)(LPCWSTR lpFileName);
61typedef BOOL (WINAPI *pfPeekMessage)(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg);
62typedef BOOL (WINAPI *pfGetMessage)(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
63typedef LRESULT (WINAPI *pfDispatchMessage)(const MSG *lpmsg);
64typedef BOOL (WINAPI *pfSetWindowTextW)(HWND hWnd, LPCWSTR lpString);
65typedef LRESULT (WINAPI *pfDefWindowProc)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
66typedef BOOL (WINAPI *pfPostMessage)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
67typedef int (WINAPI *pfMessageBoxW)(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
68
69typedef HFONT (WINAPI *pfCreateFontIndirectW)(CONST LOGFONTW *);
70typedef BOOL (WINAPI *pfGetTextMetricsW)(HDC, LPTEXTMETRICW);
71
72extern pfCreateWindowExW __CreateWindowExW;
73extern pfLoadLibraryW    __LoadLibraryW;
74extern pfPeekMessage     __PeekMessage;
75extern pfGetMessage      __GetMessage;
76extern pfDispatchMessage __DispatchMessage;
77extern pfSetWindowTextW  __SetWindowTextW;
78extern pfDefWindowProc   __DefWindowProc;
79extern pfPostMessage     __PostMessage;
80extern pfMessageBoxW     __MessageBoxW;
81
82extern pfCreateFontIndirectW __CreateFontIndirectW;
83extern pfGetTextMetricsW     __GetTextMetricsW;
84
85}; /* extern "C" */
86
87namespace fltk {
88
89////////////////////////////////////////////////////////////////
90// constant information about the display:
91
92extern FL_API void      open_display();
93extern FL_API void      close_display();
94extern FL_API HINSTANCE xdisplay;
95extern FL_API HPALETTE  xpalette; // non-zero only on 8-bit displays!
96
97////////////////////////////////////////////////////////////////
98// event handling:
99
100extern FL_API MSG msg;
101
102////////////////////////////////////////////////////////////////
103// drawing functions:
104
105extern FL_API HDC       dc;
106extern FL_API HDC       getDC();
107extern FL_API HFONT     xfont();
108extern FL_API TEXTMETRICW* textmetric();
109extern FL_API COLORREF  current_xpixel;
110extern FL_API COLORREF  xpixel(Color i);
111extern FL_API HPEN      setpen();
112extern FL_API HBRUSH    setbrush();
113extern FL_API void      clip_region(HRGN);
114extern FL_API HRGN      clip_region();
115
116extern FL_API void      draw_into(HBITMAP, int w, int h);
117extern FL_API void      stop_drawing(HBITMAP);
118extern 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
127class FL_API CreatedWindow {
128public:
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:
149inline HWND xid(const Window*w) {return CreatedWindow::find(w)->xid;}
150Window* find(HWND xid);
151
152extern 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//
Note: See TracBrowser for help on using the repository browser.