01: /*
02: * CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
03: * NETSCAPE COMMUNICATIONS CORPORATION
04: *
05: * Copyright (c) 1996 Netscape Communications Corporation.
06: * All Rights Reserved.
07: * Use of this Source Code is subject to the terms of the applicable
08: * license agreement from Netscape Communications Corporation.
09: */
10:
11: package graphical;
12:
13: import netscape.application.DragSession;
14: import netscape.application.Image;
15: import netscape.application.Target;
16:
17: public class DragPolicyContext {
18:
19: public int dragSourcePolicy;
20: public int dragDestinationPolicy;
21: public Image dragImage;
22: public int mouseDownX;
23: public int mouseDownY;
24: public DragSession dragSession;
25: public DragSession sourceDragSession; // SGP: ?
26: public Target destinationTarget;
27: public Target sourceTarget;
28:
29: /**
30: * Constructor.
31: */
32: public DragPolicyContext() {
33: this (null);
34: }
35:
36: /**
37: * Constructor.
38: * @param dragImage the drag image
39: */
40: public DragPolicyContext(Image dragImage) {
41: this .dragImage = dragImage;
42:
43: dragSession = null;
44: sourceDragSession = null;
45: mouseDownX = Integer.MIN_VALUE;
46: mouseDownY = Integer.MIN_VALUE;
47: dragSourcePolicy = DragPolicy.DRAGFROMDISALLOWED;
48: dragDestinationPolicy = DragPolicy.DRAGTODISALLOWED;
49: destinationTarget = null;
50: sourceTarget = null;
51: }
52:
53: /**
54: * Return whether the argument is a valid drag source policy.
55: * @param dsp drag source policy
56: */
57: public static boolean validateDragSourcePolicy(int dsp) {
58: return ((dsp == DragPolicy.DRAGFROMDISALLOWED)
59: || (dsp == DragPolicy.DRAGFROMCOPY) || (dsp == DragPolicy.DRAGFROMMOVE));
60: }
61:
62: /**
63: * Return whether the argument is a valid drag destination policy.
64: * @param ddp drag destination policy
65: */
66: public static boolean validateDragDestinationPolicy(int ddp) {
67: return ((ddp == DragPolicy.DRAGTODISALLOWED)
68: || (ddp == DragPolicy.DRAGTOACCEPT)
69: || (ddp == DragPolicy.DRAGTOACCEPTINCLUDE) || (ddp == DragPolicy.DRAGTOACCEPTDISPLACE));
70: }
71: }
|