/** * @file XTPComboBoxThemeOffice2013.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/XTPCasting.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/XTPMarkupRender.h" #include "Common/XTPColorManager.h" #include "Common/XTPDrawHelpers.h" #include "Common/XTPResourceImage.h" #include "Controls/Util/XTPControlTheme.h" #include "Controls/Combo/XTPComboBox.h" #include "Controls/Combo/XTPComboBoxTheme.h" #include "Controls/Combo/Themes/XTPComboBoxThemeOffice2003.h" #include "Controls/Combo/Themes/XTPComboBoxThemeVisualStudio.h" #include "Controls/Combo/Themes/XTPComboBoxThemeOffice2013.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # undef THIS_FILE static char THIS_FILE[] = __FILE__; # define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CXTPComboBoxThemeOffice2013::CXTPComboBoxThemeOffice2013() { m_bHighlight = FALSE; } CXTPComboBoxThemeOffice2013::~CXTPComboBoxThemeOffice2013() { } void CXTPComboBoxThemeOffice2013::RefreshMetrics(CXTPComboBox* pComboBox) { CXTPComboBoxTheme::RefreshMetrics(pComboBox); m_clrBackground.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("Back"), RGB(255, 255, 255))); m_clrBackHighlight.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("BackHilite"), RGB(136, 195, 255))); m_clrBackDisabled.SetStandardValue(m_clrBackground); m_clrText.SetStandardValue(XTPIniColor(_T("Controls.ComboBox"), _T("Text"), RGB(68, 68, 68))); m_clrTextHighlight.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("TextHilite"), RGB(0, 0, 0))); m_clrTextDisabled.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("TextDisabled"), RGB(152, 152, 152))); m_clrBorderNormal.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("Border"), RGB(171, 171, 171))); m_clrBorderHot.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("BorderHilite"), RGB(163, 189, 227))); m_clrBorderDisabled.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("BorderDisabled"), RGB(225, 225, 225))); m_clrButtonNormal.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("Button"), RGB(255, 255, 255))); m_clrButtonHot.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("ButtonHilite"), RGB(213, 225, 242))); m_clrButtonPressed.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("ButtonPushed"), RGB(163, 189, 227))); m_clrButtonDisabled.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("ButtonDisabled"), RGB(253, 253, 253))); m_clrButtonArrowNormal.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("Arrow"), RGB(119, 119, 119))); m_clrButtonArrowHot.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("ArrowHilite"), RGB(68, 68, 68))); m_clrButtonArrowPressed.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("ArrowPushed"), RGB(68, 68, 68))); m_clrButtonArrowDisabled.SetStandardValue( XTPIniColor(_T("Controls.ComboBox"), _T("ArrowDisabled"), RGB(198, 198, 198))); m_grcButton = m_clrButtonNormal; m_grcButtonHilite = m_clrButtonHot; m_grcButtonPushed = m_clrButtonPressed; CXTPComboBoxTheme::UpdateBackgroundBrush(); } void CXTPComboBoxThemeOffice2013::DrawButton(CDC* pDC, CXTPComboBox* pComboBox, CRect rcBtn) { ASSERT_VALID(pDC); ASSERT_VALID(pComboBox); BOOL bEnabled = pComboBox->IsWindowEnabled(); BOOL bDropped = pComboBox->IsDroppedDown(); BOOL bSelected = pComboBox->IsFocused() || pComboBox->IsHighlighted(); COLORREF clrBack = bEnabled ? (bDropped ? m_clrButtonPressed : (bSelected ? m_clrButtonHot : m_clrButtonNormal)) : m_clrButtonDisabled; pDC->FillSolidRect(&rcBtn, clrBack); if (bSelected || bDropped) { rcBtn.right = rcBtn.left + XTP_DPI_X(1); pDC->FillSolidRect(&rcBtn, m_clrBorderHot); } } void CXTPComboBoxThemeOffice2013::DrawButtonTriangle(CDC* pDC, CXTPComboBox* pComboBox, CRect rcBtn) { ASSERT_VALID(pDC); ASSERT_VALID(pComboBox); BOOL bDropped = pComboBox->IsDroppedDown(); BOOL bSelected = pComboBox->IsFocused() || pComboBox->IsHighlighted(); BOOL bEnabled = pComboBox->IsWindowEnabled(); COLORREF clrButtonArrow = bEnabled ? (bDropped ? m_clrButtonArrowPressed : (bSelected ? m_clrButtonArrowHot : m_clrButtonArrowNormal)) : m_clrButtonArrowDisabled; CPoint point; point.x = rcBtn.CenterPoint().x - XTP_DPI_X(12) / 2; point.y = rcBtn.CenterPoint().y - XTP_DPI_Y(12) / 2; CRect rc(point.x, point.y, point.x + XTP_DPI_X(12), point.y + XTP_DPI_Y(12)); XTPPrimitiveDrawer()->DrawSymbol(pDC, xtpPrimitiveSymbolPlayDown, rc, clrButtonArrow); } void CXTPComboBoxThemeOffice2013::DrawBackground(CDC* pDC, CXTPComboBox* pComboBox) { ASSERT_VALID(pDC); ASSERT_VALID(pComboBox); CXTPComboBoxTheme::DrawBackground(pDC, pComboBox); CRect rc = pComboBox->GetComboBoxRect(); BOOL bPressed = pComboBox->IsDroppedDown(); BOOL bSelected = pComboBox->IsFocused() || pComboBox->IsHighlighted(); BOOL bEnabled = pComboBox->IsWindowEnabled(); COLORREF clrBorders = bSelected ? m_clrBorderHot : m_clrBorderNormal; if (!bSelected && !bPressed && bEnabled && pComboBox->GetFlatStyle()) { pDC->Draw3dRect(rc, m_clrBorderNormal, m_clrBorderNormal); } else { pDC->Draw3dRect(rc, bEnabled ? clrBorders : (COLORREF)m_clrBorderDisabled, bEnabled ? clrBorders : (COLORREF)m_clrBorderDisabled); } }