Share more code.
This commit is contained in:
+78
-14
@@ -309,8 +309,7 @@ void WX_GRID::EnableAlternateRowColors( bool aEnable )
|
||||
{
|
||||
wxGridTableBase* table = wxGrid::GetTable();
|
||||
|
||||
wxCHECK_MSG( table, /* void */,
|
||||
"Tried to enable alternate row colors without a table assigned to the grid" );
|
||||
wxCHECK_MSG( table, /* void */, "Tried to enable alternate row colors without a table assigned to the grid" );
|
||||
|
||||
if( aEnable )
|
||||
{
|
||||
@@ -510,18 +509,6 @@ void WX_GRID::ShowHideColumns( const wxString& shownColumns )
|
||||
}
|
||||
|
||||
|
||||
void WX_GRID::ShowHideColumns( const std::bitset<64>& aShownColumns )
|
||||
{
|
||||
for( int ii = 0; ii < GetNumberCols(); ++ ii )
|
||||
{
|
||||
if( aShownColumns[ii] )
|
||||
ShowCol( ii );
|
||||
else
|
||||
HideCol( ii );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WX_GRID::DrawCornerLabel( wxDC& dc )
|
||||
{
|
||||
if( m_nativeColumnLabels )
|
||||
@@ -745,6 +732,83 @@ void WX_GRID::OnDeleteRows( const std::function<bool( int row )>& aFilter,
|
||||
}
|
||||
|
||||
|
||||
void WX_GRID::SwapRows( int aRowA, int aRowB )
|
||||
{
|
||||
for( int col = 0; col < GetNumberCols(); ++col )
|
||||
{
|
||||
wxString temp = GetCellValue( aRowA, col );
|
||||
SetCellValue( aRowA, col, GetCellValue( aRowB, col ) );
|
||||
SetCellValue( aRowB, col, temp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WX_GRID::OnMoveRowUp( const std::function<void( int row )>& aMover )
|
||||
{
|
||||
OnMoveRowUp(
|
||||
[]( int row )
|
||||
{
|
||||
return true;
|
||||
},
|
||||
aMover );
|
||||
}
|
||||
|
||||
|
||||
void WX_GRID::OnMoveRowUp( const std::function<bool( int row )>& aFilter,
|
||||
const std::function<void( int row )>& aMover )
|
||||
{
|
||||
if( !CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
int i = GetGridCursorRow();
|
||||
|
||||
if( i > 0 && aFilter( i ) )
|
||||
{
|
||||
aMover( i );
|
||||
|
||||
SetGridCursor( i - 1, GetGridCursorCol() );
|
||||
MakeCellVisible( GetGridCursorRow(), GetGridCursorCol() );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WX_GRID::OnMoveRowDown( const std::function<void( int row )>& aMover )
|
||||
{
|
||||
OnMoveRowDown(
|
||||
[]( int row )
|
||||
{
|
||||
return true;
|
||||
},
|
||||
aMover );
|
||||
}
|
||||
|
||||
|
||||
void WX_GRID::OnMoveRowDown( const std::function<bool( int row )>& aFilter,
|
||||
const std::function<void( int row )>& aMover )
|
||||
{
|
||||
if( !CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
int i = GetGridCursorRow();
|
||||
|
||||
if( i + 1 < GetNumberRows() && aFilter( i ) )
|
||||
{
|
||||
aMover( i );
|
||||
|
||||
SetGridCursor( i + 1, GetGridCursorCol() );
|
||||
MakeCellVisible( GetGridCursorRow(), GetGridCursorCol() );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WX_GRID::SetUnitsProvider( UNITS_PROVIDER* aProvider, int aCol )
|
||||
{
|
||||
m_unitsProviders[ aCol ] = aProvider;
|
||||
|
||||
Reference in New Issue
Block a user