Пример #1
0
        /// <summary>
        /// Creates the {@code DragSourceContext} to handle the current drag
        /// operation.
        /// <para>
        /// To incorporate a new <code>DragSourceContext</code>
        /// subclass, subclass <code>DragSource</code> and
        /// override this method.
        /// </para>
        /// <para>
        /// If <code>dragImage</code> is <code>null</code>, no image is used
        /// to represent the drag over feedback for this drag operation, but
        /// <code>NullPointerException</code> is not thrown.
        /// </para>
        /// <para>
        /// If <code>dsl</code> is <code>null</code>, no drag source listener
        /// is registered with the created <code>DragSourceContext</code>,
        /// but <code>NullPointerException</code> is not thrown.
        ///
        /// </para>
        /// </summary>
        /// <param name="dscp">          The <code>DragSourceContextPeer</code> for this drag </param>
        /// <param name="dgl">           The <code>DragGestureEvent</code> that triggered the
        ///                      drag </param>
        /// <param name="dragCursor">     The initial {@code Cursor} for this drag operation
        ///                       or {@code null} for the default cursor handling;
        ///                       see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a> class
        ///                       for more details on the cursor handling mechanism during drag and drop </param>
        /// <param name="dragImage">     The <code>Image</code> to drag or <code>null</code> </param>
        /// <param name="imageOffset">   The offset of the <code>Image</code> origin from the
        ///                      hotspot of the cursor at the instant of the trigger </param>
        /// <param name="t">             The subject data of the drag </param>
        /// <param name="dsl">           The <code>DragSourceListener</code>
        /// </param>
        /// <returns> the <code>DragSourceContext</code>
        /// </returns>
        /// <exception cref="NullPointerException"> if <code>dscp</code> is <code>null</code> </exception>
        /// <exception cref="NullPointerException"> if <code>dgl</code> is <code>null</code> </exception>
        /// <exception cref="NullPointerException"> if <code>dragImage</code> is not
        ///    <code>null</code> and <code>imageOffset</code> is <code>null</code> </exception>
        /// <exception cref="NullPointerException"> if <code>t</code> is <code>null</code> </exception>
        /// <exception cref="IllegalArgumentException"> if the <code>Component</code>
        ///         associated with the trigger event is <code>null</code>. </exception>
        /// <exception cref="IllegalArgumentException"> if the <code>DragSource</code> for the
        ///         trigger event is <code>null</code>. </exception>
        /// <exception cref="IllegalArgumentException"> if the drag action for the
        ///         trigger event is <code>DnDConstants.ACTION_NONE</code>. </exception>
        /// <exception cref="IllegalArgumentException"> if the source actions for the
        ///         <code>DragGestureRecognizer</code> associated with the trigger
        ///         event are equal to <code>DnDConstants.ACTION_NONE</code>. </exception>

        protected internal virtual DragSourceContext CreateDragSourceContext(DragSourceContextPeer dscp, DragGestureEvent dgl, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable t, DragSourceListener dsl)
        {
            return(new DragSourceContext(dscp, dgl, dragCursor, dragImage, imageOffset, t, dsl));
        }
Пример #2
0
        /// <summary>
        /// Start a drag, given the <code>DragGestureEvent</code>
        /// that initiated the drag, the initial
        /// <code>Cursor</code> to
        /// use,
        /// the <code>Transferable</code> subject data
        /// of the drag, and the <code>DragSourceListener</code>.
        /// <P> </summary>
        /// <param name="trigger">           the <code>DragGestureEvent</code> that initiated the drag </param>
        /// <param name="dragCursor">     the initial {@code Cursor} for this drag operation
        ///                       or {@code null} for the default cursor handling;
        ///                       see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a> class
        ///                       for more details on the cursor handling mechanism during drag and drop </param>
        /// <param name="transferable">      the subject data of the drag </param>
        /// <param name="dsl">               the <code>DragSourceListener</code>
        /// <P> </param>
        /// <exception cref="java.awt.dnd.InvalidDnDOperationException">
        ///    if the Drag and Drop
        ///    system is unable to initiate a drag operation, or if the user
        ///    attempts to start a drag while an existing drag operation
        ///    is still executing </exception>

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void startDrag(DragGestureEvent trigger, java.awt.Cursor dragCursor, java.awt.datatransfer.Transferable transferable, DragSourceListener dsl) throws InvalidDnDOperationException
        public virtual void StartDrag(DragGestureEvent trigger, Cursor dragCursor, Transferable transferable, DragSourceListener dsl)
        {
            StartDrag(trigger, dragCursor, null, null, transferable, dsl, null);
        }
