X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e08b761b0c5ecb6df295785b78f1f3637331887..d66c3960d541cf9e3ba10519a49a9e34b4ddfc81:/contrib/src/fl/bardragpl.cpp diff --git a/contrib/src/fl/bardragpl.cpp b/contrib/src/fl/bardragpl.cpp index 26b927e93a..c3f75adb6c 100644 --- a/contrib/src/fl/bardragpl.cpp +++ b/contrib/src/fl/bardragpl.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo +// Name: bardragpl.cpp +// Purpose: cbBarDragPlugin implementation // Author: Aleksandras Gluchovas // Modified by: // Created: 23/09/98 // RCS-ID: $Id$ // Copyright: (c) Aleksandras Gluchovas -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -293,8 +293,8 @@ void cbBarDragPlugin::StickToPane( cbDockPane* pPane, wxPoint& mousePos ) : mousePos.x > bounds.x; // NOTE:: about all the below min/max things: they are meant to ensure - // that mouse pointer doesn't overrun (leave) the hint-rectangle - // when dimensions it's are recalculated upon sticking it to the pane + // that the mouse pointer doesn't overrun (leave) the hint-rectangle + // when its dimensions are recalculated upon sticking it to the pane if ( pPane->IsHorizontal() && fromLowerEdge ) { @@ -341,10 +341,9 @@ void cbBarDragPlugin::StickToPane( cbDockPane* pPane, wxPoint& mousePos ) void cbBarDragPlugin::UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos ) { - // unsticking causes rectangle to get the shape, in which + // unsticking causes rectangle to get the shape in which // dragged control-bar would be when floated - int newWidth = mpDraggedBar->mDimInfo.mSizes[wxCBAR_FLOATING].x; int newHeight = mpDraggedBar->mDimInfo.mSizes[wxCBAR_FLOATING].y; @@ -371,7 +370,7 @@ void cbBarDragPlugin::UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos ) if ( pPane->IsHorizontal() && fromLowerEdge ) { - bool fromLowerEdge = mousePos.y > bounds.y; +// bool fromLowerEdge = mousePos.y > bounds.y; mHintRect.y = wxMax( bounds.y + bounds.height + 1, mousePos.y - newHeight ); @@ -457,27 +456,19 @@ void cbBarDragPlugin::ShowHint( bool prevWasInClient ) { bool wasDocked = FALSE; - if ( mpDraggedBar->mState != wxCBAR_FLOATING && !mpCurPane ) - { - mpLayout->SetBarState( mpDraggedBar, wxCBAR_FLOATING, TRUE ); - } - else - if ( mpDraggedBar->mState == wxCBAR_FLOATING && mpCurPane ) - { - mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, FALSE ); - - wasDocked = TRUE; - } if ( mpSrcPane->mProps.mRealTimeUpdatesOn == FALSE ) { - // do hevy calculations first + // do heavy calculations first wxRect actualRect = mHintRect; // will be adjusted depending on drag-settings if ( mpSrcPane->mProps.mExactDockPredictionOn && mpCurPane ) { - bool success = mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE ); + #ifdef __WXDEBUG__ + bool success = + #endif + mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE ); wxASSERT( success ); // DBG:: @@ -511,6 +502,18 @@ void cbBarDragPlugin::ShowHint( bool prevWasInClient ) { // otherwise, if real-time updates option is ON + if ( mpDraggedBar->mState != wxCBAR_FLOATING && !mpCurPane ) + { + mpLayout->SetBarState( mpDraggedBar, wxCBAR_FLOATING, TRUE ); + } + else + if ( mpDraggedBar->mState == wxCBAR_FLOATING && mpCurPane ) + { + mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, FALSE ); + + wasDocked = TRUE; + } + if ( mpCurPane ) { mpLayout->GetUpdatesManager().OnStartChanges(); @@ -519,7 +522,10 @@ void cbBarDragPlugin::ShowHint( bool prevWasInClient ) mpDraggedBar->mUMgrData.SetDirty( TRUE ); - bool success = mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE ); + #ifdef __WXDEBUG__ + bool success = + #endif + mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, FALSE ); wxASSERT( success ); // DBG :: @@ -642,19 +648,26 @@ void cbBarDragPlugin::OnMouseMove( cbMotionEvent& event ) wxCursor* pPrevCurs = mpCurCursor; if ( mpCurPane ) - - mpCurCursor = mpLayout->mpDragCursor; + { + mpCurCursor = mpLayout->mpNormalCursor; + } else { - if ( mpLayout->mFloatingOn && mpSrcPane->mProps.mRealTimeUpdatesOn ) + // if floating is off, and we are in the client + // area, the cursor will be invalid, otherwise + // it will be the normal cursor - mpCurCursor = mpLayout->mpDragCursor; + if (mpLayout->mFloatingOn) + { + mpCurCursor = mpLayout->mpNormalCursor; + } else + { mpCurCursor = mpLayout->mpNECursor; } + } if ( pPrevCurs != mpCurCursor ) - mpLayout->GetParentFrame().SetCursor( *mpCurCursor ); } @@ -662,7 +675,7 @@ void cbBarDragPlugin::OnLButtonDown( cbLeftDownEvent& event ) { if ( mBarDragStarted ) { - wxMessageBox("DblClick!"); + wxMessageBox(wxT("DblClick!")); } event.Skip(); @@ -690,13 +703,36 @@ void cbBarDragPlugin::OnLButtonUp( cbLeftUpEvent& event ) mpLayout->GetUpdatesManager().UpdateNow(); } else + { + if (mpDraggedBar->mState == wxCBAR_FLOATING) + { + mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, TRUE); + } + mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane ); } } + else + { + if (mpDraggedBar->mState != wxCBAR_FLOATING) + { + mpLayout->SetBarState(mpDraggedBar, wxCBAR_FLOATING, true); + } + + mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mHintRect; + mpLayout->ApplyBarProperties( mpDraggedBar ); + } + } mHintRect.width = -1; - mpLayout->GetParentFrame().SetCursor( *mpLayout->mpNormalCursor ); + // In Windows, at least, the frame needs to have a null cursor + // else child windows (such as text windows) inherit the cursor +#if 1 + mpLayout->GetParentFrame().SetCursor( wxNullCursor ); +#else + mpLayout->GetParentFrame().SetCursor( *mpLayout->mpNormalCursor ); +#endif mpLayout->ReleaseEventsFromPane( event.mpPane ); mpLayout->ReleaseEventsFromPlugin( this ); @@ -750,7 +786,7 @@ void cbBarDragPlugin::OnStartBarDragging( cbStartBarDraggingEvent& event ) mpLayout->CaptureEventsForPane( event.mpPane ); mpLayout->CaptureEventsForPlugin( this ); - mpLayout->GetParentFrame().SetCursor( *mpLayout->mpDragCursor ); + mpLayout->GetParentFrame().SetCursor( *mpLayout->mpNormalCursor ); mBarDragStarted = TRUE;