X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8497bbf52d4f7e37a6555040ae7def97d2618fe0..c3e016e45e2e64b6fbf1eecfdd07448044995b93:/src/generic/grid.cpp diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index a2994e1679..0e77e10991 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1234,7 +1234,7 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event) // ---------------------------------------------------------------------------- // the default values for GetValue() -wxString wxGridCellBoolEditor::ms_stringValues[2] = { _T("1"), _T("") }; +wxString wxGridCellBoolEditor::ms_stringValues[2] = { _T(""), _T("1") }; void wxGridCellBoolEditor::Create(wxWindow* parent, wxWindowID id, @@ -4163,7 +4163,7 @@ wxGrid::wxGrid( wxWindow *parent, m_rowMinHeights(GRID_HASH_SIZE) { Create(); - SetBestFittingSize(size); + SetInitialSize(size); } bool wxGrid::Create(wxWindow *parent, wxWindowID id, @@ -4178,7 +4178,7 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id, m_rowMinHeights = wxLongToLongHashMap(GRID_HASH_SIZE); Create(); - SetBestFittingSize(size); + SetInitialSize(size); return true; } @@ -4198,8 +4198,12 @@ wxGrid::~wxGrid() total ? (gs_nAttrCacheHits*100) / total : 0); #endif - if (m_ownTable) + // if we own the table, just delete it, otherwise at least don't leave it + // with dangling view pointer + if ( m_ownTable ) delete m_table; + else if ( m_table && m_table->GetView() == this ) + m_table->SetView(NULL); delete m_typeRegistry; delete m_selection; @@ -7098,8 +7102,10 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) return; } +#if !(defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS) wxClientDC dc( m_gridWin ); PrepareDC( dc ); +#endif if ( m_currentCellCoords != wxGridNoCellCoords ) { @@ -7122,15 +7128,21 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) // Otherwise refresh redraws the highlight! m_currentCellCoords = coords; +#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS + m_gridWin->Refresh(true /*, & r */); +#else DrawGridCellArea( dc, cells ); DrawAllGridLines( dc, r ); +#endif } } m_currentCellCoords = coords; wxGridCellAttr *attr = GetCellAttr( coords ); +#if !(defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS) DrawCellHighlight( dc, attr ); +#endif attr->DecRef(); } @@ -7506,7 +7518,7 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords ) // edit control is erased by this code after being rendered. // On wxMac (QD build only), the cell editor is a wxTextCntl and is rendered // implicitly, causing this out-of order render. -#if !defined(__WXMAC__) || wxMAC_USE_CORE_GRAPHICS +#if !defined(__WXMAC__) wxGridCellEditor *editor = attr->GetEditor(this, row, col); editor->PaintBackground(rect, attr); editor->DecRef(); @@ -7701,17 +7713,16 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) ) int rightCol = GetColPos( internalXToCol(right) ); int bottomRow = internalYToRow(bottom); -#ifndef __WXMAC__ - // CS: I don't know why suddenly unscrolled coordinates are used for clipping +#if !defined(__WXMAC__) || wxMAC_USE_CORE_GRAPHICS wxRegion clippedcells(0, 0, cw, ch); int i, j, cell_rows, cell_cols; wxRect rect; - for (j=topRow; j<bottomRow; j++) + for (j=topRow; j<=bottomRow; j++) { int colPos; - for (colPos=leftCol; colPos<rightCol; colPos++) + for (colPos=leftCol; colPos<=rightCol; colPos++) { i = GetColAt( colPos ); @@ -7736,9 +7747,9 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) ) int i, j, cell_rows, cell_cols; wxRect rect; - for (j=topRow; j<bottomRow; j++) + for (j=topRow; j<=bottomRow; j++) { - for (i=leftCol; i<rightCol; i++) + for (i=leftCol; i<=rightCol; i++) { GetCellSize( j, i, &cell_rows, &cell_cols ); if ((cell_rows > 1) || (cell_cols > 1))