Stop deriving wxGrid from wxPanel

This is unnecessary as TAB navigation is not supposed to work between
wxGrid children and actually harmful as this resulted in SetFocus()
doing nothing, instead of setting focus to wxGridWindow, if the focus
was on wxGrid itself for some reason (this happened at least in the grid
unit tests and resulted in failures because the in-place editor didn't
appear as expected).
This commit is contained in:
Vadim Zeitlin
2019-10-18 01:37:11 +02:00
parent 8ed116bdc6
commit 9a424602e4
2 changed files with 9 additions and 9 deletions

View File

@@ -946,7 +946,7 @@ struct WXDLLIMPEXP_CORE wxGridSizesInfo
// wxGrid // wxGrid
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGrid : public wxScrolledWindow class WXDLLIMPEXP_CORE wxGrid : public wxScrolledCanvas
{ {
public: public:
// possible selection modes // possible selection modes
@@ -2287,7 +2287,7 @@ protected:
private: private:
// implement wxScrolledWindow method to return m_gridWin size // implement wxScrolledCanvas method to return m_gridWin size
virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) wxOVERRIDE; virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) wxOVERRIDE;
// depending on the values of m_numFrozenRows and m_numFrozenCols, it will // depending on the values of m_numFrozenRows and m_numFrozenCols, it will

View File

@@ -2257,7 +2257,7 @@ void wxGridWindow::OnFocus(wxFocusEvent& event)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
wxBEGIN_EVENT_TABLE( wxGrid, wxScrolledWindow ) wxBEGIN_EVENT_TABLE( wxGrid, wxScrolledCanvas )
EVT_PAINT( wxGrid::OnPaint ) EVT_PAINT( wxGrid::OnPaint )
EVT_SIZE( wxGrid::OnSize ) EVT_SIZE( wxGrid::OnSize )
EVT_KEY_DOWN( wxGrid::OnKeyDown ) EVT_KEY_DOWN( wxGrid::OnKeyDown )
@@ -2271,7 +2271,7 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style, const wxString& name) long style, const wxString& name)
{ {
if (!wxScrolledWindow::Create(parent, id, pos, size, if (!wxScrolledCanvas::Create(parent, id, pos, size,
style | wxWANTS_CHARS, name)) style | wxWANTS_CHARS, name))
return false; return false;
@@ -3390,7 +3390,7 @@ wxGridCellCoordsArray wxGrid::CalcCellsExposed( const wxRegion& reg,
void wxGrid::PrepareDCFor(wxDC &dc, wxGridWindow *gridWindow) void wxGrid::PrepareDCFor(wxDC &dc, wxGridWindow *gridWindow)
{ {
wxScrolledWindow::PrepareDC( dc ); wxScrolledCanvas::PrepareDC( dc );
wxPoint dcOrigin = dc.GetDeviceOrigin() - GetGridWindowOffset(gridWindow); wxPoint dcOrigin = dc.GetDeviceOrigin() - GetGridWindowOffset(gridWindow);
@@ -5186,7 +5186,7 @@ void wxGrid::Refresh(bool eraseb, const wxRect* rect)
if ( m_created && !GetBatchCount() ) if ( m_created && !GetBatchCount() )
{ {
// Refresh to get correct scrolled position: // Refresh to get correct scrolled position:
wxScrolledWindow::Refresh(eraseb, rect); wxScrolledCanvas::Refresh(eraseb, rect);
if (rect) if (rect)
{ {
@@ -6824,7 +6824,7 @@ void wxGrid::ForceRefresh()
void wxGrid::DoEnable(bool enable) void wxGrid::DoEnable(bool enable)
{ {
wxScrolledWindow::DoEnable(enable); wxScrolledCanvas::DoEnable(enable);
Refresh(false /* don't erase background */); Refresh(false /* don't erase background */);
} }
@@ -7908,7 +7908,7 @@ void wxGrid::SetRowLabelSize( int width )
m_rowLabelWidth = width; m_rowLabelWidth = width;
InvalidateBestSize(); InvalidateBestSize();
CalcWindowSizes(); CalcWindowSizes();
wxScrolledWindow::Refresh( true ); wxScrolledCanvas::Refresh( true );
} }
} }
@@ -7938,7 +7938,7 @@ void wxGrid::SetColLabelSize( int height )
m_colLabelHeight = height; m_colLabelHeight = height;
InvalidateBestSize(); InvalidateBestSize();
CalcWindowSizes(); CalcWindowSizes();
wxScrolledWindow::Refresh( true ); wxScrolledCanvas::Refresh( true );
} }
} }