Something went wrong. Try again.
Reactos
Something went wrong. Try again.
3.4 kB · 127 lines
C
at master
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128/* * ReactOS Calc (Theming support) * * Copyright 2007-2017, Carlo Bramini * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#include "calc.h"
#define GET_CB(name) \ calc_##name = (type_##name)GetProcAddress(hUxTheme, #name); \ if (calc_##name == NULL) calc_##name = dummy_##name;
static HTHEME WINAPIdummy_OpenThemeData(HWND hwnd, const WCHAR *pszClassList);
static HRESULT WINAPIdummy_CloseThemeData(HTHEME hTheme);
static HRESULT WINAPIdummy_DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *prc, const RECT *prcClip);
static BOOL WINAPIdummy_IsAppThemed(void);
static BOOL WINAPIdummy_IsThemeActive(void);
static BOOL WINAPIdummy_IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId);
static HRESULT WINAPIdummy_DrawThemeParentBackground(HWND hWnd, HDC hdc, RECT *prc);
type_OpenThemeData calc_OpenThemeData = dummy_OpenThemeData;type_CloseThemeData calc_CloseThemeData = dummy_CloseThemeData;type_DrawThemeBackground calc_DrawThemeBackground = dummy_DrawThemeBackground;type_IsAppThemed calc_IsAppThemed = dummy_IsAppThemed;type_IsThemeActive calc_IsThemeActive = dummy_IsThemeActive;type_IsThemeBackgroundPartiallyTransparent calc_IsThemeBackgroundPartiallyTransparent = \ dummy_IsThemeBackgroundPartiallyTransparent;type_DrawThemeParentBackground calc_DrawThemeParentBackground = \ dummy_DrawThemeParentBackground;
static HMODULE hUxTheme;
static HTHEME WINAPIdummy_OpenThemeData(HWND hwnd, const WCHAR* pszClassList){ return NULL;}
static HRESULT WINAPIdummy_CloseThemeData(HTHEME hTheme){ return E_NOTIMPL;}
static HRESULT WINAPIdummy_DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT* prc, const RECT* prcClip){ return E_NOTIMPL;}
static BOOL WINAPIdummy_IsAppThemed(void){ return FALSE;}
static BOOL WINAPIdummy_IsThemeActive(void){ return FALSE;}
static BOOL WINAPIdummy_IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId){ return FALSE;}
static HRESULT WINAPIdummy_DrawThemeParentBackground(HWND hWnd, HDC hdc, RECT *prc){ return E_NOTIMPL;}
void Theme_Start(HINSTANCE hInstance){ hUxTheme = LoadLibrary(_T("UXTHEME")); if (hUxTheme == NULL) return;
GET_CB(OpenThemeData) GET_CB(CloseThemeData) GET_CB(DrawThemeBackground) GET_CB(IsAppThemed) GET_CB(IsThemeActive) GET_CB(IsThemeBackgroundPartiallyTransparent) GET_CB(DrawThemeParentBackground)}
void Theme_Stop(void){ if(hUxTheme == NULL) return;
FreeLibrary(hUxTheme); hUxTheme = NULL;}