diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 2a7286bdfb..c8b833419c 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -346,8 +346,11 @@ public: virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; virtual bool MSWShouldPreProcessMessage(WXMSG* msg) wxOVERRIDE; +#if WXWIN_COMPATIBILITY_3_0 // bring the control in sync with current m_windowStyle value + wxDEPRECATED_MSG("useless and will be removed in the future, use SetWindowStyleFlag() instead") void UpdateStyle(); +#endif // WXWIN_COMPATIBILITY_3_0 // Event handlers //////////////////////////////////////////////////////////////////////////// diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index a263a8e152..ad7db78eba 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -403,6 +403,8 @@ WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const return wstyle; } +#if WXWIN_COMPATIBILITY_3_0 +// Deprecated void wxListCtrl::UpdateStyle() { if ( GetHwnd() ) @@ -428,11 +430,12 @@ void wxListCtrl::UpdateStyle() // if we switched to the report view, set the extended styles for // it too - if ( !(dwStyleOld & LVS_REPORT) && (dwStyleNew & LVS_REPORT) ) + if ( (dwStyleOld & LVS_TYPEMASK) != LVS_REPORT && (dwStyleNew & LVS_TYPEMASK) == LVS_REPORT ) MSWSetExListStyles(); } } } +#endif // WXWIN_COMPATIBILITY_3_0 void wxListCtrl::FreeAllInternalData() { @@ -504,9 +507,17 @@ void wxListCtrl::SetWindowStyleFlag(long flag) { const bool wasInReportView = InReportView(); + // we don't have wxVSCROLL style, but the list control may have it, + // don't change it then in the call to parent's SetWindowStyleFlags() + DWORD dwStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE); + flag &= ~(wxHSCROLL | wxVSCROLL); + if ( dwStyle & WS_HSCROLL ) + flag |= wxHSCROLL; + if ( dwStyle & WS_VSCROLL ) + flag |= wxVSCROLL; wxListCtrlBase::SetWindowStyleFlag(flag); - - UpdateStyle(); + // As it was said, we don't have wxSCROLL style + m_windowStyle &= ~(wxHSCROLL | wxVSCROLL); // if we switched to the report view, set the extended styles for // it too