From 40fab78bcf79e9a6786859ec65ab3c0d675b73de Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 25 Aug 2000 16:52:05 +0000 Subject: [PATCH] Added some casts in hopes of fixing HP compilation problem git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/sashwin.cpp | 16 +++++++++++++--- src/generic/treectlg.cpp | 28 ++++++++++++++-------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index a808264d02..f5ec7897f2 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -73,6 +73,7 @@ void wxSashWindow::Init() m_maximumPaneSizeY = 10000; m_sashCursorWE = new wxCursor(wxCURSOR_SIZEWE); m_sashCursorNS = new wxCursor(wxCURSOR_SIZENS); + m_mouseCaptured = FALSE; // Eventually, we'll respond to colour change messages InitColours(); @@ -106,6 +107,7 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) if (event.LeftDown()) { CaptureMouse(); + m_mouseCaptured = TRUE; if ( sashHit != wxSASH_NONE ) { @@ -144,7 +146,10 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) else if ( event.LeftUp() && m_dragMode == wxSASH_DRAG_LEFT_DOWN ) { // Wasn't a proper drag - ReleaseMouse(); + if (m_mouseCaptured) + ReleaseMouse(); + m_mouseCaptured = FALSE; + wxScreenDC::EndDrawingOnTop(); m_dragMode = wxSASH_DRAG_NONE; m_draggingEdge = wxSASH_NONE; @@ -153,7 +158,10 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) { // We can stop dragging now and see what we've got. m_dragMode = wxSASH_DRAG_NONE; - ReleaseMouse(); + if (m_mouseCaptured) + ReleaseMouse(); + m_mouseCaptured = FALSE; + // Erase old tracker DrawSashTracker(m_draggingEdge, m_oldX, m_oldY); @@ -273,7 +281,9 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) } else if ( event.LeftUp() ) { - ReleaseMouse(); + if (m_mouseCaptured) + ReleaseMouse(); + m_mouseCaptured = FALSE; } else if (event.Moving() && !event.Dragging()) { diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 77219b692b..384ebdb372 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1045,7 +1045,7 @@ wxTreeItemId wxGenericTreeCtrl::DoInsertItem(const wxTreeItemId& parentId, if ( data != NULL ) { - data->m_pItem = item; + data->m_pItem = (long) item; } parent->Insert( item, previous ); @@ -1066,7 +1066,7 @@ wxTreeItemId wxGenericTreeCtrl::AddRoot(const wxString& text, image, selImage, data); if ( data != NULL ) { - data->m_pItem = m_anchor; + data->m_pItem = (long) m_anchor; } if (!HasFlag(wxTR_MULTIPLE)) @@ -1143,7 +1143,7 @@ wxTreeItemId wxGenericTreeCtrl::AppendItem(const wxTreeItemId& parentId, void wxGenericTreeCtrl::SendDeleteEvent(wxGenericTreeItem *item) { wxTreeEvent event( wxEVT_COMMAND_TREE_DELETE_ITEM, GetId() ); - event.m_item = item; + event.m_item = (long) item; event.SetEventObject( this ); ProcessEvent( event ); } @@ -1222,7 +1222,7 @@ void wxGenericTreeCtrl::Expand(const wxTreeItemId& itemId) return; wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_EXPANDING, GetId() ); - event.m_item = item; + event.m_item = (long) item; event.SetEventObject( this ); if ( ProcessEvent( event ) && !event.IsAllowed() ) @@ -1264,7 +1264,7 @@ void wxGenericTreeCtrl::Collapse(const wxTreeItemId& itemId) return; wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_COLLAPSING, GetId() ); - event.m_item = item; + event.m_item = (long) item; event.SetEventObject( this ); if ( ProcessEvent( event ) && !event.IsAllowed() ) { @@ -1440,8 +1440,8 @@ void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, } wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, GetId() ); - event.m_item = item; - event.m_itemOld = m_current; + event.m_item = (long) item; + event.m_itemOld = (long) m_current; event.SetEventObject( this ); // TODO : Here we don't send any selection mode yet ! @@ -2022,7 +2022,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) case WXK_RETURN: { wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); - event.m_item = m_current; + event.m_item = (long) m_current; event.m_code = 0; event.SetEventObject( this ); GetEventHandler()->ProcessEvent( event ); @@ -2215,7 +2215,7 @@ void wxGenericTreeCtrl::Edit( const wxTreeItemId& item ) m_currentEdit = (wxGenericTreeItem*) item.m_pItem; wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, GetId() ); - te.m_item = m_currentEdit; + te.m_item = (long) m_currentEdit; te.SetEventObject( this ); GetEventHandler()->ProcessEvent( te ); @@ -2269,7 +2269,7 @@ void wxGenericTreeCtrl::OnRenameTimer() void wxGenericTreeCtrl::OnRenameAccept() { wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, GetId() ); - le.m_item = m_currentEdit; + le.m_item = (long) m_currentEdit; le.SetEventObject( this ); le.m_label = m_renameRes; GetEventHandler()->ProcessEvent( le ); @@ -2324,7 +2324,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) : wxEVT_COMMAND_TREE_BEGIN_DRAG; wxTreeEvent nevent( command, GetId() ); - nevent.m_item = m_current; + nevent.m_item = (long) m_current; nevent.SetEventObject(this); // by default the dragging is not supported, the user code must @@ -2378,7 +2378,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) // generate the drag end event wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG, GetId()); - event.m_item = item; + event.m_item = (long) item; event.m_pointDrag = wxPoint(x, y); event.SetEventObject(this); @@ -2411,7 +2411,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) if ( event.RightDown() ) { wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId()); - nevent.m_item = item; + nevent.m_item = (long) item; nevent.m_code = 0; nevent.SetEventObject(this); GetEventHandler()->ProcessEvent(nevent); @@ -2457,7 +2457,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) m_lastOnSame = FALSE; wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); - nevent.m_item = item; + nevent.m_item = (long) item; nevent.m_code = 0; nevent.SetEventObject( this ); GetEventHandler()->ProcessEvent( nevent ); -- 2.45.2