protected internal override void OnMouseDoubleClicked(MouseEventArgs e) { // base class processing base.OnMouseDoubleClicked(e); if (GuiSystem.IsMouseButtonSet(e.Button, MouseButtons.Left)) { // if masked, set up to select all if (TextMasked) { dragAnchorIndex = 0; this.CaretIndex = text.Length; } else { // not masked, so select the word that was double clicked dragAnchorIndex = TextUtil.GetWordStartIndex(text, (caretIndex == text.Length) ? caretIndex : caretIndex + 1); CaretIndex = TextUtil.GetNextWordStartIndex(text, (caretIndex == text.Length) ? caretIndex : caretIndex + 1); } // perform actual selection operation SetSelection(dragAnchorIndex, caretIndex); e.Handled = true; } }
protected internal override void OnMouseUp(MouseEventArgs e) { // base class processing base.OnMouseUp(e); if (GuiSystem.IsMouseButtonSet(e.Button, MouseButtons.Left)) { //ReleaseInput(); e.Handled = true; } }
protected internal override void OnMouseDown(MouseEventArgs e) { // base class handling base.OnMouseDown(e); if (GuiSystem.IsMouseButtonSet(e.Button, MouseButtons.Left)) { // grab inputs CaptureInput(); // handle mouse down ClearSelection(); dragging = true; Rect absRect = GetVisibleTextArea(); PointF pt = new PointF(e.X - absRect.Left, e.Y - absRect.Top); dragAnchorIndex = GetTextIndexFromPosition(pt); this.CaretIndex = dragAnchorIndex; e.Handled = true; } }