/** * @file XTPFlowGraphSelectedElements.h * * @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 * */ /** @cond */ #if !defined(__XTPFLOWGRAPHSELECTEDELEMENTS_H__) # define __XTPFLOWGRAPHSELECTEDELEMENTS_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPFlowGraphControl; class CXTPFlowGraphPage; /** * @brief * Collection of selected elements in the flow graph. * @details * Selected elements will include Nodes, connections, and connection * points. This collection can be used to add/remove elements * to/from the selection. Elements can be selected with the mouse or * by using methods in code. */ class _XTP_EXT_CLASS CXTPFlowGraphSelectedElements : public CXTPCmdTarget { public: /** * @brief * Constructs a CXTPFlowGraphSelectedElements object. * @param pPage Target flow graph page object pointer. */ CXTPFlowGraphSelectedElements(CXTPFlowGraphPage* pPage); /** * @brief * Destroys a CXTPFlowGraphSelectedElements object, handles cleanup * and deallocation. */ virtual ~CXTPFlowGraphSelectedElements(); public: /** * @brief * Removes all elements from the current selection. */ void Clear(); /** * @brief * Sets the current selection to a specified element. * @param pElement The element to set the current selection to; can be any * valid flow graph element (connection, node). */ void SetSelection(CXTPFlowGraphElement* pElement); /** * @brief * Adds an element to the current selection. * @param pElement The element to add to the current selection; can be any * valid flow graph element (connection, node). */ void AddSelection(CXTPFlowGraphElement* pElement); /** * @brief * Removes an element from the current selection. * @param pElement The element to remove from the current selection; can be * any valid flow graph element (connection, node). */ void Remove(CXTPFlowGraphElement* pElement); /** * @brief * Removes the element at a specified index from the current selection. * @param nIndex Index of the element to remove. */ void RemoveAt(int nIndex); /** * @brief * Retrieves the number of elements in the current selection. * @return * The number of elements in the current selection. */ int GetCount() const; /** * @param nIndex Index of the element to retrieve. * @details * Elements are added using the SetSelection method and removed using * the RemoveAt method. * @return Retrieves the element at a specified index from the current selection. */ CXTPFlowGraphElement* GetAt(int nIndex) const; protected: CArray m_arrSelectedElements; /**< Collection of selected elements. */ CXTPFlowGraphPage* m_pPage; /**< Pointer to the page that the selected elements are dispalyed on. */ # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPFlowGraphSelectedElements) DECLARE_ENUM_VARIANT(CXTPFlowGraphSelectedElements) afx_msg int OleGetItemCount(); afx_msg LPDISPATCH OleGetItem(int nIndex); afx_msg void OleAddSelection(LPDISPATCH lpDisp); afx_msg void OleRemove(LPDISPATCH lpDisp); /** @endcond */ # endif }; AFX_INLINE int CXTPFlowGraphSelectedElements::GetCount() const { return (int)m_arrSelectedElements.GetSize(); } AFX_INLINE CXTPFlowGraphElement* CXTPFlowGraphSelectedElements::GetAt(int nIndex) const { return nIndex >= 0 && nIndex < m_arrSelectedElements.GetSize() ? m_arrSelectedElements[nIndex] : NULL; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPFLOWGRAPHSELECTEDELEMENTS_H__) /** @endcond */