2 * tkMacOSXConstants.h --
4 * Macros which map the names of NS constants used in the Tk code to
5 * the new name that Apple came up with for subsequent versions of the
6 * operating system. (Each new OS release seems to come with a new
7 * naming convention for the same old constants.)
9 * Copyright (c) 2017 Marc Culler
11 * See the file "license.terms" for information on usage and redistribution
12 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 #ifndef _TKMACCONSTANTS
16 #define _TKMACCONSTANTS
18 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
19 #define NSFullScreenWindowMask (1 << 14)
22 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1090
23 typedef NSInteger NSModalResponse;
27 * Let's raise a glass for the project manager who improves our lives by
28 * generating deprecation warnings about pointless changes of the names
32 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
33 #define kCTFontDefaultOrientation kCTFontOrientationDefault
34 #define kCTFontVerticalOrientation kCTFontOrientationVertical
37 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
38 #define NSOKButton NSModalResponseOK
41 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
42 #define kCTFontUserFixedPitchFontType kCTFontUIFontUserFixedPitch
45 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
46 #define NSAppKitDefined NSEventTypeAppKitDefined
47 #define NSApplicationDefined NSEventTypeApplicationDefined
48 #define NSApplicationActivatedEventType NSEventSubtypeApplicationActivated
49 #define NSApplicationDeactivatedEventType NSEventSubtypeApplicationDeactivated
50 #define NSWindowExposedEventType NSEventSubtypeWindowExposed
51 #define NSScreenChangedEventType NSEventSubtypeScreenChanged
52 #define NSWindowMovedEventType NSEventSubtypeWindowMoved
53 #define NSKeyUp NSEventTypeKeyUp
54 #define NSKeyDown NSEventTypeKeyDown
55 #define NSFlagsChanged NSEventTypeFlagsChanged
56 #define NSLeftMouseDown NSEventTypeLeftMouseDown
57 #define NSLeftMouseUp NSEventTypeLeftMouseUp
58 #define NSRightMouseDown NSEventTypeRightMouseDown
59 #define NSRightMouseUp NSEventTypeRightMouseUp
60 #define NSLeftMouseDragged NSEventTypeLeftMouseDragged
61 #define NSRightMouseDragged NSEventTypeRightMouseDragged
62 #define NSMouseMoved NSEventTypeMouseMoved
63 #define NSMouseEntered NSEventTypeMouseEntered
64 #define NSMouseExited NSEventTypeMouseExited
65 #define NSScrollWheel NSEventTypeScrollWheel
66 #define NSOtherMouseDown NSEventTypeOtherMouseDown
67 #define NSOtherMouseUp NSEventTypeOtherMouseUp
68 #define NSOtherMouseDragged NSEventTypeOtherMouseDragged
69 #define NSTabletPoint NSEventTypeTabletPoint
70 #define NSTabletProximity NSEventTypeTabletProximity
71 #define NSDeviceIndependentModifierFlagsMask NSEventModifierFlagDeviceIndependentFlagsMask
72 #define NSCommandKeyMask NSEventModifierFlagCommand
73 #define NSShiftKeyMask NSEventModifierFlagShift
74 #define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock
75 #define NSAlternateKeyMask NSEventModifierFlagOption
76 #define NSControlKeyMask NSEventModifierFlagControl
77 #define NSNumericPadKeyMask NSEventModifierFlagNumericPad
78 #define NSFunctionKeyMask NSEventModifierFlagFunction
79 #define NSCursorUpdate NSEventTypeCursorUpdate
80 #define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground
81 #define NSCompositeCopy NSCompositingOperationCopy
82 #define NSWarningAlertStyle NSAlertStyleWarning
83 #define NSInformationalAlertStyle NSAlertStyleInformational
84 #define NSCriticalAlertStyle NSAlertStyleCritical
85 #define NSCenterTextAlignment NSTextAlignmentCenter
86 #define NSAnyEventMask NSEventMaskAny
87 #define NSApplicationDefinedMask NSEventMaskApplicationDefined
88 #define NSUtilityWindowMask NSWindowStyleMaskUtilityWindow
89 #define NSNonactivatingPanelMask NSWindowStyleMaskNonactivatingPanel
90 #define NSDocModalWindowMask NSWindowStyleMaskDocModalWindow
91 #define NSHUDWindowMask NSWindowStyleMaskHUDWindow
92 #define NSTitledWindowMask NSWindowStyleMaskTitled
93 #define NSClosableWindowMask NSWindowStyleMaskClosable
94 #define NSResizableWindowMask NSWindowStyleMaskResizable
95 #define NSUnifiedTitleAndToolbarWindowMask NSWindowStyleMaskUnifiedTitleAndToolbar
96 #define NSMiniaturizableWindowMask NSWindowStyleMaskMiniaturizable
97 #define NSBorderlessWindowMask NSWindowStyleMaskBorderless
98 #define NSFullScreenWindowMask NSWindowStyleMaskFullScreen
101 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
102 #define NSStringPboardType NSPasteboardTypeString
103 #define NSOnState NSControlStateValueOn
104 #define NSOffState NSControlStateValueOff
107 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 110000
108 #define NSWindowStyleMaskTexturedBackground 0
111 #if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
112 #define GET_NSCONTEXT(context, flip) [NSGraphicsContext \
113 graphicsContextWithGraphicsPort:context flipped:flip]
115 #define GET_NSCONTEXT(context, flip) [NSGraphicsContext \
116 graphicsContextWithCGContext:context flipped:NO]