FLTK 1.4.3
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#ifndef MAC_OS_VERSION_15_0
103#define MAC_OS_VERSION_15_0 150000
104#endif
105
106
107#ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h
108#if defined(__LP64__) && __LP64__
109typedef long NSInteger;
110typedef unsigned long NSUInteger;
111#else
112typedef int NSInteger;
113typedef unsigned int NSUInteger;
114#endif
115#endif
116
117#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
118typedef CGImageAlphaInfo CGBitmapInfo;
119#endif
120
121struct flCocoaRegion {
122 int count;
123 CGRect *rects;
124}; // a region is the union of a series of rectangles
125
126#ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h
127#if defined(__LP64__) && __LP64__
128typedef double CGFloat;
129#else
130typedef float CGFloat;
131#endif
132#endif // CGFLOAT_DEFINED
133
134#else
135
136typedef struct CGContext* CGContextRef;
137
138#endif // FL_LIBRARY || FL_INTERNALS
139
140extern CGContextRef fl_gc;
141
142#endif // FL_DOXYGEN
157void fl_mac_set_about(Fl_Callback *cb, void *user_data, int shortcut = 0);
158
160extern CGContextRef fl_mac_gc();
162extern FLWindow *fl_mac_xid(const Fl_Window *win);
164extern Fl_Window *fl_mac_find(FLWindow *);
165class Fl_Gl_Window;
166
172extern int fl_mac_os_version;
173
174struct Fl_Menu_Item;
175
177public:
179 static const char *about;
184 static const char *print;
186 static const char *print_no_titlebar;
188 static const char *toggle_print_titlebar;
190 static const char *services;
192 static const char *hide;
194 static const char *hide_others;
196 static const char *show;
198 static const char *quit;
205};
206
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:176
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:196
static const char * print_no_titlebar
Localizable text for the "Print Front Window" application menu item.
Definition mac.H:186
static const char * toggle_print_titlebar
Localizable text for the "Toggle print titlebar" application menu item.
Definition mac.H:188
static const char * about
Localizable text for the "About xxx" application menu item.
Definition mac.H:179
static const char * hide_others
Localizable text for the "Hide Others" application menu item.
Definition mac.H:194
static const char * hide
Localizable text for the "Hide xxx" application menu item.
Definition mac.H:192
static const char * print
Localizable text for the "Print Front Window" application menu item.
Definition mac.H:184
static const char * quit
Localizable text for the "Quit xxx" application menu item.
Definition mac.H:198
static const char * services
Localizable text for the "Services" application menu item.
Definition mac.H:190
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:124