protected virtual void UpdateHotItem(OlvListViewHitTestInfo hti)
{
if (!this.UseHotItem && !this.UseHyperlinks)
return;
int newHotRow = hti.RowIndex;
int newHotColumn = hti.ColumnIndex;
HitTestLocation newHotCellHitLocation = hti.HitTestLocation;
HitTestLocationEx newHotCellHitLocationEx = hti.HitTestLocationEx;
OLVGroup newHotGroup = hti.Group;
// In non-details view, we treat any hit on a row as if it were a hit
// on column 0 -- which (effectively) it is!
if (newHotRow >= 0 && this.View != View.Details)
newHotColumn = 0;
if (this.HotRowIndex == newHotRow &&
this.HotColumnIndex == newHotColumn &&
this.HotCellHitLocation == newHotCellHitLocation &&
this.HotCellHitLocationEx == newHotCellHitLocationEx &&
this.HotGroup == newHotGroup)
return;
// Trigger the hotitem changed event
HotItemChangedEventArgs args = new HotItemChangedEventArgs();
args.HotCellHitLocation = newHotCellHitLocation;
args.HotCellHitLocationEx = newHotCellHitLocationEx;
args.HotColumnIndex = newHotColumn;
args.HotRowIndex = newHotRow;
args.HotGroup = newHotGroup;
args.OldHotCellHitLocation = this.HotCellHitLocation;
args.OldHotCellHitLocationEx = this.HotCellHitLocationEx;
args.OldHotColumnIndex = this.HotColumnIndex;
args.OldHotRowIndex = this.HotRowIndex;
args.OldHotGroup = this.HotGroup;
this.OnHotItemChanged(args);
// Update the state of the control
this.HotRowIndex = newHotRow;
this.HotColumnIndex = newHotColumn;
this.HotCellHitLocation = newHotCellHitLocation;
this.HotCellHitLocationEx = newHotCellHitLocationEx;
this.HotGroup = newHotGroup;
// If the event handler handled it complete, don't do anything else
if (args.Handled)
return;
this.BeginUpdate();
try {
this.Invalidate();
if (args.OldHotRowIndex != -1)
this.UnapplyHotItem(args.OldHotRowIndex);
if (this.HotRowIndex != -1) {
// Virtual lists apply hot item style when fetching their rows
if (this.VirtualMode)
this.RedrawItems(this.HotRowIndex, this.HotRowIndex, true);
else
this.UpdateHotRow(this.HotRowIndex, this.HotColumnIndex, this.HotCellHitLocation, hti.Item);
}
if (this.UseHotItem && this.HotItemStyle != null && this.HotItemStyle.Overlay != null) {
this.RefreshOverlays();
}
} finally {
this.EndUpdate();
}
}