コード例 #1
0
 /// <summary>
 /// Initialize a new instance of the DragManager class.
 /// </summary>
 public DragManager()
 {
     _redirector      = new PaletteRedirect();
     _stateCommon     = new PaletteDragDrop(null, null);
     _paletteMode     = PaletteMode.Global;
     _targetProviders = new DragTargetProviderCollection();
     _dragTargets     = new DragTargetList();
     _documentCursor  = false;
 }
コード例 #2
0
 /// <summary>
 /// Add a list of drag targets from the provided interface.
 /// </summary>
 /// <param name="provider">Interface reference.</param>
 /// <param name="dragEndData">Pages data being dragged.</param>
 public void AddRange(IDragTargetProvider provider, PageDragEndData dragEndData)
 {
     if (provider != null)
     {
         DragTargetList targets = provider.GenerateDragTargets(dragEndData);
         if ((targets != null) && (targets.Count > 0))
         {
             AddRange(targets);
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Called to initialize the implementation when dragging starts.
        /// </summary>
        /// <param name="paletteDragDrop">Drawing palette.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="pageDragEndData">Drag data associated with drag operation.</param>
        /// <param name="dragTargets">List of all drag targets.</param>
        public virtual void Start(IPaletteDragDrop paletteDragDrop,
                                  IRenderer renderer,
                                  PageDragEndData pageDragEndData,
                                  DragTargetList dragTargets)
        {
            Debug.Assert(paletteDragDrop != null);
            Debug.Assert(renderer != null);
            Debug.Assert(pageDragEndData != null);
            Debug.Assert(dragTargets != null);

            _paletteDragDrop = paletteDragDrop;
            _renderer        = renderer;
            _pageDragEndData = pageDragEndData;
            _dragTargets     = dragTargets;
        }
コード例 #4
0
        /// <summary>
        /// Release unmanaged and optionally managed resources.
        /// </summary>
        /// <param name="disposing">Called from Dispose method.</param>
        protected virtual void Dispose(bool disposing)
        {
            // If called from explicit call to Dispose
            if (disposing)
            {
                // No need to call destructor once dispose has occured
                GC.SuppressFinalize(this);

                _pageDragEndData = null;
                _dragTargets     = null;
            }

            // Mark as disposed
            _disposed = true;
        }
コード例 #5
0
        /// <summary>
        /// Called to initialize the implementation when dragging starts.
        /// </summary>
        /// <param name="paletteDragDrop">Drawing palette.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="pageDragEndData">Drag data associated with drag operation.</param>
        /// <param name="dragTargets">List of all drag targets.</param>
        public override void Start(IPaletteDragDrop paletteDragDrop,
                                   IRenderer renderer,
                                   PageDragEndData pageDragEndData,
                                   DragTargetList dragTargets)
        {
            base.Start(paletteDragDrop, renderer, pageDragEndData, dragTargets);

            if (_solid == null)
            {
                // Create and show a window without it taking focus
                _solid = new DropSolidWindow(PaletteDragDrop, Renderer);
                _solid.SetBounds(0, 0, 1, 1, BoundsSpecified.All);
                _solid.ShowWithoutActivate();
                _solid.Refresh();
            }
        }
コード例 #6
0
        /// <summary>
        /// Called to initialize the implementation when dragging starts.
        /// </summary>
        /// <param name="paletteDragDrop">Drawing palette.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="pageDragEndData">Drag data associated with drag operation.</param>
        /// <param name="dragTargets">List of all drag targets.</param>
        public override void Start(IPaletteDragDrop paletteDragDrop,
                                   IRenderer renderer,
                                   PageDragEndData pageDragEndData,
                                   DragTargetList dragTargets)
        {
            base.Start(paletteDragDrop, renderer, pageDragEndData, dragTargets);

            if (_solid == null)
            {
                // Create and show a solid feedback window without it taking focus
                _solid = new DropSolidWindow(PaletteDragDrop, Renderer);
                _solid.SetBounds(0, 0, 1, 1, BoundsSpecified.All);
                _solid.ShowWithoutActivate();
                _solid.Refresh();
            }

            ClearClusters();

            // Create clusters of related drag targets
            foreach (DragTarget target in dragTargets)
            {
                // Check if the target is actually able to drop inside itself
                if (target.IsMatch(target.HotRect.Location, pageDragEndData))
                {
                    // Find the existing cluster for the targets screen rectangle
                    DockCluster cluster = FindTargetCluster(target);

                    // Is the target allowed to be added to the found cluster (if there is one found)
                    if ((cluster == null) || cluster.ExcludeCluster || ((target.Hint & DragTargetHint.ExcludeCluster) == DragTargetHint.ExcludeCluster))
                    {
                        _clusters.Add(new DockCluster(PaletteDragDrop, Renderer, target));
                    }
                    else
                    {
                        cluster.Add(target);
                    }
                }
            }
        }
コード例 #7
0
 /// <summary>
 /// Called to cleanup when dragging has finished.
 /// </summary>
 public virtual void Quit()
 {
     _pageDragEndData = null;
     _dragTargets     = null;
 }