void CMDIView::OnLButtonUp(UINT nFlags, CPoint point) { if(this == GetCapture()) ReleaseCapture(); // Stop capturing mouse messages // Make sure there is an element if(m_pTempElement) { // Add the element pointer to the sketch GetDocument()->AddElement(m_pTempElement); InvalidateRect(&m_pTempElement->GetEnclosingRect()); m_pTempElement.reset(); // Reset the element pointer } }
int InternalDialog(HWND hDlg) { HWND hWnd,hWndFocus,hWndCapture; int rc = 0; MSG msg; if(hDlg == 0) return 0; hWnd = GetWindowWord(hDlg,DWW_PARENT); if ((hWndCapture = GetCapture())) ReleaseCapture(); while (IsWindow(hDlg) && (GetWindowWord(hDlg,DWW_STATUS) == 0)) { if(GetMessage(&msg, (HWND)0, 0, 0)) { if (msg.message == WM_CLOSE) { DispatchMessage (&msg) ; break; } if(IsDialogMessage(hDlg,&msg)) continue; TranslateMessage (&msg) ; DispatchMessage (&msg) ; } if (hWnd) { /* if there is an owner */ if (!PeekMessage(&msg,hDlg,0,0,PM_NOREMOVE)) SendMessage(hWnd,WM_ENTERIDLE,MSGF_DIALOGBOX,(LPARAM)hDlg); } } if (IsWindow(hDlg)) { rc = GetWindowWord(hDlg,DWW_RESULT); DestroyWindow(hDlg); } if(hWnd && IsWindow(hWnd)) { EnableWindow(hWnd, TRUE); if ((hWndFocus = GetDialogFocus(hWnd))) SetFocus(hWndFocus); } if (hWndCapture) SetCapture(hWndCapture); return rc; }
void CDiasStatusBar::OnRButtonUp (UINT nFlags, CPoint point) { if (GetCapture() != this) { ReleaseCapture (); return; } ReleaseCapture (); CRect rect1, rect2; GetItemRect (2, rect1); GetItemRect (3, rect2); uvar32_64 n, count = 0; CaImMenu menu; CaImMenuItem** ppItems; menu.CreatePopupMenu (); GetItemRect (2, rect1); GetItemRect (3, rect2); if (rect1.PtInRect (point) || rect2.PtInRect (point)) { count = theApp.GeomScales.GetCount (); ppItems = new CaImMenuItem*[count]; for (n = 0; n < count; ++n) { ppItems[n] = new CaImMenuItem (theApp.GeomScales[n].GetName() + "\t(" + theApp.GeomScales[n].GetUnits () + ")", (theApp.GeomScales[aimActive].GetPos () == n) ? AMIS_CHECKED : 0); menu.AppendMenu (MF_STRING | MF_ENABLED | MF_OWNERDRAW, ID_TOOLS_GEOMSCALE_1 + n, (LPCTSTR)ppItems[n]); } menu.CheckMenuRadioItem (0, n, theApp.GeomScales[aimActive].GetPos (), MF_BYPOSITION); } GetItemRect (4, rect1); GetItemRect (5, rect2); if (rect1.PtInRect (point) || rect2.PtInRect (point)) { count = theApp.DensScales.GetCount (); ppItems = new CaImMenuItem*[count]; for (n = 0; n < count; ++n) { ppItems[n] = new CaImMenuItem (theApp.DensScales[n].GetName() + "\t(" + theApp.DensScales[n].GetUnits () + ")", (theApp.DensScales[aimActive].GetPos () == n) ? AMIS_CHECKED : 0); menu.AppendMenu (MF_STRING | MF_ENABLED | MF_OWNERDRAW, ID_TOOLS_GEOMSCALE_1 + n, (LPCTSTR)ppItems[n]); } menu.CheckMenuRadioItem (0, n, theApp.DensScales[aimActive].GetPos (), MF_BYPOSITION); } GetWindowRect (rect2); menu.TrackPopupMenu (TPM_LEFTALIGN, point.x + rect2.left, point.y + rect2.top, this); for (n = 0; n < count; ++n) delete ppItems[n]; if (count > 0) delete [] ppItems; }
void SButton::OnStateChanged( DWORD dwOldState,DWORD dwNewState ) { StopCurAnimate(); if(GetCapture()==m_swnd) //点击中 return; if(m_bAnimate && ((dwOldState==WndState_Normal && dwNewState==WndState_Hover) ||(dwOldState==WndState_Hover && dwNewState==WndState_Normal))) {//启动动画 m_byAlphaAni=5; GetContainer()->RegisterTimelineHandler(this); } }
// 鼠标左键按下 void ProgressController::left_button_down() { // 查询当前光标位置,判断光标是在滑道还是滑块上 POINT p; GetCursorPos(&p); HWND hwnd = GetCapture(); ScreenToClient(hwnd, &p); if (p.x >= m_left && p.x <= m_left + m_width) { // 如果光标在滑道上 POINT point; GetCursorPos(&point); // 查询光标位置 } }
void CRoundButton2::OnCaptureChanged(CWnd *pWnd) { // Check, if we lost the mouse-capture if (GetCapture() != this) { // We have lost the mouse-capture, so the mouse has left the buttons face m_bMouseOnButton = false; // Redraw Control, if Button is hot if (m_bIsHotButton) Invalidate(); } CButton::OnCaptureChanged(pWnd); }
void CAutoRepeatButton::OnLButtonUp(UINT nFlags, CPoint point) { KillTimer(IDT_TIMER); if(GetCapture() != NULL) { /* release capture */ ReleaseCapture(); if(sent == 0 && (GetState() & BST_PUSHED) != 0) GetParent()->SendMessage(WM_COMMAND, MAKELONG(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); } /* release capture */ //CButton::OnLButtonUp(nFlags, point); }
// on mouse move void CSplitterFrame::OnMouseMove(UINT nFlags, CPoint point) { if(GetCapture()==this) { CPoint ptCursor; GetCursorPos(&ptCursor); CPoint pt = GetAbsPosition(); if(sp_uiDockSide==AFX_IDW_DOCKBAR_LEFT || sp_uiDockSide==AFX_IDW_DOCKBAR_RIGHT) { pt.x = ptCursor.x; } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_TOP || sp_uiDockSide==AFX_IDW_DOCKBAR_BOTTOM) { pt.y = ptCursor.y; } SetAbsPosition(pt); } CWnd::OnMouseMove(nFlags, point); }
void CSketcherView::OnLButtonUp(UINT nFlags, CPoint point) { if(this == GetCapture()) ReleaseCapture(); // Stop capturing mouse messages // Make sure there is an element if(m_pTempElement) { // Call a document class function to store the element // pointed to by m_pTempElement in the document object delete m_pTempElement; // This code is temporary m_pTempElement = 0; // Reset the element pointer } }
LTBOOL CFolderJoin::OnLButtonUp(int x, int y) { if (bDblClick) { bDblClick = LTFALSE; return LTFALSE; } if (GetCapture()) { return m_pPassEdit->OnEnter(); } return CBaseFolder::OnLButtonUp(x,y); }
BOOL CExtButton::PreTranslateMessage(MSG* pMsg) { if( !CExtPopupMenuWnd::IsMenuTracking() ) { InitToolTip(); m_ToolTip.RelayEvent(pMsg); } // if( CExtPopupMenuWnd::IsMenuTracking() ) // return TRUE; if( ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP ) && ( pMsg->wParam == VK_RETURN || pMsg->wParam == VK_SPACE ) ) { if( IsWindowEnabled() && IsWindowVisible() && (!m_bPushTracking) ) { if( (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) || (pMsg->message == WM_KEYUP && pMsg->wParam == VK_SPACE) ) { if( GetCapture() == this ) ReleaseCapture(); m_bMouseOver = m_bPushed = m_bPushTracking = m_bKeyTracking = FALSE; Invalidate(); UpdateWindow(); _OnClick(); return TRUE; } if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_SPACE) { m_bMouseOver = m_bPushed = m_bKeyTracking = TRUE; SetCapture(); Invalidate(); UpdateWindow(); return TRUE; } } // if( IsWindowEnabled() && IsWindowVisible() && (!m_bPushTracking) ) return TRUE; } return CButton::PreTranslateMessage(pMsg); }
////////////////// // Change state for finite-state-machine. // void CDragDropMgr::SetState(UINT iState) { // TRACE(_T("CDragDropMgr::SetState %d\n"),iState); if (iState != m_iState) { switch (iState) { case CAPTURED: ::SetCapture(m_hwndTracking); // capture mouse input break; case LDRAGGING: case RDRAGGING: m_hCursorSave = GetCursor(); // save current cursor break; default: // NONE if (GetCapture() == m_hwndTracking) ::ReleaseCapture(); // release capture and.. SetCursor(m_hCursorSave); // ..restore cursor if (m_pDragImage) { m_pDragImage->DragLeave(CWnd::FromHandle(m_ddi.hwndTarget)); m_pDragImage->EndDrag(); // end drawing and.. delete m_pDragImage; // ..destroy.. m_pDragImage=NULL; // ..image list } if (m_hwndTracking) InvalidateRect(m_hwndTracking, NULL, FALSE); if (m_ddi.hwndTarget) InvalidateRect(m_ddi.hwndTarget, NULL, FALSE); delete m_ddi.pData; m_ddi.pData = NULL; m_hwndTracking = NULL; break; } m_iState = iState; } }
void ZListTip::OnMouseMove( UINT uFlags, CPoint pt ) { #ifdef DEBUG_ALL TraceRect( "ZListTip::OnMouseMove rectTitle: ", m_rectTitle ); TracePoint( "ZListTip::OnMouseMove pt: ", pt ); #endif if ( m_rectTitle.PtInRect( pt ) == FALSE ) { #ifdef DEBUG_ALL TracePoint( "ZListTip::OnMouseMove PtInRect: ", pt ); #endif #if 0 if ( GetCapture( ) == this ) ReleaseCapture( ); SetWindowPos( 0, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE ); #else Hide( ); #endif // Forward the message ClientToScreen( &pt ); CWnd *pWnd = WindowFromPoint( pt ); if ( pWnd == this ) pWnd = m_pParentWnd; CWnd *pWndTemp = GetFocus( ); if ( pWndTemp != pWnd ) pWnd->SetFocus( ); zLONG lParam = MAKELONG( pt.x, pt.y ); int nHitTest = (int) pWnd->SendMessage( WM_NCHITTEST, 0, lParam ); if ( nHitTest == HTCLIENT ) { pWnd->ScreenToClient( &pt ); lParam = MAKELONG( pt.x, pt.y ); pWnd->PostMessage( WM_MOUSEMOVE, uFlags, lParam ); } else { pWnd->PostMessage( WM_NCMOUSEMOVE, nHitTest, lParam ); } } }
bool track_bar::on_hooked_message(message_hook_manager::t_message_hook_type p_type, int code, WPARAM wp, LPARAM lp) { win32_keyboard_lparam & lpkeyb = get_keyboard_lparam(lp); if (wp == VK_ESCAPE && !lpkeyb.transition_code && !lpkeyb.previous_key_state) { destroy_tooltip(); if (GetCapture() == get_wnd()) ReleaseCapture(); m_dragging = false; set_position_internal(m_position); message_hook_manager::deregister_hook(message_hook_manager::type_keyboard, this); m_hook_registered=false; return true; } return false; }
void CFlatToolbar::OnCancelMode() { CControlBar::OnCancelMode(); if (m_iButtonCapture >= 0) { AFX_TBBUTTON* pTBB = _GetButtonPtr(m_iButtonCapture); ASSERT(!(pTBB->nStyle & TBBS_SEPARATOR)); UINT nNewStyle = (pTBB->nStyle & ~TBBS_PRESSED); if (GetCapture() == this) ReleaseCapture(); SetButtonStyle(m_iButtonCapture, nNewStyle); m_iButtonCapture = -1; UpdateWindow(); } }
void WLTreeItemAL::OnLButtonDown(UINT /*nFlags*/, CPoint point) { SetFocus() ; m_bLButtonDown = TRUE ; HostToClient(&point) ; if (SendMessage(WM_CAN_YOU_DRAG, 0, 0)) { if (GetCapture() != this) SetCapture() ; m_bPrepareDrag = TRUE ; m_dwPrepareDragTime = GetTickCount() ; m_ptPrepareDragPoint = point ; } }
//--------------------------------------------------------------------------------------- void z_ed3View::OnRButtonDown(UINT nFlags, CPoint point) { GetCursorPos(&_scrPoint); if(GetCapture()!= this) SetCapture(); GetCursorPos(&_scrPoint); HideTheCursor(); _mm._rdown = 1; _rotating = _mm._ldown; _mm._pt = point; _mm._ptd = point; CView::OnRButtonDown(nFlags, point); }
void CFolderSave::Escape() { if (GetCapture()) { m_pEdit->Select(LTFALSE); g_pColCtrl->SetString(0, g_hOldName); g_pColCtrl->SetString(2, g_hOldTime); SetCapture(LTNULL); RemoveFixedControl(m_pEdit); } else { CBaseFolder::Escape(); } }
void CFolderJoin::Escape() { if (m_pPassEdit && GetCapture() == m_pPassEdit) { SetCapture(LTNULL); m_szPassword[0] = LTNULL; RemoveFixedControl(m_pPassEdit); RemoveFixedControl(m_pPassLabel); RemoveFixedControl(m_pPassBack); m_bAskingForPassword = FALSE; ForceMouseUpdate(); } else CBaseFolder::Escape(); }
BOOL COptionTreeImagePopUp::PreTranslateMessage(MSG* pMsg) { // Relay tooltip if (IsWindow(m_ttToolTip.GetSafeHwnd())) { m_ttToolTip.RelayEvent(pMsg); } // Sometimes if the picker loses focus it is never destroyed if (GetCapture()->GetSafeHwnd() != GetSafeHwnd()) { SetCapture(); } return CWnd::PreTranslateMessage(pMsg); }
/*********************************************************************** * ScrollTrackScrollBar * * Track a mouse button press on a scroll-bar. * pt is in screen-coordinates for non-client scroll bars. */ VOID FASTCALL ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt) { MSG Msg; UINT XOffset = 0, YOffset = 0; if (SBType != SB_CTL) { // Used with CMD mouse tracking. PWND pwnd = ValidateHwnd(Wnd); if (!pwnd) return; XOffset = pwnd->rcClient.left - pwnd->rcWindow.left; YOffset = pwnd->rcClient.top - pwnd->rcWindow.top; // RECT rect; // WIN_GetRectangles( Wnd, COORDS_CLIENT, &rect, NULL ); ScreenToClient(Wnd, &Pt); // Pt.x -= rect.left; // Pt.y -= rect.top; Pt.x += XOffset; Pt.y += YOffset; } IntScrollHandleScrollEvent(Wnd, SBType, WM_LBUTTONDOWN, Pt); do { if (!GetMessageW(&Msg, 0, 0, 0)) break; if (CallMsgFilterW(&Msg, MSGF_SCROLLBAR)) continue; if ( Msg.message == WM_LBUTTONUP || Msg.message == WM_MOUSEMOVE || (Msg.message == WM_SYSTIMER && Msg.wParam == SCROLL_TIMER)) { Pt.x = LOWORD(Msg.lParam) + XOffset; Pt.y = HIWORD(Msg.lParam) + YOffset; IntScrollHandleScrollEvent(Wnd, SBType, Msg.message, Pt); } else { TranslateMessage(&Msg); DispatchMessageW(&Msg); } if (!IsWindow(Wnd)) { ReleaseCapture(); break; } } while (Msg.message != WM_LBUTTONUP && GetCapture() == Wnd); }
// --------------------------------------------------------------------- LRESULT WinSkinWindow::onDestroy( HWND hWnd, // ウィンドウハンドル UINT uMsg, // WM_DESTROY WPARAM wParam, // 利用しないパラメータ LPARAM lParam // 利用しないパラメータ ) { // unregister CoverChangedEventHandler CoverManager* manager = CoveredCalcApp::GetInstance()->GetCoverManager(); manager->UnregisterCoverChangeEventHandler(this); // MessageFilter としての自分自身を破棄 WinCoveredCalcApp::GetInstance()->UninstallMessageFilter(this); // マウスキャプチャが残っていたら解除 if (mouseCaptureNestCount > 0) { if (GetCapture() == m_hWnd) { ReleaseCapture(); } mouseCaptureNestCount = 0; } // タイマが残っていたら終了 SInt32 index; for (index = 0; index < TimerID_Max; index++) { if (timerNestCount[index] > 0) { KillTimer(m_hWnd, timerIdToWinTimerId(static_cast<TimerID>(index))); timerNestCount[index] = 0; } } base::wndProc(hWnd, uMsg, wParam, lParam); if (NULL != uiManager) { deleteUIManager(uiManager); uiManager = NULL; } ::DestroyWindow(hToolTipWnd); hToolTipWnd = NULL; return 0; }
void IntegerItem::ItemTimer(UINT nTimer) { HWND hwnd; if (MENU_INTITEM_TIMER != nTimer) { MenuItem::ItemTimer(nTimer); return; } hwnd = m_pMenu->m_hwnd; if (0 == m_direction || GetCapture() != hwnd) { KillTimer(hwnd, nTimer); return; } SetTimer(hwnd, MENU_INTITEM_TIMER, 0 == m_count ? 320 : 80, NULL); set_next_value(); }
/// WM_PAINT int wmPaint() { PAINTSTRUCT ps; HDC hdc = BeginPaint(m_hwnd, &ps); ASSERT(hdc); if (GetCapture() != m_hwnd) { RECT rc; CHECK_TRUE( GetClientRect(m_hwnd, &rc) ); CHECK_TRUE( DrawIcon(hdc, (rcWidth(&rc) - GetSystemMetrics(SM_CXICON)) / 2, (rcHeight(&rc) - GetSystemMetrics(SM_CYICON)) / 2, m_hCursor) ); } EndPaint(m_hwnd, &ps); return 0; }
void CButtonST::OnMouseMove(UINT nFlags, CPoint point) { CWnd* pWnd; // Finestra attiva CWnd* pParent; // Finestra che contiene il bottone CButton::OnMouseMove(nFlags, point); // If the mouse enter the button with the left button pressed // then do nothing if (nFlags & MK_LBUTTON && m_MouseOnButton == FALSE) return; // If our button is not flat then do nothing if (m_bIsFlat == FALSE) return; pWnd = GetActiveWindow(); pParent = GetOwner(); if ((GetCapture() != this) && ( #ifndef ST_LIKEIE pWnd != NULL && #endif pParent != NULL)) { m_MouseOnButton = TRUE; //SetFocus(); // Thanks Ralph! SetCapture(); Invalidate(); } else { CRect rc; GetClientRect(&rc); if (!rc.PtInRect(point)) { // Redraw only if mouse goes out if (m_MouseOnButton == TRUE) { m_MouseOnButton = FALSE; Invalidate(); } // If user is NOT pressing left button then release capture! if (!(nFlags & MK_LBUTTON)) ReleaseCapture(); } } } // End of OnMouseMove
void CTestTaskView::OnMouseMove(UINT flags, CPoint point) { if (GetCapture() == this) { CPoint tmp = GetDeviceScrollPosition(); CPoint buff = _end - tmp; _end = point; CRect rect; GetWindowRect(&rect); CPoint vec = CPoint(0, 0); if ((_end.x > (rect.right - rect.left) || _end.x < 0) || (_end.y >(rect.bottom - rect.top) || _end.y < 0)) { CPoint the_line = _end - _previous; if (_end.x > (rect.right - rect.left) || _end.x < 0) { if (the_line.y < 0) vec = CPoint(0, -1); else vec = CPoint(0, 1); } else if (_end.y > (rect.bottom - rect.top) || _end.y < 0) { if (the_line.x > 0) vec = CPoint(1, 0); else vec = CPoint(-1, 0); } double alpha = acos((double)(walter::scalar_multiplication(the_line, vec) / (walter::length(the_line) * walter::length(vec)))); CPoint shift_scroll = walter::const_multiplication(the_line, cos(alpha)); if (shift_scroll != CPoint(0, 0)) { walter::normalize(shift_scroll); ScrollToPosition(GetScrollPosition() + shift_scroll); } } _end += tmp; Invalidate(); } }
//------------------------------------------------------------------------------ void CALLBACK EXPORT CNetscapeStatusBar::CParentSubclass::MonitorTimerProc( HWND hwnd, UINT uMsg, UINT uTimerId, DWORD dwTime ) { CNetscapeStatusBar *pBar = (CNetscapeStatusBar *)CWnd::FromHandlePermanent( hwnd ); if( !pBar ) { return; } CNetscapeStatusBar::CParentSubclass *pThis = pBar->pParentSubclass; if( !GetCapture() && (eSBM_Simple == pThis->m_pStatusBar->GetStatBarMode()) ) { pThis->m_pStatusBar->ResetPanes( pThis->GetPrevMode() ); pThis->StopMonitor(); } }
//--------------------------------------------------------------------------------------- void z_ed3View::OnRButtonUp(UINT nFlags, CPoint point) { if(_mm._ldown==0) { if(GetCapture() == this) ReleaseCapture(); if(_scrPoint.x!=0) SetCursorPos(_scrPoint.x, _scrPoint.y); ShowTheCursor(); } _mm._rdown=FALSE; DOC()->Invalidate(); if(!_blockMouseCall) CView::OnRButtonUp(nFlags, point); }
void CCheckListBox::OnTimer(UINT nIDEvent) { if (nIDEvent == TIMER_ID) { if (GetCapture() == this) { CPoint cpPosition; GetCursorPos(&cpPosition); ScreenToClient(&cpPosition); MouseSelect(0, cpPosition); } } else { COwnerDrawListBox::OnTimer(nIDEvent); } }
void CCheckListBox::MouseSelect(UINT nFlags, CPoint point) { int nTopIndex = GetTopIndex(); if (GetCapture() == this) { CRect crClient; GetClientRect(crClient); int nIndex = Index(point); if (nIndex >= 0) { if (nIndex != m_nCurrent) { int nItem = m_nCurrent; while (nItem != nIndex) { if (nItem < nIndex) { nItem++; } else { nItem--; } Select(nItem, m_fMark, TRUE); } UpdateWindow(); SetCurSel(nIndex); m_nCurrent = nIndex; #ifdef WIN32 GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), LBN_SELCHANGE), (LPARAM)GetSafeHwnd()); #else GetParent()->SendMessage(WM_COMMAND, GetDlgCtrlID(), MAKELPARAM(GetSafeHwnd(), LBN_SELCHANGE)); #endif } } } m_fScrolling = (GetTopIndex() != nTopIndex); }