public CannedTextSupport(IRichTextBoxOwner control, ICannedTextLookupHandler defaultLookupHandler) { _textEditor = control; _defaultLookupHandler = defaultLookupHandler; Initialize(); }
public void ShowPopup(string query, ICannedTextLookupHandler alternativeHandler) { ClosePopup(); Point pt = _textEditor.GetRichTextBox().GetPositionFromCharIndex(_textEditor.GetRichTextBox().SelectionStart); _handlerInUse = alternativeHandler ?? _defaultLookupHandler; _lookup = new CannedTextInplaceLookupControl(_handlerInUse); _lookup.Cancelled += _lookup_Cancelled; _lookup.Committed += _lookup_Committed; if (!string.IsNullOrEmpty(query)) _handlerInUse.SuggestionProvider.SetQuery(query); _popup = new PopupForm(_lookup, _textEditor.GetRichTextBox(), _textEditor.GetRichTextBox().PointToScreen(pt)); _popup.ShowPopup(); }
public void Commit(CannedText cannedText, ICannedTextLookupHandler handler) { ClosePopup(); if (cannedText != null) { if (cannedText.IsSnippet) _textEditor.SetSelectedText(handler.GetFullText(cannedText)); else _textEditor.SetSelectedText(cannedText.Text); } }
public CannedTextSupport(RichTextBox control, ICannedTextLookupHandler defaultLookupHandler) : this(new RichTextBoxOwner(control), defaultLookupHandler) { }
public CannedTextInplaceLookupControl(ICannedTextLookupHandler lookupHandler) { InitializeComponent(); _lookupHandler = lookupHandler; _suggestBox.SuggestionProvider = _lookupHandler.SuggestionProvider; }