Have headers x.H, win32.H and mac.H share a unique definition of class Fl_X
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11667 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
8a910fe8fb
commit
cd4498021e
26
FL/mac.H
26
FL/mac.H
@ -95,35 +95,11 @@ typedef float CGFloat;
|
||||
#endif
|
||||
#endif // CGFLOAT_DEFINED
|
||||
|
||||
// This object contains all mac-specific stuff about a window:
|
||||
// WARNING: this object is highly subject to change!
|
||||
class Fl_X {
|
||||
public:
|
||||
Window xid; // pointer to the Cocoa window object (FLWindow*)
|
||||
Fl_Window *w; // FLTK window for
|
||||
Fl_Region region;
|
||||
Fl_X *next; // chain of mapped windows
|
||||
static Fl_X* first;
|
||||
static Fl_X* i(const Fl_Window* w) {return (Fl_X*)w->i;}
|
||||
};
|
||||
|
||||
extern Window fl_window;
|
||||
|
||||
#endif // FL_LIBRARY || FL_INTERNALS
|
||||
|
||||
|
||||
extern CGContextRef fl_gc;
|
||||
|
||||
extern Window fl_xid(const Fl_Window*);
|
||||
extern Fl_Window* fl_find(Window xid);
|
||||
|
||||
extern Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
|
||||
extern Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
|
||||
extern void fl_delete_bitmask(Fl_Bitmask bm);
|
||||
|
||||
extern int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||
extern void fl_open_display();
|
||||
|
||||
#endif // FL_DOXYGEN
|
||||
/** \file
|
||||
Mac OS X-specific symbols.
|
||||
@ -134,11 +110,13 @@ extern void fl_open_display();
|
||||
\sa \ref osissues_macos
|
||||
@{ */
|
||||
|
||||
#ifdef FL_DOXYGEN
|
||||
/** @brief Register a function called for each file dropped onto an application icon.
|
||||
\e cb will be called with a single Unix-style file name and path.
|
||||
If multiple files were dropped, \e cb will be called multiple times.
|
||||
*/
|
||||
extern void fl_open_callback(void (*cb)(const char *));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Attaches a callback to the "About myprog" item of the system application menu.
|
||||
|
48
FL/win32.H
48
FL/win32.H
@ -44,19 +44,6 @@ typedef HWND Window;
|
||||
#define VK_APPS 0x5D
|
||||
#endif
|
||||
|
||||
// this object contains all win32-specific stuff about a window:
|
||||
// Warning: this object is highly subject to change!
|
||||
class FL_EXPORT Fl_X {
|
||||
public:
|
||||
// member variables - add new variables only at the end of this block
|
||||
Window xid;
|
||||
Fl_Window* w;
|
||||
Fl_Region region;
|
||||
Fl_X *next;
|
||||
// static variables, static functions and member functions
|
||||
static Fl_X* first;
|
||||
static Fl_X* i(const Fl_Window* w) {return (Fl_X*)w->i;}
|
||||
};
|
||||
extern FL_EXPORT UINT fl_wake_msg;
|
||||
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()
|
||||
@ -64,16 +51,8 @@ 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);
|
||||
|
||||
inline Window fl_xid(const Fl_Window* w) { Fl_X *temp = Fl_X::i(w); return temp ? temp->xid : 0; }
|
||||
|
||||
extern FL_EXPORT void fl_open_display();
|
||||
|
||||
#else
|
||||
FL_EXPORT Window fl_xid_(const Fl_Window* w);
|
||||
#define fl_xid(w) fl_xid_(w)
|
||||
#endif // FL_LIBRARY || FL_INTERNALS
|
||||
|
||||
FL_EXPORT Fl_Window* fl_find(Window xid);
|
||||
|
||||
// most recent fl_color() or fl_rgbcolor() points at one of these:
|
||||
extern FL_EXPORT struct Fl_XMap {
|
||||
@ -87,38 +66,13 @@ FL_EXPORT HBRUSH fl_brush(); // allocates a brush if necessary
|
||||
FL_EXPORT HBRUSH fl_brush_action(int); // now does the real work
|
||||
|
||||
extern FL_EXPORT HINSTANCE fl_display;
|
||||
extern FL_EXPORT Window fl_window;
|
||||
extern FL_EXPORT HDC fl_gc;
|
||||
extern FL_EXPORT MSG fl_msg;
|
||||
extern FL_EXPORT HDC fl_GetDC(Window);
|
||||
extern FL_EXPORT HDC fl_makeDC(HBITMAP);
|
||||
|
||||
/*#define fl_create_offscreen(w, h) \
|
||||
CreateCompatibleBitmap( (fl_graphics_driver->gc() ? (HDC)fl_graphics_driver->gc() : fl_GetDC(0) ) , w, h)
|
||||
|
||||
# define fl_begin_offscreen(b) \
|
||||
void* _sgc=fl_graphics_driver->gc(); Window _sw=fl_window; \
|
||||
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(); \
|
||||
fl_graphics_driver->gc(_tmp_gc); fl_window=(HWND)b; fl_push_no_clip()
|
||||
|
||||
# define fl_end_offscreen() \
|
||||
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);
|
||||
|
||||
#define fl_delete_offscreen(bitmap) DeleteObject(bitmap)*/
|
||||
|
||||
// Bitmap masks
|
||||
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
|
||||
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
|
||||
|
||||
// Dummy function to register a function for opening files via the window manager...
|
||||
inline void fl_open_callback(void (*)(const char *)) {}
|
||||
|
||||
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||
#endif // FL_DOXYGEN
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
77
FL/x.H
77
FL/x.H
@ -29,7 +29,7 @@
|
||||
|
||||
# ifdef WIN32
|
||||
# include "win32.H"
|
||||
# elif defined(__APPLE__) // PORTME: Fl_Window_Driver - Fl_X Window Driver interface
|
||||
# elif defined(__APPLE__)
|
||||
# include "mac.H"
|
||||
# elif defined(USE_SDL)
|
||||
# pragma message "FL_PORTING: write a header file based on this file, win32.H, or mac.H to define the FLTK core internals"
|
||||
@ -38,6 +38,9 @@
|
||||
# pragma message "FL_PORTING: write a header file based on this file, win32.H, or mac.H to define the FLTK core internals"
|
||||
# include "porting.H"
|
||||
# else // X11
|
||||
# ifndef USE_X11
|
||||
# define USE_X11 1
|
||||
# endif
|
||||
# if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
|
||||
# pragma set woff 3322
|
||||
# endif
|
||||
@ -49,9 +52,7 @@
|
||||
# include <X11/Xatom.h>
|
||||
# include "Fl_Window.H"
|
||||
|
||||
FL_EXPORT void fl_open_display();
|
||||
FL_EXPORT void fl_open_display(Display*);
|
||||
FL_EXPORT void fl_close_display();
|
||||
|
||||
// constant info about the X server connection:
|
||||
extern FL_EXPORT Display *fl_display;
|
||||
@ -62,7 +63,6 @@ extern FL_EXPORT Colormap fl_colormap;
|
||||
|
||||
// drawing functions:
|
||||
extern FL_EXPORT GC fl_gc;
|
||||
extern FL_EXPORT Window fl_window;
|
||||
FL_EXPORT ulong fl_xpixel(Fl_Color i);
|
||||
FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
|
||||
|
||||
@ -73,10 +73,6 @@ FL_EXPORT int fl_handle(const XEvent&);
|
||||
extern FL_EXPORT const XEvent* fl_xevent;
|
||||
extern FL_EXPORT ulong fl_event_time;
|
||||
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
|
||||
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
|
||||
|
||||
#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
|
||||
extern FL_EXPORT Window fl_message_window;
|
||||
extern FL_EXPORT void *fl_xftfont;
|
||||
@ -107,43 +103,50 @@ private:
|
||||
};
|
||||
extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
|
||||
|
||||
// this object contains all X-specific stuff about a window:
|
||||
// Warning: this object is highly subject to change!
|
||||
// FL_LIBRARY or FL_INTERNALS must be defined to access this class.
|
||||
class FL_EXPORT Fl_X {
|
||||
public:
|
||||
Window xid;
|
||||
Fl_Window *w;
|
||||
Fl_Region region;
|
||||
Fl_X *next;
|
||||
static Fl_X* first;
|
||||
static Fl_X* i(const Fl_Window* wi) {return wi->i;}
|
||||
static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
|
||||
static Fl_X* set_xid(Fl_Window*, Window);
|
||||
};
|
||||
|
||||
extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid()
|
||||
extern FL_EXPORT int fl_background_pixel; // hack into Fl_X::make_xid()
|
||||
|
||||
inline Window fl_xid(const Fl_Window* w) { Fl_X *xTemp = Fl_X::i(w); return xTemp ? xTemp->xid : 0; }
|
||||
|
||||
#else
|
||||
|
||||
extern FL_EXPORT Window fl_xid_(const Fl_Window* w);
|
||||
#define fl_xid(w) fl_xid_(w)
|
||||
|
||||
#endif // FL_LIBRARY || FL_INTERNALS
|
||||
|
||||
FL_EXPORT Fl_Window* fl_find(Window xid);
|
||||
# endif // X11
|
||||
|
||||
//
|
||||
// cross-platform declarations
|
||||
//
|
||||
#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
|
||||
|
||||
// Dummy function to register a function for opening files via the window manager...
|
||||
inline void fl_open_callback(void (*)(const char *)) {}
|
||||
|
||||
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||
|
||||
class FL_EXPORT Fl_X {
|
||||
public:
|
||||
Window xid;
|
||||
Fl_Window* w;
|
||||
Fl_Region region;
|
||||
Fl_X *next;
|
||||
// static variables, static functions and member functions
|
||||
static Fl_X* first;
|
||||
static Fl_X* i(const Fl_Window* w) {return (Fl_X*)w->i;}
|
||||
# if USE_X11 // for backward compatibility
|
||||
static void make_xid(Fl_Window*, XVisualInfo* =fl_visual, Colormap=fl_colormap);
|
||||
static Fl_X* set_xid(Fl_Window*, Window);
|
||||
# endif
|
||||
#endif
|
||||
};
|
||||
|
||||
inline Window fl_xid(const Fl_Window* w) { Fl_X *xTemp = Fl_X::i(w); return xTemp ? xTemp->xid : 0; }
|
||||
#else
|
||||
extern FL_EXPORT Window fl_xid_(const Fl_Window* w);
|
||||
# define fl_xid(w) fl_xid_(w)
|
||||
#endif // FL_LIBRARY || FL_INTERNALS
|
||||
|
||||
extern FL_EXPORT Fl_Window* fl_find(Window xid);
|
||||
extern FL_EXPORT void fl_open_display();
|
||||
extern FL_EXPORT void fl_close_display();
|
||||
extern FL_EXPORT Window fl_window;
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
|
||||
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
|
||||
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||
extern FL_EXPORT void fl_open_callback(void (*)(const char *));
|
||||
|
||||
#endif // !Fl_X_H
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
|
@ -1967,6 +1967,11 @@ void fl_close_display()
|
||||
Fl::screen_driver()->close_display();
|
||||
}
|
||||
|
||||
FL_EXPORT Window fl_xid_(const Fl_Window *w) {
|
||||
Fl_X *temp = Fl_X::i(w);
|
||||
return temp ? temp->xid : 0;
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
@ -4224,12 +4224,6 @@ CGImageRef Fl_Cocoa_Window_Driver::CGImage_from_window_rect(int x, int y, int w,
|
||||
return img;
|
||||
}
|
||||
|
||||
Window fl_xid(const Fl_Window* w)
|
||||
{
|
||||
Fl_X *temp = Fl_X::i(w);
|
||||
return temp ? temp->xid : 0;
|
||||
}
|
||||
|
||||
int Fl_Cocoa_Window_Driver::decorated_w()
|
||||
{
|
||||
if (!shown() || parent() || !border() || !visible())
|
||||
|
@ -2381,11 +2381,6 @@ void fl_cleanup_dc_list(void) { // clean up the list
|
||||
} while(t);
|
||||
}
|
||||
|
||||
FL_EXPORT Window fl_xid_(const Fl_Window *w) {
|
||||
Fl_X *temp = Fl_X::i(w);
|
||||
return temp ? temp->xid : 0;
|
||||
}
|
||||
|
||||
/* Returns images of the captures of the window title-bar, and the left, bottom and right window borders.
|
||||
This function exploits a feature of Fl_WinAPI_Screen_Driver::read_win_rectangle() which,
|
||||
when fl_gc is set to the screen device context, captures the window decoration.
|
||||
@ -2434,6 +2429,10 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top
|
||||
previous->Fl_Surface_Device::set_current();
|
||||
}
|
||||
|
||||
|
||||
FL_EXPORT void fl_open_callback(void (*)(const char *)) {}
|
||||
|
||||
|
||||
#ifdef USE_PRINT_BUTTON
|
||||
// to test the Fl_Printer class creating a "Print front window" button in a separate window
|
||||
// contains also preparePrintFront call above
|
||||
|
@ -2831,10 +2831,8 @@ void Fl_X11_Window_Driver::show() {
|
||||
}
|
||||
|
||||
|
||||
FL_EXPORT Window fl_xid_(const Fl_Window *w) {
|
||||
Fl_X *temp = Fl_X::i(w);
|
||||
return temp ? temp->xid : 0;
|
||||
}
|
||||
FL_EXPORT void fl_open_callback(void (*)(const char *)) {}
|
||||
|
||||
|
||||
//#define USE_PRINT_BUTTON 1
|
||||
#ifdef USE_PRINT_BUTTON
|
||||
|
Loading…
Reference in New Issue
Block a user