1 // Scintilla source code edit control 2 /** @file ScintillaBase.h 3 ** Defines an enhanced subclass of Editor with calltips, autocomplete and context menu. 4 **/ 5 // Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> 6 // The License.txt file describes the conditions under which this software may be distributed. 7 8 #ifndef SCINTILLABASE_H 9 #define SCINTILLABASE_H 10 11 namespace Scintilla { 12 13 class LexState; 14 /** 15 */ 16 class ScintillaBase : public Editor, IListBoxDelegate { 17 protected: 18 /** Enumeration of commands and child windows. */ 19 enum { 20 idCallTip=1, 21 idAutoComplete=2, 22 23 idcmdUndo=10, 24 idcmdRedo=11, 25 idcmdCut=12, 26 idcmdCopy=13, 27 idcmdPaste=14, 28 idcmdDelete=15, 29 idcmdSelectAll=16 30 }; 31 32 int displayPopupMenu; 33 Menu popup; 34 AutoComplete ac; 35 36 CallTip ct; 37 38 int listType; ///< 0 is an autocomplete list 39 int maxListWidth; /// Maximum width of list, in average character widths 40 int multiAutoCMode; /// Mode for autocompleting when multiple selections are present 41 42 LexState *DocumentLexState(); 43 void SetLexer(uptr_t wParam); 44 void SetLexerLanguage(const char *languageName); 45 void Colourise(int start, int end); 46 47 ScintillaBase(); 48 // Deleted so ScintillaBase objects can not be copied. 49 ScintillaBase(const ScintillaBase &) = delete; 50 ScintillaBase(ScintillaBase &&) = delete; 51 ScintillaBase &operator=(const ScintillaBase &) = delete; 52 ScintillaBase &operator=(ScintillaBase &&) = delete; 53 // ~ScintillaBase() in public section Initialise()54 void Initialise() override {} 55 void Finalise() override; 56 57 [[deprecated]] 58 // This method is deprecated, use InsertCharacter instead. The treatAsDBCS parameter is no longer used. 59 virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); 60 61 void InsertCharacter(std::string_view sv, CharacterSource charSource) override; 62 void Command(int cmdId); 63 void CancelModes() override; 64 int KeyCommand(unsigned int iMessage) override; 65 66 void AutoCompleteInsert(Sci::Position startPos, Sci::Position removeLen, const char *text, Sci::Position textLen); 67 void AutoCompleteStart(Sci::Position lenEntered, const char *list); 68 void AutoCompleteCancel(); 69 void AutoCompleteMove(int delta); 70 int AutoCompleteGetCurrent() const; 71 int AutoCompleteGetCurrentText(char *buffer) const; 72 void AutoCompleteCharacterAdded(char ch); 73 void AutoCompleteCharacterDeleted(); 74 void AutoCompleteCompleted(char ch, unsigned int completionMethod); 75 void AutoCompleteMoveToCurrentWord(); 76 void AutoCompleteSelection(); 77 void ListNotify(ListBoxEvent *plbe) override; 78 79 void CallTipClick(); 80 void CallTipShow(Point pt, const char *defn); 81 virtual void CreateCallTipWindow(PRectangle rc) = 0; 82 83 virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0; 84 bool ShouldDisplayPopup(Point ptInWindowCoordinates) const; 85 void ContextMenu(Point pt); 86 87 void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) override; 88 void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) override; 89 90 void NotifyStyleToNeeded(Sci::Position endStyleNeeded) override; 91 void NotifyLexerChanged(Document *doc, void *userData) override; 92 93 public: 94 ~ScintillaBase() override; 95 96 // Public so scintilla_send_message can use it 97 sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override; 98 }; 99 100 } 101 102 #endif 103