/** * @file XTPFlowGraphConnectionPoint.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(__XTPFLOWGRAPHCONNECTIONPOINT_H__) # define __XTPFLOWGRAPHCONNECTIONPOINT_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPFlowGraphNode; class CXTPFlowGraphImage; class CXTPMarkupUIElement; class CXTPFlowGraphConnection; /** * @brief * Represents a connection point for a node. * @details * Connection points are added to a Node and can have no input points, * only input or output points, or both. */ class _XTP_EXT_CLASS CXTPFlowGraphConnectionPoint : public CXTPFlowGraphElement { /** @cond */ DECLARE_SERIAL(CXTPFlowGraphConnectionPoint) /** @endcond */ protected: /** * @brief * Constructs a CXTPFlowGraphConnectionPoint object. */ CXTPFlowGraphConnectionPoint(); public: /** * @brief * Destroys a CXTPFlowGraphConnectionPoint object, handles cleanup * and deallocation. */ virtual ~CXTPFlowGraphConnectionPoint(); public: /** * @brief * Sets the caption of the connection point. * @param lpszCaption String caption of the connection point. */ void SetCaption(LPCTSTR lpszCaption); /** * @brief * Gets the caption of the connection point. * @return * The caption of the connection point. */ CString GetCaption() const; /** * @brief * Sets the name of the connection point. * @param lpszName String name of the connection point. * @details * You can use FindConnectionPoint to search for a connection point * by name. */ void SetName(LPCTSTR lpszName); /** * @brief * Gets the name of the connection point. * @details * You can use FindConnectionPoint to search for a connection point * by name. * @return * The name of the connection point. */ CString GetName() const; /** * @brief * Sets the tooltip for this connection point. * @param lpszTooltip Tooltip for this connection point. * @details * This is the text that is displayed when the mouse is hovered over * the connection point. */ void SetTooltip(LPCTSTR lpszTooltip); /** * @brief * Gets the tooltip for this connection point. * @details * This is the text that is displayed when the mouse is hovered over * the connection point. * @return * The tooltip for this connection point. */ CString GetTooltip() const; /** * @brief * Sets the color for the connection point. * @param clr Color for the connection point. */ void SetColor(COLORREF clr); /** * @brief * Gets the color of the connection point. * @return * The color of the connection point. */ COLORREF GetColor() const; /** * @brief * Reserved for future use. Currently can be used as a "tag" property * if needed. * @param nStyle Style value. */ void SetStyle(int nStyle); /** * @brief * Reserved for future use. Currently can be used as a "tag" property * if needed. * @return Current style value. */ int GetStyle() const; /** * @brief * Gets whether the flow graph connection will have any connection * points (input/output). * @details * An option from FlowGraphConnectionPointType that specifies the * included connection points, if any. * @return * FlowGraphConnectionPointType is used to specify whether a * flow graph connection will have any connection points. Connection * points are used to make connections between a connection in * different nodes. */ XTPFlowGraphConnectionPointType GetType() const; /** * @brief * Specifies whether the flow graph connection will have any connection * points (input/output). * @param type An option from FlowGraphConnectionPointType that specifies * the included connection points. * @details * FlowGraphConnectionPointType is used to specify whether a * flow graph connection will have any connection points. Connection * points are used to make connections between a connection in * different nodes. */ void SetType(XTPFlowGraphConnectionPointType type); /** * @brief * Gets the bounding rectangle for this element. * @return * The bounding rectangle for this element. */ CRect GetRect() const; /** * @brief * Sets the bounding rectangle for this element. * @param rect Bounding rectangle to be set. */ void SetRect(const CRect& rect); /** * @brief * Sets the ID used to identify this connection point. * @param nId New ID used to identify this connection point. */ void SetID(int nId); /** * @brief * Gets the ID used to identify this connection point. * @return * The ID used to identify this connection point. */ int GetID() const; /** * @brief * Gets whether the connection's points are locked. * @return * TRUE if the connection's points are locked, * FALSE if they can accept connections. */ BOOL IsLocked() const; /** * @brief * Specifies whether the connection's points should be locked. * @param bLocked TRUE if the connection's points should be locked, * FALSE if they should accept connections. * @details * If TRUE, then the connection's points cannot accept a connection line * and any connection lines that were added cannot be removed. */ void SetLocked(BOOL bLocked = TRUE); /** * @brief * Gets the maximum number of connections (connection lines) that the * connection point can accept. * @return * The maximum number of connections (connection lines) that the * connection point can accept. */ int GetMaxConnections() const; /** * @brief * Specifies the maximum number of connections (connection lines) * that the connection point can accept. * @param nMaxConnections The maximum number of connections (connection lines) * that the connection point can accept. */ void SetMaxConnections(int nMaxConnections); /** * @brief * Gets the number of connection lines connected to this connection point. * @return * The number of connection lines connected to this connection point. */ int GetConnectionsCount() const; /** * @brief * Gets the number of input connection lines connected to this connection point. * @return * The number of input connection lines connected to this connection point. */ int GetInputConnectionsCount() const; /** * @brief * Retrieves the input connection associated with a point by its index. * @param nIndex Index of the point whose input connection must be retrieved. * @return * A pointer to the input connection associated with the point. */ CXTPFlowGraphConnection* GetInputConnectionAt(int nIndex) const; /** * @brief * Gets the number of output connection lines connected to this connection point. * @return * The number of output connection lines connected to this connection point. */ int GetOutputConnectionsCount() const; /** * @brief * Retrieves the output connection associated with a point by its index. * @param nIndex Index of the point whose output connection must be retrieved. * @return * A pointer to the output connection associated with the point. */ CXTPFlowGraphConnection* GetOutputConnectionAt(int nIndex) const; /** * @brief * Sets the ID of the image to display to the left of the connection * point's caption. * @param nImageIndex The ID of the image to display to the left of the * connection point's caption. * @details * Use the image index to specify the index of the previously loaded * image to display next to the connection point's caption. */ void SetImageIndex(int nImageIndex); /** * @brief * Gets the ID of the image to display to the left of the connection * point's caption. * @return * The ID of the image to display to the left of the connection * point's caption. */ int GetImageIndex() const; public: /** * @brief * Call this method to get the markup element that renders the caption * of the control. * @return * A pointer to a CXTPMarkupUIElement object. */ CXTPMarkupUIElement* GetMarkupUIElement() const; public: /** * @brief * Gets a reference to the Node that this connection point belongs to. * @return * A reference to the Node that this connection point belongs to. */ CXTPFlowGraphNode* GetNode() const; /** * @brief * Gets a reference to the page that this connection point belongs to. * @return * A reference to the page that this connection point belongs to. */ CXTPFlowGraphPage* GetPage() const; /** * @brief * Gets a reference to the parent FlowGraph control. * @return * A reference to the parent FlowGraph control. */ CXTPFlowGraphControl* GetControl() const; /** * @brief * Gets the image to display to the left of the connection point's caption. * @return * The image to display to the left of the connection point's caption. */ CXTPFlowGraphImage* GetImage() const; /** * @brief * This method is called when the flow graph's layout is changed. * @details * This method is called when the page zoom level, page scroll offset, * window/Node size, window handle, Node style, Node color, or * connection style is changed. */ void OnGraphChanged(); public: /** * @brief * Call this member function to store/load a connection point using * the specified data object. * @param pPX Source/destination CXTPPropExchange data object reference. * @details * This member function is used to store/load connection point * data to/from storage. */ virtual void DoPropExchange(CXTPPropExchange* pPX); public: /** * @brief * Determines if the specified point is within the connection area. * @param point Point to test. * @return * TRUE if the specified point is located within the connection area, * otherwise FALSE. */ virtual BOOL HitTestConnectionArea(CPoint point) const; void Remove(); protected: /** * @brief * This method is called when the point is removed. */ virtual void OnRemoved(); protected: CXTPFlowGraphNode* m_pNode; /**< Reference to the Node that this connection point belongs to. */ CString m_strCaption; /**< Caption of the connection point. */ CString m_strName; /**< Unique name of the connection point. */ CString m_strTooltip; /**< Tooltip text for the item. */ COLORREF m_clrPoint; /**< Color of the connection point. */ XTPFlowGraphConnectionPointType m_nType; /**< Type of connection point; specifies whether the FlowGraphConnection will have any connection points (input/output).*/ int m_nStyle; /**< Reserved for future use. Currently can be used as a "tag" property if needed. */ int m_nId; /**< ID of the connection point. */ BOOL m_bLocked; /**< Specifies if the connection point is locked. TRUE if the connection point is locked, FALSE if it can accept connections. */ BOOL m_bMarkupPoint; /**< Specifies if the connection point is actually an XML-markup point-row */ BOOL m_bInputOutPair; /**< for the undo manager. */ int m_nMaxConnections; /**< The maximum number of connections (connection lines) that the connection point can accept. */ int m_nImageIndex; /**< ID of the image to display to the left of the connection point's caption. */ int m_nConnectionPointIndex; friend class CXTPFlowGraphConnectionPoints; friend class CXTPFlowGraphPaintManager; friend class CXTPFlowGraphConnection; friend class CXTPFlowGraphPage; friend class CXTPFlowGraphUndoDeleteConnectionPointCommand; friend class CXTPFlowGraphNode; friend class CXTPFlowGraphNodeCustom; CArray m_arrInputConnections; CArray m_arrOutputConnections; /** @cond */ // Paint Manager Properties: public: CRect m_rcPoint; /** @endcond */ # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPFlowGraphConnectionPoint) afx_msg void OleSetCaption(LPCTSTR lpszCaption); afx_msg BSTR OleGetCaption(); afx_msg void OleSetName(LPCTSTR lpszName); afx_msg BSTR OleGetName(); afx_msg void OleSetTooltip(LPCTSTR lpszTooltip); afx_msg BSTR OleGetTooltip(); afx_msg void OleSetColor(OLE_COLOR clr); afx_msg OLE_COLOR OleGetColor(); afx_msg void OleSetStyle(int nStyle); afx_msg int OleGetStyle(); afx_msg void OleSetType(int nType); afx_msg int OleGetType(); afx_msg LPDISPATCH OleGetNode(); afx_msg LPDISPATCH OleGetInputConnection(int nIndex); afx_msg LPDISPATCH OleGetOutputConnection(int nIndex); /** @endcond */ # endif }; AFX_INLINE CString CXTPFlowGraphConnectionPoint::GetCaption() const { return m_strCaption; } AFX_INLINE CString CXTPFlowGraphConnectionPoint::GetName() const { return m_strName; } AFX_INLINE void CXTPFlowGraphConnectionPoint::SetTooltip(LPCTSTR lpszTooltip) { m_strTooltip = lpszTooltip; } AFX_INLINE CString CXTPFlowGraphConnectionPoint::GetTooltip() const { return m_strTooltip; } AFX_INLINE COLORREF CXTPFlowGraphConnectionPoint::GetColor() const { return m_clrPoint; } AFX_INLINE void CXTPFlowGraphConnectionPoint::SetStyle(int nStyle) { m_nStyle = nStyle; } AFX_INLINE int CXTPFlowGraphConnectionPoint::GetStyle() const { return m_nStyle; } AFX_INLINE CXTPFlowGraphNode* CXTPFlowGraphConnectionPoint::GetNode() const { return m_pNode; } AFX_INLINE XTPFlowGraphConnectionPointType CXTPFlowGraphConnectionPoint::GetType() const { return m_nType; } AFX_INLINE void CXTPFlowGraphConnectionPoint::SetType(XTPFlowGraphConnectionPointType type) { m_nType = type; } AFX_INLINE CRect CXTPFlowGraphConnectionPoint::GetRect() const { return m_rcPoint; } AFX_INLINE void CXTPFlowGraphConnectionPoint::SetRect(const CRect& rect) { m_rcPoint = rect; } AFX_INLINE void CXTPFlowGraphConnectionPoint::SetID(int nId) { m_nId = nId; } AFX_INLINE int CXTPFlowGraphConnectionPoint::GetID() const { return m_nId; } AFX_INLINE BOOL CXTPFlowGraphConnectionPoint::IsLocked() const { return m_bLocked; } AFX_INLINE void CXTPFlowGraphConnectionPoint::SetLocked(BOOL bLocked) { m_bLocked = bLocked; } AFX_INLINE int CXTPFlowGraphConnectionPoint::GetMaxConnections() const { return m_nMaxConnections; } AFX_INLINE void CXTPFlowGraphConnectionPoint::SetMaxConnections(int nMaxConnections) { m_nMaxConnections = nMaxConnections; } AFX_INLINE int CXTPFlowGraphConnectionPoint::GetConnectionsCount() const { return (int)m_arrInputConnections.GetSize() + (int)m_arrOutputConnections.GetSize(); } AFX_INLINE int CXTPFlowGraphConnectionPoint::GetImageIndex() const { return m_nImageIndex; } AFX_INLINE int CXTPFlowGraphConnectionPoint::GetInputConnectionsCount() const { return (int)m_arrInputConnections.GetSize(); } AFX_INLINE CXTPFlowGraphConnection* CXTPFlowGraphConnectionPoint::GetInputConnectionAt(int nIndex) const { return m_arrInputConnections[nIndex]; } AFX_INLINE int CXTPFlowGraphConnectionPoint::GetOutputConnectionsCount() const { return (int)m_arrOutputConnections.GetSize(); } AFX_INLINE CXTPFlowGraphConnection* CXTPFlowGraphConnectionPoint::GetOutputConnectionAt(int nIndex) const { return m_arrOutputConnections[nIndex]; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPFLOWGRAPHCONNECTIONPOINT_H__) /** @endcond */