fixes for deprecated warnings

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-07-20 14:01:00 +00:00
parent 284fa852b4
commit 2d75caaa6d
5 changed files with 23 additions and 18 deletions

View File

@@ -351,11 +351,14 @@ public:
void SetItemSelectedImage(const wxTreeItemId& item, int image) void SetItemSelectedImage(const wxTreeItemId& item, int image)
{ SetItemImage(item, image, wxTreeItemIcon_Selected); } { 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, wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item,
long& cookie) const ); long& cookie) const );
wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item, wxTreeItemId GetNextChild(const wxTreeItemId& item,
long& cookie) const ); long& cookie) const;
#endif // WXWIN_COMPATIBILITY_2_4 #endif // WXWIN_COMPATIBILITY_2_4

View File

@@ -412,7 +412,7 @@ void MyFrame::OnDump(wxCommandEvent& WXUNUSED(event))
CHECK_ITEM( root ); CHECK_ITEM( root );
m_treeCtrl->GetItemsRecursively(root, -1); m_treeCtrl->GetItemsRecursively(root);
} }
#ifndef NO_MULTIPLE_SELECTION #ifndef NO_MULTIPLE_SELECTION
@@ -791,7 +791,7 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
// set some colours/fonts for testing // set some colours/fonts for testing
SetItemFont(rootId, *wxITALIC_FONT); SetItemFont(rootId, *wxITALIC_FONT);
long cookie; wxTreeItemIdValue cookie;
wxTreeItemId id = GetFirstChild(rootId, cookie); wxTreeItemId id = GetFirstChild(rootId, cookie);
SetItemTextColour(id, *wxBLUE); SetItemTextColour(id, *wxBLUE);
@@ -801,23 +801,24 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
SetItemBackgroundColour(id, *wxLIGHT_GREY); SetItemBackgroundColour(id, *wxLIGHT_GREY);
} }
void MyTreeCtrl::GetItemsRecursively(const wxTreeItemId& idParent, long cookie) void MyTreeCtrl::GetItemsRecursively(const wxTreeItemId& idParent,
wxTreeItemIdValue cookie)
{ {
wxTreeItemId id; wxTreeItemId id;
if( cookie == -1 ) if ( !cookie )
id = GetFirstChild(idParent, cookie); id = GetFirstChild(idParent, cookie);
else else
id = GetNextChild(idParent, cookie); id = GetNextChild(idParent, cookie);
if(id <= 0) if ( !id.IsOk() )
return; return;
wxString text = GetItemText(id); wxString text = GetItemText(id);
wxLogMessage(text); wxLogMessage(text);
if (ItemHasChildren(id)) if (ItemHasChildren(id))
GetItemsRecursively(id,-1); GetItemsRecursively(id);
GetItemsRecursively(idParent, cookie); GetItemsRecursively(idParent, cookie);
} }

View File

@@ -88,7 +88,8 @@ public:
void OnItemActivated(wxTreeEvent& event); void OnItemActivated(wxTreeEvent& event);
void OnRMouseDClick(wxMouseEvent& 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 CreateImageList(int size = 16);
void CreateButtonsImageList(int size = 11); void CreateButtonsImageList(int size = 11);

View File

@@ -651,7 +651,7 @@ void wxGenericDirCtrl::CollapseDir(wxTreeItemId parentId)
return; return;
data->m_isExpanded = FALSE; data->m_isExpanded = FALSE;
long cookie; wxTreeItemIdValue cookie;
/* Workaround because DeleteChildren has disapeared (why?) and /* Workaround because DeleteChildren has disapeared (why?) and
* CollapseAndReset doesn't work as advertised (deletes parent too) */ * CollapseAndReset doesn't work as advertised (deletes parent too) */
child = m_treeCtrl->GetFirstChild(parentId, cookie); child = m_treeCtrl->GetFirstChild(parentId, cookie);
@@ -828,7 +828,7 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString&
path2.MakeLower(); path2.MakeLower();
#endif #endif
long cookie; wxTreeItemIdValue cookie;
wxTreeItemId childId = m_treeCtrl->GetFirstChild(parentId, cookie); wxTreeItemId childId = m_treeCtrl->GetFirstChild(parentId, cookie);
while (childId.IsOk()) while (childId.IsOk())
{ {
@@ -890,7 +890,7 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path)
if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir) if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir)
{ {
// Find the first file in this directory // Find the first file in this directory
long cookie; wxTreeItemIdValue cookie;
wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie); wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie);
bool selectedChild = FALSE; bool selectedChild = FALSE;
while (childId.IsOk()) while (childId.IsOk())

View File

@@ -1615,7 +1615,7 @@ void wxGenericTreeCtrl::ExpandAll(const wxTreeItemId& item)
return; return;
} }
long cookie; wxTreeItemIdValue cookie;
wxTreeItemId child = GetFirstChild(item, cookie); wxTreeItemId child = GetFirstChild(item, cookie);
while ( child.IsOk() ) while ( child.IsOk() )
{ {
@@ -2696,7 +2696,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
} }
if (prev) if (prev)
{ {
long cookie = 0; wxTreeItemIdValue cookie;
wxTreeItemId current = m_key_current; 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? // 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 )) if (current == GetFirstChild( prev, cookie ))
@@ -2751,7 +2751,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
{ {
if (IsExpanded(m_key_current) && HasChildren(m_key_current)) if (IsExpanded(m_key_current) && HasChildren(m_key_current))
{ {
long cookie = 0; wxTreeItemIdValue cookie;
wxTreeItemId child = GetFirstChild( m_key_current, cookie ); wxTreeItemId child = GetFirstChild( m_key_current, cookie );
SelectItem( child, unselect_others, extended_select ); SelectItem( child, unselect_others, extended_select );
m_key_current=(wxGenericTreeItem*) child.m_pItem; m_key_current=(wxGenericTreeItem*) child.m_pItem;
@@ -2811,8 +2811,8 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
if ( HasFlag(wxTR_HIDE_ROOT) ) if ( HasFlag(wxTR_HIDE_ROOT) )
{ {
long dummy; wxTreeItemIdValue cookie;
prev = GetFirstChild(prev, dummy); prev = GetFirstChild(prev, cookie);
if (!prev) if (!prev)
break; break;
} }