25 # error "Never use <FL/mac.H> directly; include <FL/x.H> instead." 30 typedef FLWindow *Window;
32 typedef class FLWindow *Window;
35 #if !(defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part is used when compiling an application program 38 typedef struct flCocoaRegion* Fl_Region;
39 typedef struct CGContext* CGContextRef;
40 typedef struct OpaquePMPrintSettings* PMPrintSettings;
41 typedef struct OpaquePMPageFormat* PMPageFormat;
42 typedef struct OpaquePMPrintSession* PMPrintSession;
43 typedef struct CGImage* CGImageRef;
44 typedef struct __CFData* CFMutableDataRef;
45 typedef CGContextRef Fl_Offscreen;
47 #else // this part must be compiled when building the FLTK libraries 50 #include <ApplicationServices/ApplicationServices.h> 51 #undef check // because of Fl::check() 53 #ifndef MAC_OS_X_VERSION_10_4 54 #define MAC_OS_X_VERSION_10_4 1040 56 #ifndef MAC_OS_X_VERSION_10_5 57 #define MAC_OS_X_VERSION_10_5 1050 59 #ifndef MAC_OS_X_VERSION_10_6 60 #define MAC_OS_X_VERSION_10_6 1060 62 #ifndef MAC_OS_X_VERSION_10_7 63 #define MAC_OS_X_VERSION_10_7 1070 65 #ifndef MAC_OS_X_VERSION_10_8 66 #define MAC_OS_X_VERSION_10_8 1080 68 #ifndef MAC_OS_X_VERSION_10_9 69 #define MAC_OS_X_VERSION_10_9 1090 71 #ifndef MAC_OS_X_VERSION_10_10 72 #define MAC_OS_X_VERSION_10_10 101000 74 #ifndef MAC_OS_X_VERSION_10_11 75 #define MAC_OS_X_VERSION_10_11 101100 77 #ifndef MAC_OS_X_VERSION_10_12 78 #define MAC_OS_X_VERSION_10_12 101200 80 #ifndef MAC_OS_X_VERSION_10_13 81 #define MAC_OS_X_VERSION_10_13 101300 83 #ifndef MAC_OS_X_VERSION_10_14 84 #define MAC_OS_X_VERSION_10_14 101400 87 #ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h 88 #if defined(__LP64__) && __LP64__ 89 typedef long NSInteger;
90 typedef unsigned long NSUInteger;
92 typedef int NSInteger;
93 typedef unsigned int NSUInteger;
99 @class NSOpenGLPixelFormat;
100 @class NSOpenGLContext;
103 class NSOpenGLPixelFormat;
104 class NSOpenGLContext;
107 typedef CGContextRef Fl_Offscreen;
108 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4 109 typedef CGImageAlphaInfo CGBitmapInfo;
112 typedef struct flCocoaRegion {
118 # include "../src/Fl_Font.H" 121 struct XPoint {
int x, y; };
122 struct XRectangle {
int x, y, width, height;};
123 #ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h 124 #if defined(__LP64__) && __LP64__ 125 typedef double CGFloat;
127 typedef float CGFloat;
129 #endif // CGFLOAT_DEFINED 131 extern CGRect fl_cgrectmake_cocoa(
int x,
int y,
int w,
int h);
132 inline Fl_Region XRectangleRegion(
int x,
int y,
int w,
int h) {
133 Fl_Region R = (Fl_Region)malloc(
sizeof(*R));
135 R->rects = (CGRect *)malloc(
sizeof(CGRect));
136 *(R->rects) = fl_cgrectmake_cocoa(x, y, w, h);
139 inline void XDestroyRegion(Fl_Region r) {
145 extern NSCursor *fl_default_cursor;
153 Fl_Offscreen other_xid;
156 #if FLTK_ABI_VERSION < 10304 160 #if FLTK_ABI_VERSION < 10304 167 static Fl_X* i(
const Fl_Window* w) {
return w->i;}
168 static int fake_X_wm(
const Fl_Window*,
int&,
int&,
int&,
int&,
int&);
171 static void set_high_resolution(
bool);
172 #if FLTK_ABI_VERSION >= 10304 173 CGRect* subRect() {
return subRect_; }
174 void subRect(CGRect *r) { subRect_ = r; }
176 CGRect* subRect() {
return (CGRect*)subRegion; }
177 void subRect(CGRect *r) { subRegion = (Fl_Region)r; }
179 bool mapped_to_retina();
180 void mapped_to_retina(
bool);
181 bool changed_resolution();
182 void changed_resolution(
bool);
183 bool in_windowDidResize();
184 void in_windowDidResize(
bool);
187 static void q_fill_context();
188 static void q_clear_clipping();
189 static void q_release_context(Fl_X *x=0);
190 static void q_begin_image(CGRect&,
int x,
int y,
int w,
int h);
191 static void q_end_image();
193 static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(
int mode,
const int*);
194 static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx,
Fl_Window *window);
195 static void GLcontext_update(NSOpenGLContext*);
196 static void GLcontext_flushbuffer(NSOpenGLContext*);
197 static void GLcontext_release(NSOpenGLContext*);
198 static void GLcontext_makecurrent(NSOpenGLContext*);
199 static void GL_cleardrawable(
void);
200 static void gl_start(NSOpenGLContext*);
205 WindowRef window_ref(
void);
206 void set_key_window(
void);
208 static void set_default_icons(
const Fl_RGB_Image*[],
int) {};
212 static CGImageRef CGImage_from_window_rect(
Fl_Window *win,
int x,
int y,
int w,
int h);
213 static unsigned char *bitmap_from_window_rect(
Fl_Window *win,
int x,
int y,
int w,
int h,
int *bytesPerPixel);
214 static Fl_Region intersect_region_and_rect(Fl_Region current,
int x,
int y,
int w,
int h);
215 static void *get_carbon_function(
const char *name);
216 static void screen_work_area(
int &X,
int &Y,
int &W,
int &H,
int n);
217 static int next_marked_length;
218 static int insertion_point_location(
int *px,
int *py,
int *pheight);
219 static const int CoreText_threshold;
221 static int dnd(
int use_selection);
222 static int calc_mac_os_version(
void);
223 static void clip_to_rounded_corners(CGContextRef gc,
int w,
int h);
224 static void *get_titlebar_layer(
Fl_Window *win);
225 static void draw_layer_to_context(
void *layer, CGContextRef ctxt,
int w,
int h);
227 #if FLTK_ABI_VERSION >= 10304 231 unsigned mapped_to_retina_;
237 extern Window fl_window;
239 #endif // FL_LIBRARY || FL_INTERNALS 241 typedef CGImageRef Fl_Bitmask;
243 extern CGContextRef fl_gc;
249 extern Fl_Bitmask fl_create_bitmask(
int w,
int h,
const uchar *data);
250 extern Fl_Bitmask fl_create_alphamask(
int w,
int h,
int d,
int ld,
const uchar *data);
251 extern void fl_delete_bitmask(Fl_Bitmask bm);
253 extern void fl_copy_offscreen(
int x,
int y,
int w,
int h, Fl_Offscreen gWorld,
int srcx,
int srcy);
258 extern int fl_parse_color(
const char* p,
uchar& r,
uchar& g,
uchar& b);
259 extern void fl_open_display();
324 static void custom_application_menu_items(
const Fl_Menu_Item *m);
This widget produces an actual window.
Definition: Fl_Window.H:57
Fl_Cursor
The following constants define the mouse cursors that are available in FLTK.
Definition: Enumerations.H:1048
void fl_clip_region(Fl_Region r)
Replaces the top of the clipping stack with a clipping region of any shape.
Definition: fl_draw.H:136
void fl_delete_offscreen(Fl_Offscreen ctx)
Deletion of an offscreen graphics buffer.
Definition: Fl_Double_Window.cxx:328
FL_EXPORT void gl_start()
Creates an OpenGL context.
Definition: gl_start.cxx:56
void fl_open_callback(void(*cb)(const char *))
Register a function called for each file dropped onto an application icon.
void fl_begin_offscreen(Fl_Offscreen ctx)
Send all subsequent drawing commands to this offscreen buffer.
Definition: Fl_Double_Window.cxx:345
The Fl_RGB_Image class supports caching and drawing of full-color images with 1 to 4 channels of colo...
Definition: Fl_Image.H:202
class Fl_Sys_Menu_Bar * fl_sys_menu_bar
The system menu bar.
Definition: Fl_Sys_Menu_Bar.mm:50
Fl_Offscreen fl_create_offscreen(int w, int h)
Creation of an offscreen graphics buffer.
Definition: Fl_Double_Window.cxx:287
int fl_mac_quit_early
Determines whether cmd-Q or the "Quit xxx" item of application menu terminates the app or only the ev...
int fl_mac_os_version
The version number of the running Mac OS X (e.g., 100604 for 10.6.4)
void fl_mac_set_about(Fl_Callback *cb, void *user_data, int shortcut=0)
Attaches a callback to the "About myprog" item of the system application menu.
Definition: Fl_Sys_Menu_Bar.mm:198
void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy)
Copy a rectangular area of the given offscreen buffer into the current drawing destination.
Definition: Fl_Double_Window.cxx:94
unsigned char uchar
unsigned char
Definition: fl_types.h:30
void fl_end_offscreen()
Quit sending drawing commands to the current offscreen buffer.
Definition: Fl_Double_Window.cxx:363