void tgame_load::delete_button_callback(twindow& window) { if (current_page_ != LOCAL_PAGE) { return; } tlistbox& list = *lists_[current_page_]; const size_t index = size_t(list.get_selected_row()); if (index < games_.size()) { // See if we should ask the user for deletion confirmation if (preferences::ask_delete_saves()) { if(!gui2::tgame_delete::execute(window.video())) { return; } } // Delete the file savegame::manager::delete_game(games_[index].name); // Remove it from the list of saves games_.erase(games_.begin() + index); list.remove_row(index); display_savegame(window, list); } }
void tgame_load::pre_show(CVideo& /*video*/, twindow& window) { assert(txtFilter_); find_widget<tminimap>(&window, "minimap", false).set_config(&cache_config_); ttext_box* filter = find_widget<ttext_box>( &window, "txtFilter", false, true); window.keyboard_capture(filter); filter->set_text_changed_callback(boost::bind( &tgame_load::filter_text_changed, this, _1, _2)); tlistbox* list = find_widget<tlistbox>( &window, "savegame_list", false, true); window.keyboard_capture(list); #ifdef GUI2_EXPERIMENTAL_LISTBOX connect_signal_notify_modified(*list, boost::bind( &tgame_load::list_item_clicked , *this , boost::ref(window))); #else list->set_callback_value_change( dialog_callback<tgame_load, &tgame_load::list_item_clicked>); #endif { cursor::setter cur(cursor::WAIT); games_ = savegame::manager::get_saves_list(); } fill_game_list(window, games_); connect_signal_mouse_left_click( find_widget<tbutton>(&window, "delete", false) , boost::bind( &tgame_load::delete_button_callback , this , boost::ref(window))); display_savegame(window); }
void tgame_load::list_item_clicked(twindow& window, tlistbox& list, const int type) { display_savegame(window, list); }
void tgame_load::list_item_clicked(twindow& window) { display_savegame(window); }