]> git.saurik.com Git - wxWidgets.git/commitdiff
fixes for deprecated warnings
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 20 Jul 2003 14:01:00 +0000 (14:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 20 Jul 2003 14:01:00 +0000 (14:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/treectlg.h
samples/treectrl/treetest.cpp
samples/treectrl/treetest.h
src/generic/dirctrlg.cpp
src/generic/treectlg.cpp

index a76a4dde3850519d01f15fa33b29b08f68f2ca74..afa132456d6f1162b27ec3eb1374c4ebe81cc3f1 100644 (file)
@@ -351,11 +351,14 @@ public:
     void SetItemSelectedImage(const wxTreeItemId& item, int image)
         { SetItemImage(item, image, wxTreeItemIcon_Selected); }
 
-    // use the versions taking wxTreeItemIdValue cookies
+    // use the versions taking wxTreeItemIdValue cookies (note that
+    // GetNextChild() is not inside wxDEPRECATED on purpose, as otherwise we
+    // get twice as many warnings without any added benefit: it is always used
+    // with GetFirstChild() anyhow)
     wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item,
                                              long& cookie) const );
-    wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item,
-                                            long& cookie) const );
+    wxTreeItemId GetNextChild(const wxTreeItemId& item,
+                              long& cookie) const;
 #endif // WXWIN_COMPATIBILITY_2_4
 
 
index a485998fb453a5277b175da977731460636131dd..ab501de148a9b2a21f2d2cd09a2d8ee5e2af876f 100644 (file)
@@ -412,7 +412,7 @@ void MyFrame::OnDump(wxCommandEvent& WXUNUSED(event))
 
     CHECK_ITEM( root );
 
-    m_treeCtrl->GetItemsRecursively(root, -1);
+    m_treeCtrl->GetItemsRecursively(root);
 }
 
 #ifndef NO_MULTIPLE_SELECTION
@@ -791,7 +791,7 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
     // set some colours/fonts for testing
     SetItemFont(rootId, *wxITALIC_FONT);
 
-    long cookie;
+    wxTreeItemIdValue cookie;
     wxTreeItemId id = GetFirstChild(rootId, cookie);
     SetItemTextColour(id, *wxBLUE);
 
@@ -801,23 +801,24 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
     SetItemBackgroundColour(id, *wxLIGHT_GREY);
 }
 
-void MyTreeCtrl::GetItemsRecursively(const wxTreeItemId& idParent, long cookie)
+void MyTreeCtrl::GetItemsRecursively(const wxTreeItemId& idParent,
+                                     wxTreeItemIdValue cookie)
 {
     wxTreeItemId id;
 
-    if( cookie == -1 )
+    if ( !cookie )
         id = GetFirstChild(idParent, cookie);
     else
         id = GetNextChild(idParent, cookie);
 
-    if(id <= 0)
+    if ( !id.IsOk() )
         return;
 
     wxString text = GetItemText(id);
     wxLogMessage(text);
 
     if (ItemHasChildren(id))
-        GetItemsRecursively(id,-1);
+        GetItemsRecursively(id);
 
     GetItemsRecursively(idParent, cookie);
 }
index 78d1a73fe4791ef369e23022e1864f9bf0d9524c..1660d4581ed49cee9dfd5feeb596fad7062f7421 100644 (file)
@@ -88,7 +88,8 @@ public:
     void OnItemActivated(wxTreeEvent& event);
     void OnRMouseDClick(wxMouseEvent& event);
 
-    void GetItemsRecursively(const wxTreeItemId& idParent, long cookie);
+    void GetItemsRecursively(const wxTreeItemId& idParent,
+                             wxTreeItemIdValue cookie = 0);
 
     void CreateImageList(int size = 16);
     void CreateButtonsImageList(int size = 11);
index 686261f27fabbb8627db92fcf805d7cef22b21c9..151ad018872d2c9b262a123f9d674a8b79819f5f 100644 (file)
@@ -651,7 +651,7 @@ void wxGenericDirCtrl::CollapseDir(wxTreeItemId parentId)
         return;
 
     data->m_isExpanded = FALSE;
-    long cookie;
+    wxTreeItemIdValue cookie;
     /* Workaround because DeleteChildren has disapeared (why?) and
      * CollapseAndReset doesn't work as advertised (deletes parent too) */
     child = m_treeCtrl->GetFirstChild(parentId, cookie);
@@ -828,7 +828,7 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString&
     path2.MakeLower();
 #endif
 
-    long cookie;
+    wxTreeItemIdValue cookie;
     wxTreeItemId childId = m_treeCtrl->GetFirstChild(parentId, cookie);
     while (childId.IsOk())
     {
@@ -890,7 +890,7 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path)
         if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir)
         {
             // Find the first file in this directory
-            long cookie;
+            wxTreeItemIdValue cookie;
             wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie);
             bool selectedChild = FALSE;
             while (childId.IsOk())
index 81f2a5b92ef39821f97a4aae2f211a5dc4993bcb..30e30ca4e6d4d68cd98a707fa512cb3460cde00f 100644 (file)
@@ -1615,7 +1615,7 @@ void wxGenericTreeCtrl::ExpandAll(const wxTreeItemId& item)
             return;
     }
 
-    long cookie;
+    wxTreeItemIdValue cookie;
     wxTreeItemId child = GetFirstChild(item, cookie);
     while ( child.IsOk() )
     {
@@ -2696,7 +2696,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
                     }
                     if (prev)
                     {
-                        long cookie = 0;
+                        wxTreeItemIdValue cookie;
                         wxTreeItemId current = m_key_current;
                         // TODO: Huh?  If we get here, we'd better be the first child of our parent.  How else could it be?
                         if (current == GetFirstChild( prev, cookie ))
@@ -2751,7 +2751,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
             {
                 if (IsExpanded(m_key_current) && HasChildren(m_key_current))
                 {
-                    long cookie = 0;
+                    wxTreeItemIdValue cookie;
                     wxTreeItemId child = GetFirstChild( m_key_current, cookie );
                     SelectItem( child, unselect_others, extended_select );
                     m_key_current=(wxGenericTreeItem*) child.m_pItem;
@@ -2811,8 +2811,8 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
 
                 if ( HasFlag(wxTR_HIDE_ROOT) )
                 {
-                    long dummy;
-                    prev = GetFirstChild(prev, dummy);
+                    wxTreeItemIdValue cookie;
+                    prev = GetFirstChild(prev, cookie);
                     if (!prev)
                         break;
                 }