예제 #1
0
 /// <summary>
 /// Initialize a new instance of the DockCluster class.
 /// </summary>
 /// <param name="paletteDragDrop">Drawing palette.</param>
 /// <param name="renderer">Drawing renderer.</param>
 /// <param name="target">Initial target for the cluster.</param>
 public DockCluster(IPaletteDragDrop paletteDragDrop,
                    IRenderer renderer,
                    DragTarget target)
 {
     _paletteDragDrop = paletteDragDrop;
     _renderer        = renderer;
     _screenRect      = target.ScreenRect;
     _drawRect        = target.DrawRect;
     _hintToTarget    = new HintToTarget();
     _hintToTarget.Add(target.Hint & DragTargetHint.ExcludeFlags, target);
     _excludeCluster = (target.Hint & DragTargetHint.ExcludeCluster) == DragTargetHint.ExcludeCluster;
 }
예제 #2
0
            /// <summary>
            /// Add the new target to the cluster.
            /// </summary>
            /// <param name="target">Target to add into cluster.</param>
            public void Add(DragTarget target)
            {
                // Find the hint that excludes extra flags
                DragTargetHint hint = target.Hint & DragTargetHint.ExcludeFlags;

                // Can only add one of each hint value
                if (!_hintToTarget.ContainsKey(hint))
                {
                    _hintToTarget.Add(hint, target);

                    // Make sure the drawing rectangle encloses all targets
                    DrawRect = Rectangle.Union(DrawRect, target.DrawRect);
                }
            }