1998-10-20 01:39:29 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// "$Id$"
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// WIN32 header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2009-01-01 19:11:32 +03:00
|
|
|
// Copyright 1998-2009 by Bill Spitzak and others.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
// USA.
|
|
|
|
//
|
2005-04-16 04:13:17 +04:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
1998-10-06 23:14:55 +04:00
|
|
|
|
|
|
|
// Do not directly include this file, instead use <FL/x.H>. It will
|
|
|
|
// include this file if WIN32 is defined. This is to encourage
|
|
|
|
// portability of even the system-specific code...
|
|
|
|
|
2008-09-18 23:09:34 +04:00
|
|
|
#ifndef FL_DOXYGEN
|
2002-06-07 19:06:32 +04:00
|
|
|
#ifndef Fl_X_H
|
|
|
|
# error "Never use <FL/win32.H> directly; include <FL/x.H> instead."
|
|
|
|
#endif // !Fl_X_H
|
|
|
|
|
1998-10-06 23:14:55 +04:00
|
|
|
#include <windows.h>
|
1998-11-05 19:04:53 +03:00
|
|
|
// In some of the distributions, the gcc header files are missing some stuff:
|
1998-10-06 23:14:55 +04:00
|
|
|
#ifndef LPMINMAXINFO
|
|
|
|
#define LPMINMAXINFO MINMAXINFO*
|
1998-11-05 19:04:53 +03:00
|
|
|
#endif
|
|
|
|
#ifndef VK_LWIN
|
1998-10-06 23:14:55 +04:00
|
|
|
#define VK_LWIN 0x5B
|
|
|
|
#define VK_RWIN 0x5C
|
|
|
|
#define VK_APPS 0x5D
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// some random X equivalents
|
|
|
|
typedef HWND Window;
|
|
|
|
typedef POINT XPoint;
|
|
|
|
struct XRectangle {int x, y, width, height;};
|
2001-11-27 20:44:08 +03:00
|
|
|
typedef HRGN Fl_Region;
|
|
|
|
FL_EXPORT void fl_clip_region(Fl_Region);
|
|
|
|
inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
|
1998-10-06 23:14:55 +04:00
|
|
|
return CreateRectRgn(x,y,x+w,y+h);
|
|
|
|
}
|
2001-11-27 20:44:08 +03:00
|
|
|
inline void XDestroyRegion(Fl_Region r) {DeleteObject(r);}
|
|
|
|
inline void XClipBox(Fl_Region r,XRectangle* rect) {
|
1998-10-15 18:06:16 +04:00
|
|
|
RECT win_rect; GetRgnBox(r,&win_rect);
|
|
|
|
rect->x=win_rect.left;
|
|
|
|
rect->y=win_rect.top;
|
|
|
|
rect->width=win_rect.right-win_rect.left;
|
|
|
|
rect->height=win_rect.bottom-win_rect.top;
|
|
|
|
}
|
1998-10-06 23:14:55 +04:00
|
|
|
#define XDestroyWindow(a,b) DestroyWindow(b)
|
|
|
|
#define XMapWindow(a,b) ShowWindow(b, SW_RESTORE)
|
|
|
|
#define XUnmapWindow(a,b) ShowWindow(b, SW_HIDE)
|
|
|
|
|
|
|
|
#include "Fl_Window.H"
|
|
|
|
// this object contains all win32-specific stuff about a window:
|
|
|
|
// Warning: this object is highly subject to change!
|
2002-08-14 20:49:38 +04:00
|
|
|
class FL_EXPORT Fl_X {
|
1998-10-06 23:14:55 +04:00
|
|
|
public:
|
2005-09-13 03:03:34 +04:00
|
|
|
// member variables - add new variables only at the end of this block
|
1998-10-06 23:14:55 +04:00
|
|
|
Window xid;
|
|
|
|
HBITMAP other_xid; // for double-buffered windows
|
|
|
|
Fl_Window* w;
|
2001-11-27 20:44:08 +03:00
|
|
|
Fl_Region region;
|
1998-10-06 23:14:55 +04:00
|
|
|
Fl_X *next;
|
1998-10-20 01:00:26 +04:00
|
|
|
int wait_for_expose;
|
1998-10-06 23:14:55 +04:00
|
|
|
HDC private_dc; // used for OpenGL
|
|
|
|
HCURSOR cursor;
|
2005-09-13 03:03:34 +04:00
|
|
|
HDC saved_hdc; // saves the handle of the DC currently loaded
|
|
|
|
// static variables, static functions and member functions
|
2002-08-14 20:49:38 +04:00
|
|
|
static Fl_X* first;
|
|
|
|
static Fl_X* i(const Fl_Window* w) {return w->i;}
|
|
|
|
static int fake_X_wm(const Fl_Window* w,int &X, int &Y,
|
1999-02-17 01:00:04 +03:00
|
|
|
int &bt,int &bx,int &by);
|
2002-08-14 20:49:38 +04:00
|
|
|
void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
|
|
|
|
void flush() {w->flush();}
|
|
|
|
void set_minmax(LPMINMAXINFO minmax);
|
|
|
|
void mapraise();
|
|
|
|
static Fl_X* make(Fl_Window*);
|
1998-10-06 23:14:55 +04:00
|
|
|
};
|
1999-02-17 01:00:04 +03:00
|
|
|
extern FL_EXPORT HCURSOR fl_default_cursor;
|
2002-07-02 00:14:08 +04:00
|
|
|
extern FL_EXPORT UINT fl_wake_msg;
|
2004-11-20 06:19:59 +03:00
|
|
|
inline Window fl_xid(const Fl_Window*w) {Fl_X *temp = Fl_X::i(w); return temp ? temp->xid : 0;}
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT Fl_Window* fl_find(Window xid);
|
|
|
|
extern FL_EXPORT char fl_override_redirect; // hack into Fl_Window::make_xid()
|
|
|
|
extern FL_EXPORT int fl_background_pixel; // hack into Fl_Window::make_xid()
|
1998-10-06 23:14:55 +04:00
|
|
|
|
|
|
|
// most recent fl_color() or fl_rgbcolor() points at one of these:
|
1999-02-17 01:00:04 +03:00
|
|
|
extern FL_EXPORT struct Fl_XMap {
|
1998-10-06 23:14:55 +04:00
|
|
|
COLORREF rgb; // this should be the type the RGB() macro returns
|
|
|
|
HPEN pen; // pen, 0 if none created yet
|
|
|
|
int brush; // ref to solid brush, 0 if none created yet
|
|
|
|
} *fl_current_xmap;
|
|
|
|
inline COLORREF fl_RGB() {return fl_current_xmap->rgb;}
|
|
|
|
inline HPEN fl_pen() {return fl_current_xmap->pen;}
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT HBRUSH fl_brush(); // allocates a brush if necessary
|
2005-09-13 03:03:34 +04:00
|
|
|
FL_EXPORT HBRUSH fl_brush_action(int); // now does the real work
|
1998-10-06 23:14:55 +04:00
|
|
|
|
1999-03-09 21:16:45 +03:00
|
|
|
extern FL_EXPORT HINSTANCE fl_display;
|
|
|
|
extern FL_EXPORT Window fl_window;
|
|
|
|
extern FL_EXPORT HDC fl_gc;
|
|
|
|
extern FL_EXPORT HPALETTE fl_palette; // non-zero only on 8-bit displays!
|
|
|
|
extern FL_EXPORT HDC fl_GetDC(Window);
|
|
|
|
extern FL_EXPORT MSG fl_msg;
|
2005-09-13 03:03:34 +04:00
|
|
|
extern FL_EXPORT void fl_release_dc(HWND w, HDC dc);
|
|
|
|
extern FL_EXPORT void fl_save_dc( HWND w, HDC dc);
|
1998-10-06 23:14:55 +04:00
|
|
|
|
|
|
|
// off-screen pixmaps: create, destroy, draw into, copy to window
|
2001-11-18 23:52:28 +03:00
|
|
|
typedef HBITMAP Fl_Offscreen;
|
1998-10-06 23:14:55 +04:00
|
|
|
#define fl_create_offscreen(w, h) CreateCompatibleBitmap(fl_gc, w, h)
|
|
|
|
|
1999-03-09 21:16:45 +03:00
|
|
|
extern FL_EXPORT HDC fl_makeDC(HBITMAP);
|
2005-09-15 11:41:17 +04:00
|
|
|
|
2008-09-25 22:26:33 +04:00
|
|
|
# define fl_begin_offscreen(b) \
|
|
|
|
HDC _sgc=fl_gc; Window _sw=fl_window; \
|
|
|
|
fl_gc=fl_makeDC(b); int _savedc = SaveDC(fl_gc); fl_window=(HWND)b; fl_push_no_clip()
|
1998-10-15 18:06:16 +04:00
|
|
|
|
2008-09-25 22:26:33 +04:00
|
|
|
# define fl_end_offscreen() \
|
|
|
|
fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); fl_window=_sw; fl_gc = _sgc
|
1998-10-15 18:06:16 +04:00
|
|
|
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
|
2006-09-16 20:02:00 +04:00
|
|
|
FL_EXPORT void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
|
1998-10-06 23:14:55 +04:00
|
|
|
#define fl_delete_offscreen(bitmap) DeleteObject(bitmap);
|
1998-10-20 01:39:29 +04:00
|
|
|
|
2001-11-18 23:52:28 +03:00
|
|
|
// Bitmap masks
|
|
|
|
typedef HBITMAP Fl_Bitmask;
|
|
|
|
|
|
|
|
extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
|
2002-04-15 16:19:01 +04:00
|
|
|
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
|
2001-11-18 23:52:28 +03:00
|
|
|
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
|
|
|
|
|
2003-06-01 04:31:32 +04:00
|
|
|
// Dummy function to register a function for opening files via the window manager...
|
|
|
|
inline void fl_open_callback(void (*)(const char *)) {}
|
|
|
|
|
2001-11-19 23:59:59 +03:00
|
|
|
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
2008-09-18 23:09:34 +04:00
|
|
|
#endif // FL_DOXYGEN
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// End of "$Id$".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|