/** * @file XTPRibbonTabColorSet.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/XTPHookManager.h" #include "Common/XTPColorManager.h" #include "Common/ScrollBar/XTPScrollInfo.h" #include "TabManager/Includes.h" #include "CommandBars/XTPCommandBarsDefines.h" #include "CommandBars/XTPPaintManager.h" #include "CommandBars/XTPCommandBar.h" #include "CommandBars/XTPToolBar.h" #include "CommandBars/XTPMenuBar.h" #include "CommandBars/XTPMenuTitleBar.h" #include "CommandBars/XTPPopupBar.h" #include "CommandBars/XTPControl.h" #include "CommandBars/XTPControlButton.h" #include "CommandBars/XTPControlPopup.h" #include "Ribbon/XTPRibbonPopups.h" #include "Ribbon/XTPRibbonBar.h" #include "Ribbon/XTPRibbonTab.h" #include "Ribbon/XTPRibbonControlTab.h" #include "Ribbon/XTPRibbonTabColorSet.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif CXTPRibbonTabColorSet::CXTPRibbonTabColorSet() { m_bIsInactiveSelectedTextVisible = TRUE; } void CXTPRibbonTabColorSet::RefreshMetrics() { CXTPTabColorSetOffice2003::RefreshMetrics(); } void CXTPRibbonTabColorSet::SetTextColor(CDC* pDC, CXTPTabManagerItem* pItem) { CXTPRibbonTab* pRibbonTab = DYNAMIC_DOWNCAST(CXTPRibbonTab, pItem); CXTPRibbonBar* pRibbonBar = pRibbonTab->GetRibbonBar(); BOOL bSelected = pItem->IsSelected(); BOOL bHighlighted = pItem->IsHighlighted(); BOOL bFocused = pItem->IsFocused(); if (bSelected && pRibbonBar->IsRibbonMinimized()) { CXTPRibbonControlTab* pControlTab = (CXTPRibbonControlTab*)pItem->GetTabManager(); if (pControlTab->GetCommandBar() && pControlTab->GetCommandBar()->IsTrackingMode()) { bFocused = bHighlighted = FALSE; } else if (pControlTab->GetSelected() && bFocused) { bFocused = bSelected = FALSE; bHighlighted = TRUE; } else { bFocused = bSelected = FALSE; } } // If m_bIsInactiveSelectedTextVisible is not true the color of normal (inactive) button text // won't be visible on the selected button if (bSelected && pRibbonBar->IsBackstageViewVisible() && m_bIsInactiveSelectedTextVisible) bSelected = FALSE; pDC->SetTextColor(!pItem->IsEnabled() ? m_clrTextDisabled : bSelected ? m_clrTextSelected : bHighlighted ? m_clrTextHighlight : m_clrTextNormal); }