/* BrowserCanvas::filterItems * Filters the visible items by [filter], by name *******************************************************************/ void BrowserCanvas::filterItems(string filter) { // Clear current filter list items_filter.clear(); // If the filter is empty, just add all items to the filter if (filter.IsEmpty()) { for (unsigned a = 0; a < items.size(); a++) items_filter.push_back(a); } else { // Setup filter string filter.MakeLower(); filter += "*"; // Go through items for (unsigned a = 0; a < items.size(); a++) { // Add to filter list if name matches if (items[a]->getName().Lower().Matches(filter)) items_filter.push_back(a); } } // Update scrollbar and refresh updateScrollBar(); Refresh(); }
/* BrowserCanvas::filterItems * Filters the visible items by [filter], by name *******************************************************************/ void BrowserCanvas::filterItems(string filter) { // Find the currently-viewed item before we change the item list int viewed_index = getViewedIndex(); // Clear current filter list items_filter.clear(); // If the filter is empty, just add all items to the filter if (filter.IsEmpty()) { for (unsigned a = 0; a < items.size(); a++) items_filter.push_back(a); } else { // Setup filter string filter.MakeLower(); filter += "*"; // Go through items for (unsigned a = 0; a < items.size(); a++) { // Add to filter list if name matches if (items[a]->getName().Lower().Matches(filter)) items_filter.push_back(a); } } // Update scrollbar and refresh updateLayout(viewed_index); }
/* Executables::addGameExe * Adds a new game executable definition for game [name] *******************************************************************/ void Executables::addGameExe(string name) { game_exe_t game; game.name = name; name.Replace(" ", "_"); name.MakeLower(); game.id = name; game_exes.push_back(game); }