diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index 29cfb3de29..7bd7358d99 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -37,6 +37,8 @@ #include "wx/intl.h" #endif +#include "wx/dcbuffer.h" // for wxALWAYS_NATIVE_DOUBLE_BUFFER + // This define is necessary to prevent macro clearing #define __wxPG_SOURCE_FILE__ @@ -587,7 +589,12 @@ void wxPropertyGridManager::Init2( int style ) m_pState = m_pPropGrid->m_pState; + // Rely on native double-buffering by default. +#if wxALWAYS_NATIVE_DOUBLE_BUFFER + m_pPropGrid->SetExtraStyle(wxPG_EX_INIT_NOCAT | wxPG_EX_NATIVE_DOUBLE_BUFFERING); +#else m_pPropGrid->SetExtraStyle(wxPG_EX_INIT_NOCAT); +#endif // wxALWAYS_NATIVE_DOUBLE_BUFFER/!wxALWAYS_NATIVE_DOUBLE_BUFFER // Connect to property grid onselect event. // NB: Even if wxID_ANY is used, this doesn't connect properly in wxPython diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index af037b9b44..6ced9091b7 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -484,6 +484,11 @@ void wxPropertyGrid::Init2() // This helps with flicker SetBackgroundStyle( wxBG_STYLE_CUSTOM ); + // Rely on native double-buffering by default. +#if wxALWAYS_NATIVE_DOUBLE_BUFFER + SetExtraStyle(GetExtraStyle() | wxPG_EX_NATIVE_DOUBLE_BUFFERING); +#endif // wxALWAYS_NATIVE_DOUBLE_BUFFER + // Hook the top-level parent m_tlpClosed = NULL; m_tlpClosedTime = 0; @@ -1153,26 +1158,9 @@ void wxPropertyGrid::SetExtraStyle( long exStyle ) if ( exStyle & wxPG_EX_NATIVE_DOUBLE_BUFFERING ) { -#if defined(__WXMSW__) - - /* - // Don't use WS_EX_COMPOSITED just now. - HWND hWnd; - - if ( m_iFlags & wxPG_FL_IN_MANAGER ) - hWnd = (HWND)GetParent()->GetHWND(); - else - hWnd = (HWND)GetHWND(); - - ::SetWindowLong( hWnd, GWL_EXSTYLE, - ::GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_COMPOSITED ); - */ - -//#elif defined(__WXGTK20__) -#endif // Only apply wxPG_EX_NATIVE_DOUBLE_BUFFERING if the window // truly was double-buffered. - if ( !this->IsDoubleBuffered() ) + if ( !IsDoubleBuffered() ) { exStyle &= ~(wxPG_EX_NATIVE_DOUBLE_BUFFERING); }