Exemplo n.º 1
0
void PanelSurface::OnSurfaceClose( wxCommandEvent& event )
{
  LayerCollection* lc = MainWindow::GetMainWindowPointer()->GetLayerCollection( "Surface" );
  int nSel = m_listBoxLayers->GetSelection();
  if ( lc && nSel != wxNOT_FOUND )
  {
    Layer* layer = ( Layer* )( void* )m_listBoxLayers->GetClientData( nSel );    

    m_listBoxLayers->Delete( nSel );   

    if ( (int)m_listBoxLayers->GetCount() > nSel )
      m_listBoxLayers->SetSelection( nSel );
    else if ( nSel >= 1 )
      m_listBoxLayers->SetSelection( nSel - 1 );        

    if ( layer )
      lc->RemoveLayer( layer );

    UpdateUI();
  }
}