Beispiel #1
0
 private void ListBox_OnGiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (Mouse.OverrideCursor != null)
         Mouse.OverrideCursor = null;
     Mouse.SetCursor(_closedHandCursor);
     e.UseDefaultCursors = false;
     e.Handled = true;
 }
 void List_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (adorner != null)
     {
         ListBoxItem lbl = sender as ListBoxItem;
         var pos = lbl.PointFromScreen(GetMousePosition());
         adorner.UpdatePosition(pos);
       //e.Handled = true;
     }
 }
        private void Label_GiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            if (e.Effects == DragDropEffects.Copy)
            {
                e.UseDefaultCursors = false;
                Mouse.SetCursor(Cursors.Pen);
            }
            else
                e.UseDefaultCursors = true;

            e.Handled = true;
        }
        protected override void OnGiveFeedback(GiveFeedbackEventArgs e)
        {
            base.OnGiveFeedback(e);

            if (this.adorner != null)
            {
                Point curpos = MouseSimulator.GetCursorPosition();
                Point point = this.border.PointFromScreen(curpos);
                this.adorner.SetPosition(point.X, point.Y);
            }

            Cursor cursor = ((TextBlock)this.Resources["CursorClosedHand"]).Cursor;

            Mouse.SetCursor(cursor);
            e.Handled = true;
        }
Beispiel #5
0
        protected override void OnGiveFeedback(GiveFeedbackEventArgs e)
        {
            base.OnGiveFeedback(e);

            if (e.Effects.HasFlag(DragDropEffects.Copy))
            {
                Mouse.SetCursor(Cursors.Cross);
            }
            else if (e.Effects.HasFlag(DragDropEffects.Move))
            {
                Mouse.SetCursor(Cursors.Pen);
            }
            else
            {
                Mouse.SetCursor(Cursors.No);
            }

            e.Handled = true;
        }
Beispiel #6
0
        private static void triggerElement_GiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            if (e.Effects == DragDropEffects.None)
            {
                e.UseDefaultCursors = true;
                _isMouseOver = false;
            }
            else if (_isMouseOver)
            {
                Mouse.SetCursor(CreateCursor(_contentPresenter, 5, 5));
                e.UseDefaultCursors = false;
            }
            else
            {
                Mouse.SetCursor(Cursors.Arrow);
                e.UseDefaultCursors = false;
            }

            e.Handled = true;
        }
Beispiel #7
0
 private void OnGiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if( _adorner != null )
     {
         _adorner.SetPosition( MouseEx.GetPosition( _dragSource ) );
     }
 }
		void textArea_GiveFeedback(object sender, GiveFeedbackEventArgs e)
		{
			try {
				e.UseDefaultCursors = true;
				e.Handled = true;
			} catch (Exception ex) {
				OnDragException(ex);
			}
		}
