Fix setting style flags in wxListCtrl (wxMSW)

UpdateStyle() function was introduced in edccf428 to synchronize in
SetWindowStyleFlag() style of the control with new style flags just stored
in m_windowStyle.
In 9a8d75f1, storing directly a new flags in m_windowStyle was replaced by
the call to parent's SetWindowStyleFlag().
Because call to parent's SetWindowStyleFlag() updates both m_windowStyle
and actual style of the control for common flags (WS_*, LVS_* flags),
synchronizing the control again with UpdateStyles() is pointless (since
this function does nothing in this context).
Only wxSCROLL style flags need special care because wxListCtrl doesn't
have these styles but the control itself may have them. In order
to preserve them in the call to SetWindowStyleFlag(), we can do the trick
and request the same new scroll style as the actual physical style.
UpdateStyles() is useless now and can be deprecated.

See #17059.
This commit is contained in:
Artur Wieczorek
2017-05-18 23:55:02 +02:00
parent a647b6da72
commit 3eb650972a
2 changed files with 17 additions and 3 deletions

View File

@@ -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
////////////////////////////////////////////////////////////////////////////