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 #ifndef FL_DOXYGEN
00032
00033 #if !defined(Fl_X_H)
00034 # error "Never use <FL/mac.H> directly; include <FL/x.H> instead."
00035 #endif // !Fl_X_H
00036
00037 typedef void* Window;
00038 typedef void* Fl_Offscreen;
00039 typedef void* Fl_Bitmask;
00040
00041 #ifndef FL_LIBRARY // this part is used when compiling an application program
00042
00043 typedef void* Fl_Region;
00044 typedef void* Fl_CGContextRef;
00045 typedef void* Fl_PMPrintSettings;
00046 typedef void* Fl_PMPageFormat;
00047 typedef void* Fl_PMPrintSession;
00048
00049 #else // this part must be compiled when building the FLTK libraries
00050
00051
00052 #include <Carbon/Carbon.h>
00053 #undef check // because of Fl::check()
00054
00055 typedef CGContextRef Fl_CGContextRef;
00056 typedef PMPrintSettings Fl_PMPrintSettings;
00057 typedef PMPageFormat Fl_PMPageFormat;
00058 typedef PMPrintSession Fl_PMPrintSession;
00059
00060 #ifndef MAC_OS_X_VERSION_10_3
00061 #define MAC_OS_X_VERSION_10_3 1030
00062 #endif
00063 #ifndef MAC_OS_X_VERSION_10_4
00064 #define MAC_OS_X_VERSION_10_4 1040
00065 #endif
00066 #ifndef MAC_OS_X_VERSION_10_5
00067 #define MAC_OS_X_VERSION_10_5 1050
00068 #endif
00069 #ifndef MAC_OS_X_VERSION_10_6
00070 #define MAC_OS_X_VERSION_10_6 1060
00071 #endif
00072 #ifndef MAC_OS_X_VERSION_MAX_ALLOWED
00073 #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_3
00074 #endif
00075
00076 typedef struct flCocoaRegion {
00077 int count;
00078 CGRect *rects;
00079 } *Fl_Region;
00080
00081 # include "Fl_Window.H"
00082
00083
00084 struct XPoint { int x, y; };
00085 struct XRectangle {int x, y, width, height;};
00086 #ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h
00087 #if defined(__LP64__) && __LP64__
00088 typedef double CGFloat;
00089 #else
00090 typedef float CGFloat;
00091 #endif
00092 #endif // CGFLOAT_DEFINED
00093
00094 extern CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h);
00095 inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
00096 Fl_Region R = (Fl_Region)malloc(sizeof(*R));
00097 R->count = 1;
00098 R->rects = (CGRect *)malloc(sizeof(CGRect));
00099 *(R->rects) = fl_cgrectmake_cocoa(x, y, w, h);
00100 return R;
00101 }
00102 inline void XDestroyRegion(Fl_Region r) {
00103 if(r) {
00104 free(r->rects);
00105 free(r);
00106 }
00107 }
00108 extern void *fl_system_menu;
00109 extern void *fl_default_cursor;
00110
00111
00112
00113 class Fl_X
00114 {
00115 public:
00116 Window xid;
00117 Fl_Offscreen other_xid;
00118 Fl_Window *w;
00119 Fl_Region region;
00120 Fl_Region subRegion;
00121 Fl_X *next;
00122 Fl_X *xidChildren, *xidNext;
00123 int wait_for_expose;
00124 void *cursor;
00125 static Fl_X* first;
00126 static Fl_X* i(const Fl_Window* w) {return w->i;}
00127 static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
00128 static void make(Fl_Window*);
00129 void flush();
00130
00131 CGContextRef gc;
00132 static void q_fill_context();
00133 static void q_clear_clipping();
00134 static void q_release_context(Fl_X *x=0);
00135 static void q_begin_image(CGRect&, int x, int y, int w, int h);
00136 static void q_end_image();
00137
00138 void destroy(void);
00139 void map(void);
00140 void unmap(void);
00141 int unlink(Fl_X* start = NULL);
00142 void collapse(void);
00143 WindowRef window_ref(void);
00144 void contains_GL_subwindow(void);
00145 void set_key_window(void);
00146 void set_cursor(Fl_Cursor);
00147 static int screen_init(XRectangle screens[]);
00148 static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h);
00149 static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel);
00150 static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h);
00151 static CGContextRef watch_cursor_image(void);
00152 static CGContextRef help_cursor_image(void);
00153 static CGContextRef nesw_cursor_image(void);
00154 static CGContextRef nwse_cursor_image(void);
00155 static CGContextRef none_cursor_image(void);
00156 private:
00157 static void relink(Fl_Window*, Fl_Window*);
00158 };
00159
00160 extern struct Fl_XMap {
00161 RGBColor rgb;
00162 ulong pen;
00163 } *fl_current_xmap;
00164 extern FL_EXPORT Window fl_window;
00165
00166 #endif // FL_LIBRARY
00167
00168 extern FL_EXPORT Fl_CGContextRef fl_gc;
00169 extern FL_EXPORT class Fl_Sys_Menu_Bar *fl_sys_menu_bar;
00170
00171 extern Window fl_xid(const Fl_Window*);
00172 void fl_clip_region(Fl_Region);
00173
00174 extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
00175 extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
00176 extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
00177 extern Fl_Offscreen fl_create_offscreen(int w, int h);
00178 extern void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld, int srcx,int srcy);
00179 extern void fl_delete_offscreen(Fl_Offscreen gWorld);
00180 extern void fl_begin_offscreen(Fl_Offscreen gWorld);
00181 extern void fl_end_offscreen();
00182
00183 extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
00184 extern void fl_open_display();
00185
00186 #endif // FL_DOXYGEN
00187
00194 extern void fl_open_callback(void (*cb)(const char *));
00195
00204 extern void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut = 0);
00205
00208 extern int fl_mac_os_version;
00209
00212
00213
00214
00215