00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef FL_DOXYGEN
00033 #ifndef Fl_X_H
00034 # error "Never use <FL/win32.H> directly; include <FL/x.H> instead."
00035 #endif // !Fl_X_H
00036
00037 #include <windows.h>
00038
00039 #ifndef LPMINMAXINFO
00040 #define LPMINMAXINFO MINMAXINFO*
00041 #endif
00042 #ifndef VK_LWIN
00043 #define VK_LWIN 0x5B
00044 #define VK_RWIN 0x5C
00045 #define VK_APPS 0x5D
00046 #endif
00047
00048 #include <FL/Fl_Device.H>
00049
00050
00051 typedef HWND Window;
00052 typedef POINT XPoint;
00053 struct XRectangle {int x, y, width, height;};
00054 typedef HRGN Fl_Region;
00055 FL_EXPORT void fl_clip_region(Fl_Region);
00056 extern Fl_Region XRectangleRegion(int x, int y, int w, int h);
00057 inline void XDestroyRegion(Fl_Region r) {DeleteObject(r);}
00058 inline void XClipBox(Fl_Region r,XRectangle* rect) {
00059 RECT win_rect; GetRgnBox(r,&win_rect);
00060 rect->x=win_rect.left;
00061 rect->y=win_rect.top;
00062 rect->width=win_rect.right-win_rect.left;
00063 rect->height=win_rect.bottom-win_rect.top;
00064 }
00065 #define XDestroyWindow(a,b) DestroyWindow(b)
00066 #define XMapWindow(a,b) ShowWindow(b, SW_RESTORE)
00067 #define XUnmapWindow(a,b) ShowWindow(b, SW_HIDE)
00068
00069 #include "Fl_Window.H"
00070
00071
00072 class FL_EXPORT Fl_X {
00073 public:
00074
00075 Window xid;
00076 HBITMAP other_xid;
00077 Fl_Window* w;
00078 Fl_Region region;
00079 Fl_X *next;
00080 int wait_for_expose;
00081 HDC private_dc;
00082 HCURSOR cursor;
00083 HDC saved_hdc;
00084
00085 static Fl_X* first;
00086 static Fl_X* i(const Fl_Window* w) {return w->i;}
00087 static int fake_X_wm(const Fl_Window* w,int &X, int &Y,
00088 int &bt,int &bx,int &by);
00089 void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
00090 void flush() {w->flush();}
00091 void set_minmax(LPMINMAXINFO minmax);
00092 void mapraise();
00093 static Fl_X* make(Fl_Window*);
00094 };
00095 extern FL_EXPORT HCURSOR fl_default_cursor;
00096 extern FL_EXPORT UINT fl_wake_msg;
00097 inline Window fl_xid(const Fl_Window*w) {Fl_X *temp = Fl_X::i(w); return temp ? temp->xid : 0;}
00098 FL_EXPORT Fl_Window* fl_find(Window xid);
00099 extern FL_EXPORT char fl_override_redirect;
00100 extern FL_EXPORT int fl_background_pixel;
00101
00102
00103 extern FL_EXPORT struct Fl_XMap {
00104 COLORREF rgb;
00105 HPEN pen;
00106 int brush;
00107 } *fl_current_xmap;
00108 inline COLORREF fl_RGB() {return fl_current_xmap->rgb;}
00109 inline HPEN fl_pen() {return fl_current_xmap->pen;}
00110 FL_EXPORT HBRUSH fl_brush();
00111 FL_EXPORT HBRUSH fl_brush_action(int);
00112
00113 extern FL_EXPORT HINSTANCE fl_display;
00114 extern FL_EXPORT Window fl_window;
00115 extern FL_EXPORT HDC fl_gc;
00116 extern FL_EXPORT HPALETTE fl_palette;
00117 extern FL_EXPORT HDC fl_GetDC(Window);
00118 extern FL_EXPORT MSG fl_msg;
00119 extern FL_EXPORT void fl_release_dc(HWND w, HDC dc);
00120 extern FL_EXPORT void fl_save_dc( HWND w, HDC dc);
00121
00122
00123 typedef HBITMAP Fl_Offscreen;
00124 #define fl_create_offscreen(w, h) \
00125 CreateCompatibleBitmap( (fl_gc ? fl_gc : fl_GetDC(0) ) , w, h)
00126
00127 extern FL_EXPORT HDC fl_makeDC(HBITMAP);
00128
00129 # define fl_begin_offscreen(b) \
00130 HDC _sgc=fl_gc; Window _sw=fl_window; \
00131 Fl_Surface_Device *_ss = fl_surface; fl_display_device->set_current(); \
00132 fl_gc=fl_makeDC(b); int _savedc = SaveDC(fl_gc); fl_window=(HWND)b; fl_push_no_clip()
00133
00134 # define fl_end_offscreen() \
00135 fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); _ss->set_current(); fl_window=_sw; fl_gc = _sgc
00136
00137
00138 FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
00139 FL_EXPORT void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
00140 #define fl_delete_offscreen(bitmap) DeleteObject(bitmap);
00141
00142
00143 typedef HBITMAP Fl_Bitmask;
00144
00145 extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
00146 extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
00147 extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
00148
00149
00150 inline void fl_open_callback(void (*)(const char *)) {}
00151
00152 extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
00153 #endif // FL_DOXYGEN
00154
00155
00156