// // Transition a toolbar from float to dragging // void ToolManager::OnGrabber( GrabberEvent & event ) { // No need to propagate any further event.Skip( false ); // Remember which bar we're dragging mDragBar = mBars[ event.GetId() ]; // Calculate the drag offset wxPoint mp = event.GetPosition(); mDragOffset = mp - mDragBar->GetParent()->ClientToScreen( mDragBar->GetPosition() ) + wxPoint( 1, 1 ); // Must set the bar afloat if it's currently docked if( mDragBar->IsDocked() ) { #if defined(__WXMAC__) // Disable window animation wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Adjust the starting position mp -= mDragOffset; // Inform toolbar of change mDragBar->SetDocked( NULL, true ); // Construct a new floater mDragWindow = new ToolFrame( mParent, this, mDragBar, mp ); // Make sure the ferry is visible mDragWindow->Show(); // Notify parent of change Updated(); #if defined(__WXMAC__) // Reinstate original transition wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } else { mDragWindow = (ToolFrame *) mDragBar->GetParent(); } // We want all mouse events from this point on mParent->CaptureMouse(); // Start monitoring shift key changes mLastState = wxGetKeyState( WXK_SHIFT ); mTimer.Start( 100 ); }
// // Handle grabber clicking // void ToolDock::OnGrabber( GrabberEvent & event ) { ToolBar *t = mBars[ event.GetId() ]; // Pass it on to the manager since it isn't in the handling hierarchy mManager->ProcessEvent( event ); // We no longer have control mDockedBars.Remove( t ); }
// // Transition a toolbar from float to dragging // void ToolManager::OnGrabber( GrabberEvent & event ) { // No need to propagate any further event.Skip( false ); if(event.IsEscaping()) return HandleEscapeKey(); // Remember which bar we're dragging mDragBar = mBars[ event.GetId() ].get(); // Remember state, in case of ESCape key later if (mDragBar->IsDocked()) { mPrevDock = dynamic_cast<ToolDock*>(mDragBar->GetParent()); wxASSERT(mPrevDock); mPrevSlot = mPrevDock->GetConfiguration().Find(mDragBar); mPrevDock->WrapConfiguration(mPrevConfiguration); } else mPrevPosition = mDragBar->GetParent()->GetPosition(); // Calculate the drag offset wxPoint mp = event.GetPosition(); mDragOffset = mp - mDragBar->GetParent()->ClientToScreen( mDragBar->GetPosition() ) + wxPoint( 1, 1 ); // Must set the bar afloat if it's currently docked if( mPrevDock ) { #if defined(__WXMAC__) // Disable window animation wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Adjust the starting position mp -= mDragOffset; // Inform toolbar of change mDragBar->SetDocked( NULL, true ); mDragBar->SetPositioned(); // Construct a NEW floater wxASSERT(mParent); mDragWindow = safenew ToolFrame( mParent, this, mDragBar, mp ); // Make sure the ferry is visible mDragWindow->Show(); // Notify parent of change Updated(); #if defined(__WXMAC__) // Reinstate original transition wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } else { mDragWindow = (ToolFrame *) mDragBar->GetParent(); } // We want all mouse events from this point on if( !mParent->HasCapture() ) mParent->CaptureMouse(); // Start monitoring shift key changes mLastState = wxGetKeyState( WXK_SHIFT ); mTimer.Start( 100 ); }