X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/925e9792d32e353233985f53a4845f154e455a58..da98e15760bfcad41a5579e64955caadc2e535f3:/samples/grid/griddemo.cpp diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index 9464900565..74be937a4e 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -4,7 +4,7 @@ // Author: Michael Bedward // Modified by: // RCS-ID: $Id$ -// Copyright: (c) Michael Bedward, Julian Smart +// Copyright: (c) Michael Bedward, Julian Smart, Vadim Zeitlin // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -99,7 +99,7 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame ) EVT_MENU( ID_SET_CELL_FG_COLOUR, GridFrame::SetCellFgColour ) EVT_MENU( ID_SET_CELL_BG_COLOUR, GridFrame::SetCellBgColour ) - EVT_MENU( ID_ABOUT, GridFrame::About ) + EVT_MENU( wxID_ABOUT, GridFrame::About ) EVT_MENU( wxID_EXIT, GridFrame::OnQuit ) EVT_MENU( ID_VTABLE, GridFrame::OnVTable) EVT_MENU( ID_BUGS_TABLE, GridFrame::OnBugsTable) @@ -215,7 +215,7 @@ GridFrame::GridFrame() wxMenu *helpMenu = new wxMenu; - helpMenu->Append( ID_ABOUT, _T("&About wxGrid demo") ); + helpMenu->Append( wxID_ABOUT, _T("&About wxGrid demo") ); wxMenuBar *menuBar = new wxMenuBar; menuBar->Append( fileMenu, _T("&File") ); @@ -246,8 +246,8 @@ GridFrame::GridFrame() wxTE_MULTILINE ); logger = new wxLogTextCtrl( logWin ); - m_logOld = logger->SetActiveTarget( logger ); - logger->SetTimestamp( NULL ); + m_logOld = wxLog::SetActiveTarget( logger ); + wxLog::SetTimestamp( NULL ); #endif // wxUSE_LOG // this will create a grid and, by default, an associated grid @@ -661,10 +661,12 @@ void GridFrame::DeleteSelectedRows( wxCommandEvent& WXUNUSED(ev) ) { grid->BeginBatch(); for ( int n = 0; n < grid->GetNumberRows(); ) + { if ( grid->IsInSelection( n , 0 ) ) grid->DeleteRows( n, 1 ); - else - n++; + else + n++; + } grid->EndBatch(); } } @@ -676,10 +678,12 @@ void GridFrame::DeleteSelectedCols( wxCommandEvent& WXUNUSED(ev) ) { grid->BeginBatch(); for ( int n = 0; n < grid->GetNumberCols(); ) + { if ( grid->IsInSelection( 0 , n ) ) grid->DeleteCols( n, 1 ); - else - n++; + else + n++; + } grid->EndBatch(); } } @@ -888,7 +892,7 @@ void GridFrame::OnCellValueChanged( wxGridEvent& ev ) void GridFrame::OnCellBeginDrag( wxGridEvent& ev ) { - logBuf = _T(""); + logBuf = wxEmptyString; logBuf << _T("Got request to drag cell at") << _T(" row ") << ev.GetRow() << _T(" col ") << ev.GetCol(); @@ -935,8 +939,7 @@ void GridFrame::OnEditorHidden( wxGridEvent& ev ) void GridFrame::About( wxCommandEvent& WXUNUSED(ev) ) { (void)wxMessageBox( _T("\n\nwxGrid demo \n\n") - _T("Michael Bedward \n") - _T("mbedward@ozemail.com.au \n\n"), + _T("Michael Bedward, Julian Smart, Vadim Zeitlin"), _T("About"), wxOK ); } @@ -1197,10 +1200,13 @@ wxString BugsGridTable::GetValue( int row, int col ) switch ( col ) { case Col_Id: + return wxString::Format(_T("%d"), gd.id); + case Col_Priority: + return wxString::Format(_T("%d"), gd.prio); + case Col_Opened: - wxFAIL_MSG(_T("unexpected column")); - break; + return gd.opened ? _T("1") : _T("0"); case Col_Severity: return severities[gd.severity]; @@ -1258,7 +1264,10 @@ void BugsGridTable::SetValue( int row, int col, const wxString& value ) } } -bool BugsGridTable::CanGetValueAs( int WXUNUSED(row), int col, const wxString& typeName ) +bool +BugsGridTable::CanGetValueAs(int WXUNUSED(row), + int col, + const wxString& typeName) { if ( typeName == wxGRID_VALUE_STRING ) {