From e7d805a88ca71a0e6499fe72830e58fe594ef05b Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 6 Oct 1998 18:46:47 +0000 Subject: Commited Gustavo Hime's NT patches/fixes. git-svn-id: file:///fltk/svn/fltk/trunk@7 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Window.H | 181 +++++++++++++++++++++++++++++---------------------------- FL/win32.H | 169 ++++++++++++++++++++++++++++------------------------- 2 files changed, 180 insertions(+), 170 deletions(-) (limited to 'FL') diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H index b365f67cf..4447cc8f7 100644 --- a/FL/Fl_Window.H +++ b/FL/Fl_Window.H @@ -1,90 +1,91 @@ -// Fl_Window.H - -// fltk (Fast Light Tool Kit) version 0.99 -// Copyright (C) 1998 Bill Spitzak - -#ifndef Fl_Window_H -#define Fl_Window_H - -#include "Fl_Group.H" - -#define FL_WINDOW 0xF0 // all subclasses have type() >= this - -class Fl_Window : public Fl_Group { - - friend class Fl_X; Fl_X *i; // points at the system-specific stuff - - const char* iconlabel_; - const char* xclass_; - // size_range stuff: - short minw, minh, maxw, maxh; - uchar dw, dh, aspect, size_range_set; - void size_range_(); - // values for flags(): - enum { - FL_MODAL = 64, - FL_NOBORDER = 8, - FL_FORCE_POSITION = 16, - FL_NON_MODAL = 32 - }; - static Fl_Window *current_; - void _Fl_Window(); // constructor innards - -protected: - - virtual void draw(); - virtual void flush(); - -public: - - Fl_Window(int,int,int,int, const char* = 0); - Fl_Window(int,int, const char* = 0); - virtual ~Fl_Window(); - - virtual int handle(int); - - virtual void resize(int,int,int,int); - void border(int b); - void clear_border() {set_flag(FL_NOBORDER);} - int border() const {return !(flags() & FL_NOBORDER);} - void set_modal() {set_flag(FL_MODAL);} - uchar modal() const {return flags() & FL_MODAL;} - void set_non_modal() {set_flag(FL_NON_MODAL);} - uchar non_modal() const {return flags() & (FL_NON_MODAL|FL_MODAL);} - - void hotspot(int x, int y, int offscreen = 0); - void hotspot(const Fl_Widget*, int offscreen = 0); - void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);} - void free_position() {clear_flag(FL_FORCE_POSITION);} - void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) { - minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();} - - const char* label() const {return Fl_Widget::label();} - const char* iconlabel() const {return iconlabel_;} - void label(const char*); - void iconlabel(const char*); - void label(const char* label, const char* iconlabel); - const char* xclass() const {return xclass_;} - void xclass(const char* c) {xclass_ = c;} - - int shown() {return i != 0;} - virtual void show(); - virtual void hide(); - void show(int, char**); - void fullscreen(); - void fullscreen_off(int,int,int,int); - void iconize(); - - int x_root() const ; - int y_root() const ; - - static Fl_Window *current() {return current_;} - void make_current(); - - // for back-compatability only: - void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); - static void default_callback(Fl_Window*, void* v); - -}; - -#endif +// Fl_Window.H + +// fltk (Fast Light Tool Kit) version 0.99 +// Copyright (C) 1998 Bill Spitzak + +#ifndef Fl_Window_H +#define Fl_Window_H + +#include "Fl_Group.H" + +#define FL_WINDOW 0xF0 // all subclasses have type() >= this + +class Fl_Window : public Fl_Group { + + friend class Fl_X; Fl_X *i; // points at the system-specific stuff + + const char* iconlabel_; + const char* xclass_; + // size_range stuff: + short minw, minh, maxw, maxh; + uchar dw, dh, aspect, size_range_set; + void size_range_(); + // values for flags(): + enum { + FL_MODAL = 64, + FL_NOBORDER = 8, + FL_FORCE_POSITION = 16, + FL_NON_MODAL = 32 + }; + static Fl_Window *current_; + void _Fl_Window(); // constructor innards + +protected: + + virtual void draw(); + virtual void flush(); + +public: + + Fl_Window(int,int,int,int, const char* = 0); + Fl_Window(int,int, const char* = 0); + virtual ~Fl_Window(); + + virtual int handle(int); + + virtual void resize(int,int,int,int); + void border(int b); + void clear_border() {set_flag(FL_NOBORDER);} + int border() const {return !(flags() & FL_NOBORDER);} + void set_modal() {set_flag(FL_MODAL);} + uchar modal() const {return flags() & FL_MODAL;} + void set_non_modal() {set_flag(FL_NON_MODAL);} + uchar non_modal() const {return flags() & (FL_NON_MODAL|FL_MODAL);} + + void hotspot(int x, int y, int offscreen = 0); + void hotspot(const Fl_Widget*, int offscreen = 0); + void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);} + void free_position() {clear_flag(FL_FORCE_POSITION);} + void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) { + minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();} + + const char* label() const {return Fl_Widget::label();} + const char* iconlabel() const {return iconlabel_;} + void label(const char*); + void iconlabel(const char*); + void label(const char* label, const char* iconlabel); + const char* xclass() const {return xclass_;} + void xclass(const char* c) {xclass_ = c;} + + int shown() {return i != 0;} + virtual void show(); + virtual void hide(); + void show(int, char**); + void fullscreen(); + void fullscreen_off(int,int,int,int); + void iconize(); + void expose(uchar flags,int X,int Y,int W,int H); + + int x_root() const ; + int y_root() const ; + + static Fl_Window *current() {return current_;} + void make_current(); + + // for back-compatability only: + void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); + static void default_callback(Fl_Window*, void* v); + +}; + +#endif diff --git a/FL/win32.H b/FL/win32.H index 1572c9e73..be57ff8a1 100644 --- a/FL/win32.H +++ b/FL/win32.H @@ -1,80 +1,89 @@ -// win32.H - -// Do not directly include this file, instead use . It will -// include this file if WIN32 is defined. This is to encourage -// portability of even the system-specific code... - -#include -#ifndef LPMINMAXINFO -// the gcc header files are missing some stuff: -#define LPMINMAXINFO MINMAXINFO* -#define VK_LWIN 0x5B -#define VK_RWIN 0x5C -#define VK_APPS 0x5D -#endif - -// some random X equivalents -#define Window HWND -#define XPoint POINT -struct XRectangle {int x, y, width, height;}; -struct Region {int x, y, r, b; void operator=(int x) {r = x;}}; -inline void XClipBox(Region& i, XRectangle* o) { - o->x = i.x; o->y = i.y; o->width = i.r-i.x; o->height = i.b-i.y;} -#define fl_clip_region(R) fl_clip((R).x,(R).y,(R).r-(R).x,(R).b-(R).y) -#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! -class Fl_X { -public: - Window xid; - HBITMAP other_xid; // for double-buffered windows - Fl_Window* w; - Region region; - Fl_X *next; - HDC private_dc; // used for OpenGL - HCURSOR cursor; - static Fl_X* first; - static Fl_X* i(const Fl_Window* w) {return w->i;} - 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*); -}; -extern HCURSOR fl_default_cursor; -inline Window fl_xid(const Fl_Window*w) {return Fl_X::i(w)->xid;} -Fl_Window* fl_find(Window xid); -extern char fl_override_redirect; // hack into Fl_Window::make_xid() -extern int fl_background_pixel; // hack into Fl_Window::make_xid() - -// most recent fl_color() or fl_rgbcolor() points at one of these: -extern struct Fl_XMap { - 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;} -HBRUSH fl_brush(); // allocates a brush if necessary - -extern HINSTANCE fl_display; -extern Window fl_window; -extern HDC fl_gc; -extern HPALETTE fl_palette; // non-zero only on 8-bit displays! -extern HDC fl_DC(Window); -extern MSG fl_msg; - -// off-screen pixmaps: create, destroy, draw into, copy to window -#define Fl_Offscreen HBITMAP -#define fl_create_offscreen(w, h) CreateCompatibleBitmap(fl_gc, w, h) -extern void fl_switch_offscreen(HBITMAP); -#define fl_begin_offscreen(b) HDC _sw=fl_gc; fl_switch_offscreen(b) -#define fl_end_offscreen() fl_gc = _sw -void fl_make_current(HBITMAP bitmap); -void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy); -#define fl_delete_offscreen(bitmap) DeleteObject(bitmap); - +// win32.H + +// Do not directly include this file, instead use . It will +// include this file if WIN32 is defined. This is to encourage +// portability of even the system-specific code... + +#include +#ifndef LPMINMAXINFO +// the gcc header files are missing some stuff: +#define LPMINMAXINFO MINMAXINFO* +#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;}; +typedef HRGN Region; +void fl_clip_region(Region); +inline Region XRectangleRegion(int x, int y, int w, int h) { + return CreateRectRgn(x,y,x+w,y+h); +} +inline void XDestroyRegion(Region r) {DeleteObject(r);} + +#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! +class Fl_X { +public: + Window xid; + HBITMAP other_xid; // for double-buffered windows + Fl_Window* w; + Region region; + Fl_X *next; + HDC private_dc; // used for OpenGL + HCURSOR cursor; + static Fl_X* first; + static Fl_X* i(const Fl_Window* w) {return w->i;} + 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*); +}; +extern HCURSOR fl_default_cursor; +inline Window fl_xid(const Fl_Window*w) {return Fl_X::i(w)->xid;} +Fl_Window* fl_find(Window xid); +extern char fl_override_redirect; // hack into Fl_Window::make_xid() +extern int fl_background_pixel; // hack into Fl_Window::make_xid() + +// most recent fl_color() or fl_rgbcolor() points at one of these: +extern struct Fl_XMap { + 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;} +HBRUSH fl_brush(); // allocates a brush if necessary + +extern HINSTANCE fl_display; +extern Window fl_window; +extern HDC fl_gc; +extern HDC window_dc; // for double-buffered windows +extern HPALETTE fl_palette; // non-zero only on 8-bit displays! +extern HDC fl_GetDC(Window); +extern MSG fl_msg; + +// off-screen pixmaps: create, destroy, draw into, copy to window +#define Fl_Offscreen HBITMAP +#define fl_create_offscreen(w, h) CreateCompatibleBitmap(fl_gc, w, h) +extern void fl_switch_offscreen(HBITMAP); + +inline void fl_begin_offscreen(HBITMAP b) { + window_dc = fl_gc; fl_switch_offscreen(b); +} +inline void fl_end_offscreen() { + fl_gc = window_dc; +} +void fl_make_current(HBITMAP bitmap); +void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy); +#define fl_delete_offscreen(bitmap) DeleteObject(bitmap); + -- cgit v1.2.3