Index: src/ch/FolderDialog.cpp =================================================================== diff -u -N -r547f865c69434c14c6f16e4b529d4198f6fe2040 -rafedcb6f4d37159266b6eaa97d8a7d0ce157de00 --- src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision 547f865c69434c14c6f16e4b529d4198f6fe2040) +++ src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision afedcb6f4d37159266b6eaa97d8a7d0ce157de00) @@ -20,7 +20,6 @@ #include "ch.h" #include "DirTreeCtrl.h" #include "FolderDialog.h" -#include "Theme Helpers.h" #include "shlobj.h" #include "StringHelpers.h" #include "TRecentPathsTools.h" @@ -1040,8 +1039,7 @@ void CFolderDialog::ResizeControls(int cx, int cy) { // is app themed ? - CUxThemeSupport uxt; - bool bThemed=uxt.IsThemeSupported() && uxt.IsAppThemed(); + bool bThemed=IsAppThemed(); // settings const int iMargin=7; // dialog units Index: src/ch/Theme Helpers.cpp =================================================================== diff -u -N --- src/ch/Theme Helpers.cpp (revision 9ddf8fdd5f641491dd30c49eb90f8f740314b6af) +++ src/ch/Theme Helpers.cpp (revision 0) @@ -1,119 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2001-2008 by J�zef Starosczyk * -* ixen@copyhandler.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU Library General Public License * -* (version 2) as published by the Free Software Foundation; * -* * -* This program 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 General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public * -* License along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ -#include "stdafx.h" -#include "Theme Helpers.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -CUxThemeSupport::CUxThemeSupport() -{ - m_hThemesDll=LoadLibrary(_T("UxTheme.dll")); -} - -CUxThemeSupport::~CUxThemeSupport() -{ - if (m_hThemesDll) - FreeLibrary(m_hThemesDll); -} - -HTHEME CUxThemeSupport::OpenThemeData(HWND hwnd, LPCWSTR pszClassList) -{ - ASSERT(m_hThemesDll); - if(!m_hThemesDll) - return nullptr; - - PFNOPENTHEMEDATA pfnProc=(PFNOPENTHEMEDATA)GetProcAddress(m_hThemesDll, "OpenThemeData"); - - if (pfnProc) - return (*pfnProc)(hwnd, pszClassList); - - return nullptr; -} - -HRESULT CUxThemeSupport::CloseThemeData(HTHEME hTheme) -{ - ASSERT(m_hThemesDll); - if(!m_hThemesDll) - return E_FAIL; - - PFNCLOSETHEMEDATA pfnProc=(PFNCLOSETHEMEDATA)GetProcAddress(m_hThemesDll, "CloseThemeData"); - - if (pfnProc) - return (*pfnProc)(hTheme); - - return E_UNEXPECTED; -} - -HRESULT CUxThemeSupport::DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pDestRect, UINT uEdge, UINT uFlags, RECT* pContentRect) -{ - ASSERT(m_hThemesDll); - if(!m_hThemesDll) - return E_FAIL; - - PFNDRAWTHEMEEDGE pfnProc=(PFNDRAWTHEMEEDGE)GetProcAddress(m_hThemesDll, "DrawThemeEdge"); - - if (pfnProc) - return (*pfnProc)(hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect); - - return E_UNEXPECTED; -} - -HRESULT CUxThemeSupport::DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect) -{ - ASSERT(m_hThemesDll); - if(!m_hThemesDll) - return E_FAIL; - - PFNDRAWTHEMEBACKGROUND pfnProc=(PFNDRAWTHEMEBACKGROUND)GetProcAddress(m_hThemesDll, "DrawThemeBackground"); - - if (pfnProc) - return (*pfnProc)(hTheme, hdc, iPartId, iStateId, pRect, pClipRect); - - return E_UNEXPECTED; -} - -HRESULT CUxThemeSupport::DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT* prc) -{ - ASSERT(m_hThemesDll); - if(!m_hThemesDll) - return E_FAIL; - - PFNDRAWTHEMEPARENTBACKGROUND pfnProc=(PFNDRAWTHEMEPARENTBACKGROUND)GetProcAddress(m_hThemesDll, "DrawThemeParentBackground"); - - if (pfnProc) - return (*pfnProc)(hwnd, hdc, prc); - - return E_UNEXPECTED; -} - -BOOL CUxThemeSupport::IsAppThemed() -{ - ASSERT(m_hThemesDll); - if(!m_hThemesDll) - return FALSE; - - PFNISAPPTHEMED pfnProc=(PFNISAPPTHEMED)GetProcAddress(m_hThemesDll, "IsAppThemed"); - - if (pfnProc) - return (*pfnProc)(); - - return FALSE; -} Index: src/ch/Theme Helpers.h =================================================================== diff -u -N --- src/ch/Theme Helpers.h (revision 541304f4e098b4c7617b718287ab40646d5deb92) +++ src/ch/Theme Helpers.h (revision 0) @@ -1,56 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2001-2008 by J�zef Starosczyk * -* ixen@copyhandler.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU Library General Public License * -* (version 2) as published by the Free Software Foundation; * -* * -* This program 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 General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public * -* License along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ -#ifndef __THEME_SUPPORT__ -#define __THEME_SUPPORT__ - -// definicja HTHEME - podobna do tej z UxTheme...h -#ifndef HTHEME -#define HTHEME HANDLE -#endif - -typedef HTHEME(_stdcall *PFNOPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList); -typedef HRESULT(_stdcall *PFNCLOSETHEMEDATA)(HTHEME hTheme); -typedef HRESULT(_stdcall *PFNDRAWTHEMEEDGE)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pDestRect, UINT uEdge, UINT uFlags, RECT* pContentRect); -typedef HRESULT(_stdcall *PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pRect, const RECT* pClipRect); -typedef HRESULT(_stdcall *PFNDRAWTHEMEPARENTBACKGROUND)(HWND hwnd, HDC hdc, RECT* prc); -typedef BOOL(_stdcall *PFNISAPPTHEMED)(); - -class CUxThemeSupport -{ -public: - CUxThemeSupport(); - ~CUxThemeSupport(); - - HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList); - HRESULT CloseThemeData(HTHEME hTheme); - - bool IsThemeSupported() { return m_hThemesDll != nullptr; } - BOOL IsAppThemed(); - - HRESULT DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pDestRect, UINT uEdge, UINT uFlags, RECT* pContentRect); - - HRESULT DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect); - HRESULT DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT* prc); - -protected: - - HMODULE m_hThemesDll; -}; - -#endif Index: src/ch/ThemedButton.cpp =================================================================== diff -u -N -r547f865c69434c14c6f16e4b529d4198f6fe2040 -rafedcb6f4d37159266b6eaa97d8a7d0ce157de00 --- src/ch/ThemedButton.cpp (.../ThemedButton.cpp) (revision 547f865c69434c14c6f16e4b529d4198f6fe2040) +++ src/ch/ThemedButton.cpp (.../ThemedButton.cpp) (revision afedcb6f4d37159266b6eaa97d8a7d0ce157de00) @@ -18,7 +18,6 @@ ***************************************************************************/ #include "stdafx.h" #include "ThemedButton.h" -#include "Theme helpers.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -69,15 +68,14 @@ CRect rcItem=lpDrawItemStruct->rcItem; // draw button's frame - CUxThemeSupport uxTheme; - if (uxTheme.IsThemeSupported() && uxTheme.IsAppThemed()) + if (IsAppThemed()) { - HTHEME ht=uxTheme.OpenThemeData(lpDrawItemStruct->hwndItem, L"TOOLBAR"); + HTHEME ht=OpenThemeData(lpDrawItemStruct->hwndItem, L"TOOLBAR"); - uxTheme.DrawThemeParentBackground(lpDrawItemStruct->hwndItem, memdc.GetDC().GetSafeHdc(), &rcItem); - uxTheme.DrawThemeBackground(ht, memdc.GetDC().GetSafeHdc(), TP_BUTTON, bPushed ? TS_PRESSED : (m_bHovering ? TS_HOT : TS_NORMAL), &rcItem, nullptr); + DrawThemeParentBackground(lpDrawItemStruct->hwndItem, memdc.GetDC().GetSafeHdc(), &rcItem); + DrawThemeBackground(ht, memdc.GetDC().GetSafeHdc(), TP_BUTTON, bPushed ? TS_PRESSED : (m_bHovering ? TS_HOT : TS_NORMAL), &rcItem, nullptr); - uxTheme.CloseThemeData(ht); + CloseThemeData(ht); } else DrawFrameControl(memdc.GetDC().GetSafeHdc(), &rcItem, DFC_BUTTON, DFCS_ADJUSTRECT | DFCS_BUTTONPUSH | (bPushed ? DFCS_PUSHED : 0)); Index: src/ch/ch.vc140.vcxproj =================================================================== diff -u -N -r814b694086d5dc450efb6a5e5c6902145ddc07fd -rafedcb6f4d37159266b6eaa97d8a7d0ce157de00 --- src/ch/ch.vc140.vcxproj (.../ch.vc140.vcxproj) (revision 814b694086d5dc450efb6a5e5c6902145ddc07fd) +++ src/ch/ch.vc140.vcxproj (.../ch.vc140.vcxproj) (revision afedcb6f4d37159266b6eaa97d8a7d0ce157de00) @@ -588,7 +588,6 @@ - @@ -680,7 +679,6 @@ - Index: src/ch/ch.vc140.vcxproj.filters =================================================================== diff -u -N -r814b694086d5dc450efb6a5e5c6902145ddc07fd -rafedcb6f4d37159266b6eaa97d8a7d0ce157de00 --- src/ch/ch.vc140.vcxproj.filters (.../ch.vc140.vcxproj.filters) (revision 814b694086d5dc450efb6a5e5c6902145ddc07fd) +++ src/ch/ch.vc140.vcxproj.filters (.../ch.vc140.vcxproj.filters) (revision afedcb6f4d37159266b6eaa97d8a7d0ce157de00) @@ -111,9 +111,6 @@ Source Files\GUI - - Source Files\GUI - Source Files\GUI @@ -317,9 +314,6 @@ Source Files\GUI - - Source Files\GUI - Source Files\GUI