| 42 skipped lines |
|
|
|
| 46 | | void AutoComplete::Start(Window &parent, int ctrlID, int position, | | 46 | | void AutoComplete::Start(Window &parent, int ctrlID, |
| | | 47 | | int position, Point location, int startLen_, |
| 47 | | int startLen_, int lineHeight, bool unicodeMode) { | | 48 | | int lineHeight, bool unicodeMode) { |
|
|
|
| 51 | | lb->Create(parent, ctrlID, lineHeight, unicodeMode); | | 52 | | lb->Create(parent, ctrlID, location, lineHeight, unicodeMode); |
|
|
| 54 | | 55 | | startLen = startLen_; |
|
| 35 skipped lines |
|
|
| 92 | | 93 | | void AutoComplete::SetList(const char *list) { |
|
| 93 | | lb->Clear(); | | |
| 94 | | char *words = new char[strlen(list) + 1]; | | |
| 95 | | if (words) { | | |
| 96 | | strcpy(words, list); | | |
| 97 | | char *startword = words; | | |
| 98 | | char *numword = NULL; | | |
| 99 | | int i = 0; | | |
| 100 | | for (; words && words[i]; i++) { | | |
| 101 | | if (words[i] == separator) { | | |
| 102 | | words[i] = '\0'; | | |
| 103 | | if (numword) | | |
| 104 | | *numword = '\0'; | | |
| 105 | | lb->Append(startword, numword?atoi(numword + 1):-1); | | |
| 106 | | startword = words + i + 1; | | |
| 107 | | numword = NULL; | | |
| 108 | | } else if (words[i] == typesep) { | | 94 | | lb->SetList(list, separator, typesep); |
| 109 | | numword = words + i; | | |
| 110 | | } | | |
| 111 | | } | | |
| 112 | | if (startword) { | | |
| 113 | | if (numword) | | |
| 114 | | *numword = '\0'; | | |
| 115 | | lb->Append(startword, numword?atoi(numword + 1):-1); | | |
| 116 | | } | | |
| 117 | | delete []words; | | |
| 118 | | } | | |
|
|
| 121 | | void AutoComplete::Show() { | | 97 | | void AutoComplete::Show(bool show) { |
| 122 | | lb->Show(); | | 98 | | lb->Show(show); |
| | | 99 | | if (show) |
| 123 | | lb->Select(0); | | 100 | | lb->Select(0); |
|
|
| 126 | | 103 | | void AutoComplete::Cancel() { |
|
| 127 | | 104 | | if (lb->Created()) { |
|
| | | 105 | | lb->Clear(); |
|
|
|
| 39 skipped lines |
|
|
| 172 | | 150 | | location = pivot; |
|
| | | 151 | | if (ignoreCase) { |
| | | 152 | | // Check for exact-case match |
| | | 153 | | for (; pivot <= end; pivot++) { |
| | | 154 | | lb->GetValue(pivot, item, maxItemLen); |
| | | 155 | | if (!strncmp(word, item, lenWord)) { |
| 2 skipped lines |
| | | 158 | | } |
| | | 159 | | if (CompareNCaseInsensitive(word, item, lenWord)) |
| | | 160 | | break; |
| | | 161 | | } |
| | | 162 | | } |
| 173 | | 163 | | } else if (cond < 0) { |
|
|
| 175 | | 165 | | } else if (cond > 0) { |
|
| 10 skipped lines |