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