jpayne@69: /* jpayne@69: * tkMacOSXConstants.h -- jpayne@69: * jpayne@69: * Macros which map the names of NS constants used in the Tk code to jpayne@69: * the new name that Apple came up with for subsequent versions of the jpayne@69: * operating system. (Each new OS release seems to come with a new jpayne@69: * naming convention for the same old constants.) jpayne@69: * jpayne@69: * Copyright (c) 2017 Marc Culler jpayne@69: * jpayne@69: * See the file "license.terms" for information on usage and redistribution jpayne@69: * of this file, and for a DISCLAIMER OF ALL WARRANTIES. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TKMACCONSTANTS jpayne@69: #define _TKMACCONSTANTS jpayne@69: jpayne@69: #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 jpayne@69: #define NSFullScreenWindowMask (1 << 14) jpayne@69: #endif jpayne@69: jpayne@69: #if MAC_OS_X_VERSION_MAX_ALLOWED < 1090 jpayne@69: typedef NSInteger NSModalResponse; jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Let's raise a glass for the project manager who improves our lives by jpayne@69: * generating deprecation warnings about pointless changes of the names jpayne@69: * of constants. jpayne@69: */ jpayne@69: jpayne@69: #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 jpayne@69: #define kCTFontDefaultOrientation kCTFontOrientationDefault jpayne@69: #define kCTFontVerticalOrientation kCTFontOrientationVertical jpayne@69: #endif jpayne@69: jpayne@69: #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 jpayne@69: #define NSOKButton NSModalResponseOK jpayne@69: #endif jpayne@69: jpayne@69: #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 jpayne@69: #define kCTFontUserFixedPitchFontType kCTFontUIFontUserFixedPitch jpayne@69: #endif jpayne@69: jpayne@69: #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 jpayne@69: #define NSAppKitDefined NSEventTypeAppKitDefined jpayne@69: #define NSApplicationDefined NSEventTypeApplicationDefined jpayne@69: #define NSApplicationActivatedEventType NSEventSubtypeApplicationActivated jpayne@69: #define NSApplicationDeactivatedEventType NSEventSubtypeApplicationDeactivated jpayne@69: #define NSWindowExposedEventType NSEventSubtypeWindowExposed jpayne@69: #define NSScreenChangedEventType NSEventSubtypeScreenChanged jpayne@69: #define NSWindowMovedEventType NSEventSubtypeWindowMoved jpayne@69: #define NSKeyUp NSEventTypeKeyUp jpayne@69: #define NSKeyDown NSEventTypeKeyDown jpayne@69: #define NSFlagsChanged NSEventTypeFlagsChanged jpayne@69: #define NSLeftMouseDown NSEventTypeLeftMouseDown jpayne@69: #define NSLeftMouseUp NSEventTypeLeftMouseUp jpayne@69: #define NSRightMouseDown NSEventTypeRightMouseDown jpayne@69: #define NSRightMouseUp NSEventTypeRightMouseUp jpayne@69: #define NSLeftMouseDragged NSEventTypeLeftMouseDragged jpayne@69: #define NSRightMouseDragged NSEventTypeRightMouseDragged jpayne@69: #define NSMouseMoved NSEventTypeMouseMoved jpayne@69: #define NSMouseEntered NSEventTypeMouseEntered jpayne@69: #define NSMouseExited NSEventTypeMouseExited jpayne@69: #define NSScrollWheel NSEventTypeScrollWheel jpayne@69: #define NSOtherMouseDown NSEventTypeOtherMouseDown jpayne@69: #define NSOtherMouseUp NSEventTypeOtherMouseUp jpayne@69: #define NSOtherMouseDragged NSEventTypeOtherMouseDragged jpayne@69: #define NSTabletPoint NSEventTypeTabletPoint jpayne@69: #define NSTabletProximity NSEventTypeTabletProximity jpayne@69: #define NSDeviceIndependentModifierFlagsMask NSEventModifierFlagDeviceIndependentFlagsMask jpayne@69: #define NSCommandKeyMask NSEventModifierFlagCommand jpayne@69: #define NSShiftKeyMask NSEventModifierFlagShift jpayne@69: #define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock jpayne@69: #define NSAlternateKeyMask NSEventModifierFlagOption jpayne@69: #define NSControlKeyMask NSEventModifierFlagControl jpayne@69: #define NSNumericPadKeyMask NSEventModifierFlagNumericPad jpayne@69: #define NSFunctionKeyMask NSEventModifierFlagFunction jpayne@69: #define NSCursorUpdate NSEventTypeCursorUpdate jpayne@69: #define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground jpayne@69: #define NSCompositeCopy NSCompositingOperationCopy jpayne@69: #define NSWarningAlertStyle NSAlertStyleWarning jpayne@69: #define NSInformationalAlertStyle NSAlertStyleInformational jpayne@69: #define NSCriticalAlertStyle NSAlertStyleCritical jpayne@69: #define NSCenterTextAlignment NSTextAlignmentCenter jpayne@69: #define NSApplicationDefinedMask NSEventMaskApplicationDefined jpayne@69: #define NSUtilityWindowMask NSWindowStyleMaskUtilityWindow jpayne@69: #define NSNonactivatingPanelMask NSWindowStyleMaskNonactivatingPanel jpayne@69: #define NSDocModalWindowMask NSWindowStyleMaskDocModalWindow jpayne@69: #define NSHUDWindowMask NSWindowStyleMaskHUDWindow jpayne@69: #define NSTitledWindowMask NSWindowStyleMaskTitled jpayne@69: #define NSClosableWindowMask NSWindowStyleMaskClosable jpayne@69: #define NSResizableWindowMask NSWindowStyleMaskResizable jpayne@69: #define NSUnifiedTitleAndToolbarWindowMask NSWindowStyleMaskUnifiedTitleAndToolbar jpayne@69: #define NSMiniaturizableWindowMask NSWindowStyleMaskMiniaturizable jpayne@69: #define NSBorderlessWindowMask NSWindowStyleMaskBorderless jpayne@69: #define NSFullScreenWindowMask NSWindowStyleMaskFullScreen jpayne@69: #define NSAlphaFirstBitmapFormat NSBitmapFormatAlphaFirst jpayne@69: #define NSAnyEventMask NSEventMaskAny jpayne@69: #define NSLeftMouseDownMask NSEventMaskLeftMouseDown jpayne@69: #define NSMouseMovedMask NSEventMaskMouseMoved jpayne@69: #define NSLeftMouseDraggedMask NSEventMaskLeftMouseDragged jpayne@69: #endif jpayne@69: jpayne@69: #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 jpayne@69: #define NSStringPboardType NSPasteboardTypeString jpayne@69: #define NSOnState NSControlStateValueOn jpayne@69: #define NSOffState NSControlStateValueOff jpayne@69: #endif jpayne@69: jpayne@69: #if MAC_OS_X_VERSION_MIN_REQUIRED >= 110000 jpayne@69: #define NSWindowStyleMaskTexturedBackground 0 jpayne@69: #endif jpayne@69: jpayne@69: #if MAC_OS_X_VERSION_MIN_REQUIRED < 101000 jpayne@69: #define GET_NSCONTEXT(context, flip) [NSGraphicsContext \ jpayne@69: graphicsContextWithGraphicsPort:context flipped:flip] jpayne@69: #else jpayne@69: #define GET_NSCONTEXT(context, flip) [NSGraphicsContext \ jpayne@69: graphicsContextWithCGContext:context flipped:NO] jpayne@69: #endif jpayne@69: jpayne@69: #endif