Example #1
0
BOOL COXToolTipCtrl::SetLogFont(LPLOGFONT lpLogFont, BOOL bRedraw /*=TRUE*/)
{
    ASSERT(lpLogFont);
    if (!lpLogFont)
        return FALSE;

    // Store font as the global default
    memcpy(&m_LogFont, lpLogFont, sizeof(LOGFONT));

    // If the new font is not the same as the system font, then we will no
    // longer update the font in the event of a System Settings Change.
    LPLOGFONT lpSysFont = GetSystemToolTipFont();

    // Not reliable
    //m_bUsingSystemFont = (memcmp(&m_LogFont, lpSysFont, sizeof(LOGFONT)) == 0);
    m_bUsingSystemFont = (m_LogFont.lfWeight == lpSysFont->lfWeight &&
                          m_LogFont.lfItalic == lpSysFont->lfItalic &&
                          m_LogFont.lfHeight == lpSysFont->lfHeight &&
                          m_LogFont.lfCharSet == lpSysFont->lfCharSet &&
                          !_tcscmp(m_LogFont.lfFaceName, lpSysFont->lfFaceName));

    // Create the actual font object
    m_Font.DeleteObject();
    m_Font.CreateFontIndirect(&m_LogFont);

    if (bRedraw && ::IsWindow(GetSafeHwnd()))
        Invalidate();

    return TRUE;
}
Example #2
0
// --- In  : wFlag - System-wide parameter flag (see WM_SETTINGCHANGE).
//           lpszSection - Name of changed section or registry changes.
// --- Out :
// --- Returns :
// --- Effect : If the tooltip font has not been overriden, this updates the
//              font with the new system tooltip font
void COXToolTipCtrl::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
    CWnd::OnSettingChange(uFlags, lpszSection);

    if (m_bUsingSystemFont)
        SetLogFont(GetSystemToolTipFont(), TRUE);
}
Example #3
0
// --- In  : hFont - Specifies a handle to the new font.
// --- Out :
// --- Returns : No return value
// --- Effect : Sets the new tooltip font
LRESULT COXToolTipCtrl::OnSetFont(WPARAM hFont, LPARAM /*lParam */)
{
    LRESULT result = Default();

    // Get the logical font from the supplied handle
    LOGFONT lf;
    if (!GetObject((HFONT) hFont, sizeof(LOGFONT), &lf))
    {
        SetLogFont(GetSystemToolTipFont());
        return result;
    }

    SetLogFont(&lf, TRUE);

    return result;
}
Example #4
0
BOOL COXToolTipCtrl::Create(CWnd* pParentWnd)
{
    m_pParentWnd = pParentWnd;

    // Get the class name and create the window
    CString szClassName = AfxRegisterWndClass(CS_CLASSDC|CS_SAVEBITS,
                          LoadCursor(NULL, IDC_ARROW));

    // Create the window - just don't show it yet.
    if (!CWnd::CreateEx(WS_EX_TOPMOST, szClassName, _T(""),
                        WS_POPUP,
                        0, 0, 10, 10, // Size & position updated when needed
                        pParentWnd->GetSafeHwnd(), 0, NULL))
    {
        return FALSE;
    }

    SetLogFont(GetSystemToolTipFont(), FALSE);

    return TRUE;
}
Example #5
0
BOOL CToolTipEx::Create(CWnd *pParentWnd)
{
    // Get the class name and create the window
    CString szClassName = AfxRegisterWndClass(CS_CLASSDC | CS_SAVEBITS,
        LoadCursor(NULL, IDC_ARROW));

    // Create the window - just don't show it yet.
    if( !CWnd::CreateEx(WS_EX_TOPMOST, szClassName, _T(""), WS_POPUP,
       0, 0, 0, 0, pParentWnd->GetSafeHwnd(), 0, NULL))
    {
        return FALSE;
    }	

	m_DittoWindow.DoCreate(this);
	m_DittoWindow.SetCaptionColors(g_Opt.m_Theme.CaptionLeft(), g_Opt.m_Theme.CaptionRight());
	m_DittoWindow.SetCaptionOn(this, CGetSetOptions::GetCaptionPos(), true);
	m_DittoWindow.m_bDrawMinimize = false;
	m_DittoWindow.m_bDrawMinimize = false;
	m_DittoWindow.m_bDrawChevron = false;
	m_DittoWindow.m_sendWMClose = false;

    m_RichEdit.Create(_T(""), _T(""), WS_CHILD | WS_VISIBLE | WS_VSCROLL |
		WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL |
                      ES_AUTOHSCROLL, CRect(10, 10, 100, 200), this, 1);

    m_RichEdit.SetReadOnly();
    m_RichEdit.SetBackgroundColor(FALSE, GetSysColor(COLOR_INFOBK));

    SetLogFont(GetSystemToolTipFont(), FALSE);

	m_optionsButton.Create(NULL, WS_CHILD | BS_OWNERDRAW | WS_TABSTOP, CRect(0, 0, 0, 0), this, 2);
	m_optionsButton.LoadStdImageDPI(IDB_COG_16_16, IDB_COG_20_20, IDB_COG_24_24, IDB_COG_32_32, _T("PNG"));
	m_optionsButton.SetToolTipText(theApp.m_Language.GetString(_T("DescriptionOptionsTooltip"), _T("Description Options")));
	m_optionsButton.ShowWindow(SW_SHOW);

    return TRUE;
}