From: Vadim Zeitlin Date: Mon, 15 Sep 2008 14:09:26 +0000 (+0000) Subject: implement CreateGrid() in terms of SetTable() instead of duplicating its code and... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6b992f7df1ffe2fe4861eb2e95df2c79b9822d4a implement CreateGrid() in terms of SetTable() instead of duplicating its code and confusing the issue git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55646 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index e9c3813f83..9e05bb3158 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -4279,28 +4279,16 @@ void wxGrid::Create() } bool wxGrid::CreateGrid( int numRows, int numCols, - wxGrid::wxGridSelectionModes selmode ) + wxGridSelectionModes selmode ) { wxCHECK_MSG( !m_created, false, wxT("wxGrid::CreateGrid or wxGrid::SetTable called more than once") ); - m_numRows = numRows; - m_numCols = numCols; - - m_table = new wxGridStringTable( m_numRows, m_numCols ); - m_table->SetView( this ); - m_ownTable = true; - m_selection = new wxGridSelection( this, selmode ); - - CalcDimensions(); - - m_created = true; - - return m_created; + return SetTable(new wxGridStringTable(numRows, numCols), true, selmode); } -void wxGrid::SetSelectionMode(wxGrid::wxGridSelectionModes selmode) +void wxGrid::SetSelectionMode(wxGridSelectionModes selmode) { wxCHECK_RET( m_created, wxT("Called wxGrid::SetSelectionMode() before calling CreateGrid()") ); @@ -4310,14 +4298,16 @@ void wxGrid::SetSelectionMode(wxGrid::wxGridSelectionModes selmode) wxGrid::wxGridSelectionModes wxGrid::GetSelectionMode() const { - wxCHECK_MSG( m_created, wxGrid::wxGridSelectCells, + wxCHECK_MSG( m_created, wxGridSelectCells, wxT("Called wxGrid::GetSelectionMode() before calling CreateGrid()") ); return m_selection->GetSelectionMode(); } -bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership, - wxGrid::wxGridSelectionModes selmode ) +bool +wxGrid::SetTable(wxGridTableBase *table, + bool takeOwnership, + wxGrid::wxGridSelectionModes selmode ) { bool checkSelection = false; if ( m_created )