2001-11-27 20:44:08 +03:00
|
|
|
//
|
|
|
|
// Mac header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2018-02-01 00:17:17 +03:00
|
|
|
// Copyright 1998-2018 by Bill Spitzak and others.
|
2001-11-27 20:44:08 +03:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/COPYING.php
|
2001-11-27 20:44:08 +03:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-04-16 04:13:17 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/bugs.php
|
2001-11-27 20:44:08 +03:00
|
|
|
//
|
|
|
|
|
2018-02-01 00:17:17 +03:00
|
|
|
// Do not directly include this file, instead use <FL/platform.H>. It will
|
2001-11-27 20:44:08 +03:00
|
|
|
// include this file if "__APPLE__" is defined. This is to encourage
|
|
|
|
// portability of even the system-specific code...
|
2008-09-18 23:09:34 +04:00
|
|
|
#ifndef FL_DOXYGEN
|
2001-11-27 20:44:08 +03:00
|
|
|
|
2018-02-01 01:34:48 +03:00
|
|
|
#if !defined(FL_PLATFORM_H)
|
2018-02-01 00:17:17 +03:00
|
|
|
# error "Never use <FL/mac.H> directly; include <FL/platform.H> instead."
|
2018-02-01 01:34:48 +03:00
|
|
|
#endif // !FL_PLATFORM_H
|
2001-11-27 20:44:08 +03:00
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
#ifdef __OBJC__
|
|
|
|
@class NSOpenGLContext;
|
2023-01-11 11:32:31 +03:00
|
|
|
# ifndef GL_SILENCE_DEPRECATION
|
|
|
|
# define GL_SILENCE_DEPRECATION 1
|
|
|
|
# endif
|
2022-03-15 08:42:06 +03:00
|
|
|
#elif defined(__cplusplus)
|
|
|
|
class NSOpenGLContext;
|
|
|
|
#endif /* __OBJC__ */
|
|
|
|
extern NSOpenGLContext *fl_mac_glcontext(GLContext rc);
|
|
|
|
|
2011-11-12 17:06:54 +04:00
|
|
|
#ifdef __OBJC__
|
|
|
|
@class FLWindow; // a subclass of the NSWindow Cocoa class
|
|
|
|
typedef FLWindow *Window;
|
|
|
|
#else
|
2014-11-12 23:42:41 +03:00
|
|
|
typedef class FLWindow *Window; // pointer to the FLWindow objective-c class
|
2011-11-12 17:06:54 +04:00
|
|
|
#endif // __OBJC__
|
2011-01-10 15:42:17 +03:00
|
|
|
|
2016-03-29 23:10:37 +03:00
|
|
|
#include <FL/Fl_Widget.H> // for Fl_Callback
|
2016-02-20 00:41:02 +03:00
|
|
|
|
2016-04-19 18:00:02 +03:00
|
|
|
#if (defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part must be compiled when building the FLTK libraries
|
2010-12-23 17:24:29 +03:00
|
|
|
|
2011-01-03 19:50:34 +03:00
|
|
|
// Standard MacOS C/C++ includes...
|
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
2010-12-23 17:24:29 +03:00
|
|
|
#undef check // because of Fl::check()
|
|
|
|
|
2014-04-27 17:57:09 +04:00
|
|
|
#ifndef MAC_OS_X_VERSION_10_4
|
|
|
|
#define MAC_OS_X_VERSION_10_4 1040
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_X_VERSION_10_5
|
|
|
|
#define MAC_OS_X_VERSION_10_5 1050
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_X_VERSION_10_6
|
|
|
|
#define MAC_OS_X_VERSION_10_6 1060
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_X_VERSION_10_7
|
|
|
|
#define MAC_OS_X_VERSION_10_7 1070
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_X_VERSION_10_8
|
|
|
|
#define MAC_OS_X_VERSION_10_8 1080
|
|
|
|
#endif
|
2014-09-13 18:29:53 +04:00
|
|
|
#ifndef MAC_OS_X_VERSION_10_9
|
|
|
|
#define MAC_OS_X_VERSION_10_9 1090
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_X_VERSION_10_10
|
|
|
|
#define MAC_OS_X_VERSION_10_10 101000
|
|
|
|
#endif
|
2015-11-03 17:36:36 +03:00
|
|
|
#ifndef MAC_OS_X_VERSION_10_11
|
|
|
|
#define MAC_OS_X_VERSION_10_11 101100
|
|
|
|
#endif
|
2016-09-24 09:27:18 +03:00
|
|
|
#ifndef MAC_OS_X_VERSION_10_12
|
|
|
|
#define MAC_OS_X_VERSION_10_12 101200
|
|
|
|
#endif
|
2018-10-16 12:28:25 +03:00
|
|
|
#ifndef MAC_OS_X_VERSION_10_13
|
|
|
|
#define MAC_OS_X_VERSION_10_13 101300
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_X_VERSION_10_14
|
|
|
|
#define MAC_OS_X_VERSION_10_14 101400
|
|
|
|
#endif
|
2022-09-22 21:12:40 +03:00
|
|
|
#ifndef MAC_OS_X_VERSION_10_15
|
|
|
|
#define MAC_OS_X_VERSION_10_15 101500
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_X_VERSION_10_16
|
|
|
|
#define MAC_OS_X_VERSION_10_16 101600
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_VERSION_11_0
|
|
|
|
#define MAC_OS_VERSION_11_0 110000
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_VERSION_12_0
|
|
|
|
#define MAC_OS_VERSION_12_0 120000
|
|
|
|
#endif
|
|
|
|
#ifndef MAC_OS_VERSION_13_0
|
|
|
|
#define MAC_OS_VERSION_13_0 130000
|
|
|
|
#endif
|
2023-10-20 11:57:27 +03:00
|
|
|
#ifndef MAC_OS_VERSION_14_0
|
|
|
|
#define MAC_OS_VERSION_14_0 140000
|
|
|
|
#endif
|
2024-06-12 16:52:37 +03:00
|
|
|
#ifndef MAC_OS_VERSION_15_0
|
|
|
|
#define MAC_OS_VERSION_15_0 150000
|
|
|
|
#endif
|
2018-10-16 12:28:25 +03:00
|
|
|
|
2014-04-27 17:57:09 +04:00
|
|
|
|
2015-06-30 05:23:26 +03:00
|
|
|
#ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h
|
|
|
|
#if defined(__LP64__) && __LP64__
|
|
|
|
typedef long NSInteger;
|
|
|
|
typedef unsigned long NSUInteger;
|
|
|
|
#else
|
|
|
|
typedef int NSInteger;
|
|
|
|
typedef unsigned int NSUInteger;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-08-28 17:04:21 +03:00
|
|
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
|
|
|
|
typedef CGImageAlphaInfo CGBitmapInfo;
|
|
|
|
#endif
|
2009-12-09 02:15:30 +03:00
|
|
|
|
2016-03-26 17:36:11 +03:00
|
|
|
struct flCocoaRegion {
|
2010-12-23 17:24:29 +03:00
|
|
|
int count;
|
|
|
|
CGRect *rects;
|
2016-03-26 17:36:11 +03:00
|
|
|
}; // a region is the union of a series of rectangles
|
2010-12-23 17:24:29 +03:00
|
|
|
|
2009-12-09 02:15:30 +03:00
|
|
|
#ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h
|
|
|
|
#if defined(__LP64__) && __LP64__
|
|
|
|
typedef double CGFloat;
|
|
|
|
#else
|
2009-12-07 01:21:55 +03:00
|
|
|
typedef float CGFloat;
|
|
|
|
#endif
|
2010-01-30 00:16:20 +03:00
|
|
|
#endif // CGFLOAT_DEFINED
|
2009-12-09 02:15:30 +03:00
|
|
|
|
2016-04-20 07:09:01 +03:00
|
|
|
#else
|
|
|
|
|
|
|
|
typedef struct CGContext* CGContextRef;
|
|
|
|
|
2011-01-18 02:52:32 +03:00
|
|
|
#endif // FL_LIBRARY || FL_INTERNALS
|
2010-12-23 17:24:29 +03:00
|
|
|
|
2011-09-14 19:17:32 +04:00
|
|
|
extern CGContextRef fl_gc;
|
2001-11-27 20:44:08 +03:00
|
|
|
|
2008-09-18 23:09:34 +04:00
|
|
|
#endif // FL_DOXYGEN
|
2012-11-13 18:45:42 +04:00
|
|
|
/** \file
|
|
|
|
Mac OS X-specific symbols.
|
|
|
|
*/
|
2010-03-16 17:47:40 +03:00
|
|
|
|
2011-02-02 00:31:57 +03:00
|
|
|
/** \defgroup group_macosx Mac OS X-specific symbols
|
2018-02-12 12:16:04 +03:00
|
|
|
Mac OS X-specific symbols declared in <FL/platform.H>
|
2013-01-25 20:28:49 +04:00
|
|
|
\sa \ref osissues_macos
|
2018-06-23 23:50:22 +03:00
|
|
|
\{ */
|
2010-03-16 17:47:40 +03:00
|
|
|
|
2018-02-22 20:04:37 +03:00
|
|
|
/**
|
2018-06-23 23:50:22 +03:00
|
|
|
Attaches a callback to the "About myprog" item of the system application menu.
|
2018-02-22 20:04:37 +03:00
|
|
|
For back-compatibility.
|
|
|
|
Equivalent to Fl_Sys_Menu_Bar::about(Fl_Callback *cb, void *user_data).
|
|
|
|
*/
|
|
|
|
void fl_mac_set_about(Fl_Callback *cb, void *user_data, int shortcut = 0);
|
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
/** Returns the macOS-specific graphics context for the current window */
|
|
|
|
extern CGContextRef fl_mac_gc();
|
|
|
|
/** Returns the macOS-specific window reference corresponding to the given Fl_Window object */
|
|
|
|
extern FLWindow *fl_mac_xid(const Fl_Window *win);
|
|
|
|
/** Returns the Fl_Window corresponding to the given macOS-specific window reference */
|
|
|
|
extern Fl_Window *fl_mac_find(FLWindow *);
|
2022-09-25 17:39:40 +03:00
|
|
|
class Fl_Gl_Window;
|
2010-11-25 21:21:21 +03:00
|
|
|
|
2023-12-12 13:58:00 +03:00
|
|
|
/** The version number of the running Mac OS X (e.g., 100604 for 10.6.4, 101300 for 10.13, 140102 for 14.1.2).
|
2018-03-07 13:12:50 +03:00
|
|
|
FLTK initializes this global variable before main() begins running. If
|
|
|
|
the value is needed in a static initializer, a previous call to Fl::system_driver()
|
|
|
|
makes sure \ref fl_mac_os_version has been initialized.
|
2010-11-25 21:21:21 +03:00
|
|
|
*/
|
2011-02-02 00:31:57 +03:00
|
|
|
extern int fl_mac_os_version;
|
|
|
|
|
2015-11-26 20:28:55 +03:00
|
|
|
struct Fl_Menu_Item;
|
2013-10-05 19:06:39 +04:00
|
|
|
|
2011-02-02 00:31:57 +03:00
|
|
|
class Fl_Mac_App_Menu {
|
|
|
|
public:
|
|
|
|
/** Localizable text for the "About xxx" application menu item */
|
|
|
|
static const char *about;
|
|
|
|
/** Localizable text for the "Print Front Window" application menu item.
|
2022-02-02 13:05:39 +03:00
|
|
|
This menu item and next one won't be displayed if Fl_Mac_App_Menu::print
|
2011-02-02 00:31:57 +03:00
|
|
|
is set to an empty string.
|
|
|
|
*/
|
2022-02-02 13:19:09 +03:00
|
|
|
static const char *print;
|
2022-02-02 13:05:39 +03:00
|
|
|
/** Localizable text for the "Print Front Window" application menu item. */
|
|
|
|
static const char *print_no_titlebar;
|
|
|
|
/** Localizable text for the "Toggle print titlebar" application menu item. */
|
|
|
|
static const char *toggle_print_titlebar;
|
2011-02-02 00:31:57 +03:00
|
|
|
/** Localizable text for the "Services" application menu item */
|
|
|
|
static const char *services;
|
|
|
|
/** Localizable text for the "Hide xxx" application menu item */
|
|
|
|
static const char *hide;
|
|
|
|
/** Localizable text for the "Hide Others" application menu item */
|
|
|
|
static const char *hide_others;
|
|
|
|
/** Localizable text for the "Show All" application menu item */
|
|
|
|
static const char *show;
|
|
|
|
/** Localizable text for the "Quit xxx" application menu item */
|
|
|
|
static const char *quit;
|
2018-02-12 12:16:04 +03:00
|
|
|
/** Adds custom menu item(s) to the application menu of the system menu bar.
|
2022-02-02 13:05:39 +03:00
|
|
|
They are positioned after the "Print Front Window / Toggle printing of titlebar" items, or at their place
|
|
|
|
if they were removed with <tt>Fl_Mac_App_Menu::print = ""</tt>.
|
2018-02-12 12:16:04 +03:00
|
|
|
\param m zero-ending array of Fl_Menu_Item 's.
|
|
|
|
*/
|
2015-11-26 19:34:58 +03:00
|
|
|
static void custom_application_menu_items(const Fl_Menu_Item *m);
|
2011-02-02 00:31:57 +03:00
|
|
|
};
|
2010-11-25 21:21:21 +03:00
|
|
|
|
2010-03-16 17:47:40 +03:00
|
|
|
/** @} */
|
|
|
|
|