/** * @file XTPControlComboBoxGalleryPopupBar.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/XTPScrollBase.h" #include "Common/ScrollBar/XTPScrollInfo.h" #include "CommandBars/XTPCommandBarsDefines.h" #include "CommandBars/XTPPaintManager.h" #include "CommandBars/XTPCommandBar.h" #include "CommandBars/XTPPopupBar.h" #include "CommandBars/XTPControl.h" #include "CommandBars/XTPControlButton.h" #include "CommandBars/XTPControlPopup.h" #include "CommandBars/XTPControlEdit.h" #include "CommandBars/XTPControlComboBox.h" #include "CommandBars/XTPControls.h" #include "CommandBars/XTPControlGallery.h" #include "CommandBars/XTPControlComboBoxGalleryPopupBar.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ////////////////////////////////////////////////////////////////////////// // CXTPControlComboBoxGalleryPopupBar IMPLEMENT_XTP_COMMANDBAR(CXTPControlComboBoxGalleryPopupBar, CXTPControlComboBoxPopupBar) CXTPControlComboBoxGalleryPopupBar::CXTPControlComboBoxGalleryPopupBar() { } CXTPControlComboBoxGalleryPopupBar* AFX_CDECL CXTPControlComboBoxGalleryPopupBar::CreateComboBoxGalleryPopupBar(CXTPCommandBars* pCommandBars) { CXTPControlComboBoxGalleryPopupBar* pPopupBar = new CXTPControlComboBoxGalleryPopupBar(); pPopupBar->SetCommandBars(pCommandBars); return pPopupBar; } #include "Common/Base/Diagnostic/XTPBeginAfxMap.h" BEGIN_MESSAGE_MAP(CXTPControlComboBoxGalleryPopupBar, CXTPControlComboBoxPopupBar) ON_WM_LBUTTONUP() END_MESSAGE_MAP() #include "Common/Base/Diagnostic/XTPEndAfxMap.h" CXTPControlGallery* CXTPControlComboBoxGalleryPopupBar::GetGalleryItem() const { CXTPControl* pItem = GetControl(0); ASSERT_KINDOF(CXTPControlGallery, pItem); return (CXTPControlGallery*)pItem; } void CXTPControlComboBoxGalleryPopupBar::OnLButtonUp(UINT nFlags, CPoint point) { if (GetControls()->HitTest(point) == GetGalleryItem()) { CXTPControlComboBox* pComboBox = (CXTPControlComboBox*)m_pControlPopup; pComboBox->OnSelChanged(); pComboBox->OnExecute(); return; } CXTPPopupBar::OnLButtonUp(nFlags, point); } BOOL CXTPControlComboBoxGalleryPopupBar::SetTrackingMode(int bMode, BOOL bSelectFirst, BOOL bKeyboard) { CXTPControlComboBox* pComboBox = ((CXTPControlComboBox*)m_pControlPopup); if (!CXTPPopupBar::SetTrackingMode(bMode, bSelectFirst, bKeyboard)) return FALSE; if (!bMode) { pComboBox->NotifySite(CBN_CLOSEUP); } else { SetSelected(0, TRUE); pComboBox->UpdatePopupSelection(); pComboBox->NotifySite(CBN_DROPDOWN); } return TRUE; } BOOL CXTPControlComboBoxGalleryPopupBar::OnHookKeyDown(UINT nChar, LPARAM lParam) { _ASSERTE(m_pControlPopup); CXTPControlComboBox* pComboBox = ((CXTPControlComboBox*)m_pControlPopup); if (!pComboBox) return CXTPCommandBar::OnHookKeyDown(nChar, lParam); if (pComboBox->GetEditCtrl() && pComboBox->GetEditCtrl()->IsImeMode()) return ProcessHookKeyDown(pComboBox, nChar, lParam); if (nChar == VK_ESCAPE) { if (pComboBox->IsFocused()) return FALSE; return CXTPCommandBar::OnHookKeyDown(nChar, lParam); } if (nChar == VK_TAB) return FALSE; if (nChar == VK_RETURN) { if (GetControl(m_nSelected) == GetGalleryItem()) { m_pControlPopup->OnExecute(); return TRUE; } } return ProcessHookKeyDown(pComboBox, nChar, lParam); }