/** * @file XTPCaptionButtonThemeOffice2003.cpp * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ #include "StdAfx.h" #include "Common/XTPTypeId.h" #include "Common/XTPFramework.h" #include "Common/XTPSystemHelpers.h" #include "Common/XTPSynchro.h" #include "Common/XTPApplication.h" #include "Common/XTPSingleton.h" #include "Common/XTPGdiObjects.h" #include "Common/XTPDrawHelpers.h" #include "Common/XTPColorManager.h" #include "Controls/Util/XTPControlTheme.h" #include "Controls/Button/XTPButtonTheme.h" #include "Controls/Button/XTPButton.h" #include "Controls/Button/Themes/XTPButtonThemeUltraFlat.h" #include "Controls/Button/Themes/XTPButtonThemeOfficeXP.h" #include "Controls/Button/Themes/XTPButtonThemeOffice2003.h" #include "Controls/Static/XTPCaption.h" #include "Controls/Static/Themes/XTPCaptionButtonThemeOffice2003.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CXTPCaptionButtonThemeOffice2003 void CXTPCaptionButtonThemeOffice2003::DrawButtonBackground(CDC* pDC, CXTPButton* pButton) { if (!::IsWindow(pButton->GetSafeHwnd())) return; CRect rc = pButton->GetButtonRect(); CXTPCaption* pCaption = ((CXTPCaptionButton*)pButton)->GetCaption(); if (::IsWindow(pCaption->GetSafeHwnd())) { BOOL bHilite = pButton->IsHighlighted(); BOOL bSelected = (pButton->IsPushed() || pButton->GetChecked()); // Paint the background. if (bSelected || bHilite) { XTPDrawHelpers()->GradientFill(pDC, rc, bSelected ? XTPColorManager()->grcLunaPushed : XTPColorManager()->grcLunaSelected, FALSE); pDC->Draw3dRect(&rc, GetMSO2003Color(XPCOLOR_HIGHLIGHT_BORDER), GetMSO2003Color(XPCOLOR_HIGHLIGHT_BORDER)); } else { CXTPWindowRect rButton(pButton); CXTPClientRect rcCaption(pCaption); pCaption->ClientToScreen(rcCaption); pButton->ScreenToClient(rcCaption); XTPDrawHelpers()->GradientFill(pDC, rcCaption, pCaption->IsAppCaption() ? XTPColorManager()->grcCaption : XTPColorManager()->grcToolBar, FALSE, rc); } return; } CXTPButtonThemeOffice2003::DrawButtonBackground(pDC, pButton); } COLORREF CXTPCaptionButtonThemeOffice2003::GetTextColor(CXTPButton* pButton) { if (!pButton->IsWindowEnabled()) return GetXtremeColor(COLOR_GRAYTEXT); if (pButton->IsHighlighted() || (pButton->IsPushed() || pButton->GetChecked())) return m_crTextHilite; CXTPCaption* pCaption = ((CXTPCaptionButton*)pButton)->GetCaption(); if (::IsWindow(pCaption->GetSafeHwnd())) { return pCaption->m_clrText; } return m_crText; }