void C4MenuItem::MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) { // clicky clicky! if (iButton == C4MC_Button_LeftDown) { // button down: Init drag only; Enter selection only by button up if (IsDragElement()) StartDragging(rMouse, iX, iY, dwKeyParam); } else if (iButton == C4MC_Button_LeftUp) { // left-click performed pMenu->UserEnter(::MouseControl.GetPlayer(), this, false); return; } else if (iButton == C4MC_Button_RightUp) { // right-up: Alternative enter command pMenu->UserEnter(::MouseControl.GetPlayer(), this, true); return; } // inherited; this is just setting some vars typedef C4GUI::Element ParentClass; ParentClass::MouseInput(rMouse, iButton, iX, iY, dwKeyParam); }
void CLVHdrCtrl::OnLButtonDown(UINT nFlags, CPoint point) { CHeaderCtrl::OnLButtonDown(nFlags, point); if (!m_bCCActive) return; // Start of Drag a column (m_dwHDRType) from Header to ..... // Get client window position CPoint currentClientPosition; currentClientPosition = ::GetMessagePos(); ScreenToClient(¤tClientPosition); // Get index of column we are on HDHITTESTINFO hdhti; hdhti.pt = currentClientPosition; hdhti.flags = 0; ::SendMessage(this->GetSafeHwnd(), HDM_HITTEST, 0, (LPARAM) &hdhti); // Get column name and type HD_ITEM hdi; hdi.mask = HDI_WIDTH | HDI_LPARAM | HDI_TEXT; enum { sizeOfBuffer = 256 }; wchar_t lpBuffer[sizeOfBuffer]; hdi.pszText = lpBuffer; hdi.cchTextMax = sizeOfBuffer; GetItem(hdhti.iItem, &hdi); m_dwHDRType = hdi.lParam; // Can't play with TITLE or USER if (m_dwHDRType == CItemData::TITLE || m_dwHDRType == CItemData::USER) return; // Get the data: ColumnChooser Listbox needs the column string const size_t iLen = wcslen(lpBuffer); CString cs_text; cs_text.Format(L"%08x%02x%02x%04x%s", GetCurrentProcessId(), FROMHDR, m_dwHDRType, iLen, lpBuffer); // Set drag image m_pDragImage = CreateDragImage(hdhti.iItem); m_pDragImage->BeginDrag(0, CPoint(8, 8)); m_pDragImage->DragEnter(GetDesktopWindow(), point); // Get client rectangle RECT rClient; GetClientRect(&rClient); // Start dragging StartDragging((BYTE *)LPCWSTR(cs_text), cs_text.GetLength() * sizeof(wchar_t), m_ccddCPFID, &rClient, &point); // End dragging image m_pDragImage->DragLeave(GetDesktopWindow()); m_pDragImage->EndDrag(); //delete m_pDragImage; }
void CLibraryAlbumView::OnMouseMove(UINT nFlags, CPoint point) { if ( m_bDrag && ( nFlags & MK_LBUTTON ) ) { CLibraryFileView::OnMouseMove( nFlags, point ); CSize szDiff = point - m_ptDrag; if ( abs( szDiff.cx ) > 5 || abs( szDiff.cy ) > 5 ) { m_bDrag = FALSE; StartDragging( point ); } CLibraryFileView::OnMouseMove( nFlags, point ); return; } else m_bDrag = FALSE; // CLibraryFileView::OnMouseMove( nFlags, point ); Overridden below! CLibraryView::OnMouseMove( nFlags, point ); CLibraryTipCtrl* pTip = ((CLibraryFrame*)GetOwner())->GetToolTip(); CRect rcTrack; if ( CLibraryAlbumTrack* pTrack = HitTest( point, &rcTrack ) ) { pTip->Show( pTrack->m_nIndex ); if ( pTrack->HitTestRating( rcTrack, point ) ) { m_pRating = pTrack; Invalidate(); SetCursor( theApp.LoadCursor( IDC_HAND ) ); } else if ( m_pRating != NULL ) { m_pRating = NULL; Invalidate(); } } else { pTip->Hide(); if ( m_pRating != NULL ) { m_pRating = NULL; Invalidate(); } } }
void Element::MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) { // store self as mouse-over-component rMouse.pMouseOverElement = this; // evaluate dragging if (pDragTarget && iButton == C4MC_Button_LeftDown && !rMouse.pDragElement) StartDragging(rMouse, iX, iY, dwKeyParam); // right button down: open context menu if (iButton == C4MC_Button_RightDown) { ContextHandler *pCtx = GetContextHandler(); if (pCtx) pCtx->OnContext(this, iX, iY); } }
void BorderButton(int a,UltimateContext *uc,int x,int y,int x_root,int y_root) { switch (InitS.BorderButtons[a]) { case 'M': RaiseWin(uc); StartWinMenu(uc,x_root,y_root); break; case 'D': StartDragging(uc,x,y); break; case 'R': StartResizing(uc,x_root,y_root); break; } }
void CColumnChooserLC::OnLButtonDown(UINT nFlags, CPoint point) { CListCtrl::OnLButtonDown(nFlags, point); // Move our text m_iItem = HitTest(point); if (m_iItem == -1) return; // Start of Drag of column (m_iItem) from Column Chooser dialog to..... CString cs_text; DWORD_PTR dw_type; dw_type = GetItemData(m_iItem); // ListView HeaderCtrl only needs the type as it uses main routine // to add/delete columns via SendMessage cs_text.Format(L"%08x%02x%02x", GetCurrentProcessId(), FROMCC, dw_type); // Get client window position CPoint currentClientPosition; currentClientPosition = ::GetMessagePos(); ScreenToClient(¤tClientPosition); // Set drag image m_pDragImage = CreateDragImage(m_iItem, ¤tClientPosition); m_pDragImage->BeginDrag(0, CPoint(8, 8)); m_pDragImage->DragEnter(GetDesktopWindow(), point); // Get client rectangle RECT rClient; GetClientRect(&rClient); // Start dragging StartDragging((BYTE *)LPCWSTR(cs_text), cs_text.GetLength() * sizeof(wchar_t), m_ccddCPFID, &rClient, &point); // End dragging image m_pDragImage->DragLeave(GetDesktopWindow()); m_pDragImage->EndDrag(); delete m_pDragImage; }
void CLibraryTileView::OnMouseMove(UINT nFlags, CPoint point) { if ( m_bDrag && ( nFlags & MK_LBUTTON ) ) { CSize szDiff = point - m_ptDrag; if ( abs( szDiff.cx ) > 5 || abs( szDiff.cy ) > 5 ) { m_bDrag = FALSE; CSingleLock oLock( &Library.m_pSection ); if ( oLock.Lock( 100 ) ) StartDragging( point ); } } else m_bDrag = FALSE; CLibraryView::OnMouseMove( nFlags, point ); }
void pfGUIButtonMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { if( !fClicking ) return; if( fDraggable == nil ) return; if( !fDraggable->IsVisible() ) { // Are we outside ourselves? if( !PointInBounds( mousePt ) ) { // Yes, start dragging StartDragging(); // Hand off our interest to the draggable fDialog->SetControlOfInterest( fDraggable ); } } }
void CGradientEditor::CStepHandle::OnMouseDown(int x, int y) { StartDragging(x); parent->StopHandlingSubItemEvents(); }
void SpeedDialThumbnail::OnMouseMove(const OpPoint& point) { if (g_widget_globals->captured_widget != this || !m_mouse_down_active || m_entry->IsEmpty() || GetLocked()) return GenericThumbnail::OnMouseMove(point); if (!IsDragging()) { const int drag_treshold = 5; const bool treshold_reached = ((labs(point.x - m_mousedown_point.x) > drag_treshold) || (labs(point.y - m_mousedown_point.y) > drag_treshold)); if (treshold_reached) { if (StartDragging(point.x, point.y)) { SetZ(Z_TOP); } } } if (IsDragging()) { OpPoint parent_point = point; parent_point.x += rect.x; parent_point.y += rect.y; if (!GetParent()->GetBounds().Contains(parent_point) && !g_drag_manager->IsDragging()) { if(g_input_manager->GetTouchInputState() & TOUCH_INPUT_ACTIVE) { // if this is caused by inertia, we don't want it flying off the viewport, nor // do we want to start an drag and drop outside Opera with touch StopDragging(); return; } // Stop dragging and start drag'n'drop when we move it out from the viewport. StopDragging(); if (StartDragging(parent_point.x, parent_point.y) && m_drag_object) { // Yes, that's on purpose: reset member first, then call StartDrag(). DesktopDragObject* object = m_drag_object; m_drag_object = NULL; // This transfers drag object ownership to OpDragManager: g_drag_manager->StartDrag(object, NULL, FALSE); } return; } // Drag the floating thumbnail widget. int x = rect.x + point.x - m_mousedown_point.x; int y = rect.y + point.y - m_mousedown_point.y; SetRect(OpRect(x, y, rect.width, rect.height)); // See if we are hovering over another thumbnail, and if so, // move the thumbnails to the new positions. SpeedDialThumbnail *other_sdt = GetDropThumbnail(); if (other_sdt && other_sdt->GetContent()->AcceptsDragDrop(*m_drag_object)) { other_sdt->GetContent()->HandleDragDrop(*m_drag_object); int target_pos = g_speeddial_manager->FindSpeedDial(m_entry); m_drag_object->SetID(target_pos); GetParent()->Relayout(true, false); } } }