/// <summary> /// Notify the DragGestureListener that a Drag and Drop initiating /// gesture has occurred. Then reset the state of the Recognizer. /// <P> </summary> /// <param name="dragAction"> The action initially selected by the users gesture </param> /// <param name="p"> The point (in Component coords) where the gesture originated </param> protected internal virtual void FireDragGestureRecognized(int dragAction, Point p) { lock (this) { try { if (DragGestureListener != null) { DragGestureListener.DragGestureRecognized(new DragGestureEvent(this, dragAction, p, Events)); } } finally { Events.Clear(); } } }
/// <summary> /// unregister the current DragGestureListener /// <P> </summary> /// <param name="dgl"> the <code>DragGestureListener</code> to unregister /// from this <code>DragGestureRecognizer</code> /// <P> </param> /// <exception cref="IllegalArgumentException"> if /// dgl is not (equal to) the currently registered <code>DragGestureListener</code>. </exception> public virtual void RemoveDragGestureListener(DragGestureListener dgl) { lock (this) { if (DragGestureListener == null || !DragGestureListener.Equals(dgl)) { throw new IllegalArgumentException(); } else { DragGestureListener = null; if (Component_Renamed != null) { UnregisterListeners(); } } } }
/// <summary> /// Register a new <code>DragGestureListener</code>. /// <P> </summary> /// <param name="dgl"> the <code>DragGestureListener</code> to register /// with this <code>DragGestureRecognizer</code>. /// <P> </param> /// <exception cref="java.util.TooManyListenersException"> if a /// <code>DragGestureListener</code> has already been added. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public synchronized void addDragGestureListener(DragGestureListener dgl) throws java.util.TooManyListenersException public virtual void AddDragGestureListener(DragGestureListener dgl) { lock (this) { if (DragGestureListener != null) { throw new TooManyListenersException(); } else { DragGestureListener = dgl; if (Component_Renamed != null) { RegisterListeners(); } } } }
/// <summary> /// Construct a new <code>DragGestureRecognizer</code> /// given the <code>DragSource</code> to be used /// in this Drag and Drop operation, the <code>Component</code> /// this <code>DragGestureRecognizer</code> should "observe" /// for drag initiating gestures, the action(s) supported /// for this Drag and Drop operation, and the /// <code>DragGestureListener</code> to notify /// once a drag initiating gesture has been detected. /// <P> </summary> /// <param name="ds"> the <code>DragSource</code> this /// <code>DragGestureRecognizer</code> /// will use to process the Drag and Drop operation /// </param> /// <param name="c"> the <code>Component</code> /// this <code>DragGestureRecognizer</code> /// should "observe" the event stream to, /// in order to detect a drag initiating gesture. /// If this value is <code>null</code>, the /// <code>DragGestureRecognizer</code> /// is not associated with any <code>Component</code>. /// </param> /// <param name="sa"> the set (logical OR) of the /// <code>DnDConstants</code> /// that this Drag and Drop operation will support /// </param> /// <param name="dgl"> the <code>DragGestureRecognizer</code> /// to notify when a drag gesture is detected /// <P> </param> /// <exception cref="IllegalArgumentException"> /// if ds is <code>null</code>. </exception> protected internal DragGestureRecognizer(DragSource ds, Component c, int sa, DragGestureListener dgl) : base() { if (ds == null) { throw new IllegalArgumentException("null DragSource"); } DragSource_Renamed = ds; Component_Renamed = c; SourceActions_Renamed = sa & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK); try { if (dgl != null) { AddDragGestureListener(dgl); } } catch (TooManyListenersException) { // cant happen ... } }
/// <summary> /// Construct a new <code>MouseDragGestureRecognizer</code> /// given the <code>DragSource</code> for the /// <code>Component</code> c, the <code>Component</code> /// to observe, the action(s) /// permitted for this drag operation, and /// the <code>DragGestureListener</code> to /// notify when a drag gesture is detected. /// <P> </summary> /// <param name="ds"> The DragSource for the Component c </param> /// <param name="c"> The Component to observe </param> /// <param name="act"> The actions permitted for this Drag </param> /// <param name="dgl"> The DragGestureListener to notify when a gesture is detected /// </param> protected internal MouseDragGestureRecognizer(DragSource ds, Component c, int act, DragGestureListener dgl) : base(ds, c, act, dgl) { }
/// <summary> /// Creates a new <code>DragGestureRecognizer</code> /// that implements the default /// abstract subclass of <code>DragGestureRecognizer</code> /// for this <code>DragSource</code>, /// and sets the specified <code>Component</code> /// and <code>DragGestureListener</code> on the /// newly created object. /// /// For this <code>DragSource</code> /// the default is <code>MouseDragGestureRecognizer</code>. /// <P> </summary> /// <param name="c"> the <code>Component</code> target for the recognizer </param> /// <param name="actions"> the permitted source actions </param> /// <param name="dgl"> the <code>DragGestureListener</code> to notify /// <P> </param> /// <returns> the new <code>DragGestureRecognizer</code> or <code>null</code> /// if the <code>Toolkit.createDragGestureRecognizer</code> method /// has no implementation available for /// the requested <code>DragGestureRecognizer</code> /// subclass and returns <code>null</code> </returns> public virtual DragGestureRecognizer CreateDefaultDragGestureRecognizer(Component c, int actions, DragGestureListener dgl) { return(Toolkit.DefaultToolkit.CreateDragGestureRecognizer(typeof(MouseDragGestureRecognizer), this, c, actions, dgl)); }
/// <summary> /// Creates a new <code>DragGestureRecognizer</code> /// that implements the specified /// abstract subclass of /// <code>DragGestureRecognizer</code>, and /// sets the specified <code>Component</code> /// and <code>DragGestureListener</code> on /// the newly created object. /// <P> </summary> /// <param name="recognizerAbstractClass"> the requested abstract type </param> /// <param name="actions"> the permitted source drag actions </param> /// <param name="c"> the <code>Component</code> target </param> /// <param name="dgl"> the <code>DragGestureListener</code> to notify /// <P> </param> /// <returns> the new <code>DragGestureRecognizer</code> or <code>null</code> /// if the <code>Toolkit.createDragGestureRecognizer</code> method /// has no implementation available for /// the requested <code>DragGestureRecognizer</code> /// subclass and returns <code>null</code> </returns> public virtual T createDragGestureRecognizer <T>(Class recognizerAbstractClass, Component c, int actions, DragGestureListener dgl) where T : DragGestureRecognizer { return(Toolkit.DefaultToolkit.CreateDragGestureRecognizer(recognizerAbstractClass, this, c, actions, dgl)); }