void cbBarHintsPlugin::OnLeftUp( cbLeftUpEvent& event ) { if ( mBtnPressed ) { wxPoint inFrame = event.mPos; mpPane->PaneToFrame( &inFrame.x, &inFrame.y ); int boxOfs, grooveOfs, pos; GetHintsLayout( mpClickedBar->mBoundsInParent, *mpClickedBar, boxOfs, grooveOfs, pos ); HitTestHints( *mpClickedBar, event.mPos ); int i; for ( i = 0; i != BOXES_IN_HINT; ++i ) { mBoxes[i]->OnLeftUp( inFrame ); if ( mBoxes[i]->WasClicked() ) { if ( i == 0 ) { mpLayout->SetBarState( mpClickedBar, wxCBAR_HIDDEN, true ); // Notify bar child window of close event: if(mpClickedBar->mpBarWnd!=NULL) mpClickedBar->mpBarWnd->Close(); } else { if ( mpClickedBar->IsExpanded() ) mpPane->ContractBar( mpClickedBar ); else mpPane->ExpandBar( mpClickedBar ); } } } mBtnPressed = false; return; } else event.Skip(); }
void cbRowDragPlugin::OnLButtonUp ( cbLeftUpEvent& event ) { if ( !mDragStarted && !mDecisionMode ) { event.Skip(); return; } mpPane = event.mpPane; if ( mDecisionMode ) { cbDockPane* pPane = mpPane; SetMouseCapture( false ); mDecisionMode = false; mDragStarted = false; wxPoint frmPos = event.mPos; pPane->PaneToFrame( &frmPos.x, &frmPos.y ); if ( mpRowInFocus ) { CollapseRow( mpRowInFocus ); mpRowInFocus = 0; } else { ExpandRow( mCollapsedIconInFocus ); mCollapsedIconInFocus = -1; } mpRowInFocus = NULL; mpPane = pPane; pPane->FrameToPane( &frmPos.x, &frmPos.y ); // give it another try after relayouting bars cbMotionEvent moveEvt( frmPos, pPane ); this->OnMouseMove( moveEvt ); // this plugin has "eaten" the mouse-up event return; } else { // otherwise, the dragged row was dropped, determine // where to insert it // restore initial pane appearence ShowPaneImage(); FinishOnScreenDraw(); cbRowInfo* pRow = GetFirstRow(); mpLayout->GetUpdatesManager().OnStartChanges(); pRow->mUMgrData.SetDirty(true); cbBarInfo* pBar = mpRowInFocus->mBars[0]; while ( pBar ) { pBar->mUMgrData.SetDirty(true); if ( pBar->mpBarWnd ) { // do complete refresh pBar->mpBarWnd->Show(false); pBar->mpBarWnd->Show(true); } pBar = pBar->mpNext; } while( pRow ) { if ( mCurDragOfs < pRow->mRowY ) { InsertDraggedRowBefore( pRow ); break; } pRow = pRow->mpNext; } if ( pRow == NULL ) InsertDraggedRowBefore( NULL ); mpRowInFocus = NULL; mpLayout->RecalcLayout(false); // finish change "transaction" mpLayout->GetUpdatesManager().OnFinishChanges(); mpLayout->GetUpdatesManager().UpdateNow(); // finish drag action SetMouseCapture( false ); mDragStarted = false; } }
void cbBarDragPlugin::OnLButtonUp( cbLeftUpEvent& event ) { if ( mBarDragStarted ) { if ( mpSrcPane->mProps.mRealTimeUpdatesOn == false ) { // erase current rectangle, and finsih on-screen drawing session cbDrawHintRectEvent evt( mPrevHintRect, mpCurPane == NULL, true, true ); mpLayout->FirePluginEvent( evt ); if ( mpCurPane != NULL ) { if ( mpSrcPane->mProps.mExactDockPredictionOn ) { mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, false ); mpLayout->GetUpdatesManager().OnFinishChanges(); 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; // 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 ); mBarDragStarted = false; if ( mBarWasFloating && mpDraggedBar->mState != wxCBAR_FLOATING ) { // save bar's floating position before it was docked mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mFloatedBarBounds; } } else event.Skip(); // pass event to the next plugin }