void CTreeFileCtrl::OnLButtonUp(UINT nFlags, CPoint point) { CRect clientRect; GetClientRect(&clientRect); if (clientRect.PtInRect(point)) EndDragging(FALSE); else EndDragging(TRUE); //Let the parent class do its thing CTreeCtrl::OnLButtonUp(nFlags, point); }
void NBW_SpinBoxControls::mouseReleaseEvent(QMouseEvent*) { if(STATE_DRAGGING == _state) { _state = STATE_NORMAL; unsetCursor(); EndDragging(); } }
void NBW_SpinBoxControls::OnEditingFinished() { leda::rational rval; int typeFlag; bool success = ParseRational(_lineEdit->text().toAscii(), rval, typeFlag); if(success && typeFlag & _typeMask) { SetValue(rval); } _state = STATE_NORMAL; _lineEdit->hide(); EndDragging(); }
void wxHeaderCtrl::EndResizing(int xPhysical) { wxASSERT_MSG( IsResizing(), "shouldn't be called if we're not resizing" ); EndDragging(); ReleaseMouse(); wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_END_RESIZE, GetId()); event.SetEventObject(this); event.SetColumn(m_colBeingResized); event.SetWidth(ConstrainByMinWidth(m_colBeingResized, xPhysical)); GetEventHandler()->ProcessEvent(event); m_colBeingResized = COL_NONE; }
void wxHeaderCtrl::CancelDragging() { wxASSERT_MSG( IsDragging(), "shouldn't be called if we're not dragging anything" ); EndDragging(); unsigned int& col = IsResizing() ? m_colBeingResized : m_colBeingReordered; wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED, GetId()); event.SetEventObject(this); event.SetColumn(col); GetEventHandler()->ProcessEvent(event); col = COL_NONE; }
bool wxHeaderCtrl::EndReordering(int xPhysical) { wxASSERT_MSG( IsReordering(), "shouldn't be called if we're not reordering" ); EndDragging(); ReleaseMouse(); const int colOld = m_colBeingReordered, colNew = FindColumnAtPoint(xPhysical); m_colBeingReordered = COL_NONE; if ( xPhysical - GetColStart(colOld) == m_dragOffset ) return false; if ( colNew != colOld ) { wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_END_REORDER, GetId()); event.SetEventObject(this); event.SetColumn(colOld); const unsigned pos = GetColumnPos(FindColumnAtPoint(xPhysical)); event.SetNewOrder(pos); if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() ) { // do reorder the columns DoMoveCol(colOld, pos); } } // whether we moved the column or not, the user did move the mouse and so // did try to do it so return true return true; }
BOOL CTreeFileCtrl::PreTranslateMessage(MSG* pMsg) { // When an item is being edited make sure the edit control // receives certain important key strokes if (GetEditControl()) { ::TranslateMessage(pMsg); ::DispatchMessage(pMsg); return TRUE; // DO NOT process further } //Context menu via the keyboard if ((((pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) && // If we hit a key and (pMsg->wParam == VK_F10) && (GetKeyState(VK_SHIFT) & ~1)) != 0) || // it's Shift+F10 OR (pMsg->message == WM_CONTEXTMENU)) // Natural keyboard key { CRect rect; GetItemRect(GetSelectedItem(), rect, TRUE); ClientToScreen(rect); OnContextMenu(NULL, rect.CenterPoint()); return TRUE; } //Hitting the Escape key, Cancelling drag & drop else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE && IsDragging()) { EndDragging(TRUE); return TRUE; } //Hitting the Alt-Enter key combination, show the properties sheet else if (pMsg->message == WM_SYSKEYDOWN && pMsg->wParam == VK_RETURN) { OnFileProperties(); return TRUE; } //Hitting the Enter key, open the item else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) { OnFileOpen(); return TRUE; } //Hitting the delete key, delete the item else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DELETE) { OnFileDelete(); return TRUE; } //hitting the backspace key, go to the parent folder else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_BACK) { UpOneLevel(); return TRUE; } //hitting the F2 key, being in-place editing of an item else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F2) { OnFileRename(); return TRUE; } //hitting the F5 key, force a refresh of the whole tree else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F5) { OnViewRefresh(); return TRUE; } //Let the parent class do its thing return CTreeCtrl::PreTranslateMessage(pMsg); }