]>
git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/AutoComplete.cxx
75e26fe28370ba47421f843707a6be0c4fac864a
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() {
17 strcpy(stopChars
, "");
21 AutoComplete::~AutoComplete() {
25 bool AutoComplete::Active() {
29 void AutoComplete::Start(Window
&parent
, int ctrlID
, int position
, int startLen_
) {
31 lb
.Create(parent
, ctrlID
);
39 void AutoComplete::SetStopChars(const char *stopChars_
) {
40 strncpy(stopChars
, stopChars_
, sizeof(stopChars
));
41 stopChars
[sizeof(stopChars
) - 1] = '\0';
44 bool AutoComplete::IsStopChar(char ch
) {
45 return ch
&& strchr(stopChars
, ch
);
48 void AutoComplete::SetSeparator(char separator_
) {
49 separator
= separator_
;
52 char AutoComplete::GetSeparator() {
56 int AutoComplete::SetList(const char *list
) {
59 char *words
= new char[strlen(list
) + 1];
62 char *startword
= words
;
64 for (; words
&& words
[i
]; i
++) {
65 if (words
[i
] == separator
) {
68 maxStrLen
= Platform::Maximum(maxStrLen
, strlen(startword
));
69 startword
= words
+ i
+ 1;
74 maxStrLen
= Platform::Maximum(maxStrLen
, strlen(startword
));
82 void AutoComplete::Show() {
87 void AutoComplete::Cancel() {
96 void AutoComplete::Move(int delta
) {
97 int count
= lb
.Length();
98 int current
= lb
.GetSelection();
100 if (current
>= count
)
107 void AutoComplete::Select(const char *word
) {
108 int pos
= lb
.Find(word
);
109 //Platform::DebugPrintf("Autocompleting at <%s> %d\n", wordCurrent, pos);