{
wxGridCellRenderer* renderer = NULL;
- if ( m_defGridAttr != this || grid == NULL )
+ if ( m_defGridAttr == this || grid == NULL )
{
renderer = m_renderer; // use local attribute
if ( renderer )
}
else
{
+ // free the old attribute
+ m_attrs[(size_t)n].attr->DecRef();
+
if ( attr )
{
// change the attribute
wxDefaultSize );
SetTargetWindow( m_gridWin );
+
+ Init();
}
m_table->SetView( this );
m_ownTable = TRUE;
m_selection = new wxGridSelection( this, selmode );
- Init();
+
+ CalcDimensions();
+
m_created = TRUE;
return m_created;
void wxGrid::SetSelectionMode(wxGrid::wxGridSelectionModes selmode)
{
- if ( !m_created )
- {
- wxFAIL_MSG( wxT("Called wxGrid::SetSelectionMode() before calling CreateGrid()") );
- }
- else
- m_selection->SetSelectionMode( selmode );
+ wxCHECK_RET( m_created,
+ wxT("Called wxGrid::SetSelectionMode() before calling CreateGrid()") );
+
+ m_selection->SetSelectionMode( selmode );
}
bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
if (takeOwnership)
m_ownTable = TRUE;
m_selection = new wxGridSelection( this, selmode );
- Init();
+
+ CalcDimensions();
+
m_created = TRUE;
}
m_extraWidth =
m_extraHeight = 50;
-
- CalcDimensions();
}
// ----------------------------------------------------------------------------
wxMouseEvent& mouseEv )
{
bool claimed;
- bool vetoed= false;
+ bool vetoed= FALSE;
if ( type == wxEVT_GRID_ROW_SIZE || type == wxEVT_GRID_COL_SIZE )
{
mouseEv.ShiftDown(),
mouseEv.AltDown(),
mouseEv.MetaDown() );
-
+
claimed = GetEventHandler()->ProcessEvent(gridEvt);
vetoed = !gridEvt.IsAllowed();
claimed = GetEventHandler()->ProcessEvent(gridEvt);
vetoed = !gridEvt.IsAllowed();
}
-
- // A Veto'd event may not be `claimed' so test this first
+
+ // A Veto'd event may not be `claimed' so test this first
if (vetoed) return -1;
return claimed ? 1 : 0;
-
+
}
int row, int col )
{
bool claimed;
- bool vetoed= false;
+ bool vetoed= FALSE;
if ( type == wxEVT_GRID_ROW_SIZE || type == wxEVT_GRID_COL_SIZE )
{
vetoed = !gridEvt.IsAllowed();
}
- // A Veto'd event may not be `claimed' so test this first
+ // A Veto'd event may not be `claimed' so test this first
if (vetoed) return -1;
return claimed ? 1 : 0;
{
if ( enable )
{
- if (SendEvent( wxEVT_GRID_EDITOR_SHOWN) <0)
- return;
+ if (SendEvent( wxEVT_GRID_EDITOR_SHOWN) <0)
+ return;
// this should be checked by the caller!
wxASSERT_MSG( CanEnableCellControl(),