[TextView] add mouse handling

This commit is contained in:
miguel
2018-04-07 17:50:46 -04:00
parent e7876fb5b0
commit 49818d3058

View File

@@ -1050,26 +1050,29 @@ namespace Terminal.Gui {
return null;
}
#if false
public override bool MouseEvent (MouseEvent ev)
{
if (!ev.Flags.HasFlag (MouseFlags.Button1Clicked))
if (!ev.Flags.HasFlag (MouseFlags.Button1Clicked)) {
return false;
}
if (!HasFocus)
SuperView.SetFocus (this);
// We could also set the cursor position.
point = first + ev.X;
if (point > text.Length)
point = text.Length;
if (point < first)
point = 0;
if (ev.Y + topRow >= model.Count) {
currentRow = model.Count - topRow;
} else {
currentRow = ev.Y + topRow;
}
var r = GetCurrentLine ();
if (ev.X - leftColumn >= r.Count)
currentColumn = r.Count - leftColumn;
else
currentColumn = ev.X - leftColumn;
SetNeedsDisplay ();
PositionCursor ();
return true;
}
#endif
}
}