| 503 | } |
| 504 | |
| 505 | void ExpandingToolBar::StartMoving() |
| 506 | { |
| 507 | if (!mAreaParent) |
| 508 | return; |
| 509 | |
| 510 | int j; |
| 511 | |
| 512 | mAreaParent->CollapseAll(true); |
| 513 | |
| 514 | mTimer.Stop(); |
| 515 | |
| 516 | // This gives time for wx to finish redrawing the window that way. |
| 517 | // HACK: why do we need to do it so many times??? |
| 518 | for(j=0; j<500; j++) |
| 519 | ::wxSafeYield(); |
| 520 | |
| 521 | wxBitmap toolbarBitmap = GetToolbarBitmap(); |
| 522 | |
| 523 | msNoAutoExpandStack++; |
| 524 | mSavedArrangement = mAreaParent->SaveArrangement(); |
| 525 | mAreaParent->RemoveChild(this); |
| 526 | |
| 527 | mAreaParent->Refresh(true); |
| 528 | |
| 529 | mTopLevelParent = this; |
| 530 | while(!mTopLevelParent->IsTopLevel()) |
| 531 | mTopLevelParent = mTopLevelParent->GetParent(); |
| 532 | |
| 533 | wxPoint hotSpot = ScreenToClient(wxGetMousePosition()); |
| 534 | |
| 535 | hotSpot -= (ClientToScreen(wxPoint(0, 0)) - |
| 536 | mAreaParent->ClientToScreen(wxPoint(0, 0))); |
| 537 | |
| 538 | mDropTargets = mAreaParent->GetDropTargets(); |
| 539 | mDropTarget = kDummyRect; |
| 540 | |
| 541 | wxColour magicColor = wxColour(0, 255, 255); |
| 542 | // wxImage tgtImage = theTheme.Image(bmpToolBarTarget); |
| 543 | // ImageRoll tgtImageRoll = ImageRoll(ImageRoll::VerticalRoll, |
| 544 | // tgtImage, |
| 545 | // magicColor); |
| 546 | mTargetPanel = safenew wxPanelWrapper(mAreaParent, -1, //tgtImageRoll, |
| 547 | wxDefaultPosition, |
| 548 | wxDefaultSize, |
| 549 | wxTRANSPARENT_WINDOW); |
| 550 | mTargetPanel->SetSize(mDropTarget); |
| 551 | |
| 552 | // This gives time for wx to finish redrawing the window that way. |
| 553 | // HACK: why do we need to do it several times??? |
| 554 | for(j=0; j<500; j++) |
| 555 | ::wxSafeYield(); |
| 556 | |
| 557 | mAreaParent->SetCapturedChild(this); |
| 558 | |
| 559 | mDragImage = std::make_unique<wxDragImage>(toolbarBitmap); |
| 560 | mDragImage->BeginDrag(hotSpot, mAreaParent, mTopLevelParent); |
| 561 | mDragImage->Show(); |
| 562 | mDragImage->Move(ScreenToClient(wxGetMousePosition())); |
no test coverage detected