Пример #1
0
        public CannedTextSupport(IRichTextBoxOwner control, ICannedTextLookupHandler defaultLookupHandler)
        {
            _textEditor = control;
            _defaultLookupHandler = defaultLookupHandler;

            Initialize();
        }
Пример #2
0
        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();
        }
Пример #3
0
        public void Commit(CannedText cannedText, ICannedTextLookupHandler handler)
        {
            ClosePopup();

            if (cannedText != null)
            {
                if (cannedText.IsSnippet)
                    _textEditor.SetSelectedText(handler.GetFullText(cannedText));
                else
                    _textEditor.SetSelectedText(cannedText.Text);
            }
        }
Пример #4
0
 public CannedTextSupport(RichTextBox control, ICannedTextLookupHandler defaultLookupHandler)
     : this(new RichTextBoxOwner(control), defaultLookupHandler)
 {
 }
 public CannedTextInplaceLookupControl(ICannedTextLookupHandler lookupHandler)
 {
     InitializeComponent();
     _lookupHandler = lookupHandler;
     _suggestBox.SuggestionProvider = _lookupHandler.SuggestionProvider;
 }