Add more convenient wxGrid::ProcessTableMessage() overload
This allows to write the same thing in a shorter way without any loss of clarity.
This commit is contained in:
parent
2dafdbbed0
commit
7ee384389b
3 changed files with 29 additions and 18 deletions
|
|
@ -1553,6 +1553,9 @@ public:
|
|||
wxGridSelectionModes selmode = wxGridSelectCells );
|
||||
|
||||
bool ProcessTableMessage(const wxGridTableMessage&);
|
||||
bool ProcessTableMessage(wxGridTableBase *table, int id,
|
||||
int comInt1 = -1,
|
||||
int comInt2 = -1);
|
||||
|
||||
wxGridTableBase *GetTable() const { return m_table; }
|
||||
|
||||
|
|
|
|||
|
|
@ -3118,6 +3118,19 @@ public:
|
|||
*/
|
||||
bool ProcessTableMessage(const wxGridTableMessage& msg);
|
||||
|
||||
/**
|
||||
Convenient overload for notifying the grid about changes to its shape.
|
||||
|
||||
This is identical to the overload taking wxGridTableMessage and simply
|
||||
constructs the message object from the function arguments and then
|
||||
calls the other overload with this object.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
bool ProcessTableMessage(wxGridTableBase *table, int id,
|
||||
int comInt1 = -1,
|
||||
int comInt2 = -1);
|
||||
|
||||
///@}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1876,12 +1876,10 @@ bool wxGridStringTable::InsertRows( size_t pos, size_t numRows )
|
|||
|
||||
if ( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this,
|
||||
GetView()->ProcessTableMessage( this,
|
||||
wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
|
||||
pos,
|
||||
numRows );
|
||||
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1900,11 +1898,9 @@ bool wxGridStringTable::AppendRows( size_t numRows )
|
|||
|
||||
if ( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this,
|
||||
GetView()->ProcessTableMessage( this,
|
||||
wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
|
||||
numRows );
|
||||
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1943,12 +1939,10 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows )
|
|||
|
||||
if ( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this,
|
||||
GetView()->ProcessTableMessage( this,
|
||||
wxGRIDTABLE_NOTIFY_ROWS_DELETED,
|
||||
pos,
|
||||
numRows );
|
||||
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1981,12 +1975,10 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols )
|
|||
|
||||
if ( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this,
|
||||
GetView()->ProcessTableMessage( this,
|
||||
wxGRIDTABLE_NOTIFY_COLS_INSERTED,
|
||||
pos,
|
||||
numCols );
|
||||
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -2003,11 +1995,9 @@ bool wxGridStringTable::AppendCols( size_t numCols )
|
|||
|
||||
if ( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this,
|
||||
GetView()->ProcessTableMessage( this,
|
||||
wxGRIDTABLE_NOTIFY_COLS_APPENDED,
|
||||
numCols );
|
||||
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -2074,12 +2064,10 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols )
|
|||
|
||||
if ( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this,
|
||||
GetView()->ProcessTableMessage( this,
|
||||
wxGRIDTABLE_NOTIFY_COLS_DELETED,
|
||||
pos,
|
||||
numCols );
|
||||
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -5565,6 +5553,13 @@ bool wxGrid::ProcessTableMessage( const wxGridTableMessage& msg )
|
|||
}
|
||||
}
|
||||
|
||||
bool wxGrid::ProcessTableMessage(wxGridTableBase *table, int id,
|
||||
int comInt1,
|
||||
int comInt2)
|
||||
{
|
||||
return ProcessTableMessage(wxGridTableMessage(table, id, comInt1, comInt2));
|
||||
}
|
||||
|
||||
// The behaviour of this function depends on the grid table class
|
||||
// Clear() function. For the default wxGridStringTable class the
|
||||
// behaviour is to replace all cell contents with wxEmptyString but
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue