From: Vadim Zeitlin Date: Sun, 20 Jul 2003 14:01:00 +0000 (+0000) Subject: fixes for deprecated warnings X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2d75caaa6d36bd82abf1d7130551635d711fe586 fixes for deprecated warnings git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/treectlg.h b/include/wx/generic/treectlg.h index a76a4dde38..afa132456d 100644 --- a/include/wx/generic/treectlg.h +++ b/include/wx/generic/treectlg.h @@ -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 diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index a485998fb4..ab501de148 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -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); } diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index 78d1a73fe4..1660d4581e 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -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); diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index 686261f27f..151ad01887 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -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()) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 81f2a5b92e..30e30ca4e6 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -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; }