void InstallKeyMap() { ActionMap.Register(new KeyStroke(Keys.A, InputFlags.ShortCutKey), args => SelectAll()); ActionMap.Register(new KeyStroke(Keys.X, InputFlags.ShortCutKey), args => CutSelectedText()); ActionMap.Register(new KeyStroke(Keys.C, InputFlags.ShortCutKey), args => CopySelectedText()); ActionMap.Register(new KeyStroke(Keys.V, InputFlags.ShortCutKey), args => PasteText()); ActionMap.Register(new KeyStroke(Keys.Back), OnBackKey); ActionMap.Register(new KeyStroke(Keys.Delete), OnDeleteKey); ActionMap.Register(new KeyStroke(Keys.Escape), ClearSelection); }
public TextArea(IUIStyle style, IDocumentEditor <DocumentView <PlainTextDocument>, PlainTextDocument> editor) : base(style, editor) { ActionMap.Register(new KeyStroke(Keys.Enter), OnEnterPressed); ActionMap.Register(new KeyStroke(Keys.PageUp), OnPageUpPressed); ActionMap.Register(new KeyStroke(Keys.PageDown), OnPageDownPressed); lineNumberRenderer = new LineNumberWidget(UIStyle); lineNumberRenderer.AddNotify(this); lineNumberRenderer.Anchor = AnchoredRect.CreateLeftAnchored(); lineNumberRenderer.DocumentView = Content; RaiseChildAdded(0, lineNumberRenderer); DisplayLineNumbers = true; Caret.CaretChanged += OnCaretChanged; }