void PlayerListWnd::PlayerSelectionChanged(const GG::ListBox::SelectionSet& rows) { // mark as selected all PlayerDataPanel that are in \a rows and mark as not // selected all PlayerDataPanel that aren't in \a rows for (GG::ListBox::iterator it = m_player_list->begin(); it != m_player_list->end(); ++it) { bool select_this_row = (rows.find(it) != rows.end()); GG::ListBox::Row* row = *it; if (!row) { ErrorLogger() << "PlayerListWnd::PlayerSelectionChanged couldn't get row"; continue; } if (row->empty()) { ErrorLogger() << "PlayerListWnd::PlayerSelectionChanged got empty row"; continue; } GG::Control* control = !row->empty() ? row->at(0) : nullptr; if (!control) { ErrorLogger() << "PlayerListWnd::PlayerSelectionChanged couldn't get control from row"; continue; } PlayerDataPanel* data_panel = dynamic_cast<PlayerDataPanel*>(control); if (!data_panel) { ErrorLogger() << "PlayerListWnd::PlayerSelectionChanged couldn't get PlayerDataPanel from control"; continue; } data_panel->Select(select_this_row); } SelectedPlayersChangedSignal(); }
void SaveFileDialog::SelectionChanged(const GG::ListBox::SelectionSet& selections) { if ( selections.size() == 1 ) { auto& row = **selections.begin(); SaveFileRow* save_row = boost::polymorphic_downcast<SaveFileRow*> (row.get()); m_name_edit -> SetText ( save_row->Filename() ); } else { DebugLogger() << "SaveFileDialog::SelectionChanged: Unexpected selection size: " << selections.size(); } CheckChoiceValidity(); }
void CombatSetupWnd::PlaceableShipSelected_(const GG::ListBox::SelectionSet& sels) { assert(sels.size() <= 1u); if (sels.empty()) { PlaceableShipSelected(0); UpdatePlacementIndicators(0); } else { GG::ListBox::Row* row = **sels.begin(); ShipRow* ship_row = boost::polymorphic_downcast<ShipRow*>(row); PlaceableShipSelected(const_cast<Ship*>(ship_row->m_ship)); UpdatePlacementIndicators(ship_row->m_ship); } }
void ServerConnectWnd::ServerSelected(const GG::ListBox::SelectionSet& selections) { if (!selections.empty()) *m_IP_address_edit << ""; EnableDisableControls(); }