173 {
174 widget.ClearItems();
175
178
180
182
183 for (int i = 0; i < classes.Count(); i++)
184 {
185 string config_path = classes.Get(i);
186
187 int objects_count =
g_Game.ConfigGetChildrenCount(config_path);
188 for (int j = 0; j < objects_count; j++)
189 {
190 string child_name;
191 bool add = false;
192 g_Game.ConfigGetChildName(config_path, j, child_name);
193
194 if (!filters.Count())
195 {
196 add = true;
197 }
198 else
199 {
200 foreach (int indx, string filter:filters)
201 {
202 string child_name_lower = child_name;
204
205 if (child_name_lower.
Contains(filter))
206 {
207 add = true;
208 break;
209 }
210 }
211 }
212 if (add)
213 itemsArray.Insert(child_name);
214 }
215 }
216
217 if (itemsArray)
218 {
219 itemsArray.Sort();
220 foreach (string it:itemsArray)
221 {
222 widget.AddItem(it, NULL, 0);
223 }
224 }
225
226 if (filters)
227 {
228
229
230
231
232 foreach (string f:filters)
233 {
235 if (arr2)
236 {
237 arr2.Sort();
238 foreach (string itm: arr2)
239 {
240 int row = widget.AddItem(itm, NULL, 0);
241 }
242 }
243 }
244 }
245
246
247 }
void PrepareFilters(string filter, out TStringArray filters)
array< string > TStringArray
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.