Пример #1
0
/*
	Called every time mouse hovers over a control that was previously registered for tool tip
	Registration was done in CreateToolTip()
	The Control ID (CtrlId) of the control is extracted from the input 'param' 
	The correct text is displayed according to the Control ID
*/
void SppTabAudio::UpdateToolTip(LPVOID param)
{
	LPNMTTDISPINFO lpttt = (LPNMTTDISPINFO)param;
	TCHAR ControlText[MAX_MSG_SIZE] ={0};
	TCHAR TitleText[MAX_MSG_SIZE] ={0};
	int ControlTextSize = 0;

	// Since the id field of the control in the tooltip was defined as a handle - it has to be converted back
	int CtrlId = GetDlgCtrlID((HWND)lpttt->hdr.idFrom);

	// Handle to the tooltip window
	HWND hToolTip = lpttt->hdr.hwndFrom;

	switch (CtrlId) // Per-control tooltips
	{
	case IDC_AUD_AUTO:	// Auto bitrate check box
		DisplayToolTip(lpttt, IDS_I_AUD_AUTO, IDS_T_AUD_AUTO);
		break;
	case IDC_AUD_8:		// Bitrate = 8
		DisplayToolTip(lpttt, IDS_I_AUD_8, IDS_T_AUD_8);
		break;
	case IDC_AUD_16:	// Bitrate = 16
		DisplayToolTip(lpttt, IDS_I_AUD_16, IDS_T_AUD_16);
		break;
	case IDC_CH_AUTO:	// Auto channel check box
		DisplayToolTip(lpttt, IDS_I_CH_AUTO, IDS_T_CH_AUTO);
		break;
	case IDC_LEFT:		// Left channel
		DisplayToolTip(lpttt, IDS_I_LEFT, IDS_T_LEFT);
		break;
	case IDC_RIGHT:		// Right channel
		DisplayToolTip(lpttt, IDS_I_RIGHT, IDS_T_RIGHT);
		break;
	case IDC_LEVEL_L:	// Audio level: Left channel
		DisplayToolTip(lpttt, IDS_I_LEVEL_L, IDS_T_LEVEL_L);
		break;
	case IDC_LEVEL_R:	// Audio level: Right channel
		DisplayToolTip(lpttt, IDS_I_LEVEL_R, IDS_T_LEVEL_R);
		break;
	case IDC_LEVEL_M:	// Audio level
		DisplayToolTip(lpttt, IDS_I_LEVEL_M);
		break;



	default:
		DisplayToolTip(lpttt, IDS_W_NOT_IMP, L"OOOPS", TTI_WARNING);
		break;
	}
}
Пример #2
0
//Show tooltip
//rCurrentPoint specifies current mouse position and it is in client coordinates of parent window(Not in screen coordinates).
BOOL CToolTip2::Show(const CPoint& rCurrentPoint)
{
	ASSERT(this != NULL );
	ASSERT(m_hWnd != NULL );

	//Is text empty or tool tip already displayed?
	if ( m_szText.IsEmpty() || m_bShowStatus)
		return FALSE;

	m_ptCurrent = rCurrentPoint;
	m_bShowStatus = TRUE;
	//Show tool tip
	DisplayToolTip(rCurrentPoint);
	return TRUE;
}
Пример #3
0
/*
	Should be never be called - only inhereted methods should be called
	Called every time mouse hovers over a control that was previously registered for tool tip
	Registration was done in CreateToolTip()
	The Control ID (CtrlId) of the control is extracted from the input 'param' 
	The correct text is displayed according to the Control ID
*/
void SppTab::UpdateToolTip(LPVOID param)
{
	LPNMTTDISPINFO lpttt = (LPNMTTDISPINFO)param;
	TCHAR ControlText[MAX_MSG_SIZE] ={0};
	TCHAR TitleText[MAX_MSG_SIZE] ={0};
	int ControlTextSize = 0;

	// Since the id field of the control in the tooltip was defined as a handle - it has to be converted back
	int CtrlId = GetDlgCtrlID((HWND)lpttt->hdr.idFrom);

	// Handle to the tooltip window
	HWND hToolTip = lpttt->hdr.hwndFrom;
	DisplayToolTip(lpttt, IDS_W_NOT_IMP, L"OOOPS!", TTI_WARNING);
	return;

}
Пример #4
0
// --- In  : nFlags - Unused
//           point -  Unused
// --- Out :
// --- Returns :
// --- Effect : Causes a switch between standard and extended info viewing
void COXToolTipCtrl::OnLButtonDown(UINT /*nFlags*/, CPoint /*point*/)
{
    // Sometimes a click comes through the pipeline after the tool
    // has already been removed
    if (!m_pCurrentToolTip || m_bTipCancelled)
        return;

    if (m_bHasExtendedText)
    {
        CRect rect;
        GetWindowRect(rect);
        DisplayToolTip(rect.TopLeft(), !m_bExtended);
    }

    if (m_hOldFocusWnd)
        ::SetFocus(m_hOldFocusWnd);

    //CWnd::OnLButtonDown(nFlags, point);
}
Пример #5
0
void CToolTip2::OnPaint()
{
	CPaintDC dc(this);

	DisplayToolTip(m_ptCurrent);
}
Пример #6
0
// --- In  : nIDEvent - The timer event
// --- Out :
// --- Returns :
// --- Effect : Timer events are used to either Activate the tooltip after
//              the mouse has been stationary for the specified time, remove
//              the tip after a specified display time, or periodically check
//              that the mouse is still within the bounds of the tool.
void COXToolTipCtrl::OnTimer(UINT nIDEvent)
{
    CPoint pt;
    COXToolTipInfo *pToolTip = NULL;

    if (!m_pCurrentToolTip || m_bTipCancelled)
    {
        KillTimer(nIDEvent);
        Pop();
        return;
    }

    switch (nIDEvent)
    {
    // The mouse has been still for sufficient time. If it's still in the
    // initial tool, then show the tooltip for that tool.
    case eIDDisplayToolEvent:
        KillTimer(eIDDisplayToolEvent);
        if (IsCursorInTool(m_pCurrentToolTip))
        {
            CPoint pt;
            GetCursorPos(&pt);
            pt += m_ptOffset;
            DisplayToolTip(pt);
            m_nElapsedTime = 0;
            SetTimer(eIDCheckToolEvent, m_nCheckInterval, NULL);
        }
        else
        {
            m_pCurrentToolTip = NULL;
        }
        break;

    // The tooltip is visible, check to see if: (a) it has been visible too long, and
    // (b) is still in the bounding rect (or tooltip window). If all is well then
    // reset the egg timer and check again later.
    case eIDCheckToolEvent:
        m_nElapsedTime += m_nCheckInterval;

        GetCursorPos(&pt);
        m_pParentWnd->ScreenToClient(&pt);
        pToolTip = FindToolFromPoint(pt);

        // Check that the cursor isn't over a new tool
        if (pToolTip && pToolTip != m_pCurrentToolTip)
        {
            KillTimer(eIDCheckToolEvent);
            Pop();
            return;
        }

        if (!IsCursorInTool(m_pCurrentToolTip) || (m_nElapsedTime >= m_nDisplayTime))
        {
            if (IsCursorInToolTip())
            {
                //TRACE0("Cursor in tooltip - will check later\n");
                //SetTimer(eIDCheckToolEvent, m_nCheckInterval, NULL);
            }
            else
            {
                //TRACE0("Not in tool or tooltip anymore, or expired. Destroying\n");
                KillTimer(eIDCheckToolEvent);
                Pop();
                //m_pCurrentToolTip = NULL;
            }
        }
        else
        {
            //TRACE0("Everything's OK - will check later\n");
            //SetTimer(eIDCheckToolEvent, m_nCheckInterval, NULL);
        }

        break;

    default:
        ASSERT(FALSE);
    }
}