25# error "Never use <FL/mac.H> directly; include <FL/x.H> instead."
30typedef FLWindow *Window;
32typedef class FLWindow *Window;
35#if !(defined(FL_LIBRARY) || defined(FL_INTERNALS))
38typedef struct flCocoaRegion* Fl_Region;
39typedef struct CGContext* CGContextRef;
40typedef struct OpaquePMPrintSettings* PMPrintSettings;
41typedef struct OpaquePMPageFormat* PMPageFormat;
42typedef struct OpaquePMPrintSession* PMPrintSession;
43typedef struct CGImage* CGImageRef;
44typedef struct __CFData* CFMutableDataRef;
45typedef CGContextRef Fl_Offscreen;
50#include <ApplicationServices/ApplicationServices.h>
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
81#ifndef NSINTEGER_DEFINED
82#if defined(__LP64__) && __LP64__
83typedef long NSInteger;
84typedef unsigned long NSUInteger;
87typedef unsigned int NSUInteger;
93@class NSOpenGLPixelFormat;
94@class NSOpenGLContext;
97class NSOpenGLPixelFormat;
101typedef CGContextRef Fl_Offscreen;
102#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
103typedef CGImageAlphaInfo CGBitmapInfo;
106typedef struct flCocoaRegion {
112# include "../src/Fl_Font.H"
115struct XPoint {
int x, y; };
116struct XRectangle {
int x, y, width, height;};
117#ifndef CGFLOAT_DEFINED
118#if defined(__LP64__) && __LP64__
119typedef double CGFloat;
121typedef float CGFloat;
125extern CGRect fl_cgrectmake_cocoa(
int x,
int y,
int w,
int h);
126inline Fl_Region XRectangleRegion(
int x,
int y,
int w,
int h) {
127 Fl_Region R = (Fl_Region)malloc(
sizeof(*R));
129 R->rects = (CGRect *)malloc(
sizeof(CGRect));
130 *(R->rects) = fl_cgrectmake_cocoa(x, y, w, h);
133inline void XDestroyRegion(Fl_Region r) {
139extern NSCursor *fl_default_cursor;
147 Fl_Offscreen other_xid;
150#if FLTK_ABI_VERSION < 10304
154#if FLTK_ABI_VERSION < 10304
161 static Fl_X* i(
const Fl_Window* w) {
return w->i;}
162 static int fake_X_wm(
const Fl_Window*,
int&,
int&,
int&,
int&,
int&);
165 static void set_high_resolution(
bool);
166#if FLTK_ABI_VERSION >= 10304
167 CGRect* subRect() {
return subRect_; }
168 void subRect(CGRect *r) { subRect_ = r; }
170 CGRect* subRect() {
return (CGRect*)subRegion; }
171 void subRect(CGRect *r) { subRegion = (Fl_Region)r; }
173 bool mapped_to_retina();
174 void mapped_to_retina(
bool);
175 bool changed_resolution();
176 void changed_resolution(
bool);
177 bool in_windowDidResize();
178 void in_windowDidResize(
bool);
181 static void q_fill_context();
182 static void q_clear_clipping();
183 static void q_release_context(Fl_X *x=0);
184 static void q_begin_image(CGRect&,
int x,
int y,
int w,
int h);
185 static void q_end_image();
187 static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(
int mode,
const int*);
188 static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx,
Fl_Window *window);
189 static void GLcontext_update(NSOpenGLContext*);
190 static void GLcontext_flushbuffer(NSOpenGLContext*);
191 static void GLcontext_release(NSOpenGLContext*);
192 static void GLcontext_makecurrent(NSOpenGLContext*);
193 static void GL_cleardrawable(
void);
198 WindowRef window_ref(
void);
199 void set_key_window(
void);
201 static void set_default_icons(
const Fl_RGB_Image*[],
int) {};
205 static CGImageRef CGImage_from_window_rect(
Fl_Window *win,
int x,
int y,
int w,
int h);
206 static unsigned char *bitmap_from_window_rect(
Fl_Window *win,
int x,
int y,
int w,
int h,
int *bytesPerPixel);
207 static Fl_Region intersect_region_and_rect(Fl_Region current,
int x,
int y,
int w,
int h);
208 static void *get_carbon_function(
const char *name);
209 static void screen_work_area(
int &X,
int &Y,
int &W,
int &H,
int n);
210 static int next_marked_length;
211 static int insertion_point_location(
int *px,
int *py,
int *pheight);
212 static const int CoreText_threshold;
214 static int dnd(
int use_selection);
215 static int calc_mac_os_version(
void);
216 static void clip_to_rounded_corners(CGContextRef gc,
int w,
int h);
217 static void *get_titlebar_layer(
Fl_Window *win);
218 static void draw_layer_to_context(
void *layer, CGContextRef ctxt,
int w,
int h);
220#if FLTK_ABI_VERSION >= 10304
224 unsigned mapped_to_retina_;
230extern Window fl_window;
234typedef CGImageRef Fl_Bitmask;
236extern CGContextRef fl_gc;
242extern Fl_Bitmask fl_create_bitmask(
int w,
int h,
const uchar *data);
243extern Fl_Bitmask fl_create_alphamask(
int w,
int h,
int d,
int ld,
const uchar *data);
244extern void fl_delete_bitmask(Fl_Bitmask bm);
246extern void fl_copy_offscreen(
int x,
int y,
int w,
int h, Fl_Offscreen gWorld,
int srcx,
int srcy);
252extern void fl_open_display();
268extern void fl_open_callback(void (*cb)(const char *));
Fl_Cursor
The following constants define the mouse cursors that are available in FLTK.
Definition Enumerations.H:1048
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
This widget produces an actual window.
Definition Fl_Window.H:57
unsigned char uchar
unsigned char
Definition fl_types.h:30
void fl_begin_offscreen(Fl_Offscreen ctx)
Send all subsequent drawing commands to this offscreen buffer.
Definition Fl_Double_Window.cxx:345
Fl_Offscreen fl_create_offscreen(int w, int h)
Creation of an offscreen graphics buffer.
Definition Fl_Double_Window.cxx:287
Fl_Region fl_clip_region()
Returns the current clipping region.
Definition fl_draw.H:140
void fl_delete_offscreen(Fl_Offscreen ctx)
Deletion of an offscreen graphics buffer.
Definition Fl_Double_Window.cxx:328
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
void fl_end_offscreen()
Quit sending drawing commands to the current offscreen buffer.
Definition Fl_Double_Window.cxx:363
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
class Fl_Sys_Menu_Bar * fl_sys_menu_bar
The system menu bar.
Definition Fl_Sys_Menu_Bar.mm:50