Пример #3
0
        /// <summary>
        /// Start a drag, given the <code>DragGestureEvent</code>
        /// that initiated the drag, the initial <code>Cursor</code>
        /// to use,
        /// the <code>Image</code> to drag,
        /// the offset of the <code>Image</code> origin
        /// from the hotspot of the <code>Cursor</code>
        /// at the instant of the trigger,
        /// the subject data of the drag, and
        /// the <code>DragSourceListener</code>.
        /// <P> </summary>
        /// <param name="trigger">           the <code>DragGestureEvent</code> that initiated the drag </param>
        /// <param name="dragCursor">     the initial {@code Cursor} for this drag operation
        ///                       or {@code null} for the default cursor handling;
        ///                       see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
        ///                       for more details on the cursor handling mechanism during drag and drop </param>
        /// <param name="dragImage">         the <code>Image</code> to drag or <code>null</code> </param>
        /// <param name="dragOffset">        the offset of the <code>Image</code> origin from the hotspot
        ///                          of the <code>Cursor</code> at the instant of the trigger </param>
        /// <param name="transferable">      the subject data of the drag </param>
        /// <param name="dsl">               the <code>DragSourceListener</code>
        /// <P> </param>
        /// <exception cref="java.awt.dnd.InvalidDnDOperationException">
        ///    if the Drag and Drop
        ///    system is unable to initiate a drag operation, or if the user
        ///    attempts to start a drag while an existing drag operation
        ///    is still executing </exception>

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void startDrag(DragGestureEvent trigger, java.awt.Cursor dragCursor, java.awt.Image dragImage, java.awt.Point dragOffset, java.awt.datatransfer.Transferable transferable, DragSourceListener dsl) throws InvalidDnDOperationException
        public virtual void StartDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point dragOffset, Transferable transferable, DragSourceListener dsl)
        {
            StartDrag(trigger, dragCursor, dragImage, dragOffset, transferable, dsl, null);
        }
Пример #4
0
        /// <summary>
        /// Start a drag, given the <code>DragGestureEvent</code>
        /// that initiated the drag, the initial
        /// <code>Cursor</code> to use,
        /// the <code>Image</code> to drag,
        /// the offset of the <code>Image</code> origin
        /// from the hotspot of the <code>Cursor</code> at
        /// the instant of the trigger,
        /// the <code>Transferable</code> subject data
        /// of the drag, the <code>DragSourceListener</code>,
        /// and the <code>FlavorMap</code>.
        /// <P> </summary>
        /// <param name="trigger">        the <code>DragGestureEvent</code> that initiated the drag </param>
        /// <param name="dragCursor">     the initial {@code Cursor} for this drag operation
        ///                       or {@code null} for the default cursor handling;
        ///                       see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
        ///                       for more details on the cursor handling mechanism during drag and drop </param>
        /// <param name="dragImage">      the image to drag or {@code null} </param>
        /// <param name="imageOffset">    the offset of the <code>Image</code> origin from the hotspot
        ///                       of the <code>Cursor</code> at the instant of the trigger </param>
        /// <param name="transferable">   the subject data of the drag </param>
        /// <param name="dsl">            the <code>DragSourceListener</code> </param>
        /// <param name="flavorMap">      the <code>FlavorMap</code> to use, or <code>null</code>
        /// <P> </param>
        /// <exception cref="java.awt.dnd.InvalidDnDOperationException">
        ///    if the Drag and Drop
        ///    system is unable to initiate a drag operation, or if the user
        ///    attempts to start a drag while an existing drag operation
        ///    is still executing </exception>

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void startDrag(DragGestureEvent trigger, java.awt.Cursor dragCursor, java.awt.Image dragImage, java.awt.Point imageOffset, java.awt.datatransfer.Transferable transferable, DragSourceListener dsl, java.awt.datatransfer.FlavorMap flavorMap) throws InvalidDnDOperationException
        public virtual void StartDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl, FlavorMap flavorMap)
        {
            SunDragSourceContextPeer.DragDropInProgress = true;

            try
            {
                if (flavorMap != null)
                {
                    this.FlavorMap_Renamed = flavorMap;
                }

                DragSourceContextPeer dscp = Toolkit.DefaultToolkit.CreateDragSourceContextPeer(trigger);

                DragSourceContext dsc = CreateDragSourceContext(dscp, trigger, dragCursor, dragImage, imageOffset, transferable, dsl);

                if (dsc == null)
                {
                    throw new InvalidDnDOperationException();
                }

                dscp.StartDrag(dsc, dsc.Cursor, dragImage, imageOffset);                 // may throw
            }
            catch (RuntimeException e)
            {
                SunDragSourceContextPeer.DragDropInProgress = false;
                throw e;
            }
        }
Пример #5
0
 /// <summary>
 /// Removes the old drag-source-listener from drag-source-listener-l
 /// and returns the resulting multicast listener.
 /// </summary>
 /// <param name="l"> drag-source-listener-l </param>
 /// <param name="oldl"> the drag-source-listener being removed </param>
 public static DragSourceListener Remove(DragSourceListener l, DragSourceListener oldl)
 {
     return((DragSourceListener)RemoveInternal(l, oldl));
 }
Пример #6
0
 /// <summary>
 /// Adds drag-source-listener-a with drag-source-listener-b and
 /// returns the resulting multicast listener.
 /// </summary>
 /// <param name="a"> drag-source-listener-a </param>
 /// <param name="b"> drag-source-listener-b </param>
 public static DragSourceListener Add(DragSourceListener a, DragSourceListener b)
 {
     return((DragSourceListener)AddInternal(a, b));
 }