Merge branch 'msw-double-buffer'
Improve double-buffering support in wxMSW wxListCtrl and optionally use it in wxTreeCtrl too. Closes https://github.com/wxWidgets/wxWidgets/pull/636
This commit is contained in:
@@ -442,6 +442,8 @@ wxMSW:
|
|||||||
- Fix UTF-32 conversion for non-BMP characters (ARATA Mizuki).
|
- Fix UTF-32 conversion for non-BMP characters (ARATA Mizuki).
|
||||||
- Use correct parent for the native modal dialogs (Andreas Falkenhahn).
|
- Use correct parent for the native modal dialogs (Andreas Falkenhahn).
|
||||||
- Fix layout of wxSlider with wxSL_VALUE_LABEL only (gafatoa).
|
- Fix layout of wxSlider with wxSL_VALUE_LABEL only (gafatoa).
|
||||||
|
- Fix flicker when resizing columns of report-mode wxListCtrl.
|
||||||
|
- Implement wxTreeCtrl::SetDoubleBuffered() (Steve Browne).
|
||||||
|
|
||||||
wxOSX/Cocoa:
|
wxOSX/Cocoa:
|
||||||
|
|
||||||
|
@@ -244,6 +244,10 @@
|
|||||||
#define TV_FIRST 0x1100
|
#define TV_FIRST 0x1100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TVS_EX_DOUBLEBUFFER
|
||||||
|
#define TVS_EX_DOUBLEBUFFER 0x0004
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef TVS_FULLROWSELECT
|
#ifndef TVS_FULLROWSELECT
|
||||||
#define TVS_FULLROWSELECT 0x1000
|
#define TVS_FULLROWSELECT 0x1000
|
||||||
#endif
|
#endif
|
||||||
@@ -253,6 +257,11 @@
|
|||||||
#define TVM_SETTEXTCOLOR (TV_FIRST + 30)
|
#define TVM_SETTEXTCOLOR (TV_FIRST + 30)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TVM_SETEXTENDEDSTYLE
|
||||||
|
#define TVM_SETEXTENDEDSTYLE (TV_FIRST + 44)
|
||||||
|
#define TVM_GETEXTENDEDSTYLE (TV_FIRST + 45)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Various defines used by the webview library that are needed by mingw
|
// Various defines used by the webview library that are needed by mingw
|
||||||
|
|
||||||
#ifndef DISPID_COMMANDSTATECHANGE
|
#ifndef DISPID_COMMANDSTATECHANGE
|
||||||
|
@@ -202,6 +202,9 @@ public:
|
|||||||
// returns true if the platform should explicitly apply a theme border
|
// returns true if the platform should explicitly apply a theme border
|
||||||
virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; }
|
virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; }
|
||||||
|
|
||||||
|
virtual bool IsDoubleBuffered() const wxOVERRIDE;
|
||||||
|
virtual void SetDoubleBuffered(bool on) wxOVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Implement "update locking" in a custom way for this control.
|
// Implement "update locking" in a custom way for this control.
|
||||||
virtual void DoFreeze() wxOVERRIDE;
|
virtual void DoFreeze() wxOVERRIDE;
|
||||||
|
@@ -334,6 +334,10 @@ void wxListCtrl::MSWSetExListStyles()
|
|||||||
// it seems better to enable it by default than disable
|
// it seems better to enable it by default than disable
|
||||||
LVS_EX_HEADERDRAGDROP
|
LVS_EX_HEADERDRAGDROP
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// As we use LVS_EX_DOUBLEBUFFER above, we don't need to erase our
|
||||||
|
// background and doing it only results in flicker.
|
||||||
|
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
|
WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
|
||||||
|
@@ -796,6 +796,46 @@ bool wxTreeCtrl::Create(wxWindow *parent,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxTreeCtrl::IsDoubleBuffered() const
|
||||||
|
{
|
||||||
|
if ( !GetHwnd() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Notice that TVM_GETEXTENDEDSTYLE is supported since XP, so we can always
|
||||||
|
// send this message, no need for comctl32.dll version check here.
|
||||||
|
const LRESULT
|
||||||
|
exTreeStyle = ::SendMessage(GetHwnd(), TVM_GETEXTENDEDSTYLE, 0, 0);
|
||||||
|
|
||||||
|
return (exTreeStyle & TVS_EX_DOUBLEBUFFER) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxTreeCtrl::SetDoubleBuffered(bool on)
|
||||||
|
{
|
||||||
|
if ( !GetHwnd() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// TVS_EX_DOUBLEBUFFER is only supported since Vista, don't try to set it
|
||||||
|
// under XP, who knows what could this do.
|
||||||
|
if ( wxApp::GetComCtl32Version() >= 610 )
|
||||||
|
{
|
||||||
|
const HRESULT hr = ::SendMessage(GetHwnd(),
|
||||||
|
TVM_SETEXTENDEDSTYLE,
|
||||||
|
TVS_EX_DOUBLEBUFFER,
|
||||||
|
on ? TVS_EX_DOUBLEBUFFER : 0);
|
||||||
|
if ( hr == S_OK )
|
||||||
|
{
|
||||||
|
// There is no need to erase background for a double-buffered
|
||||||
|
// window, so disable it when enabling double buffering and restore
|
||||||
|
// the default background style value when disabling it.
|
||||||
|
SetBackgroundStyle(on ? wxBG_STYLE_PAINT : wxBG_STYLE_ERASE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogApiError("TreeView_SetExtendedStyle(TVS_EX_DOUBLEBUFFER)", hr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxTreeCtrl::~wxTreeCtrl()
|
wxTreeCtrl::~wxTreeCtrl()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
m_isBeingDeleted = true;
|
||||||
|
Reference in New Issue
Block a user