/** * @file XTPComboBoxEditCtrl.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/XTPFramework.h" #include "Common/XTPMarkupRender.h" #include "Controls/Util/XTPControlTheme.h" #include "Controls/Combo/XTPComboBoxEditCtrl.h" #include "Controls/Combo/XTPComboBox.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #include "Common/Base/Diagnostic/XTPBeginAfxMap.h" BEGIN_MESSAGE_MAP(CXTPComboBoxEditCtrl, CEdit) //{{AFX_MSG_MAP(CComboBoxCtrl) ON_WM_KILLFOCUS() ON_WM_SETFOCUS() ON_MESSAGE_VOID(WM_MOUSELEAVE, OnMouseLeave) ON_WM_MOUSEMOVE() //}}AFX_MSG_MAP END_MESSAGE_MAP() #include "Common/Base/Diagnostic/XTPEndAfxMap.h" void CXTPComboBoxEditCtrl::OnMouseLeave() { CXTPComboBox* pControl = (CXTPComboBox*)GetParent(); if (pControl->m_bHighlighted) { TRACKMOUSEEVENT tme = { sizeof(TRACKMOUSEEVENT), TME_LEAVE, pControl->m_hWnd, HOVER_DEFAULT }; _TrackMouseEvent(&tme); } } void CXTPComboBoxEditCtrl::OnMouseMove(UINT nFlags, CPoint point) { CRect rc; GetClientRect(&rc); CXTPComboBox* pControl = (CXTPComboBox*)GetParent(); BOOL bHot = rc.PtInRect(point) && !pControl->m_bFocused; if (bHot != pControl->m_bHighlighted) { pControl->m_bHighlighted = bHot; pControl->RedrawFocusedFrame(); if (bHot) { TRACKMOUSEEVENT tme = { sizeof(TRACKMOUSEEVENT), TME_LEAVE, m_hWnd, HOVER_DEFAULT }; _TrackMouseEvent(&tme); } } CEdit::OnMouseMove(nFlags, point); } void CXTPComboBoxEditCtrl::OnKillFocus(CWnd* pNewWnd) { CEdit::OnKillFocus(pNewWnd); CXTPComboBox* pControl = (CXTPComboBox*)GetParent(); if (pNewWnd != GetParent()) { pControl->m_bFocused = FALSE; pControl->RefreshMetrics(); pControl->RedrawFocusedFrame(); } } void CXTPComboBoxEditCtrl::OnSetFocus(CWnd* pOldWnd) { CEdit::OnSetFocus(pOldWnd); CXTPComboBox* pControl = (CXTPComboBox*)GetParent(); pControl->m_bFocused = TRUE; pControl->m_bHighlighted = FALSE; pControl->RedrawFocusedFrame(); }