Beispiel #9
0
 public static void DefaultGiveFeedback(System.Windows.IDataObject data, GiveFeedbackEventArgs e)
 {
     bool flag1 = false;
     bool flag2 = DataObjectExtensions.IsDropDescriptionDefault(data);
     DropImageType dropImageType = DropImageType.Invalid;
     if (!DataObjectExtensions.IsDropDescriptionValid(data) || flag2)
     {
         dropImageType = DataObjectExtensions.GetDropImageType(data);
         flag1 = true;
     }
     if (DataObjectExtensions.IsShowingLayered(data))
     {
         e.UseDefaultCursors = false;
         Mouse.SetCursor(Cursors.Arrow);
     }
     else
         e.UseDefaultCursors = true;
     if (DataObjectExtensions.InvalidateRequired(data) || !flag2 || dropImageType != DropImageType.None)
     {
         DataObjectExtensions.InvalidateDragImage(data);
         DataObjectExtensions.SetInvalidateRequired(data, false);
     }
     if (flag1 && e.Effects != (DragDropEffects)dropImageType)
     {
         if (e.Effects == DragDropEffects.Copy)
             DataObjectExtensions.SetDropDescription(data, DropImageType.Copy, "Copy", string.Empty);
         else if (e.Effects == DragDropEffects.Link)
             DataObjectExtensions.SetDropDescription(data, DropImageType.Link, "Link", string.Empty);
         else if (e.Effects == DragDropEffects.Move)
             DataObjectExtensions.SetDropDescription(data, DropImageType.Move, "Move", string.Empty);
         else if (e.Effects == DragDropEffects.None)
             DataObjectExtensions.SetDropDescription(data, DropImageType.None, (string)null, (string)null);
         DataObjectExtensions.SetDropDescriptionIsDefault(data, true);
         DataObjectExtensions.SetInvalidateRequired(data, true);
     }
     e.Handled = true;
 }
 /// <summary>
 ///     Virtual method reporting the give feedback is going to happen
 /// </summary>
 protected internal virtual void OnGiveFeedback(GiveFeedbackEventArgs e) {}
        private static void OnGiveFeedbackThunk(object sender, GiveFeedbackEventArgs e)
        {
            Invariant.Assert(!e.Handled, "Unexpected: Event has already been handled.");

            UIElement uie = sender as UIElement;

            if (uie != null)
            {
                uie.OnGiveFeedback(e);
            }
            else
            {
                ContentElement ce = sender as ContentElement;

                if (ce != null)
                {
                    ce.OnGiveFeedback(e);
                }
                else
                {
                    ((UIElement3D)sender).OnGiveFeedback(e);
                }
            }
        }
Beispiel #12
0
 private void ellipse_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
 }
Beispiel #13
0
		protected virtual void OnPreviewGiveFeedback(GiveFeedbackEventArgs e)
		{
			throw new NotImplementedException ();
		}
Beispiel #14
0
 static void DragSource_PreviewGiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     // Can be used to set custom cursors
 }
Beispiel #15
0
 public void PreprocessGiveFeedback(GiveFeedbackEventArgs e) {
     IMouseProcessor processor = Content as IMouseProcessor;
     if (processor != null) {
         processor.PreprocessGiveFeedback(e);
     }
 }
		void MouseElement_GiveFeedback(object sender, GiveFeedbackEventArgs e) {
			foreach (var m in mouseProcessors) {
				if (e.Handled)
					break;
				m.PreprocessGiveFeedback(e);
			}
			if (!e.Handled)
				defaultMouseProcessor.OnGiveFeedback(sender, e);
			foreach (var m in mouseProcessors)
				m.PostprocessGiveFeedback(e);
		}
 private static void DropTarget_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (EffectAdorner != null) {
     e.UseDefaultCursors = false;
     e.Handled = true;
       } else {
     e.UseDefaultCursors = true;
     e.Handled = true;
       }
 }
 protected virtual void OnGiveFeedback(GiveFeedbackEventArgs e);
 /// <summary>
 ///     Virtual method reporting the preview give feedback is going to happen
 /// </summary>
 protected virtual void OnPreviewGiveFeedback(GiveFeedbackEventArgs e) {}
        private void DragScopeGiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            if (e.Effects == DragDropEffects.Move)
            {
                e.UseDefaultCursors = false;
                Mouse.SetCursor(Cursors.Hand);
            }
            else
                e.UseDefaultCursors = true;

            e.Handled = true;
        }
Beispiel #21
0
 public static void DefaultGiveFeedbackHandler(object sender, GiveFeedbackEventArgs e)
 {
     UIElement key = sender as UIElement;
     if (key == null || !DataObjectExtensions.dataContext.ContainsKey(key))
         return;
     DataObjectExtensions.DefaultGiveFeedback(DataObjectExtensions.dataContext[key].Data, e);
 }
Beispiel #22
0
 private void ListBox_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
 }
