replaced untyped hash with a typed one; 64 bit fixes (don't cast pointers to long...)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1138,7 +1138,8 @@ wxTreeItemId wxGenericTreeCtrl::GetItemParent(const wxTreeItemId& item) const
|
||||
return ((wxGenericTreeItem*) item.m_pItem)->GetParent();
|
||||
}
|
||||
|
||||
wxTreeItemId wxGenericTreeCtrl::GetFirstChild(const wxTreeItemId& item, long& cookie) const
|
||||
wxTreeItemId wxGenericTreeCtrl::GetFirstChild(const wxTreeItemId& item,
|
||||
wxTreeItemIdValue& cookie) const
|
||||
{
|
||||
wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
|
||||
|
||||
@@ -1146,7 +1147,40 @@ wxTreeItemId wxGenericTreeCtrl::GetFirstChild(const wxTreeItemId& item, long& co
|
||||
return GetNextChild(item, cookie);
|
||||
}
|
||||
|
||||
wxTreeItemId wxGenericTreeCtrl::GetNextChild(const wxTreeItemId& item, long& cookie) const
|
||||
wxTreeItemId wxGenericTreeCtrl::GetNextChild(const wxTreeItemId& item,
|
||||
wxTreeItemIdValue& cookie) const
|
||||
{
|
||||
wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
|
||||
|
||||
wxArrayGenericTreeItems& children = ((wxGenericTreeItem*) item.m_pItem)->GetChildren();
|
||||
|
||||
// it's ok to cast cookie to size_t, we never have indices big enough to
|
||||
// overflow "void *"
|
||||
size_t *pIndex = (size_t *)&cookie;
|
||||
if ( *pIndex < children.Count() )
|
||||
{
|
||||
return children.Item(*pIndex++);
|
||||
}
|
||||
else
|
||||
{
|
||||
// there are no more of them
|
||||
return wxTreeItemId();
|
||||
}
|
||||
}
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_4
|
||||
|
||||
wxTreeItemId wxGenericTreeCtrl::GetFirstChild(const wxTreeItemId& item,
|
||||
long& cookie) const
|
||||
{
|
||||
wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
|
||||
|
||||
cookie = 0;
|
||||
return GetNextChild(item, cookie);
|
||||
}
|
||||
|
||||
wxTreeItemId wxGenericTreeCtrl::GetNextChild(const wxTreeItemId& item,
|
||||
long& cookie) const
|
||||
{
|
||||
wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
|
||||
|
||||
@@ -1162,6 +1196,8 @@ wxTreeItemId wxGenericTreeCtrl::GetNextChild(const wxTreeItemId& item, long& coo
|
||||
}
|
||||
}
|
||||
|
||||
#endif // WXWIN_COMPATIBILITY_2_4
|
||||
|
||||
wxTreeItemId wxGenericTreeCtrl::GetLastChild(const wxTreeItemId& item) const
|
||||
{
|
||||
wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
|
||||
@@ -1354,7 +1390,7 @@ wxTreeItemId wxGenericTreeCtrl::DoInsertItem(const wxTreeItemId& parentId,
|
||||
|
||||
if ( data != NULL )
|
||||
{
|
||||
data->m_pItem = (long) item;
|
||||
data->m_pItem = item;
|
||||
}
|
||||
|
||||
parent->Insert( item, previous );
|
||||
@@ -1374,7 +1410,7 @@ wxTreeItemId wxGenericTreeCtrl::AddRoot(const wxString& text,
|
||||
image, selImage, data);
|
||||
if ( data != NULL )
|
||||
{
|
||||
data->m_pItem = (long) m_anchor;
|
||||
data->m_pItem = m_anchor;
|
||||
}
|
||||
|
||||
if (HasFlag(wxTR_HIDE_ROOT))
|
||||
@@ -1462,7 +1498,7 @@ wxTreeItemId wxGenericTreeCtrl::AppendItem(const wxTreeItemId& parentId,
|
||||
void wxGenericTreeCtrl::SendDeleteEvent(wxGenericTreeItem *item)
|
||||
{
|
||||
wxTreeEvent event( wxEVT_COMMAND_TREE_DELETE_ITEM, GetId() );
|
||||
event.m_item = (long) item;
|
||||
event.m_item = item;
|
||||
event.SetEventObject( this );
|
||||
ProcessEvent( event );
|
||||
}
|
||||
@@ -1552,7 +1588,7 @@ void wxGenericTreeCtrl::Expand(const wxTreeItemId& itemId)
|
||||
return;
|
||||
|
||||
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_EXPANDING, GetId() );
|
||||
event.m_item = (long) item;
|
||||
event.m_item = item;
|
||||
event.SetEventObject( this );
|
||||
|
||||
if ( ProcessEvent( event ) && !event.IsAllowed() )
|
||||
@@ -1600,7 +1636,7 @@ void wxGenericTreeCtrl::Collapse(const wxTreeItemId& itemId)
|
||||
return;
|
||||
|
||||
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_COLLAPSING, GetId() );
|
||||
event.m_item = (long) item;
|
||||
event.m_item = item;
|
||||
event.SetEventObject( this );
|
||||
if ( ProcessEvent( event ) && !event.IsAllowed() )
|
||||
{
|
||||
@@ -1790,8 +1826,8 @@ void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId,
|
||||
}
|
||||
|
||||
wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, GetId() );
|
||||
event.m_item = (long) item;
|
||||
event.m_itemOld = (long) m_current;
|
||||
event.m_item = item;
|
||||
event.m_itemOld = m_current;
|
||||
event.SetEventObject( this );
|
||||
// TODO : Here we don't send any selection mode yet !
|
||||
|
||||
@@ -2633,7 +2669,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
||||
if ( !event.HasModifiers() )
|
||||
{
|
||||
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
|
||||
event.m_item = (long) m_current;
|
||||
event.m_item = m_current;
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent( event );
|
||||
}
|
||||
@@ -2881,7 +2917,7 @@ void wxGenericTreeCtrl::Edit( const wxTreeItemId& item )
|
||||
wxGenericTreeItem *itemEdit = (wxGenericTreeItem *)item.m_pItem;
|
||||
|
||||
wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, GetId() );
|
||||
te.m_item = (long) itemEdit;
|
||||
te.m_item = itemEdit;
|
||||
te.SetEventObject( this );
|
||||
if ( GetEventHandler()->ProcessEvent( te ) && !te.IsAllowed() )
|
||||
{
|
||||
@@ -2912,7 +2948,7 @@ bool wxGenericTreeCtrl::OnRenameAccept(wxGenericTreeItem *item,
|
||||
const wxString& value)
|
||||
{
|
||||
wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, GetId() );
|
||||
le.m_item = (long) item;
|
||||
le.m_item = item;
|
||||
le.SetEventObject( this );
|
||||
le.m_label = value;
|
||||
le.m_editCancelled = FALSE;
|
||||
@@ -2924,7 +2960,7 @@ void wxGenericTreeCtrl::OnRenameCancelled(wxGenericTreeItem *item)
|
||||
{
|
||||
// let owner know that the edit was cancelled
|
||||
wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, GetId() );
|
||||
le.m_item = (long) item;
|
||||
le.m_item = item;
|
||||
le.SetEventObject( this );
|
||||
le.m_label = wxEmptyString;
|
||||
le.m_editCancelled = TRUE;
|
||||
@@ -2982,7 +3018,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
||||
: wxEVT_COMMAND_TREE_BEGIN_DRAG;
|
||||
|
||||
wxTreeEvent nevent( command, GetId() );
|
||||
nevent.m_item = (long) m_current;
|
||||
nevent.m_item = m_current;
|
||||
nevent.SetEventObject(this);
|
||||
|
||||
// by default the dragging is not supported, the user code must
|
||||
@@ -3043,7 +3079,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
||||
// generate the drag end event
|
||||
wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG, GetId());
|
||||
|
||||
event.m_item = (long) item;
|
||||
event.m_item = item;
|
||||
event.m_pointDrag = pt;
|
||||
event.SetEventObject(this);
|
||||
|
||||
@@ -3069,7 +3105,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
||||
if ( event.RightDown() )
|
||||
{
|
||||
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
|
||||
nevent.m_item = (long) item;
|
||||
nevent.m_item = item;
|
||||
nevent.m_pointDrag = CalcScrolledPosition(pt);
|
||||
nevent.SetEventObject(this);
|
||||
GetEventHandler()->ProcessEvent(nevent);
|
||||
@@ -3164,7 +3200,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
||||
|
||||
// send activate event first
|
||||
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
|
||||
nevent.m_item = (long) item;
|
||||
nevent.m_item = item;
|
||||
nevent.m_pointDrag = CalcScrolledPosition(pt);
|
||||
nevent.SetEventObject( this );
|
||||
if ( !GetEventHandler()->ProcessEvent( nevent ) )
|
||||
|
Reference in New Issue
Block a user