void CTesthelpCtrl::OnLButtonDown(UINT nFlags, CPoint point) { // pass this message to the ToolTip control RelayEvent(WM_LBUTTONDOWN, (WPARAM)nFlags, MAKELPARAM(LOWORD(point.x), LOWORD(point.y))); COleControl::OnLButtonDown(nFlags, point); }
void CTesthelpCtrl::OnMouseMove(UINT nFlags, CPoint point) { // pass this message to the ToolTip control RelayEvent(WM_MOUSEMOVE, (WPARAM)nFlags, MAKELPARAM(LOWORD(point.x), LOWORD(point.y))); COleControl::OnMouseMove(nFlags, point); }
///////////////////////////////////////////////////////////////////////////// // //Method......: OnLButtonUp //Class.......: CxShadeButton // //Author......: Milan Gardian //Created.....: MAR-2001 // //Return value: NONE //Parameters..: As follows // > [in] nFlags: not used // > [in] point: coordinates of the mouse pointer when this event was spawned //Exceptions..: NONE //------------ //Description : // // > Handle event when left button is released (goes up) // //--------------------------------------------------------- void CxShadeButton::OnLButtonUp(UINT nFlags, CPoint point) { //TRACE("* %08X: up\n", ::GetTickCount()); //Pass this message to the ToolTip control RelayEvent(WM_LBUTTONUP,(WPARAM)nFlags,MAKELPARAM(LOWORD(point.x),LOWORD(point.y))); //Default-process the message m_button_down = false; CButton::OnLButtonUp(nFlags, point); }
///////////////////////////////////////////////////////////////////////////// // //Method......: OnMouseMove //Class.......: CxShadeButton // //Author......: Milan Gardian //Created.....: MAR-2001 // //Return value: NONE //Parameters..: As follows // > [in] nFlags: not used // > [in] point: coordinates of the mouse pointer when this event was spawned //Exceptions..: NONE //------------ //Description : // // > Handle change of mouse position: see the comments in the // method for further info. // //--------------------------------------------------------- void CxShadeButton::OnMouseMove(UINT nFlags, CPoint point) { //TRACE("* %08X: Mouse\n", ::GetTickCount()); //Pass this message to the ToolTip control RelayEvent(WM_MOUSEMOVE,(WPARAM)nFlags,MAKELPARAM(LOWORD(point.x),LOWORD(point.y))); //If we are in capture mode, button has been pressed down //recently and not yet released - therefore check is we are //actually over the button or somewhere else. If the mouse //position changed considerably (e.g. we moved mouse pointer //from the button to some other place outside button area) //force the control to redraw // if ((m_button_down) && (::GetCapture() == m_hWnd)) { POINT p2 = point; ::ClientToScreen(m_hWnd, &p2); HWND mouse_wnd = ::WindowFromPoint(p2); bool pressed = ((GetState() & BST_PUSHED) == BST_PUSHED); bool need_pressed = (mouse_wnd == m_hWnd); if (pressed != need_pressed) { //TRACE("* %08X Redraw\n", GetTickCount()); SetState(need_pressed ? TRUE : FALSE); Invalidate(); } } else { //Otherwise the button is released. That means we should //know when we leave its area - and so if we are not tracking //this mouse leave event yet, start now! // if (!m_tracking) { TRACKMOUSEEVENT t = { sizeof(TRACKMOUSEEVENT), TME_LEAVE, m_hWnd, 0 }; if (::_TrackMouseEvent(&t)) { //TRACE("* Mouse enter\n"); m_tracking = true; Invalidate(); } } } //Forward this event to superclass CButton::OnMouseMove(nFlags, point); }
LRESULT CCDInfo::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { POINT pt; short nTrack; pt.x = LOWORD(lParam); // horizontal position of cursor pt.y = HIWORD(lParam); // vertical position of cursor nTrack = GetTrackFromPoint(pt); if (nTrack) CDEvents_Click(nTrack); RelayEvent(uMsg, wParam, lParam, bHandled); return 0; }
LRESULT CCDInfo::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (m_wndToolTip.m_hWnd) { POINT pt; static int uId; pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); m_nMouseTrack = GetTrackFromPoint(pt); if (m_nMouseTrack) { TOOLINFO ti; ti.cbSize = sizeof(TOOLINFO); ti.hwnd = m_hTheWnd; uId = (uId==2) ? 1 : 2; ti.uId = uId; ti.rect.left = pt.x; ti.rect.right = pt.x+1; ti.rect.top = pt.y; ti.rect.bottom = pt.y+1; m_wndToolTip.SendMessage(TTM_NEWTOOLRECT, 0, (LPARAM)&ti); if (m_nMouseTrack) { short nLength = m_cd.GetTrackLength(m_nMouseTrack); short nSeconds = (short)(nLength % 60); TCHAR szTip[10]; TCHAR szSeconds[3]; wsprintf(szTip, _T("%hd:"), nLength / 60); if (nSeconds < 10) _tcscat_s(szTip, _countof(szTip), _T("0")); wsprintf(szSeconds, _T("%hd"), nSeconds); _tcscat_s(szTip, _countof(szTip), szSeconds); ti.lpszText = szTip; m_wndToolTip.SendMessage(TTM_UPDATETIPTEXT, 0, (LPARAM)&ti); } } RelayEvent(uMsg, wParam, lParam, bHandled); } return 0; }
///////////////////////////////////////////////////////////////////////////// // //Method......: OnLButtonUp //Class.......: CxSkinButton // //Author......: Milan Gardian //Created.....: MAR-2001 // //Return value: NONE //Parameters..: As follows // > [in] nFlags: not used // > [in] point: coordinates of the mouse pointer when this event was spawned //Exceptions..: NONE //------------ //Description : // // > Handle event when left button is released (goes up) // //--------------------------------------------------------- void CxSkinButton::OnLButtonUp(UINT nFlags, CPoint point) { //TRACE("* %08X: up\n", ::GetTickCount()); if (m_Style){ //track mouse for radio & check buttons POINT p2 = point; ::ClientToScreen(m_hWnd, &p2); HWND mouse_wnd = ::WindowFromPoint(p2); if (mouse_wnd == m_hWnd){ // mouse is in button if (m_Style==BS_CHECKBOX) SetCheck(m_Checked ? 0 : 1); if (m_Style==BS_RADIOBUTTON) SetCheck(1); } } //Pass this message to the ToolTip control RelayEvent(WM_LBUTTONUP,(WPARAM)nFlags,MAKELPARAM(LOWORD(point.x),LOWORD(point.y))); //Default-process the message m_button_down = false; CButton::OnLButtonUp(nFlags, point); }
///////////////////////////////////////////////////////////////////////////// // //Method......: OnLButtonDown //Class.......: CxShadeButton // //Author......: Milan Gardian //Created.....: MAR-2001 // //Return value: NONE //Parameters..: As follows // > [in] nFlags: not used // > [in] point: coordinates of the mouse pointer when this event was spawned //Exceptions..: NONE //------------ //Description : // // > Handle event when left button is pressed down // //--------------------------------------------------------- void CxShadeButton::OnLButtonDown(UINT nFlags, CPoint point) { //TRACE("* %08X: down\n", ::GetTickCount()); //Pass this message to the ToolTip control RelayEvent(WM_LBUTTONDOWN,(WPARAM)nFlags,MAKELPARAM(LOWORD(point.x),LOWORD(point.y))); //If we are tracking this button, cancel it if (m_tracking) { TRACKMOUSEEVENT t = { sizeof(TRACKMOUSEEVENT), TME_CANCEL | TME_LEAVE, m_hWnd, 0 }; if (::_TrackMouseEvent(&t)) { m_tracking = false; } } //Default-process the message m_button_down = true; CButton::OnLButtonDown(nFlags, point); }
BOOL STipCtrl::PreTranslateMessage( MSG* pMsg ) { if(IsWindow()) RelayEvent(pMsg); return FALSE; }
BOOL CToolTipWnd::PreTranslateMessage( MSG *pMsg ) { RelayEvent( pMsg ); return CWnd::PreTranslateMessage( pMsg ); }