Beispiel #23
0
        private void dtGridActors_GiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
           // TreeViewItem nd = (TreeViewItem)((TreeView)sender).SelectedItem;
           // StackPanel st = (StackPanel)nd.Header;
            Image im = null;
            if (_allOpsCursor == null)
            {

              //  TextBlock lbl = st.Children[1] as TextBlock;
               // if (lbl != null)  //  Unit font
                {

                    Label lblDrag = new Label();
                    lblDrag.Content = new string((char)150, 1);// lbl.Text;//  .Content;
                  //  lblDrag.Content = new string((char)86, 1);// lbl.Text;//  .Content;
                    lblDrag.Foreground = Brushes.Red; //lbl.Foreground;
                    lblDrag.FontFamily = new System.Windows.Media.FontFamily("Wingdings 2");//"Wingdings 2";// UserSession.KingsGameFontFamily;// new FontFamily("Simulation Font Environmental");
                    lblDrag.FontSize =  40;// lbl.FontSize;
                    double fs = 20;// lbl.FontSize;
                    lblDrag.Height = 40;// lbl.Height;
                    lblDrag.Width = 40;// lbl.Width;

                    lblDrag.FontWeight = System.Windows.FontWeights.Bold;

                    //new
                   // lblDrag.Foreground = System.Windows.Media.Brushes.Black;

                    try
                    {
                        _allOpsCursor = CursorHelper.CreateCursor(lblDrag, (int)8, (int)8, false);
                        Mouse.SetCursor(_allOpsCursor);
                    }
                    catch (Exception ex)
                    {
                    }


                }




            }

            e.UseDefaultCursors = false;
            e.Handled = true;
        }
 private void Subitem_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
 }
 void IMouseProcessor.PreprocessGiveFeedback(GiveFeedbackEventArgs e)
 {
     if (_mouseProcessor != null)
     {
         _mouseProcessor.PreprocessGiveFeedback(e);
     }
 }
        /// <summary>
        /// Called when the preview give feedback is called.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="GiveFeedbackEventArgs"/> instance containing the event data.</param>
        private static void OnPreviewGiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            FrameworkElement dragSource = (FrameworkElement)sender;

            if (popup == null)
            {
                DataTemplate dataTemplate = GetContentTemplate(dragSource);

                FrameworkElement popupContent;
                if (dataTemplate == null)
                {
                    popupContent = CloneFrameworkElement(dragSource);
                }
                else
                {
                    popupContent = new ContentPresenter()
                    {
                        Content = GetData(dragSource),
                        ContentTemplate = dataTemplate,
                    };
                }

                popup = new Popup()
                {
                    AllowsTransparency = true,
                    Child = popupContent,
                    DataContext = dragSource.DataContext,
                    IsHitTestVisible = false,
                    IsOpen = true
                };
            }

            System.Drawing.Point cursorPosition = System.Windows.Forms.Cursor.Position;
            Point mousePoint = new Point(cursorPosition.X, cursorPosition.Y);

            popup.HorizontalOffset = mousePoint.X + 20;
            popup.VerticalOffset = mousePoint.Y + 5;
        }
 private void OnGiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     e.SetCursor(Cursors.Arrow);
     e.Handled = true;
 }
Beispiel #28
0
        /// <summary>
        /// An event reporting that the give feedback during drag-and-drop operation.
        /// </summary>
        internal static void OnGiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            TextEditor This = TextEditor._GetTextEditor(sender);

            if (This == null)
            {
                return;
            }

            // Ignore the event if the editor has been detached from its scope
            if (!This._IsEnabled)
            {
                return;
            }

            // Show the default DragDrop cursor.
            e.UseDefaultCursors = true;

            // Consider event handled
            e.Handled = true;
        }
Beispiel #29
0
        /// <summary>
        /// Display the appropriate drag cursor based on
        /// DragDropEffects returned within the DropManager
        /// </summary>
        private void DragSource_GiveFeedback(object sender, GiveFeedbackEventArgs e) {

            if(this._dragDropObject.AddAdorner) {
                Point point = Utilities.Win32GetCursorPos();
                DefaultAdorner dragAdorner = this._dragDropObject.DragAdorner;
                dragAdorner.SetMousePosition(dragAdorner.AdornedElement.PointFromScreen(point));
            }

            if((this._dragDropObject.DataProviderActions & DataProviderActions.GiveFeedback) != 0)
                this._dragDropObject.DragSource_GiveFeedback(sender, e);

        }
		void IMouseProcessor.PostprocessGiveFeedback(GiveFeedbackEventArgs e) { }