1 /*
2  * Copyright (c) 2011, 2014, 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 #ifndef CDropTarget_h
27 #define CDropTarget_h
28 
29 #import <AppKit/AppKit.h>
30 #import <jni.h>
31 
32 @class ControlModel;
33 
34 @class CDropTarget;
35 
36 @protocol CDropTargetHolder
37 - (void) setDropTarget:(CDropTarget *)target;
38 @end
39 
40 @interface CDropTarget : NSObject {
41 @private
42     NSView<CDropTargetHolder>* fView;
43     jobject            fComponent;
44     jobject            fDropTarget;
45     jobject            fDropTargetContextPeer;
46 }
47 
48 + (CDropTarget *) currentDropTarget;
49 
50 // Common methods:
51 - (id)init:(jobject)dropTarget component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control;
52 - (void)controlModelControlValid;
53 - (void)removeFromView:(JNIEnv *)env;
54 
55 - (NSInteger)getDraggingSequenceNumber;
56 - (jobject)copyDraggingDataForFormat:(jlong)format;
57 - (void)javaDraggingEnded:(jlong)draggingSequenceNumber success:(BOOL)jsuccess action:(jint)jdropaction;
58 
59 // dnd APIs (see AppKit/NSDragging.h, NSDraggingDestination):
60 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
61 - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender;
62 - (void)draggingExited:(id <NSDraggingInfo>)sender;
63 - (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender;
64 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
65 - (void)concludeDragOperation:(id <NSDraggingInfo>)sender;
66 - (void)draggingEnded:(id <NSDraggingInfo>)sender;
67 
68 - (jint)currentJavaActions;
69 
70 @end
71 
72 #endif // CDropTarget_h
73