fltk/FL/mac.H

164 lines
4.4 KiB
Objective-C

//
// "$Id$"
//
// Mac header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2016 by Bill Spitzak and others.
//
// 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:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
// Do not directly include this file, instead use <FL/x.H>. It will
// include this file if "__APPLE__" is defined. This is to encourage
// portability of even the system-specific code...
#ifndef FL_DOXYGEN
#if !defined(Fl_X_H)
# error "Never use <FL/mac.H> directly; include <FL/x.H> instead."
#endif // !Fl_X_H
#ifdef __OBJC__
@class FLWindow; // a subclass of the NSWindow Cocoa class
typedef FLWindow *Window;
#else
typedef class FLWindow *Window; // pointer to the FLWindow objective-c class
#endif // __OBJC__
#include <FL/Fl_Widget.H> // for Fl_Callback
#if (defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part must be compiled when building the FLTK libraries
// Standard MacOS C/C++ includes...
#include <ApplicationServices/ApplicationServices.h>
#undef check // because of Fl::check()
#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
#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
#ifndef MAC_OS_X_VERSION_10_11
#define MAC_OS_X_VERSION_10_11 101100
#endif
#ifndef MAC_OS_X_VERSION_10_12
#define MAC_OS_X_VERSION_10_12 101200
#endif
#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
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
typedef CGImageAlphaInfo CGBitmapInfo;
#endif
struct flCocoaRegion {
int count;
CGRect *rects;
}; // a region is the union of a series of rectangles
#ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h
#if defined(__LP64__) && __LP64__
typedef double CGFloat;
#else
typedef float CGFloat;
#endif
#endif // CGFLOAT_DEFINED
#else
typedef struct CGContext* CGContextRef;
#endif // FL_LIBRARY || FL_INTERNALS
extern CGContextRef fl_gc;
#endif // FL_DOXYGEN
/** \file
Mac OS X-specific symbols.
*/
/** \defgroup group_macosx Mac OS X-specific symbols
Mac OS X-specific symbols declared in <FL/x.H> or <FL/gl.h>
\sa \ref osissues_macos
@{ */
/**
* \brief Attaches a callback to the "About myprog" item of the system application menu.
*
* \param cb a callback that will be called by "About myprog" menu item
* with NULL 1st argument.
* \param user_data a pointer transmitted as 2nd argument to the callback.
* \param shortcut optional shortcut to attach to the "About myprog" menu item (e.g., FL_META+'a')
*/
extern void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut = 0);
/** \brief The version number of the running Mac OS X (e.g., 100604 for 10.6.4)
*/
extern int fl_mac_os_version;
/** The system menu bar.
*/
extern class Fl_Sys_Menu_Bar *fl_sys_menu_bar;
struct Fl_Menu_Item;
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.
This menu item won't be displayed if Fl_Mac_App_Menu::print
is set to an empty string.
*/
static const char *print;
/** 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;
static void custom_application_menu_items(const Fl_Menu_Item *m);
};
/** @} */
//
// End of "$Id$".
//