FLTK
mac.H
Go to the documentation of this file.
1 //
2 // Mac header file for the Fast Light Tool Kit (FLTK).
3 //
4 // Copyright 1998-2018 by Bill Spitzak and others.
5 //
6 // This library is free software. Distribution and use rights are outlined in
7 // the file "COPYING" which should have been included with this file. If this
8 // file is missing or damaged, see the license at:
9 //
10 // https://www.fltk.org/COPYING.php
11 //
12 // Please see the following page on how to report bugs and issues:
13 //
14 // https://www.fltk.org/bugs.php
15 //
16 
17 // Do not directly include this file, instead use <FL/platform.H>. It will
18 // include this file if "__APPLE__" is defined. This is to encourage
19 // portability of even the system-specific code...
20 #ifndef FL_DOXYGEN
21 
22 #if !defined(FL_PLATFORM_H)
23 # error "Never use <FL/mac.H> directly; include <FL/platform.H> instead."
24 #endif // !FL_PLATFORM_H
25 
26 #ifdef __OBJC__
27 @class FLWindow; // a subclass of the NSWindow Cocoa class
28 typedef FLWindow *Window;
29 #else
30 typedef class FLWindow *Window; // pointer to the FLWindow objective-c class
31 #endif // __OBJC__
32 
33 #include <FL/Fl_Widget.H> // for Fl_Callback
34 
35 #if (defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part must be compiled when building the FLTK libraries
36 
37 // Standard MacOS C/C++ includes...
38 #include <ApplicationServices/ApplicationServices.h>
39 #undef check // because of Fl::check()
40 
41 #ifndef MAC_OS_X_VERSION_10_4
42 #define MAC_OS_X_VERSION_10_4 1040
43 #endif
44 #ifndef MAC_OS_X_VERSION_10_5
45 #define MAC_OS_X_VERSION_10_5 1050
46 #endif
47 #ifndef MAC_OS_X_VERSION_10_6
48 #define MAC_OS_X_VERSION_10_6 1060
49 #endif
50 #ifndef MAC_OS_X_VERSION_10_7
51 #define MAC_OS_X_VERSION_10_7 1070
52 #endif
53 #ifndef MAC_OS_X_VERSION_10_8
54 #define MAC_OS_X_VERSION_10_8 1080
55 #endif
56 #ifndef MAC_OS_X_VERSION_10_9
57 #define MAC_OS_X_VERSION_10_9 1090
58 #endif
59 #ifndef MAC_OS_X_VERSION_10_10
60 #define MAC_OS_X_VERSION_10_10 101000
61 #endif
62 #ifndef MAC_OS_X_VERSION_10_11
63 #define MAC_OS_X_VERSION_10_11 101100
64 #endif
65 #ifndef MAC_OS_X_VERSION_10_12
66 #define MAC_OS_X_VERSION_10_12 101200
67 #endif
68 #ifndef MAC_OS_X_VERSION_10_13
69 #define MAC_OS_X_VERSION_10_13 101300
70 #endif
71 #ifndef MAC_OS_X_VERSION_10_14
72 #define MAC_OS_X_VERSION_10_14 101400
73 #endif
74 
75 
76 #ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h
77 #if defined(__LP64__) && __LP64__
78 typedef long NSInteger;
79 typedef unsigned long NSUInteger;
80 #else
81 typedef int NSInteger;
82 typedef unsigned int NSUInteger;
83 #endif
84 #endif
85 
86 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
87 typedef CGImageAlphaInfo CGBitmapInfo;
88 #endif
89 
90 struct flCocoaRegion {
91  int count;
92  CGRect *rects;
93 }; // a region is the union of a series of rectangles
94 
95 #ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h
96 #if defined(__LP64__) && __LP64__
97 typedef double CGFloat;
98 #else
99 typedef float CGFloat;
100 #endif
101 #endif // CGFLOAT_DEFINED
102 
103 #else
104 
105 typedef struct CGContext* CGContextRef;
106 
107 #endif // FL_LIBRARY || FL_INTERNALS
108 
109 extern CGContextRef fl_gc;
110 
111 #endif // FL_DOXYGEN
112 
126 void fl_mac_set_about(Fl_Callback *cb, void *user_data, int shortcut = 0);
127 
128 
134 extern int fl_mac_os_version;
135 
136 struct Fl_Menu_Item;
137 
139 public:
141  static const char *about;
146  static const char *print;
148  static const char *services;
150  static const char *hide;
152  static const char *hide_others;
154  static const char *show;
156  static const char *quit;
162  static void custom_application_menu_items(const Fl_Menu_Item *m);
163 };
164 
static const char * hide
Localizable text for the "Hide xxx" application menu item.
Definition: mac.H:150
void() Fl_Callback(Fl_Widget *, void *)
Default callback type definition for all fltk widgets (by far the most used)
Definition: Fl_Widget.H:32
Definition: mac.H:138
static const char * about
Localizable text for the "About xxx" application menu item.
Definition: mac.H:141
static const char * print
Localizable text for the "Print Front Window" application menu item.
Definition: mac.H:146
static const char * quit
Localizable text for the "Quit xxx" application menu item.
Definition: mac.H:156
static const char * services
Localizable text for the "Services" application menu item.
Definition: mac.H:148
Fl_Widget, Fl_Label classes .
static const char * hide_others
Localizable text for the "Hide Others" application menu item.
Definition: mac.H:152
The Fl_Menu_Item structure defines a single menu item that is used by the Fl_Menu_ class...
Definition: Fl_Menu_Item.H:107
static const char * show
Localizable text for the "Show All" application menu item.
Definition: mac.H:154
int fl_mac_os_version
The version number of the running Mac OS X (e.g., 100604 for 10.6.4, 101300 for 10.13).
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.