/** * @file XTPListBoxThemeResource.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/XTPColorManager.h" #include "Common/XTPResourceImage.h" #include "Common/ScrollBar/XTPScrollBase.h" #include "Common/ScrollBar/XTPScrollBarCtrl.h" #include "Common/ScrollBar/XTPScrollable.h" #include "Controls/Util/XTPControlTheme.h" #include "Controls/ListBox/XTPListBox.h" #include "Controls/ListBox/Themes/XTPListBoxThemeResource.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif void CXTPListBoxThemeResource::DrawItem(CDC* pDC, CXTPListBox* pListBox, LPDRAWITEMSTRUCT lpDIS) { CRect rcItem = lpDIS->rcItem; BOOL bSelected = ((lpDIS->itemState & ODS_SELECTED) == ODS_SELECTED); BOOL bHasFocus = pListBox->HasFocus(); BOOL bHighlighted = (int)lpDIS->itemID == pListBox->m_nHotItem; if ((lpDIS->itemID != (UINT)-1) && (lpDIS->itemAction & (ODA_DRAWENTIRE | ODA_SELECT))) { COLORREF clrWindow = GetBackColor(); COLORREF clrWindowText = pListBox->IsWindowEnabled() ? GetXtremeColor(COLOR_WINDOWTEXT) : GetXtremeColor(COLOR_GRAYTEXT); CRect rcText(rcItem); rcText.DeflateRect(pListBox->m_nTextPadding, 0); CXTPResourceImages* pImages = XTPResourceImages(); if ((bSelected || bHighlighted) && pListBox->IsWindowEnabled()) { CXTPResourceImage* pImage = pImages->LoadFile(_T("LISTBOX")); if (pImage) { pImage->DrawImage(pDC, rcItem, pImage->GetSource(bSelected && bHighlighted ? 2 : bHasFocus && bSelected ? 1 : !bHasFocus && bSelected ? 3 : 0, 4), CRect(4, 4, 4, 4), COLORREF_NULL); clrWindow = COLORREF_NULL; } } pDC->SetBkMode(TRANSPARENT); clrWindowText = pImages->GetImageColor(_T("LISTBOX"), _T("NormalText")); // set the text and text background colors, then repaint the item. pDC->SetBkColor(clrWindow); pDC->SetTextColor(clrWindowText); if (clrWindow != COLORREF_NULL) pDC->FillSolidRect(&rcItem, clrWindow); DrawItemText(pDC, rcText, pListBox, lpDIS); } } void CXTPListBoxThemeResource::RefreshMetrics() { }