/// <summary> /// Process a change in mouse position. /// </summary> /// <param name="e">Mouse event information that triggered call.</param> public override void OnMouseMove(MouseEventArgs e) { if (CallingControl.Handle != IntPtr.Zero) { // Convert from Control coordinates to screen coordinates Point mousePos = CallingControl.PointToScreen(new Point(e.X, e.Y)); // Find HotZone this position is inside HotZone hz = FindHotZone(mousePos); if (hz != _currentHotZone) { if (_currentHotZone != null) { _currentHotZone.RemoveIndicator(DragFeedback, mousePos); } _currentHotZone = hz; if (_currentHotZone != null) { _currentHotZone.DrawIndicator(DragFeedback, mousePos); } } else { if (_currentHotZone != null) { _currentHotZone.UpdateForMousePosition(DragFeedback, mousePos, this); } } } base.OnMouseMove(e); }
/// <summary> /// Adds the specified HotZone object to the collection. /// </summary> /// <param name="value">The HotZone object to add to the collection.</param> /// <returns>The HotZone object added to the collection.</returns> public HotZone Add(HotZone value) { // Use base class to process actual collection operation base.List.Add(value as object); return(value); }
/// <summary> /// Find the new hot zone to use. /// </summary> /// <param name="mousePos">Screen mouse position.</param> /// <param name="hotZone">Incoming hot zone.</param> /// <param name="suppress">Suppress subsequent indicators.</param> /// <returns>New hot zone.</returns> public override HotZone FindHotZone(Point mousePos, HotZone hotZone, ref bool suppress) { // If no zone currently created if (hotZone == null) { hotZone = _floatingZone; } return(hotZone); }
private HotZone FindHotZone(Point mousePos) { bool suppress = false; HotZone hotZone = null; // Ask each hot area in turn for a hot zone to use foreach (HotArea area in _hotAreas) { hotZone = area.FindHotZone(mousePos, hotZone, ref suppress); } return(hotZone); }
/// <summary> /// Perform initialization. /// </summary> /// <param name="squares">Show squares or diamonds.</param> /// <param name="callingControl">Calling control instance.</param> /// <param name="source">Type of source.</param> /// <param name="c">Source content.</param> /// <param name="wc">WindowContent that contains content.</param> /// <param name="ff">Floating form source.</param> /// <param name="dm">DockingManager instance.</param> /// <param name="offset">Screen offset.</param> protected override void InternalConstruct(bool squares, Control callingControl, Source source, Content c, WindowContent wc, FloatingForm ff, DockingManager dm, Point offset) { // Initialize zone specific details _hotZones = null; _currentHotZone = null; // Let base class store information base.InternalConstruct(squares, callingControl, source, c, wc, ff, dm, offset); }
/// <summary> /// Find the new hot zone to use. /// </summary> /// <param name="mousePos">Screen mouse position.</param> /// <param name="hotZone">Incoming hot zone.</param> /// <param name="suppress">Suppress subsequent indicators.</param> /// <returns>New hot zone.</returns> public override HotZone FindHotZone(Point mousePos, HotZone hotZone, ref bool suppress) { // Is the mouse contained in the inside hot rectangle? bool hotInside = _insideRect.Contains(mousePos) && !suppress; // Change in hot state? if (hotInside != _hotInside) { // Do we need to create the feedback indicator? if (hotInside) { // Create the indicator feedback _drop = new DropIndicators(_squares, false, true, true, true, true); // Ask the window to be shown within the provided rectangle _drop.ShowRelative(_insideRect); } else { _active = 0; Cleanup(); } // Update state _hotInside = hotInside; } // Check the mouse position against the available drop indicators if (_hotInside) { int active = 0; // Can only test against indicators if hot zone not already defined if (hotZone == null) { // Find the newly active indicator active = _drop.ScreenMouseMove(mousePos); } // Only interested in a change of active value if (_active != active) { // Use new value _active = active; // If no longer need the indicators, remove them! if (_active == 0) { _drop.MouseReset(); } } // Use the current active hot zone switch (_active) { case 1: hotZone = _hotLeft; break; case 2: hotZone = _hotRight; break; case 3: hotZone = _hotTop; break; case 4: hotZone = _hotBottom; break; } } return(hotZone); }
/// <summary> /// Find the new hot zone to use. /// </summary> /// <param name="mousePos">Screen mouse position.</param> /// <param name="hotZone">Incoming hot zone.</param> /// <param name="suppress">Suppress subsequent indicators.</param> /// <returns>New hot zone.</returns> public override HotZone FindHotZone(Point mousePos, HotZone hotZone, ref bool suppress) { // Is the mouse contained in the inside hot rectangle? bool hotInside = _tabbedRect.Contains(mousePos) && !suppress; // Change in hot state? if (hotInside != _hotInside) { // Do we need to create the feedback indicator? if (hotInside) { // Indicators depends on direction of zone bool vert = (_zs.Direction == LayoutDirection.Vertical); // Create the indicator feedback _drop = new DropIndicators(_squares, !_disallowTabbed, !vert && !_disallowInsert, !vert && !_disallowInsert, vert && !_disallowInsert, vert && !_disallowInsert); // Ask the window to be shown within the provided rectangle _drop.ShowRelative(_tabbedRect); } else { _active = 0; Cleanup(); } // Update state _hotInside = hotInside; } // Check the mouse position against the available drop indicators if (_hotInside) { int active = 0; // Can only test against indicators if hot zone not already defined if (hotZone == null) { // Find the newly active indicator active = _drop.ScreenMouseMove(mousePos); } // Only interested in a change of active value if (_active != active) { // Use new value _active = active; // If no longer need the indicators, remove them! if (_active == 0) { _drop.MouseReset(); } } // Use the current active hot zone switch (_active) { case 1: case 3: hotZone = _hotLT; break; case 2: case 4: hotZone = _hotRB; break; case 5: hotZone = _hotMiddle; break; } } // Do we suppress subsequenct indicators? if (_hotInside && _suppress) { suppress = true; } return(hotZone); }
/// <summary> /// Determines whether a HotZone is in the collection. /// </summary> /// <param name="value">The HotZone to locate in the collection.</param> /// <returns>true if item is found in the collection; otherwise, false.</returns> public bool Contains(HotZone value) { // Use base class to process actual collection operation return(base.List.Contains(value as object)); }
/// <summary> /// Inserts a HotZone instance into the collection at the specified location. /// </summary> /// <param name="index">The location in the collection where you want to add the HotZone.</param> /// <param name="value">The HotZone object to insert.</param> public void Insert(int index, HotZone value) { // Use base class to process actual collection operation base.List.Insert(index, value as object); }
/// <summary> /// Removes a HotZone from the collection. /// </summary> /// <param name="value">A HotZone to remove from the collection.</param> public void Remove(HotZone value) { // Use base class to process actual collection operation base.List.Remove(value as object); }
/// <summary> /// Returns the index of the first occurrence of the given HotZone. /// </summary> /// <param name="value">The HotZone to locate.</param> /// <returns>Index of object; otherwise -1</returns> public int IndexOf(HotZone value) { // Find the 0 based index of the requested entry return(base.List.IndexOf(value)); }
/// <summary> /// Find the new hot zone to use. /// </summary> /// <param name="mousePos">Screen mouse position.</param> /// <param name="hotZone">Incoming hot zone.</param> /// <param name="suppress">Suppress subsequent indicators.</param> /// <returns>New hot zone.</returns> public abstract HotZone FindHotZone(Point mousePos, HotZone hotZone, ref bool suppress);