#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
//
#else
+
+#if !defined(MAC_OS_X_VERSION_10_12) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)
+ // replacements for macOS versions before 10.12
+ #define NSWindowStyleMaskResizable NSResizableWindowMask
+ #define NSWindowStyleMaskClosable NSClosableWindowMask
+ #define NSWindowStyleMaskTitled NSTitledWindowMask
+#endif
+
static Standard_Integer getScreenBottom()
{
Cocoa_LocalPool aLocalPool;
myYBottom = myYTop + thePxHeight;
Cocoa_LocalPool aLocalPool;
- NSUInteger aWinStyle = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
+ NSUInteger aWinStyle = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable;
NSRect aRectNs = NSMakeRect (float(myXLeft), float(myYTop), float(thePxWidth), float(thePxHeight));
myHWindow = [[NSWindow alloc] initWithContentRect: aRectNs
styleMask: aWinStyle
#include <Draw_Window.hxx>
#include <Cocoa_LocalPool.hxx>
+#if !defined(MAC_OS_X_VERSION_10_12) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)
+ // replacements for macOS versions before 10.12
+ #define NSEventTypeLeftMouseDown NSLeftMouseDown
+ #define NSEventTypeRightMouseDown NSRightMouseDown
+ #define NSEventTypeLeftMouseDragged NSLeftMouseDragged
+ #define NSEventTypeMouseMoved NSMouseMoved
+
+ #define NSEventMaskLeftMouseDragged NSLeftMouseDraggedMask
+ #define NSEventMaskMouseMoved NSMouseMovedMask
+ #define NSEventMaskLeftMouseDown NSLeftMouseDownMask
+ #define NSEventMaskRightMouseDown NSRightMouseDownMask
+
+ #define NSWindowStyleMaskResizable NSResizableWindowMask
+ #define NSWindowStyleMaskClosable NSClosableWindowMask
+ #define NSWindowStyleMaskTitled NSTitledWindowMask
+
+ #define NSCompositingOperationSourceOver NSCompositeSourceOver
+#endif
+
@interface Draw_CocoaView : NSView
{
NSImage* myImage;
[myImage drawInRect: aBounds
fromRect: NSZeroRect
- operation: NSCompositeSourceOver
+ operation: NSCompositingOperationSourceOver
fraction: 1
respectFlipped: YES
hints: nil];
if (myWindow == NULL)
{
NSRect aRectNs = NSMakeRect (theXLeft, anYTop, theWidth, theHeight);
- NSUInteger aWinStyle = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
+ NSUInteger aWinStyle = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable;
myWindow = [[NSWindow alloc] initWithContentRect: aRectNs
styleMask: aWinStyle
{
Cocoa_LocalPool aLocalPool;
- unsigned int anEventMatchMask = NSLeftMouseDownMask | NSRightMouseDownMask;
+ unsigned int anEventMatchMask = NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown;
if (!theWait)
{
- anEventMatchMask = anEventMatchMask | NSMouseMovedMask | NSLeftMouseDraggedMask;
+ anEventMatchMask = anEventMatchMask | NSEventMaskMouseMoved | NSEventMaskLeftMouseDragged;
Draw_IsInZoomingMode = Standard_True;
}
NSEventType anEventType = [anEvent type];
- if (anEventType == NSLeftMouseDown)
+ if (anEventType == NSEventTypeLeftMouseDown)
{
theButton = 1;
}
- else if (anEventType == NSRightMouseDown)
+ else if (anEventType == NSEventTypeRightMouseDown)
{
theButton = 3;
}
- else if ((anEventType == NSMouseMoved || anEventType == NSLeftMouseDragged) && !theWait)
+ else if ((anEventType == NSEventTypeMouseMoved || anEventType == NSEventTypeLeftMouseDragged) && !theWait)
{
theButton = 0;
}
{
continue;
}
+
+ // deprecated since macOS 10.12 without replacement
+ Standard_DISABLE_DEPRECATION_WARNINGS
anAttribs[aLastAttrib++] = NSOpenGLPFAStereo;
+ Standard_ENABLE_DEPRECATION_WARNINGS
}
anAttribs[aLastAttrib] = 0;
#include <TCollection_AsciiString.hxx>
#include <NCollection_DoubleMap.hxx>
+#if !defined(MAC_OS_X_VERSION_10_12) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)
+ // replacements for macOS versions before 10.12
+ #define NSEventModifierFlagControl NSControlKeyMask
+ #define NSEventModifierFlagShift NSShiftKeyMask
+#endif
+
//! Custom Cocoa view to handle events
@interface ViewerTest_CocoaEventManagerView : NSView
@end
- (void )mouseDown: (NSEvent* )theEvent
{
getMouseCoords (self, theEvent, X_ButtonPress, Y_ButtonPress);
- VT_ProcessButton1Press (0, NULL, Standard_False, [theEvent modifierFlags] & NSShiftKeyMask);
+ VT_ProcessButton1Press (0, NULL, Standard_False, [theEvent modifierFlags] & NSEventModifierFlagShift);
}
// =======================================================================
- (void )mouseUp: (NSEvent* )theEvent
{
getMouseCoords (self, theEvent, X_Motion, Y_Motion);
- VT_ProcessButton1Release([theEvent modifierFlags] & NSShiftKeyMask);
+ VT_ProcessButton1Release([theEvent modifierFlags] & NSEventModifierFlagShift);
}
- (void )mouseDragged: (NSEvent* )theEvent
{
IsDragged = Standard_True;
- if ([theEvent modifierFlags] & NSControlKeyMask)
+ if ([theEvent modifierFlags] & NSEventModifierFlagControl)
{
getMouseCoords (self, theEvent, X_Motion, Y_Motion);
VT_ProcessControlButton2Motion();
// =======================================================================
- (void )rightMouseDragged: (NSEvent* )theEvent
{
- if ([theEvent modifierFlags] & NSControlKeyMask)
+ if ([theEvent modifierFlags] & NSEventModifierFlagControl)
{
getMouseCoords (self, theEvent, X_Motion, Y_Motion);
VT_ProcessControlButton3Motion();