FLTK 1.4.0
Loading...
Searching...
No Matches
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 NSOpenGLContext;
28# ifndef GL_SILENCE_DEPRECATION
29# define GL_SILENCE_DEPRECATION 1
30# endif
31#elif defined(__cplusplus)
32 class NSOpenGLContext;
33#endif /* __OBJC__ */
34extern NSOpenGLContext *fl_mac_glcontext(GLContext rc);
35
36#ifdef __OBJC__
37@class FLWindow; // a subclass of the NSWindow Cocoa class
38typedef FLWindow *Window;
39#else
40typedef class FLWindow *Window; // pointer to the FLWindow objective-c class
41#endif // __OBJC__
42
43#include <FL/Fl_Widget.H> // for Fl_Callback
44
45#if (defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part must be compiled when building the FLTK libraries
46
47// Standard MacOS C/C++ includes...
48#include <ApplicationServices/ApplicationServices.h>
49#undef check // because of Fl::check()
50
51#ifndef MAC_OS_X_VERSION_10_4
52#define MAC_OS_X_VERSION_10_4 1040
53#endif
54#ifndef MAC_OS_X_VERSION_10_5
55#define MAC_OS_X_VERSION_10_5 1050
56#endif
57#ifndef MAC_OS_X_VERSION_10_6
58#define MAC_OS_X_VERSION_10_6 1060
59#endif
60#ifndef MAC_OS_X_VERSION_10_7
61#define MAC_OS_X_VERSION_10_7 1070
62#endif
63#ifndef MAC_OS_X_VERSION_10_8
64#define MAC_OS_X_VERSION_10_8 1080
65#endif
66#ifndef MAC_OS_X_VERSION_10_9
67#define MAC_OS_X_VERSION_10_9 1090
68#endif
69#ifndef MAC_OS_X_VERSION_10_10
70#define MAC_OS_X_VERSION_10_10 101000
71#endif
72#ifndef MAC_OS_X_VERSION_10_11
73#define MAC_OS_X_VERSION_10_11 101100
74#endif
75#ifndef MAC_OS_X_VERSION_10_12
76#define MAC_OS_X_VERSION_10_12 101200
77#endif
78#ifndef MAC_OS_X_VERSION_10_13
79#define MAC_OS_X_VERSION_10_13 101300
80#endif
81#ifndef MAC_OS_X_VERSION_10_14
82#define MAC_OS_X_VERSION_10_14 101400
83#endif
84#ifndef MAC_OS_X_VERSION_10_15
85#define MAC_OS_X_VERSION_10_15 101500
86#endif
87#ifndef MAC_OS_X_VERSION_10_16
88#define MAC_OS_X_VERSION_10_16 101600
89#endif
90#ifndef MAC_OS_VERSION_11_0
91#define MAC_OS_VERSION_11_0 110000
92#endif
93#ifndef MAC_OS_VERSION_12_0
94#define MAC_OS_VERSION_12_0 120000
95#endif
96#ifndef MAC_OS_VERSION_13_0
97#define MAC_OS_VERSION_13_0 130000
98#endif
99#ifndef MAC_OS_VERSION_14_0
100#define MAC_OS_VERSION_14_0 140000
101#endif
102
103
104#ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h
105#if defined(__LP64__) && __LP64__
106typedef long NSInteger;
107typedef unsigned long NSUInteger;
108#else
109typedef int NSInteger;
110typedef unsigned int NSUInteger;
111#endif
112#endif
113
114#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
115typedef CGImageAlphaInfo CGBitmapInfo;
116#endif
117
118struct flCocoaRegion {
119 int count;
120 CGRect *rects;
121}; // a region is the union of a series of rectangles
122
123#ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h
124#if defined(__LP64__) && __LP64__
125typedef double CGFloat;
126#else
127typedef float CGFloat;
128#endif
129#endif // CGFLOAT_DEFINED
130
131#else
132
133typedef struct CGContext* CGContextRef;
134
135#endif // FL_LIBRARY || FL_INTERNALS
136
137extern CGContextRef fl_gc;
138
139#endif // FL_DOXYGEN
154void fl_mac_set_about(Fl_Callback *cb, void *user_data, int shortcut = 0);
155
157extern CGContextRef fl_mac_gc();
159extern FLWindow *fl_mac_xid(const Fl_Window *win);
161extern Fl_Window *fl_mac_find(FLWindow *);
162class Fl_Gl_Window;
163
169extern int fl_mac_os_version;
170
171struct Fl_Menu_Item;
172
174public:
176 static const char *about;
181 static const char *print;
183 static const char *print_no_titlebar;
185 static const char *toggle_print_titlebar;
187 static const char *services;
189 static const char *hide;
191 static const char *hide_others;
193 static const char *show;
195 static const char *quit;
202};
203
Fl_Widget and Fl_Label classes.
The Fl_Gl_Window widget sets things up so OpenGL works.
Definition Fl_Gl_Window.H:56
Definition mac.H:173
static void custom_application_menu_items(const Fl_Menu_Item *m)
Adds custom menu item(s) to the application menu of the system menu bar.
static const char * show
Localizable text for the "Show All" application menu item.
Definition mac.H:193
static const char * print_no_titlebar
Localizable text for the "Print Front Window" application menu item.
Definition mac.H:183
static const char * toggle_print_titlebar
Localizable text for the "Toggle print titlebar" application menu item.
Definition mac.H:185
static const char * about
Localizable text for the "About xxx" application menu item.
Definition mac.H:176
static const char * hide_others
Localizable text for the "Hide Others" application menu item.
Definition mac.H:191
static const char * hide
Localizable text for the "Hide xxx" application menu item.
Definition mac.H:189
static const char * print
Localizable text for the "Print Front Window" application menu item.
Definition mac.H:181
static const char * quit
Localizable text for the "Quit xxx" application menu item.
Definition mac.H:195
static const char * services
Localizable text for the "Services" application menu item.
Definition mac.H:187
This widget produces an actual window.
Definition Fl_Window.H:55
int fl_mac_os_version
The version number of the running Mac OS X (e.g., 100604 for 10.6.4, 101300 for 10....
FLWindow * fl_mac_xid(const Fl_Window *win)
Returns the macOS-specific window reference corresponding to the given Fl_Window object.
CGContextRef fl_mac_gc()
Returns the macOS-specific graphics context for the current window.
Fl_Window * fl_mac_find(FLWindow *)
Returns the Fl_Window corresponding to the given macOS-specific window reference.
struct opaque * GLContext
Pointer to a platform-specific structure representing the window's OpenGL rendering context.
Definition platform_types.h:66
The Fl_Menu_Item structure defines a single menu item that is used by the Fl_Menu_ class.
Definition Fl_Menu_Item.H:115