fixed SetWindowStyleFlag() to not remove WS_VISIBLE; also refresh the control automatically (closes bug 1019440)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29193 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2004-09-18 11:03:24 +00:00
parent 494ab5def0
commit 6e2fef031b
2 changed files with 20 additions and 16 deletions

View File

@ -278,6 +278,7 @@ wxMSW:
- fixed wxMaximizeEvent generation in wxFrame
- don't send duplicate EVT_COMBOBOX events whenever selection changes any more
- implemented support for selecting printer bin (Steven Van Ingelgem)
- fixed wxListCtrl::SetSingleStyle() which was broken since a few releases
wxUniv/X11:

View File

@ -447,9 +447,17 @@ void wxListCtrl::UpdateStyle()
// The new window view style
DWORD dwStyleNew = MSWGetStyle(m_windowStyle, NULL);
// some styles are not returned by MSWGetStyle()
if ( IsShown() )
dwStyleNew |= WS_VISIBLE;
// Get the current window style.
DWORD dwStyleOld = ::GetWindowLong(GetHwnd(), GWL_STYLE);
// we don't have wxVSCROLL style, but the list control may have it,
// don't change it then
dwStyleNew |= dwStyleOld & (WS_HSCROLL | WS_VSCROLL);
// Only set the window style if the view bits have changed.
if ( dwStyleOld != dwStyleNew )
{
@ -510,30 +518,25 @@ void wxListCtrl::SetSingleStyle(long style, bool add)
flag = flag & ~wxLC_MASK_SORT;
}
if ( flag & style )
{
if ( !add )
flag -= style;
}
if ( add )
flag |= style;
else
{
if ( add )
{
flag |= style;
}
}
flag &= ~style;
m_windowStyle = flag;
UpdateStyle();
SetWindowStyleFlag(flag);
}
// Set the whole window style
void wxListCtrl::SetWindowStyleFlag(long flag)
{
m_windowStyle = flag;
if ( flag != m_windowStyle )
{
m_windowStyle = flag;
UpdateStyle();
UpdateStyle();
Refresh();
}
}
// ----------------------------------------------------------------------------