1 /* 2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #import <Cocoa/Cocoa.h> 27 #import <jni.h> 28 29 #import "GlassHostView.h" 30 #import "GlassFullscreenWindow.h" 31 #import "GlassDragSource.h" 32 #import "GlassAccessible.h" 33 34 // helper class that implements the custom GlassView functionality 35 @interface GlassViewDelegate : NSObject <GlassDragSourceDelegate> 36 { 37 NSView *nsView; 38 39 NSTrackingRectTag trackingRect; 40 41 GlassHostView *parentHost; 42 NSWindow *parentWindow; 43 CGFloat parentWindowAlpha; 44 45 GlassHostView *fullscreenHost; 46 // not nil when the FS mode is initiated with the OS X 10.7 widget 47 NSWindow* nativeFullScreenModeWindow; 48 49 BOOL mouseIsDown; 50 BOOL mouseIsOver; 51 int mouseDownMask; // bit 0 - left, 1 - right, 2 - other button 52 53 BOOL gestureInProgress; 54 55 NSEvent *lastEvent; 56 57 // The last processed key event 58 NSEvent *s_lastKeyEvent; 59 60 NSDragOperation dragOperation; 61 NSInteger lastTrackingNumber; 62 63 @public 64 jobject jView; 65 // not nil when we create a new FS window ourselves 66 GlassFullscreenWindow *fullscreenWindow; 67 } 68 69 - (id)initWithView:(NSView*)view withJview:(jobject)jview; 70 71 - (void)viewDidMoveToWindow; 72 - (void)setFrameSize:(NSSize)newSize; 73 - (void)setFrame:(NSRect)frameRect; 74 - (void)updateTrackingAreas; 75 - (void)drawRect:(NSRect)dirtyRect; 76 77 - (void)setResizableForFullscreen:(BOOL)resizable; 78 79 - (void)sendJavaMouseEvent:(NSEvent *)theEvent; 80 - (void)resetMouseTracking; 81 - (void)sendJavaMenuEvent:(NSEvent *)theEvent; 82 - (void)sendJavaKeyEvent:(NSEvent *)event isDown:(BOOL)isDown; 83 - (void)sendJavaModifierKeyEvent:(NSEvent *)theEvent; 84 - (void)sendJavaGestureEvent:(NSEvent *)theEvent type:(int)type; 85 - (void)sendJavaGestureBeginEvent:(NSEvent *)theEvent; 86 - (void)sendJavaGestureEndEvent:(NSEvent *)theEvent; 87 88 - (NSDragOperation)sendJavaDndEvent:(id <NSDraggingInfo>)info type:(jint)type; 89 90 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal; 91 - (void)startDrag:(NSDragOperation)operation; 92 93 - (BOOL)suppressMouseEnterExitOnMouseDown; 94 95 - (void)enterFullscreenWithAnimate:(BOOL)animate withKeepRatio:(BOOL)keepRatio withHideCursor:(BOOL)hideCursor; 96 - (void)exitFullscreenWithAnimate:(BOOL)animate; 97 - (void)sendJavaFullScreenEvent:(BOOL)entered withNativeWidget:(BOOL)isNative; 98 99 - (void)notifyInputMethod:(id)aString attr:(int)attr length:(int)length cursor:(int)cursor selectedRange:(NSRange)selectionRange; 100 - (NSRect)getInputMethodCandidatePosRequest:(int)pos; 101 102 - (void)setFrameOrigin:(NSPoint)newOrigin; 103 104 - (jobject)jView; 105 106 - (GlassAccessible*)getAccessible; 107 108 @end