C# Class Smrf.GraphicsLib.ToolTipTrackerBase

Helper class for displaying tooltips.
This is meant for use by a Control object that displays various objects within its window and wants to show a tooltip for each object. The ToolTip class in the FCL makes it easy to show a single tooltip for an entire control, but it does not support different tooltips for different parts of the control's window.

To use ToolTipTracker, call OnMouseMoveOverObject from the control's MouseMove event handler. If the mouse is currently over an object that has a tooltip associated with it, pass the object as the method's oObjectToTrack parameter. Otherwise, pass null. Also, call OnMouseMoveOverObject with a null parameter from the control's MouseLeave event handler.

If the mouse remains over an object for a period of milliseconds, ToolTipTracker fires a event. The event arguments include the object being tracked.

A HideToolTip event is fired when the tooltip should be hidden. This occurs HideDelayMs after the event fires if the mouse remains over the object, or immediately if OnMouseMoveOverObject(null) is called.

Note that ToolTipTracker does not actually show or hide the tooltip; that's up to the application. The easiest way to do this is to create a child ToolTipPanel control and call its Show and Hide methods in response to the ShowToolTip and HideToolTip events.

If the mouse is moved to another object within ReshowDelayMs milliseconds, another ShowToolTip event is fired. Otherwise, the waiting period reverts to ShowDelayMs.

Call Reset to reset ToolTipTracker to its initial state. This forces a HideToolTip event if a tooltip is showing.

IMPORTANT

The control must call Dispose() from its own Dispose method. This prevents timer-based events from firing after the control no longer has a handle.

Inheritance: Object, IDisposable
Mostra file Open project: 2014-sed-team3/term-project

Protected Properties

Property Type Description
m_bDisposed System.Boolean
m_iHideDelayMs System.Int32
m_iReshowDelayMs System.Int32
m_iShowDelayMs System.Int32
m_iState State
m_oTimer IToolTipTimer
m_oTrackedObject Object

Public Methods

Method Description
Dispose ( ) : void
OnMouseMoveOverObject ( Object objectToTrack ) : void
Reset ( ) : void
ToolTipTrackerBase ( IToolTipTimer toolTipTimer ) : System

Initializes a new instance of the ToolTipTrackerBase class.

Protected Methods

Method Description
ChangeState ( State iState, Object oObjectToTrack ) : void
Dispose ( System.Boolean bDisposing ) : void
FireHideToolTipEvent ( Object oObject ) : void
FireShowToolTipEvent ( Object oObject ) : void
TimerTick ( Object oSource, EventArgs oEventArgs ) : void
ValidateDelayProperty ( Int32 iValue, String sPropertyName ) : void

Private Methods

Method Description
AssertValid ( ) : void

Method Details

ChangeState() protected method

protected ChangeState ( State iState, Object oObjectToTrack ) : void
iState State
oObjectToTrack Object
return void

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( System.Boolean bDisposing ) : void
bDisposing System.Boolean
return void

FireHideToolTipEvent() protected method

protected FireHideToolTipEvent ( Object oObject ) : void
oObject Object
return void

FireShowToolTipEvent() protected method

protected FireShowToolTipEvent ( Object oObject ) : void
oObject Object
return void

OnMouseMoveOverObject() public method

public OnMouseMoveOverObject ( Object objectToTrack ) : void
objectToTrack Object
return void

Reset() public method

public Reset ( ) : void
return void

TimerTick() protected method

protected TimerTick ( Object oSource, EventArgs oEventArgs ) : void
oSource Object
oEventArgs System.EventArgs
return void

ToolTipTrackerBase() public method

Initializes a new instance of the ToolTipTrackerBase class.
public ToolTipTrackerBase ( IToolTipTimer toolTipTimer ) : System
toolTipTimer IToolTipTimer /// The timer to use internally. See the /// interface for details. ///
return System

ValidateDelayProperty() protected method

protected ValidateDelayProperty ( Int32 iValue, String sPropertyName ) : void
iValue System.Int32
sPropertyName String
return void

Property Details

m_bDisposed protected_oe property

protected Boolean,System m_bDisposed
return System.Boolean

m_iHideDelayMs protected_oe property

protected Int32,System m_iHideDelayMs
return System.Int32

m_iReshowDelayMs protected_oe property

protected Int32,System m_iReshowDelayMs
return System.Int32

m_iShowDelayMs protected_oe property

protected Int32,System m_iShowDelayMs
return System.Int32

m_iState protected_oe property

protected State m_iState
return State

m_oTimer protected_oe property

protected IToolTipTimer m_oTimer
return IToolTipTimer

m_oTrackedObject protected_oe property

protected Object m_oTrackedObject
return Object