]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/ScintillaBase.h
cb85b55b511e40163693709f944f7b3cae3cea87
[wxWidgets.git] / src / stc / scintilla / src / ScintillaBase.h
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 /**
12 */
13 class ScintillaBase : public Editor {
14 // Private so ScintillaBase objects can not be copied
15 ScintillaBase(const ScintillaBase &) : Editor() {}
16 ScintillaBase &operator=(const ScintillaBase &) { return *this; }
17
18 protected:
19 /** Enumeration of commands and child windows. */
20 enum {
21 idCallTip=1,
22 idAutoComplete=2,
23
24 idcmdUndo=10,
25 idcmdRedo=11,
26 idcmdCut=12,
27 idcmdCopy=13,
28 idcmdPaste=14,
29 idcmdDelete=15,
30 idcmdSelectAll=16
31 };
32
33 bool displayPopupMenu;
34 Menu popup;
35 AutoComplete ac;
36
37 CallTip ct;
38
39 int listType; ///< 0 is an autocomplete list
40 SString listSelected; ///< Receives listbox selected string
41 int maxListWidth; /// Maximum width of list, in average character widths
42
43 bool performingStyle; ///< Prevent reentrance
44
45 #ifdef SCI_LEXER
46 int lexLanguage;
47 const LexerModule *lexCurrent;
48 PropSet props;
49 enum {numWordLists=KEYWORDSET_MAX+1};
50 WordList *keyWordLists[numWordLists+1];
51 void SetLexer(uptr_t wParam);
52 void SetLexerLanguage(const char *languageName);
53 void Colourise(int start, int end);
54 #endif
55
56 ScintillaBase();
57 virtual ~ScintillaBase();
58 virtual void Initialise() = 0;
59 virtual void Finalise() = 0;
60
61 virtual void RefreshColourPalette(Palette &pal, bool want);
62
63 virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false);
64 void Command(int cmdId);
65 virtual void CancelModes();
66 virtual int KeyCommand(unsigned int iMessage);
67
68 void AutoCompleteStart(int lenEntered, const char *list);
69 void AutoCompleteCancel();
70 void AutoCompleteMove(int delta);
71 int AutoCompleteGetCurrent();
72 void AutoCompleteCharacterAdded(char ch);
73 void AutoCompleteCharacterDeleted();
74 void AutoCompleteCompleted();
75 void AutoCompleteMoveToCurrentWord();
76 static void AutoCompleteDoubleClick(void* p);
77
78 void CallTipClick();
79 void CallTipShow(Point pt, const char *defn);
80 virtual void CreateCallTipWindow(PRectangle rc) = 0;
81
82 virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0;
83 void ContextMenu(Point pt);
84
85 virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
86
87 virtual void NotifyStyleToNeeded(int endStyleNeeded);
88 public:
89 // Public so scintilla_send_message can use it
90 virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
91 };
92
93 #endif