/** * @file XTPDockingPaneBaseContainer.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/XTPColorManager.h" #include "TabManager/Includes.h" #include "DockingPane/XTPDockingPaneDefines.h" #include "DockingPane/XTPDockingPaneBase.h" #include "DockingPane/XTPDockingPaneBaseContainer.h" #include "DockingPane/XTPDockingPaneManager.h" #include "DockingPane/XTPDockingPane.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ////////////////////////////////////////////////////////////////////////// // CXTPDockingPaneBaseContainer CXTPDockingPaneBaseContainer::CXTPDockingPaneBaseContainer(XTPDockingPaneType type, CXTPDockingPaneLayout* pLayout) : CXTPDockingPaneBase(type, pLayout) { } CXTPDockingPaneBaseContainer::~CXTPDockingPaneBaseContainer() { } POSITION CXTPDockingPaneBaseContainer::ContainPane(CXTPDockingPaneBase* pPane) const { if (pPane == (CXTPDockingPaneBase*)this) return (POSITION)TRUE; POSITION pos = m_lstPanes.GetHeadPosition(); while (pos) { POSITION posContain = pos; if (m_lstPanes.GetNext(pos)->ContainPane(pPane)) return posContain; } return NULL; } void CXTPDockingPaneBaseContainer::FindPane(XTPDockingPaneType type, CXTPDockingPaneBaseList* pList) const { if (GetType() == type) { if (IsEmpty()) { return; } pList->AddTail((CXTPDockingPaneBase*)this); } POSITION pos = m_lstPanes.GetHeadPosition(); while (pos) { CXTPDockingPaneBase* pPane = m_lstPanes.GetNext(pos); pPane->FindPane(type, pList); } } BOOL CXTPDockingPaneBaseContainer::IsEmpty() const { POSITION pos = m_lstPanes.GetHeadPosition(); while (pos) { CXTPDockingPaneBase* pPane = m_lstPanes.GetNext(pos); if (!pPane->IsEmpty()) { return FALSE; } } return TRUE; } POSITION CXTPDockingPaneBaseContainer::GetHeadPosition() const { return m_lstPanes.GetHeadPosition(); } CXTPDockingPaneBase* CXTPDockingPaneBaseContainer::GetNext(POSITION& pos) const { return m_lstPanes.GetNext(pos); } CXTPDockingPaneBase* CXTPDockingPaneBaseContainer::GetFirstPane() const { if (m_lstPanes.IsEmpty()) return NULL; return m_lstPanes.GetHead(); } CXTPDockingPaneBase* CXTPDockingPaneBaseContainer::GetLastPane() const { if (m_lstPanes.IsEmpty()) return NULL; return m_lstPanes.GetTail(); } BOOL CXTPDockingPaneBaseContainer::OnAction(XTPDockingPaneAction action) { CXTPDockingPaneManager* pManager = GetDockingPaneManager(); CXTPDockingPaneBaseList lstChilds; FindPane(xtpPaneTypeDockingPane, &lstChilds); POSITION pos = lstChilds.GetHeadPosition(); while (pos) { CXTPDockingPane* pPane = static_cast(lstChilds.GetNext(pos)); if (pManager->NotifyAction(action, pPane, this)) return TRUE; } return FALSE; }