コード例 #1
0
ファイル: SaveFileDialog.cpp プロジェクト: matt474/freeorion
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();
}
コード例 #2
0
ファイル: CombatSetupWnd.cpp プロジェクト: anarsky/freeorion
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);
    }
}