]> git.saurik.com Git - wxWidgets.git/commitdiff
set listview extended styles after switching to report view and not only when creatin...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 26 Jan 2008 22:54:47 +0000 (22:54 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 26 Jan 2008 22:54:47 +0000 (22:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/listctrl.h
src/msw/listctrl.cpp

index 00583ea8a39a337bb4863f7806c3c193f65c8ae9..b63269dbbe29c136965af8d502becdbe3f101579 100644 (file)
@@ -442,6 +442,11 @@ private:
     // process NM_CUSTOMDRAW notification message
     WXLPARAM OnCustomDraw(WXLPARAM lParam);
 
+    // set the extended styles for the control (used by Create() and
+    // UpdateStyle()), only should be called if InReportView()
+    void MSWSetExListStyles();
+
+
     DECLARE_DYNAMIC_CLASS(wxListCtrl)
     DECLARE_EVENT_TABLE()
     DECLARE_NO_COPY_CLASS(wxListCtrl)
index cdc51230747dd7243c254ac5611049a01b9a14ef..84eafb3d90bbc21c8a161080f0c4c2c203d43329 100644 (file)
@@ -338,9 +338,17 @@ bool wxListCtrl::Create(wxWindow *parent,
     // GetTextColour will always return black
     SetTextColour(GetDefaultAttributes().colFg);
 
+    if ( InReportView() )
+        MSWSetExListStyles();
+
+    return true;
+}
+
+void wxListCtrl::MSWSetExListStyles()
+{
     // for comctl32.dll v 4.70+ we want to have some non default extended
     // styles because it's prettier (and also because wxGTK does it like this)
-    if ( InReportView() && wxApp::GetComCtl32Version() >= 470 )
+    if ( wxApp::GetComCtl32Version() >= 470 )
     {
         ::SendMessage
         (
@@ -354,8 +362,6 @@ bool wxListCtrl::Create(wxWindow *parent,
             LVS_EX_HEADERDRAGDROP
         );
     }
-
-    return true;
 }
 
 WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
@@ -454,6 +460,11 @@ void wxListCtrl::UpdateStyle()
         if ( dwStyleOld != dwStyleNew )
         {
             ::SetWindowLong(GetHwnd(), GWL_STYLE, dwStyleNew);
+
+            // if we switched to the report view, set the extended styles for
+            // it too
+            if ( !(dwStyleOld & LVS_REPORT) && (dwStyleNew & LVS_REPORT) )
+                MSWSetExListStyles();
         }
     }
 }