1 // Scintilla source code edit control
2 /** @file ScintillaBase.h
3 ** Defines an enhanced subclass of Editor with calltips, autocomplete and context menu.
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.
8 #ifndef SCINTILLABASE_H
9 #define SCINTILLABASE_H
21 class ScintillaBase
: public Editor
{
23 /** Enumeration of commands and child windows. */
37 enum { maxLenInputIME
= 200 };
45 int listType
; ///< 0 is an autocomplete list
46 int maxListWidth
; /// Maximum width of list, in average character widths
47 int multiAutoCMode
; /// Mode for autocompleting when multiple selections are present
50 LexState
*DocumentLexState();
51 void SetLexer(uptr_t wParam
);
52 void SetLexerLanguage(const char *languageName
);
53 void Colourise(int start
, int end
);
57 // Deleted so ScintillaBase objects can not be copied.
58 explicit ScintillaBase(const ScintillaBase
&) = delete;
59 ScintillaBase
&operator=(const ScintillaBase
&) = delete;
60 virtual ~ScintillaBase();
61 void Initialise() override
{}
62 void Finalise() override
;
64 void AddCharUTF(const char *s
, unsigned int len
, bool treatAsDBCS
=false) override
;
65 void Command(int cmdId
);
66 void CancelModes() override
;
67 int KeyCommand(unsigned int iMessage
) override
;
69 void AutoCompleteInsert(Sci::Position startPos
, int removeLen
, const char *text
, int textLen
);
70 void AutoCompleteStart(int lenEntered
, const char *list
);
71 void AutoCompleteCancel();
72 void AutoCompleteMove(int delta
);
73 int AutoCompleteGetCurrent() const;
74 int AutoCompleteGetCurrentText(char *buffer
) const;
75 void AutoCompleteCharacterAdded(char ch
);
76 void AutoCompleteCharacterDeleted();
77 void AutoCompleteCompleted(char ch
, unsigned int completionMethod
);
78 void AutoCompleteMoveToCurrentWord();
79 static void AutoCompleteDoubleClick(void *p
);
82 void CallTipShow(Point pt
, const char *defn
);
83 virtual void CreateCallTipWindow(PRectangle rc
) = 0;
85 virtual void AddToPopUp(const char *label
, int cmd
=0, bool enabled
=true) = 0;
86 bool ShouldDisplayPopup(Point ptInWindowCoordinates
) const;
87 void ContextMenu(Point pt
);
89 void ButtonDownWithModifiers(Point pt
, unsigned int curTime
, int modifiers
) override
;
90 void ButtonDown(Point pt
, unsigned int curTime
, bool shift
, bool ctrl
, bool alt
) override
;
91 void RightButtonDownWithModifiers(Point pt
, unsigned int curTime
, int modifiers
) override
;
93 void NotifyStyleToNeeded(Sci::Position endStyleNeeded
) override
;
94 void NotifyLexerChanged(Document
*doc
, void *userData
) override
;
97 // Public so scintilla_send_message can use it
98 sptr_t
WndProc(unsigned int iMessage
, uptr_t wParam
, sptr_t lParam
) override
;