]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/stc/scintilla/src/AutoComplete.cxx
5bc50d1efab3dfe8db55159a75ff693d6349e4e0
1 // Scintilla source code edit control
2 // AutoComplete.cxx - defines the auto completion list box
3 // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
4 // The License.txt file describes the conditions under which this software may be distributed.
11 #include "AutoComplete.h"
13 AutoComplete::AutoComplete() :
20 cancelAtStartPos(true) {
22 fillUpChars
[0] = '\0';
25 AutoComplete::~AutoComplete() {
29 bool AutoComplete::Active() {
33 void AutoComplete::Start(Window
&parent
, int ctrlID
, int position
, int startLen_
) {
35 lb
.Create(parent
, ctrlID
);
43 void AutoComplete::SetStopChars(const char *stopChars_
) {
44 strncpy(stopChars
, stopChars_
, sizeof(stopChars
));
45 stopChars
[sizeof(stopChars
) - 1] = '\0';
48 bool AutoComplete::IsStopChar(char ch
) {
49 return ch
&& strchr(stopChars
, ch
);
52 void AutoComplete::SetFillUpChars(const char *fillUpChars_
) {
53 strncpy(fillUpChars
, fillUpChars_
, sizeof(fillUpChars
));
54 fillUpChars
[sizeof(fillUpChars
) - 1] = '\0';
57 bool AutoComplete::IsFillUpChar(char ch
) {
58 return ch
&& strchr(fillUpChars
, ch
);
61 void AutoComplete::SetSeparator(char separator_
) {
62 separator
= separator_
;
65 char AutoComplete::GetSeparator() {
69 void AutoComplete::SetList(const char *list
) {
71 char *words
= new char[strlen(list
) + 1];
74 char *startword
= words
;
76 for (; words
&& words
[i
]; i
++) {
77 if (words
[i
] == separator
) {
80 startword
= words
+ i
+ 1;
91 void AutoComplete::Show() {
96 void AutoComplete::Cancel() {
104 void AutoComplete::Move(int delta
) {
105 int count
= lb
.Length();
106 int current
= lb
.GetSelection();
108 if (current
>= count
)
115 void AutoComplete::Select(const char *word
) {
116 int pos
= lb
.Find(word
);
117 //Platform::DebugPrintf("Autocompleting at <%s> %d\n", wordCurrent, pos);