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