From 0f83b57a8b2cec6ad8cd51069da269eed96ef083 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 2 Oct 2011 18:09:24 +0200 Subject: [PATCH] remove the XPTheme wrapper class since we now require at least XP and don't need to link dynamically anymore. based on TSVN revision 20010 Signed-off-by: Sven Strickroth --- src/Git/GitStatusListCtrl.cpp | 6 +- src/Git/GitStatusListCtrl.h | 3 - src/TortoiseGitBlame/TortoiseGitBlame.vcproj | 36 +- src/TortoiseProc/EditPropertiesDlg.cpp | 4 +- src/TortoiseProc/FileDiffDlg.cpp | 5 +- src/TortoiseProc/FileDiffDlg.h | 4 +- src/TortoiseProc/GitLogListBase.cpp | 34 +- src/TortoiseProc/GitLogListBase.h | 4 +- src/TortoiseProc/LogDlg.cpp | 4 +- src/TortoiseProc/LogDlg.h | 1 - src/TortoiseProc/Settings/SetBugTraq.cpp | 4 +- src/TortoiseProc/Settings/SetHooks.cpp | 4 +- src/TortoiseProc/Settings/SetLookAndFeelPage.cpp | 7 +- src/TortoiseProc/Settings/SetOverlayIcons.cpp | 4 +- src/TortoiseProc/Settings/SetProgsAdvDlg.cpp | 4 +- src/TortoiseProc/TortoiseProc.vcproj | 10 +- src/Utils/MiscUI/OddButton.cpp | 278 ----------- src/Utils/MiscUI/OddButton.h | 105 ---- src/Utils/MiscUI/XPImageButton.cpp | 181 ------- src/Utils/MiscUI/XPImageButton.h | 31 -- src/Utils/MiscUI/XPTheme.cpp | 591 ----------------------- src/Utils/MiscUI/XPTheme.h | 432 ----------------- src/Utils/Utils.vcproj | 12 - 23 files changed, 59 insertions(+), 1705 deletions(-) delete mode 100644 src/Utils/MiscUI/OddButton.cpp delete mode 100644 src/Utils/MiscUI/OddButton.h delete mode 100644 src/Utils/MiscUI/XPImageButton.cpp delete mode 100644 src/Utils/MiscUI/XPImageButton.h delete mode 100644 src/Utils/MiscUI/XPTheme.cpp delete mode 100644 src/Utils/MiscUI/XPTheme.h diff --git a/src/Git/GitStatusListCtrl.cpp b/src/Git/GitStatusListCtrl.cpp index 39a0cf9f4..aa8e7d9da 100644 --- a/src/Git/GitStatusListCtrl.cpp +++ b/src/Git/GitStatusListCtrl.cpp @@ -51,7 +51,6 @@ //#include "AddDlg.h" //#include "EditPropertiesDlg.h" //#include "CreateChangelistDlg.h" -#include "XPTheme.h" #include "CommonResource.h" #include "AppUtils.h" @@ -225,8 +224,7 @@ void CGitStatusListCtrl::Init(DWORD dwColumns, const CString& sColumnInfoContain SetRedraw(false); SetExtendedStyle(exStyle); - CXPTheme theme; - theme.SetWindowTheme(m_hWnd, L"Explorer", NULL); + SetWindowTheme(m_hWnd, L"Explorer", NULL); m_nIconFolder = SYS_IMAGE_LIST().GetDirIconIndex(); SetImageList(&SYS_IMAGE_LIST(), LVSIL_SMALL); @@ -4138,7 +4136,7 @@ void CGitStatusListCtrl::PreSubclassWindow() { CListCtrl::PreSubclassWindow(); EnableToolTips(TRUE); - m_Theme.SetWindowTheme(GetSafeHwnd(), L"Explorer", NULL); + SetWindowTheme(GetSafeHwnd(), L"Explorer", NULL); } INT_PTR CGitStatusListCtrl::OnToolHitTest(CPoint point, TOOLINFO* pTI) const diff --git a/src/Git/GitStatusListCtrl.h b/src/Git/GitStatusListCtrl.h index b66cb0bc8..8f6d3fd30 100644 --- a/src/Git/GitStatusListCtrl.h +++ b/src/Git/GitStatusListCtrl.h @@ -24,7 +24,6 @@ #include "GitRev.h" #include "GitConfig.h" #include "Colors.h" -#include "XPTheme.h" #include "CommonResource.h" #include "HintListCtrl.h" @@ -1206,8 +1205,6 @@ public: int m_FileLoaded; git_revnum_t m_CurrentVersion; bool m_bDoNotAutoselectSubmodules; -public: - CXPTheme m_Theme; }; #if 0 diff --git a/src/TortoiseGitBlame/TortoiseGitBlame.vcproj b/src/TortoiseGitBlame/TortoiseGitBlame.vcproj index e191ea328..f769b55c2 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlame.vcproj +++ b/src/TortoiseGitBlame/TortoiseGitBlame.vcproj @@ -72,7 +72,7 @@ /> m_CommitHash].size();i++) { CString str; @@ -623,7 +628,7 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index) } //When row selected, ajust label color - if (!(m_Theme.IsAppThemed() && m_bVista)) + if (!(IsAppThemed() && m_bVista)) if (rItem.state & LVIS_SELECTED) colRef = CColors::MixColors(colRef, ::GetSysColor(COLOR_HIGHLIGHT), 150); @@ -658,13 +663,13 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index) W_Dc.Draw3dRect(rectEdge, m_Colors.Lighten(colRef,50), m_Colors.Darken(colRef,50)); //Draw text inside label - if (m_Theme.IsAppThemed() && m_bVista) + if (IsAppThemed() && m_bVista) { int txtState = LISS_NORMAL; if (rItem.state & LVIS_SELECTED) txtState = LISS_SELECTED; - m_Theme.DrawText(hdc, LVP_LISTITEM, txtState, shortname, -1, textpos | DT_SINGLELINE | DT_VCENTER, 0, &rt); + DrawThemeText(hTheme,hdc, LVP_LISTITEM, txtState, shortname, -1, textpos | DT_SINGLELINE | DT_VCENTER, 0, &rt); } else { @@ -695,13 +700,13 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index) } rt.right=rect.right; - if (m_Theme.IsAppThemed() && m_bVista) + if (IsAppThemed() && m_bVista) { int txtState = LISS_NORMAL; if (rItem.state & LVIS_SELECTED) txtState = LISS_SELECTED; - m_Theme.DrawText(hdc, LVP_LISTITEM, txtState, data->GetSubject(), -1, DT_NOPREFIX | DT_LEFT | DT_SINGLELINE | DT_VCENTER, 0, &rt); + DrawThemeText(hTheme,hdc, LVP_LISTITEM, txtState, data->GetSubject(), -1, DT_NOPREFIX | DT_LEFT | DT_SINGLELINE | DT_VCENTER, 0, &rt); } else { @@ -717,6 +722,9 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index) } } + if (hTheme) + CloseThemeData(hTheme); + W_Dc.Detach(); } @@ -1110,7 +1118,7 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult) if (data->bCopiedSelf) { // only change the background color if the item is not 'hot' (on vista with m_Themes enabled) - if (!m_Theme.IsAppm_Themed() || !m_bVista || ((pLVCD->nmcd.uItemState & CDIS_HOT)==0)) + if (!IsAppThemed()) || !m_bVista || ((pLVCD->nmcd.uItemState & CDIS_HOT)==0)) pLVCD->clrTextBk = GetSysColor(COLOR_MENU); } @@ -3205,4 +3213,4 @@ void CGitLogListBase::OnColumnMoved(NMHDR *pNMHDR, LRESULT *pResult) m_ColumnManager.OnColumnMoved(pNMHDR, pResult); Invalidate(FALSE); -} +} \ No newline at end of file diff --git a/src/TortoiseProc/GitLogListBase.h b/src/TortoiseProc/GitLogListBase.h index 5c1c540ff..2eba09946 100644 --- a/src/TortoiseProc/GitLogListBase.h +++ b/src/TortoiseProc/GitLogListBase.h @@ -21,7 +21,6 @@ #pragma once #include "HintListCtrl.h" -#include "XPTheme.h" #include "CommonResource.h" #include "Git.h" #include "ProjectProperties.h" @@ -448,8 +447,7 @@ public: protected: CComCriticalSection m_critSec; - CXPTheme m_Theme; - BOOL m_bVista; + bool m_bVista; HICON m_hModifiedIcon; HICON m_hReplacedIcon; diff --git a/src/TortoiseProc/LogDlg.cpp b/src/TortoiseProc/LogDlg.cpp index 08b52ae1e..9fca9b2ae 100644 --- a/src/TortoiseProc/LogDlg.cpp +++ b/src/TortoiseProc/LogDlg.cpp @@ -227,8 +227,8 @@ BOOL CLogDlg::OnInitDialog() m_cHidePaths.SetCheck(BST_INDETERMINATE); - //theme.SetWindowTheme(m_LogList.GetSafeHwnd(), L"Explorer", NULL); - //theme.SetWindowTheme(m_ChangedFileListCtrl.GetSafeHwnd(), L"Explorer", NULL); + //SetWindowTheme(m_LogList.GetSafeHwnd(), L"Explorer", NULL); + //SetWindowTheme(m_ChangedFileListCtrl.GetSafeHwnd(), L"Explorer", NULL); // set up the columns m_LogList.DeleteAllItems(); diff --git a/src/TortoiseProc/LogDlg.h b/src/TortoiseProc/LogDlg.h index 0a8d62c10..e8724f243 100644 --- a/src/TortoiseProc/LogDlg.h +++ b/src/TortoiseProc/LogDlg.h @@ -313,7 +313,6 @@ private: DWORD m_maxChild; HACCEL m_hAccel; - //CXPTheme theme; bool m_bVista; }; static UINT WM_REVSELECTED = RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG")); diff --git a/src/TortoiseProc/Settings/SetBugTraq.cpp b/src/TortoiseProc/Settings/SetBugTraq.cpp index bfa9c2b86..6b13ba456 100644 --- a/src/TortoiseProc/Settings/SetBugTraq.cpp +++ b/src/TortoiseProc/Settings/SetBugTraq.cpp @@ -19,7 +19,6 @@ #include "stdafx.h" #include "SetBugTraq.h" #include "SetBugTraqAdv.h" -#include "XPTheme.h" IMPLEMENT_DYNAMIC(CSetBugTraq, ISettingsPropPage) @@ -72,8 +71,7 @@ BOOL CSetBugTraq::OnInitDialog() temp.LoadString(IDS_SETTINGS_BUGTRAQ_PARAMETERSCOL); m_cBugTraqList.InsertColumn(2, temp); - CXPTheme theme; - theme.SetWindowTheme(m_cBugTraqList.GetSafeHwnd(), L"Explorer", NULL); + SetWindowTheme(m_hWnd, L"Explorer", NULL); RebuildBugTraqList(); diff --git a/src/TortoiseProc/Settings/SetHooks.cpp b/src/TortoiseProc/Settings/SetHooks.cpp index 252e77f6c..574a1f6fc 100644 --- a/src/TortoiseProc/Settings/SetHooks.cpp +++ b/src/TortoiseProc/Settings/SetHooks.cpp @@ -21,7 +21,6 @@ #include "SetHooks.h" #include "SetHooksAdv.h" #include "Hooks.h" -#include "XPTheme.h" IMPLEMENT_DYNAMIC(CSetHooks, ISettingsPropPage) @@ -77,8 +76,7 @@ BOOL CSetHooks::OnInitDialog() temp.LoadString(IDS_SETTINGS_HOOKS_SHOWCOL); m_cHookList.InsertColumn(4, temp); - CXPTheme theme; - theme.SetWindowTheme(m_cHookList.GetSafeHwnd(), L"Explorer", NULL); + SetWindowTheme(m_hWnd, L"Explorer", NULL); RebuildHookList(); diff --git a/src/TortoiseProc/Settings/SetLookAndFeelPage.cpp b/src/TortoiseProc/Settings/SetLookAndFeelPage.cpp index 61d4b4f85..e36803aa4 100644 --- a/src/TortoiseProc/Settings/SetLookAndFeelPage.cpp +++ b/src/TortoiseProc/Settings/SetLookAndFeelPage.cpp @@ -24,7 +24,6 @@ #include "StringUtils.h" #include ".\setlookandfeelpage.h" #include "MessageBox.h" -#include "XPTheme.h" #include "MenuInfo.h" #include "ShellCache.h" @@ -142,8 +141,7 @@ BOOL CSetLookAndFeelPage::OnInitDialog() m_cMenuList.DeleteColumn(c--); m_cMenuList.InsertColumn(0, _T("")); - CXPTheme theme; - theme.SetWindowTheme(m_cMenuList.GetSafeHwnd(), L"Explorer", NULL); + SetWindowTheme(m_hWnd, L"Explorer", NULL); m_cMenuList.SetRedraw(false); @@ -271,8 +269,7 @@ BOOL CSetExtMenu::OnInitDialog() m_cMenuList.DeleteColumn(c--); m_cMenuList.InsertColumn(0, _T("")); - CXPTheme theme; - theme.SetWindowTheme(m_cMenuList.GetSafeHwnd(), L"Explorer", NULL); + SetWindowTheme(m_cMenuList.GetSafeHwnd(), L"Explorer", NULL); m_cMenuList.SetRedraw(false); diff --git a/src/TortoiseProc/Settings/SetOverlayIcons.cpp b/src/TortoiseProc/Settings/SetOverlayIcons.cpp index a6043781b..4e539dfb7 100644 --- a/src/TortoiseProc/Settings/SetOverlayIcons.cpp +++ b/src/TortoiseProc/Settings/SetOverlayIcons.cpp @@ -26,7 +26,6 @@ #include "AppUtils.h" #include "PathUtils.h" #include "ShellUpdater.h" -#include "XPTheme.h" IMPLEMENT_DYNAMIC(CSetOverlayIcons, ISettingsPropPage) CSetOverlayIcons::CSetOverlayIcons() @@ -127,8 +126,7 @@ BOOL CSetOverlayIcons::OnInitDialog() m_sReadOnly.LoadString(IDS_SETTINGS_READONLYNAME); m_sLocked.LoadString(IDS_SETTINGS_LOCKEDNAME); - CXPTheme theme; - theme.SetWindowTheme(m_cIconList.GetSafeHwnd(), L"Explorer", NULL); + SetWindowTheme(m_hWnd, L"Explorer", NULL); ShowIconSet(true); diff --git a/src/TortoiseProc/Settings/SetProgsAdvDlg.cpp b/src/TortoiseProc/Settings/SetProgsAdvDlg.cpp index 59ad9e3f0..b29dadc01 100644 --- a/src/TortoiseProc/Settings/SetProgsAdvDlg.cpp +++ b/src/TortoiseProc/Settings/SetProgsAdvDlg.cpp @@ -20,7 +20,6 @@ #include "TortoiseProc.h" #include "ToolAssocDlg.h" #include "SetProgsAdvDlg.h" -#include "XPTheme.h" #include "PathUtils.h" #include "DirFileEnum.h" @@ -139,8 +138,7 @@ BOOL CSetProgsAdvDlg::OnInitDialog() while (c>=0) m_ToolListCtrl.DeleteColumn(c--); - CXPTheme theme; - theme.SetWindowTheme(m_ToolListCtrl.GetSafeHwnd(), L"Explorer", NULL); + SetWindowTheme(m_hWnd, L"Explorer", NULL); CString temp; temp.LoadString(IDS_PROGS_EXTCOL); diff --git a/src/TortoiseProc/TortoiseProc.vcproj b/src/TortoiseProc/TortoiseProc.vcproj index 777a48ca4..543c4bb80 100644 --- a/src/TortoiseProc/TortoiseProc.vcproj +++ b/src/TortoiseProc/TortoiseProc.vcproj @@ -75,7 +75,7 @@ /> - + \ No newline at end of file diff --git a/src/Utils/MiscUI/OddButton.cpp b/src/Utils/MiscUI/OddButton.cpp deleted file mode 100644 index feadf4122..000000000 --- a/src/Utils/MiscUI/OddButton.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2001-2002 Paolo Messina and Jerzy Kaczorowski - * - * The contents of this file are subject to the Artistic License (the "License"). - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * http://www.opensource.org/licenses/artistic-license.html - * - * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - */ - -// OddButton.cpp : implementation file -// - -#include "stdafx.h" -#include "OddButton.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// COddButton - -COddButton::COddButton() -{ - m_bDefault = FALSE; - m_bCanBeDefault = FALSE; - - // invalid value, since type still unknown - m_nTypeStyle = ODDBTN_BS_TYPEMASK; -} - -COddButton::~COddButton() -{ -} - -IMPLEMENT_DYNAMIC(COddButton, CButton) - -BEGIN_MESSAGE_MAP(COddButton, CButton) - //{{AFX_MSG_MAP(COddButton) - ON_WM_GETDLGCODE() - //}}AFX_MSG_MAP - ON_MESSAGE(BM_SETSTYLE, OnSetStyle) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// COddButton message handlers - -/*! - PreSubclassWindow virtual override - - Initialize internal data members and verify that the BS_OWNERDRAW style is set - \note COddButton::PreSubclassWindow should be called if overrided in a derived class -*/ -void COddButton::PreSubclassWindow() -{ - // set initial control type - m_nTypeStyle = GetStyle() & ODDBTN_BS_TYPEMASK; - - // set initial default state flag - if (m_nTypeStyle == BS_DEFPUSHBUTTON) - { - // enable default state handling for push buttons - m_bCanBeDefault = TRUE; - - // set default state for a default button - m_bDefault = TRUE; - - // adjust style for default button - m_nTypeStyle = BS_PUSHBUTTON; - } - else if (m_nTypeStyle == BS_PUSHBUTTON) - { - // enable default state handling for push buttons - m_bCanBeDefault = TRUE; - } - - // you should not set the Owner Draw before this call - // (don't use the resource editor "Owner Draw" or - // ModifyStyle(0, BS_OWNERDRAW) before calling PreSubclassWindow() ) - ASSERT(m_nTypeStyle != BS_OWNERDRAW); - - // switch to owner-draw - ModifyStyle(ODDBTN_BS_TYPEMASK, BS_OWNERDRAW, SWP_FRAMECHANGED); - - CButton::PreSubclassWindow(); -} - -/// WM_GETDLGCODE message handler, indicate to the system whether we want to handle default state -UINT COddButton::OnGetDlgCode() -{ - UINT nCode = CButton::OnGetDlgCode(); - - // handle standard control types - switch (GetControlType()) - { - case BS_RADIOBUTTON: - case BS_AUTORADIOBUTTON: - nCode |= DLGC_RADIOBUTTON; - break; - - case BS_GROUPBOX: - nCode = DLGC_STATIC; - break; - } - - // tell the system if we want default state handling - // (losing default state always allowed) - if (m_bCanBeDefault || m_bDefault) - nCode |= (m_bDefault ? DLGC_DEFPUSHBUTTON : DLGC_UNDEFPUSHBUTTON); - - return nCode; -} - -/// BM_SETSTYLE message handler, update internal default state data member -LRESULT COddButton::OnSetStyle(WPARAM wParam, LPARAM lParam) -{ - UINT_PTR nNewType = (wParam & ODDBTN_BS_TYPEMASK); - - // update default state flag - if (nNewType == BS_DEFPUSHBUTTON) - { - // we must like default state at this point - ASSERT(m_bCanBeDefault); - - m_bDefault = TRUE; - } - else if (nNewType == BS_PUSHBUTTON) - { - // losing default state always allowed - m_bDefault = FALSE; - } - - // can't change control type after owner-draw is set. - // let the system process changes to other style bits - // and redrawing, while keeping owner-draw style - return DefWindowProc(BM_SETSTYLE, - (wParam & ~ODDBTN_BS_TYPEMASK) | BS_OWNERDRAW, lParam); -} - -///////////////////////////////////////////////////////////////////////////// -// COddButton methods - -/*! - Get the type of control to draw - \return The of control -*/ -UINT COddButton::GetControlType() const -{ - return m_nTypeStyle; -} - -/*! - Get the control's default state - \return TRUE if control has a default state, FALSE otherwise -*/ -BOOL COddButton::IsDefault() const -{ - // if we have default state, we must like it! - ASSERT((m_bCanBeDefault && m_bDefault) == m_bDefault); - - return m_bDefault; -} - -/*! - Enable default state handling - \param bEnable TRUE to enable default state handling, FALSE to disable -*/ -void COddButton::EnableDefault(BOOL bEnable) -{ - m_bCanBeDefault = bEnable; - - // disabling default when control has default state - // needs removing the default state - if (!bEnable && m_bDefault) - { - // remove default state - SendMessage(BM_SETSTYLE, (GetStyle() & ~ODDBTN_BS_TYPEMASK) | BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); - ASSERT(m_bDefault == FALSE); - - // update default button - CWnd* pParent = GetParent(); - if( pParent ) - { - LRESULT lRes = pParent->SendMessage(DM_GETDEFID); - if (HIWORD(lRes) == DC_HASDEFID) - { - pParent->SendMessage(DM_SETDEFID, LOWORD(lRes)); - } - } - } -} - -/*! - Set the dialog's default pushbutton - \param pDialog Dialog to set the default pushbutton - \param nID Button ID to make default - \note It fixes the drawing problem that sometimes occurs when using plain CDialog::SetDefID, - see also MS kb Q67655 ( - HOWTO: Change or Set the Default Push Button in a Dialog Box) -*/ -void COddButton::SetDefID(CDialog* pDialog, const UINT nID) -{ - if( !pDialog || !::IsWindow(pDialog->m_hWnd) ) - { - ASSERT(FALSE); // Bad pointer or dialog is not a window - return; - } - - // get the current default button - const DWORD dwPrevDefID = pDialog->GetDefID(); - const UINT nPrevID = (HIWORD(dwPrevDefID) == DC_HASDEFID) ? LOWORD(dwPrevDefID) : 0; - - /* - * Set the new default ID in the dialog - */ - pDialog->SetDefID(nID); - - /* - * Make sure the previous default button doesn't have the default state anymore - */ - - // check previous ID is a default-compatible button - // and it has the default state - LRESULT lRes = (nPrevID == 0) ? 0 : pDialog->SendDlgItemMessage(nPrevID, WM_GETDLGCODE); - if( (lRes & DLGC_BUTTON) && - (lRes & DLGC_DEFPUSHBUTTON) ) - { - pDialog->SendDlgItemMessage(nPrevID, BM_SETSTYLE, - BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); - } - - /* - * Make sure the new default button receives the default state - */ - - // check new ID is a button - lRes = (nID == 0) ? 0 : pDialog->SendDlgItemMessage(nID, WM_GETDLGCODE); - if( lRes & DLGC_BUTTON ) - { - // exception: current focused button should keep its default state (IMHO) - CWnd* pFocusWnd = GetFocus(); - LRESULT lResFocus = (pFocusWnd == NULL) ? 0 : pFocusWnd->SendMessage(WM_GETDLGCODE); - - // check focused control is a default-compatible button - if( (lResFocus & DLGC_BUTTON) && - (lResFocus & (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON)) ) - { - // remove default state (if needed) - if( (lRes & DLGC_DEFPUSHBUTTON) && - (nID != (UINT)pFocusWnd->GetDlgCtrlID()) ) - { - pDialog->SendDlgItemMessage(nID, BM_SETSTYLE, - BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); - } - - // set default state (if needed) - if( lResFocus & DLGC_UNDEFPUSHBUTTON ) - { - pFocusWnd->SendMessage(BM_SETSTYLE, - BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); - } - } - else if( lRes & DLGC_UNDEFPUSHBUTTON ) - { - // not default-compatible button has the focus - // set default state - pDialog->SendDlgItemMessage(nID, BM_SETSTYLE, - BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); - } - } -} diff --git a/src/Utils/MiscUI/OddButton.h b/src/Utils/MiscUI/OddButton.h deleted file mode 100644 index 69f6cd9d3..000000000 --- a/src/Utils/MiscUI/OddButton.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2001-2002 Paolo Messina and Jerzy Kaczorowski - * - * The contents of this file are subject to the Artistic License (the "License"). - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * http://www.opensource.org/licenses/artistic-license.html - * - * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - */ - -#if !defined(AFX_ODDBUTTON_H__4CA1E42E_E3C3_4FEA_99A1_E865DEB500DA__INCLUDED_) -#define AFX_ODDBUTTON_H__4CA1E42E_E3C3_4FEA_99A1_E865DEB500DA__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// OddButton.h : header file -// - -/// Control's type mask -#define ODDBTN_BS_TYPEMASK 0x0000000FL - -///////////////////////////////////////////////////////////////////////////// -// COddButton window - -/*! - \brief Owner-Draw Default Button is a base class for owner-draw buttons that provides basic - support for default state handling. - - Derived class can indicate the default state when appropriate simply by calling - COddButton::IsDefault method to determine the default state and using - any visual effect (e.g. a thin black frame around the button) when it becomes default. - - \note A special static method COddButton::SetDefID can be used to set the default button - for the dialog to work around the problems with using a CDialog::SetDefID described in MS kb Q67655 - ( - HOWTO: Change or Set the Default Push Button in a Dialog Box - ) -*/ -class COddButton : public CButton -{ - DECLARE_DYNAMIC(COddButton) -// Construction -public: - COddButton(); - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(COddButton) - protected: - virtual void PreSubclassWindow(); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~COddButton(); - -// Generated message map functions -protected: - //{{AFX_MSG(COddButton) - afx_msg UINT OnGetDlgCode(); - //}}AFX_MSG - afx_msg LRESULT OnSetStyle(WPARAM wParam, LPARAM lParam); - - DECLARE_MESSAGE_MAP() - -private: - // Data members - BOOL m_bCanBeDefault; /*!< TRUE to enable default state handling */ - BOOL m_bDefault; /*!< Set to TRUE when control has default state */ - UINT m_nTypeStyle; /*!< Type of control */ - -protected: -// Interface - - /// Use to enable or disable default state handling - void EnableDefault(BOOL bEnable); - - /// Use to know whether the control has a default state - BOOL IsDefault() const; - - /// Use to know the type of control to draw - UINT GetControlType() const; - -public: - /// Use to set the dialog's default pushbutton - static void SetDefID(CDialog* pDialog, const UINT nID); -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_ODDBUTTON_H__4CA1E42E_E3C3_4FEA_99A1_E865DEB500DA__INCLUDED_) diff --git a/src/Utils/MiscUI/XPImageButton.cpp b/src/Utils/MiscUI/XPImageButton.cpp deleted file mode 100644 index edc213c65..000000000 --- a/src/Utils/MiscUI/XPImageButton.cpp +++ /dev/null @@ -1,181 +0,0 @@ -#include "stdafx.h" -#include "XPTheme.h" -#include "XPImageButton.h" - - -IMPLEMENT_DYNAMIC(CXPImageButton, CButton) -CXPImageButton::CXPImageButton() -{ -} - -CXPImageButton::~CXPImageButton() -{ -} - -BEGIN_MESSAGE_MAP(CXPImageButton, CButton) - ON_NOTIFY_REFLECT (NM_CUSTOMDRAW, OnNotifyCustomDraw) -END_MESSAGE_MAP() - -void CXPImageButton::OnNotifyCustomDraw(NMHDR * pNotifyStruct, LRESULT* result) -{ - LPNMCUSTOMDRAW pCustomDraw = (LPNMCUSTOMDRAW)pNotifyStruct; - ASSERT(pCustomDraw->hdr.hwndFrom == m_hWnd); - - DWORD style = GetStyle(); - if ((style & (BS_BITMAP | BS_ICON)) == 0 || !m_xpButton.IsAppThemed() || !m_xpButton.IsActive()) - { - // not an icon or bitmap. So just let windows handle its drawing. - *result = CDRF_DODEFAULT; - return; - } - - if (pCustomDraw->dwDrawStage == CDDS_PREERASE) - { - m_xpButton.DrawParentBackground(m_hWnd, pCustomDraw->hdc, &pCustomDraw->rc); - } - - if (pCustomDraw->dwDrawStage == CDDS_PREERASE || pCustomDraw->dwDrawStage == CDDS_PREPAINT) - { - m_xpButton.Open(m_hWnd, L"BUTTON"); - if (!m_xpButton.IsAppThemed() || !m_xpButton.IsActive()) - { - *result = CDRF_DODEFAULT; - return; - } - - // find the state for DrawThemeBackground() - int state_id = PBS_NORMAL; - if (style & WS_DISABLED) - state_id = PBS_DISABLED; - else if (pCustomDraw->uItemState & CDIS_SELECTED) - state_id = PBS_PRESSED; - else if (pCustomDraw->uItemState & CDIS_HOT) - state_id = PBS_HOT; - else if (style & BS_DEFPUSHBUTTON) - state_id = PBS_DEFAULTED; - - // draw themed button background according to the button state - m_xpButton.DrawBackground(pCustomDraw->hdc, BP_PUSHBUTTON, state_id, &pCustomDraw->rc, NULL); - - CRect content_rect (pCustomDraw->rc); - m_xpButton.GetBackgroundContentRect(pCustomDraw->hdc, BP_PUSHBUTTON, state_id, &pCustomDraw->rc, &content_rect); - m_xpButton.Close(); - - // draw the image - if (style & BS_BITMAP) - { - DrawBitmap(pCustomDraw->hdc, &content_rect, style); - } - else - { - ASSERT (style & BS_ICON); - DrawIcon(pCustomDraw->hdc, &content_rect, style); - } - - // draw the focus rectangle if needed - if (pCustomDraw->uItemState & CDIS_FOCUS) - { - // draw focus rectangle - DrawFocusRect(pCustomDraw->hdc, &content_rect); - } - - *result = CDRF_SKIPDEFAULT; - return; - } - - ASSERT (false); - *result = CDRF_DODEFAULT; -} - -void CXPImageButton::DrawBitmap(HDC hDC, const CRect& Rect, DWORD style) -{ - HBITMAP hBitmap = GetBitmap(); - if (hBitmap == NULL) - return; - - // determine the size of the bitmap image - BITMAPINFO bmi; - memset (&bmi, 0, sizeof(BITMAPINFO)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - GetDIBits(hDC, hBitmap, 0, 0, NULL, &bmi, DIB_RGB_COLORS); - - // determine position of top-left corner of bitmap - int x = ImageLeft(bmi.bmiHeader.biWidth, Rect, style); - int y = ImageTop(bmi.bmiHeader.biHeight, Rect, style); - - // Draw the bitmap - DrawState(hDC, NULL, NULL, (LPARAM) hBitmap, 0, x, y, bmi.bmiHeader.biWidth, bmi.bmiHeader.biHeight, - (style & WS_DISABLED) != 0 ? (DST_BITMAP | DSS_DISABLED) : (DST_BITMAP | DSS_NORMAL)); -} - -void CXPImageButton::DrawIcon(HDC hDC, const CRect& Rect, DWORD style) -{ - HICON hIcon = GetIcon(); - if (hIcon == NULL) - return; - - // determine the size of the icon - ICONINFO ii; - GetIconInfo(hIcon, &ii); - BITMAPINFO bmi; - memset(&bmi, 0, sizeof(BITMAPINFO)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - int cx = 0; - int cy = 0; - if (ii.hbmColor != NULL) - { - GetDIBits(hDC, ii.hbmColor, 0, 0, NULL, &bmi, DIB_RGB_COLORS); - cx = bmi.bmiHeader.biWidth; - cy = bmi.bmiHeader.biHeight; - } - else - { - GetDIBits(hDC, ii.hbmMask, 0, 0, NULL, &bmi, DIB_RGB_COLORS); - cx = bmi.bmiHeader.biWidth; - cy = bmi.bmiHeader.biHeight/2; - } - - // determine the position of the top-left corner of the icon - int x = ImageLeft (cx, Rect, style); - int y = ImageTop (cy, Rect, style); - - // Draw the icon - DrawState(hDC, NULL, NULL, (LPARAM) hIcon, 0, x, y, cx, cy, - (style & WS_DISABLED) != 0 ? (DST_ICON | DSS_DISABLED) : (DST_ICON | DSS_NORMAL)); - if (ii.hbmColor) - DeleteObject(ii.hbmColor); - if (ii.hbmMask) - DeleteObject(ii.hbmMask); -} - -int CXPImageButton::ImageLeft(int cx, const CRect& Rect, DWORD style) const -{ - // calculate the left position of the image so it is drawn on left, right or centered (the default) - // as set by the style settings. - int x = Rect.left; - if (cx > Rect.Width()) - cx = Rect.Width(); - else if ((style & BS_CENTER) == BS_LEFT) - x = Rect.left; - else if ((style & BS_CENTER) == BS_RIGHT) - x = Rect.right - cx; - else - x = Rect.left + (Rect.Width() - cx)/2; - return x; -} - -int CXPImageButton::ImageTop(int cy, const CRect& Rect, DWORD style) const -{ - // calculate the top position of the image so it is drawn on top, bottom or vertically centered (the default) - // as set by the style settings. - int y = Rect.top; - if (cy > Rect.Height()) - cy = Rect.Height(); - if ((style & BS_VCENTER) == BS_TOP) - y = Rect.top; - else if ((style & BS_VCENTER) == BS_BOTTOM) - y = Rect.bottom - cy; - else - y = Rect.top + (Rect.Height() - cy)/2; - return y; -} diff --git a/src/Utils/MiscUI/XPImageButton.h b/src/Utils/MiscUI/XPImageButton.h deleted file mode 100644 index d49f18995..000000000 --- a/src/Utils/MiscUI/XPImageButton.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "XPTheme.h" -#include "OddButton.h" - -/** - * \ingroup TortoiseProc - * A CButton which can show icons and images with - * the XP style. Normal CButtons only show the icons/images - * themselves, without the XP style background. - */ -class CXPImageButton : public CButton -{ - DECLARE_DYNAMIC(CXPImageButton) - -public: - CXPImageButton(); - virtual ~CXPImageButton(); - -protected: - DECLARE_MESSAGE_MAP() - - afx_msg void OnNotifyCustomDraw ( NMHDR * pNotifyStruct, LRESULT* result ); - - void DrawBitmap (HDC hDC, const CRect& Rect, DWORD style); - void DrawIcon (HDC hDC, const CRect& Rect, DWORD style); - int ImageLeft(int cx, const CRect& Rect, DWORD style) const; - int ImageTop(int cy, const CRect& Rect, DWORD style) const; - CXPTheme m_xpButton; -}; - diff --git a/src/Utils/MiscUI/XPTheme.cpp b/src/Utils/MiscUI/XPTheme.cpp deleted file mode 100644 index 8c0019b5d..000000000 --- a/src/Utils/MiscUI/XPTheme.cpp +++ /dev/null @@ -1,591 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2002 by Pål Kristian Tønder -// -// Distribute and change freely, except: don't remove my name from the source -// -// No warrantee of any kind, express or implied, is included with this -// software; use at your own risk, responsibility for damages (if any) to -// anyone resulting from the use of this software rests entirely with the -// user. -// -// Heavily based on the CVisualStyleXP class of David Yuheng Zhao. The difference -// is that the dll is global and the HTHEME handle is wrapped. The HTHEME handle is -// automatically released as the object is deleted. All API functions not directly -// related to a HTHEME instance are realized as static methods. To optimize the -// execution speed, static function pointers are used. During execution, either -// the actual function or the failure function is assigned to the static function -// pointer, which is used from there on. -// -// To explicitly Release the dll, call the static Release method. To check whether -// Theming is available, that is, if the platform is XP or newer, use the static -// method IsAvailable -// -// If you have any questions, I can be reached as follows: -// pal.k.tonder@powel.no -// -// -// How to use: -// Instead of calling the API directly, -// HTHEME hTheme = OpenThemeData(...); -// if(hTheme == NULL) { -// // draw old fashion way -// } -// else { -// DrawThemeBackground(hTheme, ...); -// . -// [more method calls] -// . -// CloseThemeData(hTheme); -// } -// -// use a variable of the CXPTheme class -// CXPTheme theme(...); -// if(!theme) { -// // draw old fashion way -// } -// else { -// theme.DrawBackground(...); -// . -// [more method calls] -// . -// } -// -// A couple of convenient operator overloads are provided:: -// - operator HTHEME for accessing the HTHEME handle -// - operator ! for checking if HTHEME handle is valid -// -///////////////////////////////////////////////////////////////////////////// -#include "stdafx.h" -#include "XPTheme.h" - -// Initializing static members -BOOL CXPTheme::m_bLoaded = FALSE; -HMODULE CXPTheme::m_hThemeDll = NULL; - -CXPTheme::PFNOPENTHEMEDATA CXPTheme::m_pOpenThemeData = NULL; -CXPTheme::PFNCLOSETHEMEDATA CXPTheme::m_pCloseThemeData = NULL; -CXPTheme::PFNDRAWTHEMEBACKGROUND CXPTheme::m_pDrawThemeBackground = NULL; -CXPTheme::PFNDRAWTHEMETEXT CXPTheme::m_pDrawThemeText = NULL; -CXPTheme::PFNGETTHEMEBACKGROUNDCONTENTRECT CXPTheme::m_pGetThemeBackgroundContentRect = NULL; -CXPTheme::PFNGETTHEMEBACKGROUNDEXTENT CXPTheme::m_pGetThemeBackgroundExtent = NULL; -CXPTheme::PFNGETTHEMEPARTSIZE CXPTheme::m_pGetThemePartSize = NULL; -CXPTheme::PFNGETTHEMETEXTEXTENT CXPTheme::m_pGetThemeTextExtent = NULL; -CXPTheme::PFNGETTHEMETEXTMETRICS CXPTheme::m_pGetThemeTextMetrics = NULL; -CXPTheme::PFNGETTHEMEBACKGROUNDREGION CXPTheme::m_pGetThemeBackgroundRegion = NULL; -CXPTheme::PFNHITTESTTHEMEBACKGROUND CXPTheme::m_pHitTestThemeBackground = NULL; -CXPTheme::PFNDRAWTHEMEEDGE CXPTheme::m_pDrawThemeEdge = NULL; -CXPTheme::PFNDRAWTHEMEICON CXPTheme::m_pDrawThemeIcon = NULL; -CXPTheme::PFNISTHEMEPARTDEFINED CXPTheme::m_pIsThemePartDefined = NULL; -CXPTheme::PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT CXPTheme::m_pIsThemeBackgroundPartiallyTransparent = NULL; -CXPTheme::PFNGETTHEMECOLOR CXPTheme::m_pGetThemeColor = NULL; -CXPTheme::PFNGETTHEMEMETRIC CXPTheme::m_pGetThemeMetric = NULL; -CXPTheme::PFNGETTHEMESTRING CXPTheme::m_pGetThemeString = NULL; -CXPTheme::PFNGETTHEMEBOOL CXPTheme::m_pGetThemeBool = NULL; -CXPTheme::PFNGETTHEMEINT CXPTheme::m_pGetThemeInt = NULL; -CXPTheme::PFNGETTHEMEENUMVALUE CXPTheme::m_pGetThemeEnumValue = NULL; -CXPTheme::PFNGETTHEMEPOSITION CXPTheme::m_pGetThemePosition = NULL; -CXPTheme::PFNGETTHEMEFONT CXPTheme::m_pGetThemeFont = NULL; -CXPTheme::PFNGETTHEMERECT CXPTheme::m_pGetThemeRect = NULL; -CXPTheme::PFNGETTHEMEMARGINS CXPTheme::m_pGetThemeMargins = NULL; -CXPTheme::PFNGETTHEMEINTLIST CXPTheme::m_pGetThemeIntList = NULL; -CXPTheme::PFNGETTHEMEPROPERTYORIGIN CXPTheme::m_pGetThemePropertyOrigin = NULL; -CXPTheme::PFNSETWINDOWTHEME CXPTheme::m_pSetWindowTheme = NULL; -CXPTheme::PFNGETTHEMEFILENAME CXPTheme::m_pGetThemeFilename = NULL; -CXPTheme::PFNGETTHEMESYSCOLOR CXPTheme::m_pGetThemeSysColor = NULL; -CXPTheme::PFNGETTHEMESYSCOLORBRUSH CXPTheme::m_pGetThemeSysColorBrush = NULL; -CXPTheme::PFNGETTHEMESYSBOOL CXPTheme::m_pGetThemeSysBool = NULL; -CXPTheme::PFNGETTHEMESYSSIZE CXPTheme::m_pGetThemeSysSize = NULL; -CXPTheme::PFNGETTHEMESYSFONT CXPTheme::m_pGetThemeSysFont = NULL; -CXPTheme::PFNGETTHEMESYSSTRING CXPTheme::m_pGetThemeSysString = NULL; -CXPTheme::PFNGETTHEMESYSINT CXPTheme::m_pGetThemeSysInt = NULL; -CXPTheme::PFNISTHEMEACTIVE CXPTheme::m_pIsThemeActive = NULL; -CXPTheme::PFNISAPPTHEMED CXPTheme::m_pIsAppThemed = NULL; -CXPTheme::PFNGETWINDOWTHEME CXPTheme::m_pGetWindowTheme = NULL; -CXPTheme::PFNENABLETHEMEDIALOGTEXTURE CXPTheme::m_pEnableThemeDialogTexture = NULL; -CXPTheme::PFNISTHEMEDIALOGTEXTUREENABLED CXPTheme::m_pIsThemeDialogTextureEnabled = NULL; -CXPTheme::PFNGETTHEMEAPPPROPERTIES CXPTheme::m_pGetThemeAppProperties = NULL; -CXPTheme::PFNSETTHEMEAPPPROPERTIES CXPTheme::m_pSetThemeAppProperties = NULL; -CXPTheme::PFNGETCURRENTTHEMENAME CXPTheme::m_pGetCurrentThemeName = NULL; -CXPTheme::PFNGETTHEMEDOCUMENTATIONPROPERTY CXPTheme::m_pGetThemeDocumentationProperty = NULL; -CXPTheme::PFNDRAWTHEMEPARENTBACKGROUND CXPTheme::m_pDrawThemeParentBackground = NULL; -CXPTheme::PFNENABLETHEMING CXPTheme::m_pEnableTheming = NULL; - -// Constructors -CXPTheme::CXPTheme(void) : m_hTheme(NULL) -{ -} - -CXPTheme::CXPTheme(HTHEME hTheme) -{ - m_hTheme = hTheme; -} - -CXPTheme::CXPTheme(HWND hwnd, LPCWSTR pszClassList) -{ - m_hTheme = NULL; - Open(hwnd, pszClassList); -} - -// Destructor -CXPTheme::~CXPTheme(void) -{ - Close(); -} - -void CXPTheme::Attach(HTHEME hTheme) -{ - Close(); - m_hTheme = hTheme; -} - -HTHEME CXPTheme::Detach() -{ - HTHEME hTheme = m_hTheme; - m_hTheme = NULL; - return hTheme; -} - -CXPTheme::operator HTHEME() const -{ - return m_hTheme; -} - -bool CXPTheme::operator !() const -{ - return (m_hTheme == NULL); -} - -BOOL CXPTheme::IsAvailable() -{ - if (m_hThemeDll == NULL && !m_bLoaded) { - m_hThemeDll = LoadLibrary(_T("UxTheme.dll")); - m_bLoaded = TRUE; - } - return m_hThemeDll != NULL; -} - -void CXPTheme::Release(void) -{ - if (m_hThemeDll != NULL) { - FreeLibrary(m_hThemeDll); - m_hThemeDll = NULL; - m_bLoaded = FALSE; - - // Set all function pointers to NULL - m_pOpenThemeData = NULL; - m_pCloseThemeData = NULL; - m_pDrawThemeBackground = NULL; - m_pDrawThemeText = NULL; - m_pGetThemeBackgroundContentRect = NULL; - m_pGetThemeBackgroundExtent = NULL; - m_pGetThemePartSize = NULL; - m_pGetThemeTextExtent = NULL; - m_pGetThemeTextMetrics = NULL; - m_pGetThemeBackgroundRegion = NULL; - m_pHitTestThemeBackground = NULL; - m_pDrawThemeEdge = NULL; - m_pDrawThemeIcon = NULL; - m_pIsThemePartDefined = NULL; - m_pIsThemeBackgroundPartiallyTransparent = NULL; - m_pGetThemeColor = NULL; - m_pGetThemeMetric = NULL; - m_pGetThemeString = NULL; - m_pGetThemeBool = NULL; - m_pGetThemeInt = NULL; - m_pGetThemeEnumValue = NULL; - m_pGetThemePosition = NULL; - m_pGetThemeFont = NULL; - m_pGetThemeRect = NULL; - m_pGetThemeMargins = NULL; - m_pGetThemeIntList = NULL; - m_pGetThemePropertyOrigin = NULL; - m_pSetWindowTheme = NULL; - m_pGetThemeFilename = NULL; - m_pGetThemeSysColor = NULL; - m_pGetThemeSysColorBrush = NULL; - m_pGetThemeSysBool = NULL; - m_pGetThemeSysSize = NULL; - m_pGetThemeSysFont = NULL; - m_pGetThemeSysString = NULL; - m_pGetThemeSysInt = NULL; - m_pIsThemeActive = NULL; - m_pIsAppThemed = NULL; - m_pGetWindowTheme = NULL; - m_pEnableThemeDialogTexture = NULL; - m_pIsThemeDialogTextureEnabled = NULL; - m_pGetThemeAppProperties = NULL; - m_pSetThemeAppProperties = NULL; - m_pGetCurrentThemeName = NULL; - m_pGetThemeDocumentationProperty = NULL; - m_pDrawThemeParentBackground = NULL; - m_pEnableTheming = NULL; - } -} - -void* CXPTheme::GetProc(LPCSTR szProc, void* pfnFail) -{ - void* pRet = pfnFail; - if (m_hThemeDll == NULL && !m_bLoaded) { - m_hThemeDll = LoadLibrary(_T("UxTheme.dll")); - m_bLoaded = TRUE; - } - if (m_hThemeDll != NULL) - pRet = GetProcAddress(m_hThemeDll, szProc); - return pRet; -} - -BOOL CXPTheme::Open(HWND hwnd, LPCWSTR pszClassList) -{ - // Close before opening - Close(); - if(m_pOpenThemeData == NULL) - m_pOpenThemeData = (CXPTheme::PFNOPENTHEMEDATA)GetProc("OpenThemeData", (void*)OpenThemeDataFail); - m_hTheme = (*m_pOpenThemeData)(hwnd, pszClassList); - return m_hTheme != NULL; -} - -void CXPTheme::Close() -{ - if(m_hTheme != NULL) { - if(m_pCloseThemeData == NULL) - m_pCloseThemeData = (CXPTheme::PFNCLOSETHEMEDATA)GetProc("CloseThemeData", (void*)CloseThemeDataFail); - (*m_pCloseThemeData)(m_hTheme); - m_hTheme = NULL; - } -} - -HRESULT CXPTheme::DrawBackground(HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect) -{ - if(m_pDrawThemeBackground == NULL) - m_pDrawThemeBackground = - (CXPTheme::PFNDRAWTHEMEBACKGROUND)GetProc("DrawThemeBackground", (void*)DrawThemeBackgroundFail); - return (*m_pDrawThemeBackground)(m_hTheme, hdc, iPartId, iStateId, pRect, pClipRect); -} - - -HRESULT CXPTheme::DrawText(HDC hdc, int iPartId, - int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, - DWORD dwTextFlags2, const RECT *pRect) -{ - if(m_pDrawThemeText == NULL) - m_pDrawThemeText = (CXPTheme::PFNDRAWTHEMETEXT)GetProc("DrawThemeText", (void*)DrawThemeTextFail); - return (*m_pDrawThemeText)(m_hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, dwTextFlags2, pRect); -} -HRESULT CXPTheme::GetBackgroundContentRect( HDC hdc, - int iPartId, int iStateId, const RECT *pBoundingRect, - RECT *pContentRect) -{ - if(m_pGetThemeBackgroundContentRect == NULL) - m_pGetThemeBackgroundContentRect = (CXPTheme::PFNGETTHEMEBACKGROUNDCONTENTRECT)GetProc("GetThemeBackgroundContentRect", (void*)GetThemeBackgroundContentRectFail); - return (*m_pGetThemeBackgroundContentRect)(m_hTheme, hdc, iPartId, iStateId, pBoundingRect, pContentRect); -} -HRESULT CXPTheme::GetBackgroundExtent( HDC hdc, - int iPartId, int iStateId, const RECT *pContentRect, - RECT *pExtentRect) -{ - if(m_pGetThemeBackgroundExtent == NULL) - m_pGetThemeBackgroundExtent = (CXPTheme::PFNGETTHEMEBACKGROUNDEXTENT)GetProc("GetThemeBackgroundExtent", (void*)GetThemeBackgroundExtentFail); - return (*m_pGetThemeBackgroundExtent)(m_hTheme, hdc, iPartId, iStateId, pContentRect, pExtentRect); -} -HRESULT CXPTheme::GetPartSize(HDC hdc, int iPartId, int iStateId, RECT * pRect, enum THEMESIZE eSize, SIZE *psz) -{ - if(m_pGetThemePartSize == NULL) - m_pGetThemePartSize = - (CXPTheme::PFNGETTHEMEPARTSIZE)GetProc("GetThemePartSize", (void*)GetThemePartSizeFail); - return (*m_pGetThemePartSize)(m_hTheme, hdc, iPartId, iStateId, pRect, eSize, psz); -} - -HRESULT CXPTheme::GetTextExtent(HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, - DWORD dwTextFlags, const RECT *pBoundingRect, - RECT *pExtentRect) -{ - if(m_pGetThemeTextExtent == NULL) - m_pGetThemeTextExtent = (CXPTheme::PFNGETTHEMETEXTEXTENT)GetProc("GetThemeTextExtent", (void*)GetThemeTextExtentFail); - return (*m_pGetThemeTextExtent)(m_hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, pBoundingRect, pExtentRect); -} - -HRESULT CXPTheme::GetTextMetrics(HDC hdc, int iPartId, int iStateId, TEXTMETRIC* ptm) -{ - if(m_pGetThemeTextMetrics == NULL) - m_pGetThemeTextMetrics = (CXPTheme::PFNGETTHEMETEXTMETRICS)GetProc("GetThemeTextMetrics", (void*)GetThemeTextMetricsFail); - return (*m_pGetThemeTextMetrics)(m_hTheme, hdc, iPartId, iStateId, ptm); -} - -HRESULT CXPTheme::GetBackgroundRegion(HDC hdc, int iPartId, int iStateId, const RECT *pRect, HRGN *pRegion) -{ - if(m_pGetThemeBackgroundRegion == NULL) - m_pGetThemeBackgroundRegion = (CXPTheme::PFNGETTHEMEBACKGROUNDREGION)GetProc("GetThemeBackgroundRegion", (void*)GetThemeBackgroundRegionFail); - return (*m_pGetThemeBackgroundRegion)(m_hTheme, hdc, iPartId, iStateId, pRect, pRegion); -} - -HRESULT CXPTheme::HitTestBackground(HDC hdc, int iPartId, int iStateId, DWORD dwOptions, const RECT *pRect, HRGN hrgn, - POINT ptTest, WORD *pwHitTestCode) -{ - if(m_pHitTestThemeBackground == NULL) - m_pHitTestThemeBackground = (CXPTheme::PFNHITTESTTHEMEBACKGROUND)GetProc("HitTestThemeBackground", (void*)HitTestThemeBackgroundFail); - return (*m_pHitTestThemeBackground)(m_hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode); -} - -HRESULT CXPTheme::DrawEdge(HDC hdc, int iPartId, int iStateId, - const RECT *pDestRect, UINT uEdge, UINT uFlags, RECT *pContentRect) -{ - if(m_pDrawThemeEdge == NULL) - m_pDrawThemeEdge = (CXPTheme::PFNDRAWTHEMEEDGE)GetProc("DrawThemeEdge", (void*)DrawThemeEdgeFail); - return (*m_pDrawThemeEdge)(m_hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect); -} - -HRESULT CXPTheme::DrawIcon(HDC hdc, int iPartId, - int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex) -{ - if(m_pDrawThemeIcon == NULL) - m_pDrawThemeIcon = (CXPTheme::PFNDRAWTHEMEICON)GetProc("DrawThemeIcon", (void*)DrawThemeIconFail); - return (*m_pDrawThemeIcon)(m_hTheme, hdc, iPartId, iStateId, pRect, himl, iImageIndex); -} - -BOOL CXPTheme::IsPartDefined(int iPartId, int iStateId) -{ - if(m_pIsThemePartDefined == NULL) - m_pIsThemePartDefined = (CXPTheme::PFNISTHEMEPARTDEFINED)GetProc("IsThemePartDefined", (void*)IsThemePartDefinedFail); - return (*m_pIsThemePartDefined)(m_hTheme, iPartId, iStateId); -} - -BOOL CXPTheme::IsBackgroundPartiallyTransparent(int iPartId, int iStateId) -{ - if(m_pIsThemeBackgroundPartiallyTransparent == NULL) - m_pIsThemeBackgroundPartiallyTransparent = (CXPTheme::PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)GetProc("IsThemeBackgroundPartiallyTransparent", (void*)IsThemeBackgroundPartiallyTransparentFail); - return (*m_pIsThemeBackgroundPartiallyTransparent)(m_hTheme, iPartId, iStateId); -} - -HRESULT CXPTheme::GetColor(int iPartId, int iStateId, int iPropId, COLORREF *pColor) -{ - if(m_pGetThemeColor == NULL) - m_pGetThemeColor = (CXPTheme::PFNGETTHEMECOLOR)GetProc("GetThemeColor", (void*)GetThemeColorFail); - return (*m_pGetThemeColor)(m_hTheme, iPartId, iStateId, iPropId, pColor); -} - -HRESULT CXPTheme::GetMetric(HDC hdc, int iPartId, int iStateId, int iPropId, int *piVal) -{ - if(m_pGetThemeMetric == NULL) - m_pGetThemeMetric = (CXPTheme::PFNGETTHEMEMETRIC)GetProc("GetThemeMetric", (void*)GetThemeMetricFail); - return (*m_pGetThemeMetric)(m_hTheme, hdc, iPartId, iStateId, iPropId, piVal); -} - -HRESULT CXPTheme::GetString(int iPartId, int iStateId, int iPropId, LPWSTR pszBuff, int cchMaxBuffChars) -{ - if(m_pGetThemeString == NULL) - m_pGetThemeString = (CXPTheme::PFNGETTHEMESTRING)GetProc("GetThemeString", (void*)GetThemeStringFail); - return (*m_pGetThemeString)(m_hTheme, iPartId, iStateId, iPropId, pszBuff, cchMaxBuffChars); -} - -HRESULT CXPTheme::GetBool(int iPartId, int iStateId, int iPropId, BOOL *pfVal) -{ - if(m_pGetThemeBool == NULL) - m_pGetThemeBool = (CXPTheme::PFNGETTHEMEBOOL)GetProc("GetThemeBool", (void*)GetThemeBoolFail); - return (*m_pGetThemeBool)(m_hTheme, iPartId, iStateId, iPropId, pfVal); -} - -HRESULT CXPTheme::GetInt(int iPartId, int iStateId, int iPropId, int *piVal) -{ - if(m_pGetThemeInt == NULL) - m_pGetThemeInt = (CXPTheme::PFNGETTHEMEINT)GetProc("GetThemeInt", (void*)GetThemeIntFail); - return (*m_pGetThemeInt)(m_hTheme, iPartId, iStateId, iPropId, piVal); -} - -HRESULT CXPTheme::GetEnumValue(int iPartId, int iStateId, int iPropId, int *piVal) -{ - if(m_pGetThemeEnumValue == NULL) - m_pGetThemeEnumValue = (CXPTheme::PFNGETTHEMEENUMVALUE)GetProc("GetThemeEnumValue", (void*)GetThemeEnumValueFail); - return (*m_pGetThemeEnumValue)(m_hTheme, iPartId, iStateId, iPropId, piVal); -} - -HRESULT CXPTheme::GetPosition(int iPartId, int iStateId, int iPropId, POINT *pPoint) -{ - if(m_pGetThemePosition == NULL) - m_pGetThemePosition = (CXPTheme::PFNGETTHEMEPOSITION)GetProc("GetThemePosition", (void*)GetThemePositionFail); - return (*m_pGetThemePosition)(m_hTheme, iPartId, iStateId, iPropId, pPoint); -} - -HRESULT CXPTheme::GetFont( HDC hdc, int iPartId, - int iStateId, int iPropId, LOGFONT *pFont) -{ - if(m_pGetThemeFont == NULL) - m_pGetThemeFont = (CXPTheme::PFNGETTHEMEFONT)GetProc("GetThemeFont", (void*)GetThemeFontFail); - return (*m_pGetThemeFont)(m_hTheme, hdc, iPartId, iStateId, iPropId, pFont); -} - -HRESULT CXPTheme::GetRect(int iPartId, int iStateId, int iPropId, RECT *pRect) -{ - if(m_pGetThemeRect == NULL) - m_pGetThemeRect = (CXPTheme::PFNGETTHEMERECT)GetProc("GetThemeRect", (void*)GetThemeRectFail); - return (*m_pGetThemeRect)(m_hTheme, iPartId, iStateId, iPropId, pRect); -} - -HRESULT CXPTheme::GetMargins( HDC hdc, int iPartId, - int iStateId, int iPropId, RECT *prc, MARGINS *pMargins) -{ - if(m_pGetThemeMargins == NULL) - m_pGetThemeMargins = (CXPTheme::PFNGETTHEMEMARGINS)GetProc("GetThemeMargins", (void*)GetThemeMarginsFail); - return (*m_pGetThemeMargins)(m_hTheme, hdc, iPartId, iStateId, iPropId, prc, pMargins); -} - -HRESULT CXPTheme::GetIntList(int iPartId, int iStateId, int iPropId, INTLIST *pIntList) -{ - if(m_pGetThemeIntList == NULL) - m_pGetThemeIntList = (CXPTheme::PFNGETTHEMEINTLIST)GetProc("GetThemeIntList", (void*)GetThemeIntListFail); - return (*m_pGetThemeIntList)(m_hTheme, iPartId, iStateId, iPropId, pIntList); -} - -HRESULT CXPTheme::GetPropertyOrigin(int iPartId, int iStateId, int iPropId, enum PROPERTYORIGIN *pOrigin) -{ - if(m_pGetThemePropertyOrigin == NULL) - m_pGetThemePropertyOrigin = (CXPTheme::PFNGETTHEMEPROPERTYORIGIN)GetProc("GetThemePropertyOrigin", (void*)GetThemePropertyOriginFail); - return (*m_pGetThemePropertyOrigin)(m_hTheme, iPartId, iStateId, iPropId, pOrigin); -} - -HRESULT CXPTheme::SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName, - LPCWSTR pszSubIdList) -{ - if(m_pSetWindowTheme == NULL) - m_pSetWindowTheme = (CXPTheme::PFNSETWINDOWTHEME)GetProc("SetWindowTheme", (void*)SetWindowThemeFail); - return (*m_pSetWindowTheme)(hwnd, pszSubAppName, pszSubIdList); -} - -HRESULT CXPTheme::GetFilename(int iPartId, - int iStateId, int iPropId, LPWSTR pszThemeFileName, int cchMaxBuffChars) -{ - if(m_pGetThemeFilename == NULL) - m_pGetThemeFilename = (CXPTheme::PFNGETTHEMEFILENAME)GetProc("GetThemeFilename", (void*)GetThemeFilenameFail); - return (*m_pGetThemeFilename)(m_hTheme, iPartId, iStateId, iPropId, pszThemeFileName, cchMaxBuffChars); -} - -COLORREF CXPTheme::GetSysColor(int iColorId) -{ - if(m_pGetThemeSysColor == NULL) - m_pGetThemeSysColor = (CXPTheme::PFNGETTHEMESYSCOLOR)GetProc("GetThemeSysColor", (void*)GetThemeSysColorFail); - return (*m_pGetThemeSysColor)(m_hTheme, iColorId); -} - -HBRUSH CXPTheme::GetSysColorBrush(int iColorId) -{ - if(m_pGetThemeSysColorBrush == NULL) - m_pGetThemeSysColorBrush = (CXPTheme::PFNGETTHEMESYSCOLORBRUSH)GetProc("GetThemeSysColorBrush", (void*)GetThemeSysColorBrushFail); - return (*m_pGetThemeSysColorBrush)(m_hTheme, iColorId); -} - -BOOL CXPTheme::GetSysBool(int iBoolId) -{ - if(m_pGetThemeSysBool == NULL) - m_pGetThemeSysBool = (CXPTheme::PFNGETTHEMESYSBOOL)GetProc("GetThemeSysBool", (void*)GetThemeSysBoolFail); - return (*m_pGetThemeSysBool)(m_hTheme, iBoolId); -} - -int CXPTheme::GetSysSize(int iSizeId) -{ - if(m_pGetThemeSysSize == NULL) - m_pGetThemeSysSize = (CXPTheme::PFNGETTHEMESYSSIZE)GetProc("GetThemeSysSize", (void*)GetThemeSysSizeFail); - return (*m_pGetThemeSysSize)(m_hTheme, iSizeId); -} - -HRESULT CXPTheme::GetSysFont(int iFontId, LOGFONT *plf) -{ - if(m_pGetThemeSysFont == NULL) - m_pGetThemeSysFont = (CXPTheme::PFNGETTHEMESYSFONT)GetProc("GetThemeSysFont", (void*)GetThemeSysFontFail); - return (*m_pGetThemeSysFont)(m_hTheme, iFontId, plf); -} - -HRESULT CXPTheme::GetSysString(int iStringId, - LPWSTR pszStringBuff, int cchMaxStringChars) -{ - if(m_pGetThemeSysString == NULL) - m_pGetThemeSysString = (CXPTheme::PFNGETTHEMESYSSTRING)GetProc("GetThemeSysString", (void*)GetThemeSysStringFail); - return (*m_pGetThemeSysString)(m_hTheme, iStringId, pszStringBuff, cchMaxStringChars); -} - -HRESULT CXPTheme::GetSysInt(int iIntId, int *piValue) -{ - if(m_pGetThemeSysInt == NULL) - m_pGetThemeSysInt = (CXPTheme::PFNGETTHEMESYSINT)GetProc("GetThemeSysInt", (void*)GetThemeSysIntFail); - return (*m_pGetThemeSysInt)(m_hTheme, iIntId, piValue); -} - -BOOL CXPTheme::IsActive() -{ - if(m_pIsThemeActive == NULL) - m_pIsThemeActive = (CXPTheme::PFNISTHEMEACTIVE)GetProc("IsThemeActive", (void*)IsThemeActiveFail); - return (*m_pIsThemeActive)(); -} - -BOOL CXPTheme::IsAppThemed() -{ - if(m_pIsAppThemed == NULL) - m_pIsAppThemed = (CXPTheme::PFNISAPPTHEMED)GetProc("IsAppThemed", (void*)IsAppThemedFail); - return (*m_pIsAppThemed)(); -} - -HTHEME CXPTheme::GetWindowTheme(HWND hwnd) -{ - if(m_pGetWindowTheme == NULL) - m_pGetWindowTheme = (CXPTheme::PFNGETWINDOWTHEME)GetProc("GetWindowTheme", (void*)GetWindowThemeFail); - return (*m_pGetWindowTheme)(hwnd); -} - -HRESULT CXPTheme::EnableDialogTexture(HWND hwnd, DWORD dwFlags) -{ - if(m_pEnableThemeDialogTexture == NULL) - m_pEnableThemeDialogTexture = (CXPTheme::PFNENABLETHEMEDIALOGTEXTURE)GetProc("EnableThemeDialogTexture", (void*)EnableThemeDialogTextureFail); - return (*m_pEnableThemeDialogTexture)(hwnd, dwFlags); -} - -BOOL CXPTheme::IsDialogTextureEnabled(HWND hwnd) -{ - if(m_pIsThemeDialogTextureEnabled == NULL) - m_pIsThemeDialogTextureEnabled = (CXPTheme::PFNISTHEMEDIALOGTEXTUREENABLED)GetProc("IsThemeDialogTextureEnabled", (void*)IsThemeDialogTextureEnabledFail); - return (*m_pIsThemeDialogTextureEnabled)(hwnd); -} - -DWORD CXPTheme::GetAppProperties() -{ - if(m_pGetThemeAppProperties == NULL) - m_pGetThemeAppProperties = (CXPTheme::PFNGETTHEMEAPPPROPERTIES)GetProc("GetThemeAppProperties", (void*)GetThemeAppPropertiesFail); - return (*m_pGetThemeAppProperties)(); -} - -void CXPTheme::SetAppProperties(DWORD dwFlags) -{ - if(m_pSetThemeAppProperties == NULL) - m_pSetThemeAppProperties = (CXPTheme::PFNSETTHEMEAPPPROPERTIES)GetProc("SetThemeAppProperties", (void*)SetThemeAppPropertiesFail); - (*m_pSetThemeAppProperties)(dwFlags); -} - -HRESULT CXPTheme::GetCurrentName( - LPWSTR pszThemeFileName, int cchMaxNameChars, - LPWSTR pszColorBuff, int cchMaxColorChars, - LPWSTR pszSizeBuff, int cchMaxSizeChars) -{ - if(m_pGetCurrentThemeName == NULL) - m_pGetCurrentThemeName = (CXPTheme::PFNGETCURRENTTHEMENAME)GetProc("GetCurrentThemeName", (void*)GetCurrentThemeNameFail); - return (*m_pGetCurrentThemeName)(pszThemeFileName, cchMaxNameChars, pszColorBuff, cchMaxColorChars, pszSizeBuff, cchMaxSizeChars); -} - -HRESULT CXPTheme::GetDocumentationProperty(LPCWSTR pszThemeName, - LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars) -{ - if(m_pGetThemeDocumentationProperty == NULL) - m_pGetThemeDocumentationProperty = (CXPTheme::PFNGETTHEMEDOCUMENTATIONPROPERTY)GetProc("GetThemeDocumentationProperty", (void*)GetThemeDocumentationPropertyFail); - return (*m_pGetThemeDocumentationProperty)(pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars); -} - - -HRESULT CXPTheme::DrawParentBackground(HWND hwnd, HDC hdc, RECT* prc) -{ - if(m_pDrawThemeParentBackground == NULL) - m_pDrawThemeParentBackground = (CXPTheme::PFNDRAWTHEMEPARENTBACKGROUND)GetProc("DrawThemeParentBackground", (void*)DrawThemeParentBackgroundFail); - return (*m_pDrawThemeParentBackground)(hwnd, hdc, prc); -} - -HRESULT CXPTheme::EnableTheming(BOOL fEnable) -{ - if(m_pEnableTheming == NULL) - m_pEnableTheming = (CXPTheme::PFNENABLETHEMING)GetProc("EnableTheming", (void*)EnableThemingFail); - return (*m_pEnableTheming)(fEnable); -} diff --git a/src/Utils/MiscUI/XPTheme.h b/src/Utils/MiscUI/XPTheme.h deleted file mode 100644 index ec51b8b7c..000000000 --- a/src/Utils/MiscUI/XPTheme.h +++ /dev/null @@ -1,432 +0,0 @@ -#ifndef _THEME_H_ -#define _THEME_H_ - -#pragma once - -#include -#include - -#ifndef WM_THEMECHANGED -#define WM_THEMECHANGED 0x031A -#endif - -#pragma warning(push) -#pragma warning(disable : 4100) - -class CXPTheme -{ -private: - HTHEME m_hTheme; - - static HMODULE m_hThemeDll; - static BOOL m_bLoaded; - - static void* GetProc(LPCSTR szProc, void* pfnFail); - - typedef HTHEME(__stdcall *PFNOPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList); - static HTHEME __stdcall OpenThemeDataFail(HWND , LPCWSTR ) - {return NULL;} - static PFNOPENTHEMEDATA m_pOpenThemeData; - - typedef HRESULT(__stdcall *PFNCLOSETHEMEDATA)(HTHEME hTheme); - static HRESULT __stdcall CloseThemeDataFail(HTHEME) - {return E_FAIL;} - static PFNCLOSETHEMEDATA m_pCloseThemeData; - - typedef HRESULT(__stdcall *PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect); - static HRESULT __stdcall DrawThemeBackgroundFail(HTHEME, HDC, int, int, const RECT *, const RECT *) - {return E_FAIL;} - static PFNDRAWTHEMEBACKGROUND m_pDrawThemeBackground; - - typedef HRESULT (__stdcall *PFNDRAWTHEMETEXT)(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, - DWORD dwTextFlags2, const RECT *pRect); - static HRESULT __stdcall DrawThemeTextFail(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT*) - {return E_FAIL;} - static PFNDRAWTHEMETEXT m_pDrawThemeText; - - typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, const RECT *pBoundingRect, - RECT *pContentRect); - static HRESULT __stdcall GetThemeBackgroundContentRectFail(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, const RECT *pBoundingRect, - RECT *pContentRect) - {return E_FAIL;} - static PFNGETTHEMEBACKGROUNDCONTENTRECT m_pGetThemeBackgroundContentRect; - - typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDEXTENT)(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, const RECT *pContentRect, - RECT *pExtentRect); - static HRESULT __stdcall GetThemeBackgroundExtentFail(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, const RECT *pContentRect, - RECT *pExtentRect) - {return E_FAIL;} - static PFNGETTHEMEBACKGROUNDEXTENT m_pGetThemeBackgroundExtent; - - typedef HRESULT(__stdcall *PFNGETTHEMEPARTSIZE)(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, RECT * pRect, enum THEMESIZE eSize, SIZE *psz); - static HRESULT __stdcall GetThemePartSizeFail(HTHEME, HDC, int, int, RECT *, enum THEMESIZE, SIZE *) - {return E_FAIL;} - static PFNGETTHEMEPARTSIZE m_pGetThemePartSize; - - typedef HRESULT (__stdcall *PFNGETTHEMETEXTEXTENT)(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, - DWORD dwTextFlags, const RECT *pBoundingRect, - RECT *pExtentRect); - static HRESULT __stdcall GetThemeTextExtentFail(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, - DWORD dwTextFlags, const RECT *pBoundingRect, - RECT *pExtentRect) - {return E_FAIL;} - static PFNGETTHEMETEXTEXTENT m_pGetThemeTextExtent; - - typedef HRESULT (__stdcall *PFNGETTHEMETEXTMETRICS)(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, TEXTMETRIC* ptm); - static HRESULT __stdcall GetThemeTextMetricsFail(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, TEXTMETRIC* ptm) - {return E_FAIL;} - static PFNGETTHEMETEXTMETRICS m_pGetThemeTextMetrics; - - typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDREGION)(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, const RECT *pRect, HRGN *pRegion); - static HRESULT __stdcall GetThemeBackgroundRegionFail(HTHEME hTheme, HDC hdc, - int iPartId, int iStateId, const RECT *pRect, HRGN *pRegion) - {return E_FAIL;} - static PFNGETTHEMEBACKGROUNDREGION m_pGetThemeBackgroundRegion; - - typedef HRESULT (__stdcall *PFNHITTESTTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, DWORD dwOptions, const RECT *pRect, HRGN hrgn, - POINT ptTest, WORD *pwHitTestCode); - static HRESULT __stdcall HitTestThemeBackgroundFail(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, DWORD dwOptions, const RECT *pRect, HRGN hrgn, - POINT ptTest, WORD *pwHitTestCode) - {return E_FAIL;} - static PFNHITTESTTHEMEBACKGROUND m_pHitTestThemeBackground; - - typedef HRESULT (__stdcall *PFNDRAWTHEMEEDGE)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, - const RECT *pDestRect, UINT uEdge, UINT uFlags, RECT *pContentRect); - static HRESULT __stdcall DrawThemeEdgeFail(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, - const RECT *pDestRect, UINT uEdge, UINT uFlags, RECT *pContentRect) - {return E_FAIL;} - static PFNDRAWTHEMEEDGE m_pDrawThemeEdge; - - typedef HRESULT (__stdcall *PFNDRAWTHEMEICON)(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex); - static HRESULT __stdcall DrawThemeIconFail(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex) - {return E_FAIL;} - static PFNDRAWTHEMEICON m_pDrawThemeIcon; - - typedef BOOL (__stdcall *PFNISTHEMEPARTDEFINED)(HTHEME hTheme, int iPartId, - int iStateId); - static BOOL __stdcall IsThemePartDefinedFail(HTHEME hTheme, int iPartId, - int iStateId) - {return FALSE;} - static PFNISTHEMEPARTDEFINED m_pIsThemePartDefined; - - typedef BOOL (__stdcall *PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(HTHEME hTheme, - int iPartId, int iStateId); - static BOOL __stdcall IsThemeBackgroundPartiallyTransparentFail(HTHEME hTheme, - int iPartId, int iStateId) - {return FALSE;} - static PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT m_pIsThemeBackgroundPartiallyTransparent; - - typedef HRESULT (__stdcall *PFNGETTHEMECOLOR)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, COLORREF *pColor); - static HRESULT __stdcall GetThemeColorFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, COLORREF *pColor) - {return E_FAIL;} - static PFNGETTHEMECOLOR m_pGetThemeColor; - - typedef HRESULT (__stdcall *PFNGETTHEMEMETRIC)(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, int iPropId, int *piVal); - static HRESULT __stdcall GetThemeMetricFail(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, int iPropId, int *piVal) - {return E_FAIL;} - static PFNGETTHEMEMETRIC m_pGetThemeMetric; - - typedef HRESULT (__stdcall *PFNGETTHEMESTRING)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, LPWSTR pszBuff, int cchMaxBuffChars); - static HRESULT __stdcall GetThemeStringFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, LPWSTR pszBuff, int cchMaxBuffChars) - {return E_FAIL;} - static PFNGETTHEMESTRING m_pGetThemeString; - - typedef HRESULT (__stdcall *PFNGETTHEMEBOOL)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, BOOL *pfVal); - static HRESULT __stdcall GetThemeBoolFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, BOOL *pfVal) - {return E_FAIL;} - static PFNGETTHEMEBOOL m_pGetThemeBool; - - typedef HRESULT (__stdcall *PFNGETTHEMEINT)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, int *piVal); - static HRESULT __stdcall GetThemeIntFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, int *piVal) - {return E_FAIL;} - static PFNGETTHEMEINT m_pGetThemeInt; - - typedef HRESULT (__stdcall *PFNGETTHEMEENUMVALUE)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, int *piVal); - static HRESULT __stdcall GetThemeEnumValueFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, int *piVal) - {return E_FAIL;} - static PFNGETTHEMEENUMVALUE m_pGetThemeEnumValue; - - typedef HRESULT (__stdcall *PFNGETTHEMEPOSITION)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, POINT *pPoint); - static HRESULT __stdcall GetThemePositionFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, POINT *pPoint) - {return E_FAIL;} - static PFNGETTHEMEPOSITION m_pGetThemePosition; - - typedef HRESULT (__stdcall *PFNGETTHEMEFONT)(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, int iPropId, LOGFONT *pFont); - static HRESULT __stdcall GetThemeFontFail(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, int iPropId, LOGFONT *pFont) - {return E_FAIL;} - static PFNGETTHEMEFONT m_pGetThemeFont; - - typedef HRESULT (__stdcall *PFNGETTHEMERECT)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, RECT *pRect); - static HRESULT __stdcall GetThemeRectFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, RECT *pRect) - {return E_FAIL;} - static PFNGETTHEMERECT m_pGetThemeRect; - - typedef HRESULT (__stdcall *PFNGETTHEMEMARGINS)(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, int iPropId, RECT *prc, MARGINS *pMargins); - static HRESULT __stdcall GetThemeMarginsFail(HTHEME hTheme, HDC hdc, int iPartId, - int iStateId, int iPropId, RECT *prc, MARGINS *pMargins) - {return E_FAIL;} - static PFNGETTHEMEMARGINS m_pGetThemeMargins; - - typedef HRESULT (__stdcall *PFNGETTHEMEINTLIST)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, INTLIST *pIntList); - static HRESULT __stdcall GetThemeIntListFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, INTLIST *pIntList) - {return E_FAIL;} - static PFNGETTHEMEINTLIST m_pGetThemeIntList; - - typedef HRESULT (__stdcall *PFNGETTHEMEPROPERTYORIGIN)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, enum PROPERTYORIGIN *pOrigin); - static HRESULT __stdcall GetThemePropertyOriginFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, enum PROPERTYORIGIN *pOrigin) - {return E_FAIL;} - static PFNGETTHEMEPROPERTYORIGIN m_pGetThemePropertyOrigin; - - typedef HRESULT (__stdcall *PFNSETWINDOWTHEME)(HWND hwnd, LPCWSTR pszSubAppName, - LPCWSTR pszSubIdList); - static HRESULT __stdcall SetWindowThemeFail(HWND hwnd, LPCWSTR pszSubAppName, - LPCWSTR pszSubIdList) - {return E_FAIL;} - static PFNSETWINDOWTHEME m_pSetWindowTheme; - - typedef HRESULT (__stdcall *PFNGETTHEMEFILENAME)(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, LPWSTR pszThemeFileName, int cchMaxBuffChars); - static HRESULT __stdcall GetThemeFilenameFail(HTHEME hTheme, int iPartId, - int iStateId, int iPropId, LPWSTR pszThemeFileName, int cchMaxBuffChars) - {return E_FAIL;} - static PFNGETTHEMEFILENAME m_pGetThemeFilename; - - typedef COLORREF (__stdcall *PFNGETTHEMESYSCOLOR)(HTHEME hTheme, int iColorId); - static COLORREF __stdcall GetThemeSysColorFail(HTHEME hTheme, int iColorId) - {return RGB(255,255,255);} - static PFNGETTHEMESYSCOLOR m_pGetThemeSysColor; - - typedef HBRUSH (__stdcall *PFNGETTHEMESYSCOLORBRUSH)(HTHEME hTheme, int iColorId); - static HBRUSH __stdcall GetThemeSysColorBrushFail(HTHEME hTheme, int iColorId) - {return NULL;} - static PFNGETTHEMESYSCOLORBRUSH m_pGetThemeSysColorBrush; - - typedef BOOL (__stdcall *PFNGETTHEMESYSBOOL)(HTHEME hTheme, int iBoolId); - static BOOL __stdcall GetThemeSysBoolFail(HTHEME hTheme, int iBoolId) - {return FALSE;} - static PFNGETTHEMESYSBOOL m_pGetThemeSysBool; - - typedef int (__stdcall *PFNGETTHEMESYSSIZE)(HTHEME hTheme, int iSizeId); - static int __stdcall GetThemeSysSizeFail(HTHEME hTheme, int iSizeId) - {return 0;} - static PFNGETTHEMESYSSIZE m_pGetThemeSysSize; - - typedef HRESULT (__stdcall *PFNGETTHEMESYSFONT)(HTHEME hTheme, int iFontId, LOGFONT *plf); - static HRESULT __stdcall GetThemeSysFontFail(HTHEME hTheme, int iFontId, LOGFONT *plf) - {return E_FAIL;} - static PFNGETTHEMESYSFONT m_pGetThemeSysFont; - - typedef HRESULT (__stdcall *PFNGETTHEMESYSSTRING)(HTHEME hTheme, int iStringId, - LPWSTR pszStringBuff, int cchMaxStringChars); - static HRESULT __stdcall GetThemeSysStringFail(HTHEME hTheme, int iStringId, - LPWSTR pszStringBuff, int cchMaxStringChars) - {return E_FAIL;} - static PFNGETTHEMESYSSTRING m_pGetThemeSysString; - - typedef HRESULT (__stdcall *PFNGETTHEMESYSINT)(HTHEME hTheme, int iIntId, int *piValue); - static HRESULT __stdcall GetThemeSysIntFail(HTHEME hTheme, int iIntId, int *piValue) - {return E_FAIL;} - static PFNGETTHEMESYSINT m_pGetThemeSysInt; - - typedef BOOL (__stdcall *PFNISTHEMEACTIVE)(); - static BOOL __stdcall IsThemeActiveFail() - {return FALSE;} - static PFNISTHEMEACTIVE m_pIsThemeActive; - - typedef BOOL(__stdcall *PFNISAPPTHEMED)(); - static BOOL __stdcall IsAppThemedFail() - {return FALSE;} - static PFNISAPPTHEMED m_pIsAppThemed; - - typedef HTHEME (__stdcall *PFNGETWINDOWTHEME)(HWND hwnd); - static HTHEME __stdcall GetWindowThemeFail(HWND hwnd) - {return NULL;} - static PFNGETWINDOWTHEME m_pGetWindowTheme; - - typedef HRESULT (__stdcall *PFNENABLETHEMEDIALOGTEXTURE)(HWND hwnd, DWORD dwFlags); - static HRESULT __stdcall EnableThemeDialogTextureFail(HWND hwnd, DWORD dwFlags) - {return E_FAIL;} - static PFNENABLETHEMEDIALOGTEXTURE m_pEnableThemeDialogTexture; - - typedef BOOL (__stdcall *PFNISTHEMEDIALOGTEXTUREENABLED)(HWND hwnd); - static BOOL __stdcall IsThemeDialogTextureEnabledFail(HWND hwnd) - {return FALSE;} - static PFNISTHEMEDIALOGTEXTUREENABLED m_pIsThemeDialogTextureEnabled; - - typedef DWORD (__stdcall *PFNGETTHEMEAPPPROPERTIES)(); - static DWORD __stdcall GetThemeAppPropertiesFail() - {return 0;} - static PFNGETTHEMEAPPPROPERTIES m_pGetThemeAppProperties; - - typedef void (__stdcall *PFNSETTHEMEAPPPROPERTIES)(DWORD dwFlags); - static void __stdcall SetThemeAppPropertiesFail(DWORD dwFlags) - {return;} - static PFNSETTHEMEAPPPROPERTIES m_pSetThemeAppProperties; - - typedef HRESULT (__stdcall *PFNGETCURRENTTHEMENAME)( - LPWSTR pszThemeFileName, int cchMaxNameChars, - LPWSTR pszColorBuff, int cchMaxColorChars, - LPWSTR pszSizeBuff, int cchMaxSizeChars); - static HRESULT __stdcall GetCurrentThemeNameFail( - LPWSTR pszThemeFileName, int cchMaxNameChars, - LPWSTR pszColorBuff, int cchMaxColorChars, - LPWSTR pszSizeBuff, int cchMaxSizeChars) - {return E_FAIL;} - static PFNGETCURRENTTHEMENAME m_pGetCurrentThemeName; - - typedef HRESULT (__stdcall *PFNGETTHEMEDOCUMENTATIONPROPERTY)(LPCWSTR pszThemeName, - LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars); - static HRESULT __stdcall GetThemeDocumentationPropertyFail(LPCWSTR pszThemeName, - LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars) - {return E_FAIL;} - static PFNGETTHEMEDOCUMENTATIONPROPERTY m_pGetThemeDocumentationProperty; - - typedef HRESULT (__stdcall *PFNDRAWTHEMEPARENTBACKGROUND)(HWND hwnd, HDC hdc, RECT* prc); - static HRESULT __stdcall DrawThemeParentBackgroundFail(HWND hwnd, HDC hdc, RECT* prc) - {return E_FAIL;} - static PFNDRAWTHEMEPARENTBACKGROUND m_pDrawThemeParentBackground; - - typedef HRESULT (__stdcall *PFNENABLETHEMING)(BOOL fEnable); - static HRESULT __stdcall EnableThemingFail(BOOL fEnable) - {return E_FAIL;} - static PFNENABLETHEMING m_pEnableTheming; -public: - BOOL Open(HWND hwnd, LPCWSTR pszClassList); - void Close(); - HRESULT DrawBackground(HDC hdc, - int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect); - HRESULT DrawText(HDC hdc, int iPartId, - int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, - DWORD dwTextFlags2, const RECT *pRect); - HRESULT GetBackgroundContentRect(HDC hdc, - int iPartId, int iStateId, const RECT *pBoundingRect, - RECT *pContentRect); - HRESULT GetBackgroundExtent(HDC hdc, - int iPartId, int iStateId, const RECT *pContentRect, - RECT *pExtentRect); - HRESULT GetPartSize(HDC hdc, - int iPartId, int iStateId, RECT * pRect, enum THEMESIZE eSize, SIZE *psz); - HRESULT GetTextExtent(HDC hdc, - int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, - DWORD dwTextFlags, const RECT *pBoundingRect, - RECT *pExtentRect); - HRESULT GetTextMetrics(HDC hdc, - int iPartId, int iStateId, TEXTMETRIC* ptm); - HRESULT GetBackgroundRegion(HDC hdc, - int iPartId, int iStateId, const RECT *pRect, HRGN *pRegion); - HRESULT HitTestBackground(HDC hdc, int iPartId, - int iStateId, DWORD dwOptions, const RECT *pRect, HRGN hrgn, - POINT ptTest, WORD *pwHitTestCode); - HRESULT DrawEdge(HDC hdc, int iPartId, int iStateId, - const RECT *pDestRect, UINT uEdge, UINT uFlags, RECT *pContentRect); - HRESULT DrawIcon(HDC hdc, int iPartId, - int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex); - BOOL IsPartDefined(int iPartId, - int iStateId); - BOOL IsBackgroundPartiallyTransparent( - int iPartId, int iStateId); - HRESULT GetColor(int iPartId, - int iStateId, int iPropId, COLORREF *pColor); - HRESULT GetMetric(HDC hdc, int iPartId, - int iStateId, int iPropId, int *piVal); - HRESULT GetString(int iPartId, - int iStateId, int iPropId, LPWSTR pszBuff, int cchMaxBuffChars); - HRESULT GetBool(int iPartId, - int iStateId, int iPropId, BOOL *pfVal); - HRESULT GetInt(int iPartId, - int iStateId, int iPropId, int *piVal); - HRESULT GetEnumValue(int iPartId, - int iStateId, int iPropId, int *piVal); - HRESULT GetPosition(int iPartId, - int iStateId, int iPropId, POINT *pPoint); - HRESULT GetFont(HDC hdc, int iPartId, - int iStateId, int iPropId, LOGFONT *pFont); - HRESULT GetRect(int iPartId, - int iStateId, int iPropId, RECT *pRect); - HRESULT GetMargins(HDC hdc, int iPartId, - int iStateId, int iPropId, RECT *prc, MARGINS *pMargins); - HRESULT GetIntList(int iPartId, - int iStateId, int iPropId, INTLIST *pIntList); - HRESULT GetPropertyOrigin(int iPartId, - int iStateId, int iPropId, enum PROPERTYORIGIN *pOrigin); - static HRESULT SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName, - LPCWSTR pszSubIdList); - HRESULT GetFilename(int iPartId, - int iStateId, int iPropId, LPWSTR pszThemeFileName, int cchMaxBuffChars); - COLORREF GetSysColor(int iColorId); - HBRUSH GetSysColorBrush(int iColorId); - BOOL GetSysBool(int iBoolId); - int GetSysSize(int iSizeId); - HRESULT GetSysFont(int iFontId, LOGFONT *plf); - HRESULT GetSysString(int iStringId, - LPWSTR pszStringBuff, int cchMaxStringChars); - HRESULT GetSysInt(int iIntId, int *piValue); - static BOOL IsActive(); - static BOOL IsAppThemed(); - static HTHEME GetWindowTheme(HWND hwnd); - static HRESULT EnableDialogTexture(HWND hwnd, DWORD dwFlags); - static BOOL IsDialogTextureEnabled(HWND hwnd); - static DWORD GetAppProperties(); - static void SetAppProperties(DWORD dwFlags); - static HRESULT GetCurrentName( - LPWSTR pszThemeFileName, int cchMaxNameChars, - LPWSTR pszColorBuff, int cchMaxColorChars, - LPWSTR pszSizeBuff, int cchMaxSizeChars); - static HRESULT GetDocumentationProperty(LPCWSTR pszThemeName, - LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars); - static HRESULT DrawParentBackground(HWND hwnd, HDC hdc, RECT* prc); - static HRESULT EnableTheming(BOOL fEnable); -public: - CXPTheme(void); - CXPTheme(HTHEME hTheme); - CXPTheme(HWND hwnd, LPCWSTR pszClassList); - ~CXPTheme(void); - void Attach(HTHEME hTheme); - HTHEME Detach(); - operator HTHEME() const; - bool operator!() const; - - static void Release(void); - static BOOL IsAvailable(); -}; -#pragma warning(pop) -#endif \ No newline at end of file diff --git a/src/Utils/Utils.vcproj b/src/Utils/Utils.vcproj index dbb7112f8..ba1285625 100644 --- a/src/Utils/Utils.vcproj +++ b/src/Utils/Utils.vcproj @@ -641,10 +641,6 @@ > - - @@ -668,14 +664,6 @@ RelativePath=".\MiscUI\WaterEffect.cpp" > - - - -