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
|
||||||
#endif // CGFLOAT_DEFINED
|
#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
|
#endif // FL_LIBRARY || FL_INTERNALS
|
||||||
|
|
||||||
|
|
||||||
extern CGContextRef fl_gc;
|
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
|
#endif // FL_DOXYGEN
|
||||||
/** \file
|
/** \file
|
||||||
Mac OS X-specific symbols.
|
Mac OS X-specific symbols.
|
||||||
@ -134,11 +110,13 @@ extern void fl_open_display();
|
|||||||
\sa \ref osissues_macos
|
\sa \ref osissues_macos
|
||||||
@{ */
|
@{ */
|
||||||
|
|
||||||
|
#ifdef FL_DOXYGEN
|
||||||
/** @brief Register a function called for each file dropped onto an application icon.
|
/** @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.
|
\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.
|
If multiple files were dropped, \e cb will be called multiple times.
|
||||||
*/
|
*/
|
||||||
extern void fl_open_callback(void (*cb)(const char *));
|
extern void fl_open_callback(void (*cb)(const char *));
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Attaches a callback to the "About myprog" item of the system application menu.
|
* \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
|
#define VK_APPS 0x5D
|
||||||
#endif
|
#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 UINT fl_wake_msg;
|
||||||
extern FL_EXPORT char fl_override_redirect; // hack into Fl_Window::make_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()
|
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_release_dc(HWND w, HDC dc);
|
||||||
extern FL_EXPORT void fl_save_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
|
#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:
|
// most recent fl_color() or fl_rgbcolor() points at one of these:
|
||||||
extern FL_EXPORT struct Fl_XMap {
|
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
|
FL_EXPORT HBRUSH fl_brush_action(int); // now does the real work
|
||||||
|
|
||||||
extern FL_EXPORT HINSTANCE fl_display;
|
extern FL_EXPORT HINSTANCE fl_display;
|
||||||
extern FL_EXPORT Window fl_window;
|
|
||||||
extern FL_EXPORT HDC fl_gc;
|
extern FL_EXPORT HDC fl_gc;
|
||||||
extern FL_EXPORT MSG fl_msg;
|
extern FL_EXPORT MSG fl_msg;
|
||||||
extern FL_EXPORT HDC fl_GetDC(Window);
|
extern FL_EXPORT HDC fl_GetDC(Window);
|
||||||
extern FL_EXPORT HDC fl_makeDC(HBITMAP);
|
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
|
#endif // FL_DOXYGEN
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id$".
|
// End of "$Id$".
|
||||||
//
|
//
|
||||||
|
55
FL/x.H
55
FL/x.H
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
# ifdef WIN32
|
# ifdef WIN32
|
||||||
# include "win32.H"
|
# include "win32.H"
|
||||||
# elif defined(__APPLE__) // PORTME: Fl_Window_Driver - Fl_X Window Driver interface
|
# elif defined(__APPLE__)
|
||||||
# include "mac.H"
|
# include "mac.H"
|
||||||
# elif defined(USE_SDL)
|
# 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"
|
# 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"
|
# 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"
|
# include "porting.H"
|
||||||
# else // X11
|
# else // X11
|
||||||
|
# ifndef USE_X11
|
||||||
|
# define USE_X11 1
|
||||||
|
# endif
|
||||||
# if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
|
# if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
|
||||||
# pragma set woff 3322
|
# pragma set woff 3322
|
||||||
# endif
|
# endif
|
||||||
@ -49,9 +52,7 @@
|
|||||||
# include <X11/Xatom.h>
|
# include <X11/Xatom.h>
|
||||||
# include "Fl_Window.H"
|
# include "Fl_Window.H"
|
||||||
|
|
||||||
FL_EXPORT void fl_open_display();
|
|
||||||
FL_EXPORT void fl_open_display(Display*);
|
FL_EXPORT void fl_open_display(Display*);
|
||||||
FL_EXPORT void fl_close_display();
|
|
||||||
|
|
||||||
// constant info about the X server connection:
|
// constant info about the X server connection:
|
||||||
extern FL_EXPORT Display *fl_display;
|
extern FL_EXPORT Display *fl_display;
|
||||||
@ -62,7 +63,6 @@ extern FL_EXPORT Colormap fl_colormap;
|
|||||||
|
|
||||||
// drawing functions:
|
// drawing functions:
|
||||||
extern FL_EXPORT GC fl_gc;
|
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(Fl_Color i);
|
||||||
FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
|
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 const XEvent* fl_xevent;
|
||||||
extern FL_EXPORT ulong fl_event_time;
|
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)
|
#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
|
||||||
extern FL_EXPORT Window fl_message_window;
|
extern FL_EXPORT Window fl_message_window;
|
||||||
extern FL_EXPORT void *fl_xftfont;
|
extern FL_EXPORT void *fl_xftfont;
|
||||||
@ -107,43 +103,50 @@ private:
|
|||||||
};
|
};
|
||||||
extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
|
extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
|
||||||
|
|
||||||
// this object contains all X-specific stuff about a window:
|
extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid()
|
||||||
// Warning: this object is highly subject to change!
|
extern FL_EXPORT int fl_background_pixel; // hack into Fl_X::make_xid()
|
||||||
// FL_LIBRARY or FL_INTERNALS must be defined to access this class.
|
|
||||||
|
#endif // FL_LIBRARY || FL_INTERNALS
|
||||||
|
|
||||||
|
# endif // X11
|
||||||
|
|
||||||
|
//
|
||||||
|
// cross-platform declarations
|
||||||
|
//
|
||||||
|
#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
|
||||||
|
|
||||||
class FL_EXPORT Fl_X {
|
class FL_EXPORT Fl_X {
|
||||||
public:
|
public:
|
||||||
Window xid;
|
Window xid;
|
||||||
Fl_Window* w;
|
Fl_Window* w;
|
||||||
Fl_Region region;
|
Fl_Region region;
|
||||||
Fl_X *next;
|
Fl_X *next;
|
||||||
|
// static variables, static functions and member functions
|
||||||
static Fl_X* first;
|
static Fl_X* first;
|
||||||
static Fl_X* i(const Fl_Window* wi) {return wi->i;}
|
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 void make_xid(Fl_Window*, XVisualInfo* =fl_visual, Colormap=fl_colormap);
|
||||||
static Fl_X* set_xid(Fl_Window*, Window);
|
static Fl_X* set_xid(Fl_Window*, Window);
|
||||||
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
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; }
|
inline Window fl_xid(const Fl_Window* w) { Fl_X *xTemp = Fl_X::i(w); return xTemp ? xTemp->xid : 0; }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern FL_EXPORT Window fl_xid_(const Fl_Window* w);
|
extern FL_EXPORT Window fl_xid_(const Fl_Window* w);
|
||||||
# define fl_xid(w) fl_xid_(w)
|
# define fl_xid(w) fl_xid_(w)
|
||||||
|
|
||||||
#endif // FL_LIBRARY || FL_INTERNALS
|
#endif // FL_LIBRARY || FL_INTERNALS
|
||||||
|
|
||||||
FL_EXPORT Fl_Window* fl_find(Window xid);
|
extern FL_EXPORT Fl_Window* fl_find(Window xid);
|
||||||
|
extern FL_EXPORT void fl_open_display();
|
||||||
|
extern FL_EXPORT void fl_close_display();
|
||||||
// Dummy function to register a function for opening files via the window manager...
|
extern FL_EXPORT Window fl_window;
|
||||||
inline void fl_open_callback(void (*)(const char *)) {}
|
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 int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||||
|
extern FL_EXPORT void fl_open_callback(void (*)(const char *));
|
||||||
|
|
||||||
# endif
|
#endif // !Fl_X_H
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id$".
|
// End of "$Id$".
|
||||||
|
@ -1967,6 +1967,11 @@ void fl_close_display()
|
|||||||
Fl::screen_driver()->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$".
|
// End of "$Id$".
|
||||||
//
|
//
|
||||||
|
@ -4224,12 +4224,6 @@ CGImageRef Fl_Cocoa_Window_Driver::CGImage_from_window_rect(int x, int y, int w,
|
|||||||
return img;
|
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()
|
int Fl_Cocoa_Window_Driver::decorated_w()
|
||||||
{
|
{
|
||||||
if (!shown() || parent() || !border() || !visible())
|
if (!shown() || parent() || !border() || !visible())
|
||||||
|
@ -2381,11 +2381,6 @@ void fl_cleanup_dc_list(void) { // clean up the list
|
|||||||
} while(t);
|
} 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.
|
/* 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,
|
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.
|
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();
|
previous->Fl_Surface_Device::set_current();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FL_EXPORT void fl_open_callback(void (*)(const char *)) {}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PRINT_BUTTON
|
#ifdef USE_PRINT_BUTTON
|
||||||
// to test the Fl_Printer class creating a "Print front window" button in a separate window
|
// to test the Fl_Printer class creating a "Print front window" button in a separate window
|
||||||
// contains also preparePrintFront call above
|
// 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_EXPORT void fl_open_callback(void (*)(const char *)) {}
|
||||||
Fl_X *temp = Fl_X::i(w);
|
|
||||||
return temp ? temp->xid : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//#define USE_PRINT_BUTTON 1
|
//#define USE_PRINT_BUTTON 1
|
||||||
#ifdef USE_PRINT_BUTTON
|
#ifdef USE_PRINT_BUTTON
|
||||||
|
Loading…
Reference in New Issue
Block a user