diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2016-01-04 23:09:32 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2016-01-04 23:09:32 +0000 |
| commit | b1520373aebb3f16e1aad19d253c1ec12439664c (patch) | |
| tree | fc48095864b484ab563a34f65040d00a8a3a9c54 /FL | |
| parent | eb1abad3ca43963f7826f067e70bc3a20db352da (diff) | |
Created pseudo code for all FL_PORTED section so that FLTK compiles and links (Xcode, hello, other C flags: -D FL_PORTING -U __APPLE__ -U __APPLE_QUARTZ__)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@10993 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl.H | 5 | ||||
| -rw-r--r-- | FL/Fl_Device.H | 2 | ||||
| -rw-r--r-- | FL/Fl_Image.H | 2 | ||||
| -rw-r--r-- | FL/Fl_Menu_Item.H | 2 | ||||
| -rw-r--r-- | FL/Fl_Pixmap.H | 2 | ||||
| -rw-r--r-- | FL/Fl_Printer.H | 6 | ||||
| -rw-r--r-- | FL/filename.H | 2 | ||||
| -rw-r--r-- | FL/porting.H | 165 | ||||
| -rw-r--r-- | FL/x.H | 1 |
9 files changed, 185 insertions, 2 deletions
@@ -37,6 +37,10 @@ # undef check # endif +# ifdef BSD +# undef BSD +# endif + class Fl_Widget; class Fl_Window; @@ -55,6 +59,7 @@ struct Fl_Label; #elif defined(FL_PORTING) # pragma message "FL_PORTING: define a type for FL_SOCKET" # define FL_SOCKET int // default if not ported +# undef check #else # define FL_SOCKET int #endif diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H index 97266c391..aa34199c0 100644 --- a/FL/Fl_Device.H +++ b/FL/Fl_Device.H @@ -528,6 +528,8 @@ public: #elif defined(FL_PORTING) # pragma message "FL_PORTING: define a native graphics driver Fl_xxx_Graphics_Driver" +class FL_EXPORT Fl_XXX_Graphics_Driver : public Fl_Graphics_Driver { +}; #else // X11 diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H index 0396e6b48..6c44c94aa 100644 --- a/FL/Fl_Image.H +++ b/FL/Fl_Image.H @@ -210,6 +210,8 @@ public: void *mask_; // for internal use (mask bitmap) #elif defined(FL_PORTING) # pragma message "FL_PORTING: define variables to hold an RGB image and a mask for Fl_RGB_Image" + unsigned id_; // don't use + unsigned mask_; // don't use #else unsigned id_; // for internal use unsigned mask_; // for internal use (mask bitmap) diff --git a/FL/Fl_Menu_Item.H b/FL/Fl_Menu_Item.H index 8167149ea..3c2b5ebcf 100644 --- a/FL/Fl_Menu_Item.H +++ b/FL/Fl_Menu_Item.H @@ -22,7 +22,7 @@ # include "Fl_Widget.H" # include "Fl_Image.H" -# if defined(__APPLE__) && defined(check) +# if (defined(__APPLE__) || defined(FL_PORTING)) && defined(check) # undef check # endif diff --git a/FL/Fl_Pixmap.H b/FL/Fl_Pixmap.H index 4be6ee28c..06b28f8dd 100644 --- a/FL/Fl_Pixmap.H +++ b/FL/Fl_Pixmap.H @@ -71,6 +71,8 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image { void *mask_; // for internal use (mask bitmap) #elif defined(FL_PORTING) # pragma message "FL_PORTING: define member variables to store an RGB image and a mask for Fl_Pixmap" + void *id_; // don't use + void *mask_; // don't use #else unsigned id_; // for internal use unsigned mask_; // for internal use (mask bitmap) diff --git a/FL/Fl_Printer.H b/FL/Fl_Printer.H index ffea61dc1..d133ea7f5 100644 --- a/FL/Fl_Printer.H +++ b/FL/Fl_Printer.H @@ -98,6 +98,11 @@ public: #elif defined(FL_PORTING) # pragma message "FL_PORTING: define your own Fl_xxx_Printer class" +class Fl_XXX_Printer : public Fl_Paged_Device { + friend class Fl_Printer; +protected: + Fl_XXX_Printer(void) { } +}; #else @@ -233,6 +238,7 @@ private: Fl_System_Printer *printer; #elif defined(FL_PORTING) # pragma message "FL_PORTING: instantiate your own Fl_xxx_Printer here" + Fl_XXX_Printer *printer; #else Fl_PostScript_Printer *printer; #endif diff --git a/FL/filename.H b/FL/filename.H index 1d3ca6249..acc8056ed 100644 --- a/FL/filename.H +++ b/FL/filename.H @@ -83,7 +83,7 @@ struct dirent {char d_name[1];}; # elif defined(FL_PORTING) # pragma message "FL_PORTING: insert the equivalent to dirent.h on your system" - struct dirent {char d_name[1];}; // default if not ported +# include <dirent.h> # else /* * WARNING: on some systems (very few nowadays?) <dirent.h> may not exist. diff --git a/FL/porting.H b/FL/porting.H new file mode 100644 index 000000000..34ad95826 --- /dev/null +++ b/FL/porting.H @@ -0,0 +1,165 @@ +// +// "$Id$" +// +// Mac header file for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2015 by Bill Spitzak and others. +// +// 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 +// +// Please report all bugs and problems on the following page: +// +// http://www.fltk.org/str.php +// + +// Do not directly include this file, instead use <FL/x.H>. + +// This file can be used as a template when porting FLTK to a new platform + +#if !defined(Fl_X_H) +# error "Never use <FL/porting.H> directly; include <FL/x.H> instead." +#endif // !Fl_X_H + + +#if !(defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part is used when compiling an application program +# include <FL/Fl_Widget.H> + +typedef void *Fl_Region; +typedef void *Fl_Offscreen; + +#else // this part must be compiled when building the FLTK libraries + +typedef void *Fl_Region; +typedef void *Fl_Offscreen; + +# include "Fl_Window.H" +# include "../src/Fl_Font.H" + +// Some random X equivalents +struct XPoint { int x, y; }; +struct XRectangle {int x, y, width, height;}; + +typedef void *Window; + +//typedef float CGFloat; + +inline Fl_Region XRectangleRegion(int x, int y, int w, int h) { + // write code here + return 0L; +} + +inline void XDestroyRegion(Fl_Region r) { + // write code here +} + +extern void *fl_default_cursor; + +// This object contains all platform-specific stuff about a window: +// WARNING: this object is highly subject to change! +class Fl_X { + +public: + Window xid; // pointer to the native window object (FLWindow*) + Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window) + Fl_Window *w; // FLTK window for + Fl_Region region; +//#if FLTK_ABI_VERSION < 10304 +// Fl_Region subRegion; // for ABI compatibility, recycled to replace subRect_ +//#endif + Fl_X *next; // chain of mapped windows +//#if FLTK_ABI_VERSION < 10304 +// Fl_X *xidChildren; // useless with true subwindows, recycled to replace mapped_to_retina_ +// Fl_X *xidNext; // useless with true subwindows +//#endif + int wait_for_expose; +// NSCursor *cursor; + static Fl_X* first; + static Fl_X* i(const Fl_Window* w) {return w->i;} + static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&); + static Fl_X* make(Fl_Window*); + void flush(); +//#if FLTK_ABI_VERSION >= 10304 +// CGRect* subRect() { return subRect_; } // getter +// void subRect(CGRect *r) { subRect_ = r; } // setter +//#else +// CGRect* subRect() { return (CGRect*)subRegion; } // getter +// void subRect(CGRect *r) { subRegion = (Fl_Region)r; } // setter +//#endif +// bool mapped_to_retina(); // is window mapped to retina display? +// void mapped_to_retina(bool); // sets whether window is mapped to retina display +// bool changed_resolution(); // did window just moved to display with another resolution? +// void changed_resolution(bool);// sets whether window just moved to display with another resolution +// bool in_windowDidResize(); // is window performing windowDidResize? +// void in_windowDidResize(bool); // sets whether window is performing windowDidResize +// // Quartz additions: +// CGContextRef gc; // graphics context (NULL when using QD) +// static void q_fill_context(); // fill a Quartz context with current FLTK state +// static void q_clear_clipping(); // remove all clipping from a Quartz context +// static void q_release_context(Fl_X *x=0); // free all resources associated with fl_gc +// static void q_begin_image(CGRect&, int x, int y, int w, int h); +// static void q_end_image(); +// // Cocoa additions +// static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // computes NSOpenGLPixelFormat from Gl window's mode +// static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx, Fl_Window *window); +// static void GLcontext_update(NSOpenGLContext*); +// static void GLcontext_flushbuffer(NSOpenGLContext*); +// static void GLcontext_release(NSOpenGLContext*); +// static void GLcontext_makecurrent(NSOpenGLContext*); +// static void GL_cleardrawable(void); +// void destroy(void); +// void map(void); +// void unmap(void); +// void collapse(void); +// WindowRef window_ref(void); // useless with cocoa GL windows +// void set_key_window(void); +// // OS X doesn't have per window icons + static void set_default_icons(const Fl_RGB_Image*[], int); + void set_icons(); + int set_cursor(Fl_Cursor); + int set_cursor(const Fl_RGB_Image*, int, int); +// static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h); +// static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel); +// static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h); +// static void *get_carbon_function(const char *name); +// static void screen_work_area(int &X, int &Y, int &W, int &H, int n); // compute work area of a given screen +// static int next_marked_length; // next length of marked text after current marked text will have been replaced +// static int insertion_point_location(int *px, int *py, int *pheight); // computes window coordinates & height of insertion point +// static const int CoreText_threshold; // Mac OS version from which the Core Text API is used to display text +// static Fl_Fontdesc* calc_fl_fonts(void); // computes the fl_fonts global variable +// static int dnd(int use_selection); // call Fl_X::dnd(1) to support text dragging +// static int calc_mac_os_version(void); // computes the fl_mac_os_version global variable +// static void clip_to_rounded_corners(CGContextRef gc, int w, int h); +}; + +extern Window fl_window; + +#endif // FL_LIBRARY || FL_INTERNALS + +typedef void *Fl_Bitmask; + +extern void *fl_gc; + +extern Window fl_xid(const Fl_Window*); +extern Fl_Window* fl_find(Window xid); +void fl_clip_region(Fl_Region); + +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 Fl_Offscreen fl_create_offscreen(int w, int h); +extern void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld, int srcx,int srcy); +extern void fl_delete_offscreen(Fl_Offscreen gWorld); +extern void fl_begin_offscreen(Fl_Offscreen gWorld); +extern void fl_end_offscreen(); + +extern int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b); +extern void fl_open_display(); + +// +// End of "$Id$". +// + @@ -32,6 +32,7 @@ # include "mac.H" # elif defined(FL_PORTING) # 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 # if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files # pragma set woff 3322 |
