]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
Applied patch #421073 (making setup options work)
[wxWidgets.git] / src / msw / treectrl.cpp
index a480a3d7e62b359f57dcab2fd96da34bdf2e7ded..f42d35f685a90edf358013f27d68d51d7ec06269 100644 (file)
@@ -369,7 +369,7 @@ public:
             DoTraverse(root, recursively);
         }
 
-    virtual bool OnVisit(const wxTreeItemId& item)
+    virtual bool OnVisit(const wxTreeItemId& WXUNUSED(item))
     {
         m_count++;
 
@@ -449,7 +449,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
 // ----------------------------------------------------------------------------
 
 // handy table for sending events
-static const wxEventType g_events[2][2] =
+static wxEventType g_events[2][2] =
 {
     { wxEVT_COMMAND_TREE_ITEM_COLLAPSED, wxEVT_COMMAND_TREE_ITEM_COLLAPSING },
     { wxEVT_COMMAND_TREE_ITEM_EXPANDED,  wxEVT_COMMAND_TREE_ITEM_EXPANDING  }
@@ -502,8 +502,15 @@ void wxTreeCtrl::Init()
     m_textCtrl = NULL;
     m_hasAnyAttr = FALSE;
     m_dragImage = NULL;
-
     m_htSelStart = 0;
+
+    // Initialize static array of events, because with the new event system,
+    // they may not be initialized yet.
+
+    g_events[0][0] = wxEVT_COMMAND_TREE_ITEM_COLLAPSED;
+    g_events[0][1] = wxEVT_COMMAND_TREE_ITEM_COLLAPSING;
+    g_events[1][0] = wxEVT_COMMAND_TREE_ITEM_EXPANDED;
+    g_events[1][1] = wxEVT_COMMAND_TREE_ITEM_EXPANDING;
 }
 
 bool wxTreeCtrl::Create(wxWindow *parent,
@@ -520,7 +527,10 @@ bool wxTreeCtrl::Create(wxWindow *parent,
         return FALSE;
 
     DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP |
-                   TVS_SHOWSELALWAYS /* | WS_CLIPSIBLINGS */;
+                   TVS_SHOWSELALWAYS;
+
+    if ( m_windowStyle & wxCLIP_SIBLINGS )
+        wstyle |= WS_CLIPSIBLINGS;
 
     if ((m_windowStyle & wxTR_NO_LINES) == 0)
         wstyle |= TVS_HASLINES;
@@ -643,7 +653,7 @@ wxTreeCtrl::~wxTreeCtrl()
 
     // delete user data to prevent memory leaks
     DeleteAllItems();
-    
+
     if (m_ownsImageListNormal) delete m_imageListNormal;
     if (m_ownsImageListState) delete m_imageListState;
 }
@@ -1636,7 +1646,7 @@ wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item,
 }
 
 // End label editing, optionally cancelling the edit
-void wxTreeCtrl::EndEditLabel(const wxTreeItemId& item, bool discardChanges)
+void wxTreeCtrl::EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool discardChanges)
 {
     TreeView_EndEditLabelNow(GetHwnd(), discardChanges);
 
@@ -2217,7 +2227,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                         return TRUE;
                 }
             }
-            break;
+//            break;  // can never be reached
 #endif // _WIN32_IE >= 0x300
 
         case NM_DBLCLK:
@@ -2337,7 +2347,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
         case TVN_GETDISPINFO:
             // NB: so far the user can't set the image himself anyhow, so do it
             //     anyway - but this may change later
-            if ( /* !processed && */ 1 )
+//          if ( /* !processed && */ 1 )
             {
                 wxTreeItemId item = event.m_item;
                 TV_DISPINFO *info = (TV_DISPINFO *)lParam;
@@ -2361,7 +2371,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                                           : wxTreeItemIcon_Selected
                         );
                 }
-            }
+                       }
             break;
 
         //default: