]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed SetWindowStyleFlag() to not remove WS_VISIBLE; also refresh the control automat...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 18 Sep 2004 11:03:24 +0000 (11:03 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 18 Sep 2004 11:03:24 +0000 (11:03 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29193 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/listctrl.cpp

index ea21518896348cd4c4d42e1e37246b76e1951312..b66f0365254d1daa4463aec6b092ca1c13b935bb 100644 (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:
 
index cf1841b1972e027a8003d66ef1cb7bfb103ab633..3c08663e15bf4dbd2d00fd0329db714b9c04b8ff 100644 (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;
-        }
-    }
-
-    m_windowStyle = flag;
+        flag &= ~style;
 
-    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();
+    }
 }
 
 // ----------------------------------------------------------------------------