bool CEditTreeCtrl::HandleKeyDown(WPARAM wParam, LPARAM lParam) { bool bCtrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0; bool bShift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0; HTREEITEM hCur = GetSelectedItem(); if(GetEditControl() == 0) { method fnc = m_Keymap[int(wParam)][bCtrl][bShift]; if(fnc) return (this->*fnc)(hCur); } // under some circumstances we need to check some more keys switch(int(wParam)) { case VK_ESCAPE: if(m_pDragData) { DragStop(); return true; } /*FALLTHRU*/ case VK_RETURN: if(GetEditControl() != 0) { GetEditControl()->SendMessage(WM_KEYDOWN, wParam, lParam); return true; } break; default: break; } return false; }
void CEditTreeCtrl::OnRButtonUp(UINT nFlags, CPoint point) { if(m_pDragData) { if(m_pDragData->IsRightDragging()) DragEnd(); else // Right-click during a left-click-drag breaks the drag operation DragStop(); } else CTreeCtrl::OnRButtonUp(nFlags, point); }
void CEditTreeCtrl::OnDragContextCmd(UINT id) { // Should only reach this during a right-drag... ASSERT(m_pDragData != 0); if(id != ID_DRAG_CANCEL) { bool bCopy = (id == ID_DRAG_COPY); DragMoveItem(m_pDragData->GetDragItem(), m_pDragData->GetDropTarget(), EDropHint(m_pDragData->GetDropHint()), bCopy); } DragStop(); }
void CEditTreeCtrl::DragEnd() { ASSERT(m_pDragData != 0); TRACE1(_T("CEditTreeCtrl::DragEnd('%s')\n"), LPCTSTR(GetItemText(m_pDragData->GetDragItem()))); EDropHint eHint; HTREEITEM hDrop = GetDropTarget(eHint); if(m_pDragData->IsRightDragging()) { if(eHint == DROP_NODROP) DragStop(); else { CPoint point; GetCursorPos(&point); DragDisplayContextMenu(point); } } else { bool bCtrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0; DragMoveItem(m_pDragData->GetDragItem(), hDrop, eHint, bCtrl); DragStop(); } }
bool TBarView::InvokeItem(const char* signature) { // sent from TeamMenuItem if (Dragging() && AppCanHandleTypes(signature)) { SendDragMessage(signature); // invoking okay to toss memory DragStop(true); return true; } return false; }
void TBarView::HandleDeskbarMenu(BMessage* messagewithdestination) { if (!Dragging()) return; // in mini-mode if (fVertical && fState != kExpandoState) { // if drop is in the team menu, bail if (fBarMenuBar->CountItems() >= 2) { uint32 buttons; BPoint location; GetMouse(&location, &buttons); if (fBarMenuBar->ItemAt(1)->Frame().Contains(location)) return; } } if (messagewithdestination) { entry_ref ref; if (messagewithdestination->FindRef("refs", &ref) == B_OK) { BEntry entry(&ref, true); if (entry.IsDirectory()) { // if the ref received (should only be 1) is a directory // then add the drag refs to the directory AddRefsToDeskbarMenu(DragMessage(), &ref); } else SendDragMessage(NULL, &ref); } } else { // adds drag refs to top level in deskbar menu AddRefsToDeskbarMenu(DragMessage(), NULL); } // clean up drag message and types list DragStop(true); }