Exemple #1
0
/***********************************************************************
 *      GetThemeFont                                        (UXTHEME.@)
 */
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
                            int iStateId, int iPropId, LOGFONTW *pFont)
{
    PTHEME_PROPERTY tp;

    TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
    if(!hTheme)
        return E_HANDLE;

    if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId)))
        return E_PROP_ID_UNSUPPORTED;
    return MSSTYLES_GetPropertyFont(tp, hdc, pFont);
}
Exemple #2
0
/***********************************************************************
 *      GetThemeSysFont                                     (UXTHEME.@)
 */
HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf)
{
    HRESULT hr = S_OK;
    PTHEME_PROPERTY tp;

    TRACE("(%p, %d)\n", hTheme, iFontID);
    if(hTheme) {
        if((tp = MSSTYLES_FindMetric(TMT_FONT, iFontID))) {
            HDC hdc = GetDC(NULL);
            hr = MSSTYLES_GetPropertyFont(tp, hdc, plf);
            ReleaseDC(NULL, hdc);
            if(SUCCEEDED(hr))
                return S_OK;
        }
    }
    if(iFontID == TMT_ICONTITLEFONT) {
        if(!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(LOGFONTW), plf, 0))
            return HRESULT_FROM_WIN32(GetLastError());
    }
    else {
        NONCLIENTMETRICSW ncm;
        LOGFONTW *font = NULL;
        ncm.cbSize = sizeof(NONCLIENTMETRICSW);
        if(!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0))
            return HRESULT_FROM_WIN32(GetLastError());
        switch(iFontID) {
        case TMT_CAPTIONFONT:
            font = &ncm.lfCaptionFont;
            break;
        case TMT_SMALLCAPTIONFONT:
            font = &ncm.lfSmCaptionFont;
            break;
        case TMT_MENUFONT:
            font = &ncm.lfMenuFont;
            break;
        case TMT_STATUSFONT:
            font = &ncm.lfStatusFont;
            break;
        case TMT_MSGBOXFONT:
            font = &ncm.lfMessageFont;
            break;
        default:
            FIXME("Unknown FontID: %d\n", iFontID);
            break;
        }
        if(font) *plf = *font;
        else     hr = STG_E_INVALIDPARAMETER;
    }
    return hr;
}