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).
|
|
|
|
//
|
2016-02-18 19:21:51 +03:00
|
|
|
// Copyright 1998-2016 by Bill Spitzak and others.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/COPYING.php
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
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>
|
2011-01-18 02:52:32 +03:00
|
|
|
typedef HRGN Fl_Region;
|
|
|
|
typedef HWND Window;
|
2011-02-05 02:32:53 +03:00
|
|
|
typedef POINT XPoint;
|
2011-01-18 02:52:32 +03:00
|
|
|
|
2016-02-20 00:41:02 +03:00
|
|
|
#include <FL/Fl_Device.H>
|
2011-02-05 19:55:04 +03:00
|
|
|
#include <FL/Fl_Window.H>
|
|
|
|
|
2011-01-18 02:52:32 +03:00
|
|
|
// this part is included only when compiling the FLTK library or if requested explicitly
|
|
|
|
#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
|
|
|
|
|
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
|
|
|
|
struct XRectangle {int x, y, width, height;};
|
2010-03-14 21:07:24 +03:00
|
|
|
extern Fl_Region XRectangleRegion(int x, int y, int w, int 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)
|
|
|
|
|
|
|
|
// this object contains all win32-specific stuff about a window:
|
|
|
|
// Warning: this object is highly subject to change!
|
2016-02-25 20:56:48 +03:00
|
|
|
class FL_EXPORT Fl_X {
|
1998-10-06 23:14:55 +04:00
|
|
|
public:
|
2016-02-25 20:56:48 +03:00
|
|
|
virtual ~Fl_X() {} // very important
|
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;
|
2014-06-16 15:17:57 +04:00
|
|
|
int custom_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;
|
2016-02-20 01:46:00 +03:00
|
|
|
static Fl_X* i(const Fl_Window* w) {return (Fl_X*)w->i;}
|
2002-08-14 20:49:38 +04:00
|
|
|
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);
|
2014-06-11 13:10:53 +04:00
|
|
|
void make_fullscreen(int X, int Y, int W, int H);
|
2016-02-20 01:46:00 +03:00
|
|
|
void setwindow(Fl_Window* wi) {w=wi; wi->i=(Fl_Window_Driver*)this;}
|
2002-08-14 20:49:38 +04:00
|
|
|
void flush() {w->flush();}
|
|
|
|
void set_minmax(LPMINMAXINFO minmax);
|
|
|
|
void mapraise();
|
2014-06-16 15:39:32 +04:00
|
|
|
static void set_default_icons(const Fl_RGB_Image*[], int);
|
|
|
|
static void set_default_icons(HICON, HICON);
|
|
|
|
void set_icons();
|
2014-06-16 15:17:57 +04:00
|
|
|
int set_cursor(Fl_Cursor);
|
|
|
|
int set_cursor(const Fl_RGB_Image*, int, int);
|
2002-08-14 20:49:38 +04:00
|
|
|
static Fl_X* make(Fl_Window*);
|
1998-10-06 23:14:55 +04:00
|
|
|
};
|
2002-07-02 00:14:08 +04:00
|
|
|
extern FL_EXPORT UINT fl_wake_msg;
|
1999-02-17 01:00:04 +03:00
|
|
|
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()
|
2011-01-18 02:52:32 +03:00
|
|
|
extern FL_EXPORT HPALETTE fl_palette; // non-zero only on 8-bit displays!
|
|
|
|
extern FL_EXPORT void fl_release_dc(HWND w, HDC dc);
|
|
|
|
extern FL_EXPORT void fl_save_dc( HWND w, HDC dc);
|
|
|
|
|
2011-01-20 16:22:30 +03:00
|
|
|
inline Window fl_xid(const Fl_Window* w) { Fl_X *temp = Fl_X::i(w); return temp ? temp->xid : 0; }
|
|
|
|
|
2014-09-15 13:35:05 +04:00
|
|
|
extern FL_EXPORT void fl_open_display();
|
|
|
|
|
2011-01-20 16:22:30 +03:00
|
|
|
#else
|
|
|
|
FL_EXPORT Window fl_xid_(const Fl_Window* w);
|
|
|
|
#define fl_xid(w) fl_xid_(w)
|
2011-01-18 02:52:32 +03:00
|
|
|
#endif // FL_LIBRARY || FL_INTERNALS
|
|
|
|
|
|
|
|
FL_EXPORT Fl_Window* fl_find(Window xid);
|
2011-05-23 22:32:47 +04:00
|
|
|
void fl_clip_region(Fl_Region);
|
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 MSG fl_msg;
|
2011-01-18 02:52:32 +03:00
|
|
|
extern FL_EXPORT HDC fl_GetDC(Window);
|
|
|
|
extern FL_EXPORT HDC fl_makeDC(HBITMAP);
|
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;
|
2010-07-09 21:31:33 +04:00
|
|
|
#define fl_create_offscreen(w, h) \
|
2016-02-19 15:40:24 +03:00
|
|
|
CreateCompatibleBitmap( (fl_graphics_driver->gc() ? (HDC)fl_graphics_driver->gc() : fl_GetDC(0) ) , w, h)
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2008-09-25 22:26:33 +04:00
|
|
|
# define fl_begin_offscreen(b) \
|
2016-02-19 15:40:24 +03:00
|
|
|
void* _sgc=fl_graphics_driver->gc(); Window _sw=fl_window; \
|
2016-02-18 19:21:51 +03:00
|
|
|
Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); \
|
|
|
|
HDC _tmp_gc = fl_makeDC(b); int _savedc = SaveDC(_tmp_gc); \
|
|
|
|
Fl_Display_Device::display_device()->set_current(); \
|
2016-02-19 15:40:24 +03:00
|
|
|
fl_graphics_driver->gc(_tmp_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() \
|
2016-02-19 15:40:24 +03:00
|
|
|
fl_pop_clip(); RestoreDC((HDC)fl_graphics_driver->gc(), _savedc); DeleteDC((HDC)fl_graphics_driver->gc()); _ss->set_current(); fl_window=_sw; fl_graphics_driver->gc(_sgc);
|
2011-01-18 02:52:32 +03:00
|
|
|
|
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);
|
2011-01-18 02:52:32 +03: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
|
|
|
//
|