/** * @file XTPFlowGraphControl.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(__XTPFLOWGRAPHCONTROL_H__) # define __XTPFLOWGRAPHCONTROL_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPFlowGraphPaintManager; class CXTPFlowGraphPage; class CXTPFlowGraphPages; class CXTPFlowGraphDrawContext; class CXTPFlowGraphNode; class CXTPFlowGraphNodeCustom; class CXTPPropExchange; class CXTPFlowGraphSelectedElements; class CXTPFlowGraphConnection; class CXTPFlowGraphElement; class CXTPFlowGraphConnectionPoint; class CXTPFlowGraphUndoManager; class CXTPFlowGraphImages; class CXTPToolTipContext; class CXTPFlowGraphPageHistory; class CXTPMarkupContext; class CXTPMarkupDependencyProperty; /** * @brief * Node resizing options (drag/drop size of Nodes). * @details * To resize a Node, you must click the border of the Node and drag it * to the desired width/height. * Set AllowResizeNodes to TRUE to enable resizable Nodes. You can * set the Lock property of a single Node if you don't want it moved * and resized. * @see * CXTPFlowGraphControl::SetAllowResizeNodes */ enum XTPFlowGraphResize { xtpFlowGraphResizeNone = 0, /**< Resizing is disabled. */ xtpFlowGraphResizeHorizontal = 1, /**< Nodes can be resized horizontally only.*/ xtpFlowGraphResizeVertical = 2, /**< Nodes can be resized vertically only.*/ xtpFlowGraphResizeBoth = 3 /**< Nodes can be resized both vertically and horizontally.*/ }; /** * @brief * Draw quality options for the flow graph. * @details * Set SmoothingMode to the setting that best matches your systems * capabilities. * * These option greatly affect the performance of the control and * will in part be affected by the graphics capability of the machine * that uses the control. xtpFlowGraphSmoothingModeHighQuality is * recommended when you do not intend for the nodes to be dragged by the * user. If dragging is enabled, then this setting is most affected by * the systems graphic capabilities. * @see * CXTPFlowGraphControl::SetSmoothingMode */ enum XTPFlowGraphSmoothingMode { xtpFlowGraphSmoothingModeHighQuality, /**< Uses GDI+ to draw the flow graph for the highest quality picture. This option looks the best, but might be slow when performing drag operations on lower end graphic cards. */ xtpFlowGraphSmoothingModeHighSpeed, /**< Uses GDI+ to draw the flow graph with slightly lower quality to improve speed over the High Quality option. */ xtpFlowGraphSmoothingModeGDI, /**< Uses GDI Standard to draw the flow graph. Performance will be good on lower end graphic cards; however, the quality does not look as good as the GDI+ options. */ xtpFlowGraphSmoothingModeAuto, /**< Will combine the various quality modes to get the best performance and quality. It will draw with a higher quality mode for viewing and then switch to a lower quality mode when performing drag operations. */ }; /** * @brief * Custom XAML properties used in CXTPFlowGraphNode and CXTPFlowGraphNodeCustom. */ enum XTPFlowGraphCustomProperty { xtpFlowGraphPropertyConnectionPoint = 0, /**< Applied to default nodes only. Tells the control that a given [Rectangle] is a connection point. */ xtpFlowGraphPropertyConnectionPointType = 1, /**< Applied to default nodes only. Tells the control that a given XAML element can have a color. */ xtpFlowGraphPropertyCanSetColor = 2, /**< Applied to default nodes only. Tells the control that a given XAML element can have a color.*/ xtpFlowGraphPropertyConnectionPointIn = 3, /**< Applied to custom nodes only. Tells the control of how to place connection points within the given XAML shape can be applied to canvas on custom markup nodes when the markup doesn't contain a path. */ xtpFlowGraphPropertyResizable = 4 /**< Applied to custom Nodes only. Tells the control that a given shape is resizable or not. A shape is resizable when this property is omitted. */ }; /** * @brief * Default XAML templates for a default node and its table rows with connection points. */ enum XTPFlowGraphDefaultXAMLTemplate { xtpFlowGraphTemplateNode = 0, /**< A Node.*/ xtpFlowGraphTemplateNodePointNone = 1, /**< Node table row with no connection points.*/ xtpFlowGraphTemplateNodePointIn = 2, /**< Node table row with input connection point.*/ xtpFlowGraphTemplateNodePointOut = 3, /**< Node table row with output connection point.*/ xtpFlowGraphTemplateNodePointInOut = 4 /**< Node table row with input & output connection points.*/ }; /** * @brief * Flow Graph Control. Used to display relationship graphs. * @details * The Flow Graph Control is used to display relationship graphs. This * can be thought of as a relationship diagram commonly used to * display the relationships for a relational database. * * The control consists of "Nodes" that can be thought of as tables * in a database. The Nodes contain "connections" (fields of a * table). The connections can have many "connection points" that can * be used to link the connections between different nodes (i.e. * linking an invoice table to a customer table via a connection). * * Nodes and connection lines can be dragged around the graph * allowing the user to fully customize the look of their * relationship diagram. * * The control also supports undo/redo edit operations in the case * you allow the nodes to be moved, renamed, connections * added/removed, etc. * * Several different zoom navigation functions allow the control to * zoom to a specific Node, zoom to a range of Nodes, zoom to * the selection and fit it to the window. * * Page transitions can be used to transition from one database to * another. */ class _XTP_EXT_CLASS CXTPFlowGraphControl : public CWnd { /** @cond */ DECLARE_DYNAMIC(CXTPFlowGraphControl) /** @endcond */ public: /** * @brief * Constructs a CXTPFlowGraphControl object. */ CXTPFlowGraphControl(); /** * @brief * Destroys a CXTPFlowGraphControl object, handles cleanup and * deallocation. */ virtual ~CXTPFlowGraphControl(); public: /** * @brief * Sets the active page. * @details * The flow graph can contain many pages that each have their own set * of Nodes/connections. GetActivePage will retrieve a reference to the page * currently in view. Note that only one page can be viewed at a time. * @param pPage Reference to the page to make active. */ void SetActivePage(CXTPFlowGraphPage* pPage); /** * @brief * Collection of all pages in the flow graph. * @details * A page is what contains all the elements in the flow graph. The * flow graph can contain many pages, each of which can contain * Nodes, Node groups, and connections. A page is the first thing that * you must add to the flow graph and then you can add elements * to the pages. * @return * Reference to the collection of all pages in the flow graph. */ CXTPFlowGraphPages* GetPages() const; /** * @brief * This method is called whenever the flow graph or any of its * elements have changed. * @details * For example, 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. */ virtual void OnGraphChanged(); public: /** * @brief * Retrieves the FlowGraphPaintManager object used for drawing the * flow graph. * @details * The paint manager holds many properties to change the various * colors and other visual properties used in the flow graph. * @return * The FlowGraphPaintManager object used for drawing the flow graph. */ CXTPFlowGraphPaintManager* GetPaintManager() const; /** * @brief * Sets the FlowGraphPaintManager object used for drawing the * flow graph. * @details * The paint manager holds many properties to change the various * colors and other visual properties used in the flow graph. * @param pPaintManager Reference to the FlowGraphPaintManager object to * use for drawing the flow graph. */ void SetPaintManager(CXTPFlowGraphPaintManager* pPaintManager); /** * @brief * Retrieves a reference to all the images that the flow graph can use. * @details * Use this method to manage all images for the flow graph. * @return * A reference to all the images that the flow graph can use. */ CXTPFlowGraphImages* GetImages() const; public: /** * @brief * Exchanges layout and state information to/from a PropExchange * object. * @details * The PropExchange object provides a universal solution to * save the layout and state of the flow graph to a single file * or the system registry with support to write/load directly * to/from a file or registry. * @param pPX PropExhange object to exchange data with. */ virtual void DoPropExchange(CXTPPropExchange* pPX); public: /** * @brief * Called by the framework to draw the flow graph control. * @param pDC Pointer to a valid device context. * @details * This will redraw the control's background and call OnDraw for the * active page. */ virtual void OnDraw(CXTPFlowGraphDrawContext* pDC); /** * @brief * Updates the position of elements in the graph. * @details * Call this method after applying changes in code that require a * reposition of elements of the flow graph (e.g. adding nodes). */ virtual void Reposition(); /** * @brief * Redraws the control. * @details * Call this method after applying changes in code that require a * visual redraw (e.g. color). */ virtual void RedrawControl(); /** * @brief * Retrieves a reference to the currently active page. * @details * The flow graph can contain many pages that each have their own set * of Nodes/connections. GetActivePage will retrieve a reference to the page * currently in view. Note that only one page can be viewed at a time. * @return * A reference to the currently active page. */ CXTPFlowGraphPage* GetActivePage() const; /** * @brief * Gets an object that keeps track of page history and allows for the * history to be navigated. * @return * A FlowGraphPageHistory object used to navigate the history of the pages. */ CXTPFlowGraphPageHistory* GetHistory() const; /** * @brief * Gets the manager used to Undo and Redo edit operations in the flow graph. * @details * The FlowGraphUndoManager allows for certain edit operations to be * undone and re-done in the Flow Graph. Supported operations are * Add/Remove/Move/Resize Nodes/Move Connector Lines/Rename Nodes/Grouping. * If any of these operations are performed, then they can easily * be undone/re-done using the methods of the FlowGraphUndoManager. * * StartGroup and EndGroup are used to "group" a set of "undoable" * operations together. Grouping the operations together is useful * since the grouped operations can be Undone or Re-done with a single * call to Undo or Redo. If the operations are not grouped, then * you would have to call Undo or Redo for each operation performed. * * Any "undoable" operations performed between StartGroup and EndGroup * will be undone/re-done with a single call to Undo or Redo. * @return * Reference to the FlowGraphUndoManager. */ CXTPFlowGraphUndoManager* GetUndoManager() const; /** * @brief * Registers the window class if it has not already been registered. * @param hInstance Instance of the resource where the control is located. * @return * TRUE if the window class was successfully registered. */ BOOL RegisterWindowClass(HINSTANCE hInstance = NULL); /** * @brief * Call this method to create a flow graph control. * @param dwStyle Styles to use. * @param rect Specifies the size and position of the item. * @param pParentWnd Pointer to the parent window. * @param nID ID to use for this control. * @return TRUE if successful, FALSE otherwise. */ BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID); using CWnd::Create; public: /** * @brief * Gets the current zoom level of the control. * @details * 0.0 is 0 zoom and 1.0 is 100% zoom. * @return * The current zoom level of the control. */ double GetZoomLevel() const; /** * @brief * Sets the current zoom level for the control. * @param dZoomLevel New zoom level to use. * @details * 0.0 is 0 zoom and 1.0 is 100% zoom. */ void SetZoomLevel(double dZoomLevel); /** * @brief * Gets the scroll offset (how much the page has been scrolled). This * retrieves the X/Y coordinates excluding the left/right offset. * @return * The scroll offset (how much the page has been scrolled). This * retrieves a point that contains the X/Y coordinates excluding * the left/right offset. */ CPoint GetScrollOffset() const; /** * @brief * Call this method to set the minimum and maximum zoom percentages * that are allowed when using the various zoom methods. * @details * By default, there is no zoom restriction. 0.0 is 0 and 1.0 is 100%. * @param dMinZoom Minimum zoom value (0.0 \- 1.0). * @param dMaxZoom Maximum zoom value (0.0 \- 1.0). */ void SetZoomRange(double dMinZoom, double dMaxZoom); /** * @brief * This method uses the current zoom level and scroll offset to transform * a point in logical coordinates to current drawing coordinates. * @param pt Point in logical coordinates. * @return * The transformed current drawing coordinates. */ CPoint TransformPoint(CPoint pt) const; /** * @brief * Zooms to the currently selected Nodes. * @details * This will fill the entire view with the currently selected Nodes. */ virtual void ZoomToSelection(); /** * @brief * Fits all the Nodes in the active page to the window. * @details * The contents of the active page will zoom in or out to fit all * content to the full size of the page. */ virtual void ZoomFitToWindow(); /** * @brief * Zooms the view to a specific set of coordinates on the active page. * @details * This will zoom the view to the specified coordinates. * @param lpRect Specifies the coordinates of the rectangle to zoom to. * @param bAnimate TRUE to use animation wile zooming. */ virtual void ZoomToRect(LPCRECT lpRect, BOOL bAnimate = TRUE); /** * @brief * Call this method to use animation to scroll to the specified offset * in the control. * @param ptScrollOffset A point that represents the offset to scroll to. * @param dZoomLevel Level of zoom to use. * @details * 0.0 is 0 zoom and 1.0 is 100% zoom. */ virtual void AnimateTo(CPoint ptScrollOffset, double dZoomLevel); /** * @brief * This method will transition from a Node on the current page to a Node * on a different page. * @param pNodeFrom Reference to a Node on the current page to transition from. * @param pNodeTo Reference to a Node on a different page to transition to. * @details * AnimatePageTransition will transition from a Node on the current page * to a Node on a different page. This will cause the active page to * change to the page that contains the Node that was transitioned to. */ virtual void AnimatePageTransition(CXTPFlowGraphNode* pNodeFrom, CXTPFlowGraphNode* pNodeTo); /** * @brief * Sets the delay to use between animation steps when animation is used * (zooming/scrolling). * @param nDelay New animation delay. */ void SetAnimationDelay(int nDelay); /** * @brief * Gets the delay used between animation steps when animation is used * (zooming/scrolling). * @return * The animation delay. */ int GetAnimationDelay() const; public: /** * @brief * Specifies whether the user can drag/move Nodes. * @param bAllow TRUE to allow Nodes to be moved, FALSE to lock them. */ void SetAllowMoveNodes(BOOL bAllow); /** * @brief * Gets whether the user can drag/move Nodes. * @return * TRUE if nodes are allowed to be moved, FALSE if they are locked. */ BOOL GetAllowMoveNodes() const; /** * @brief * Sets Node resizing options (drag/drop size of nodes). * @details * To resize a Node, you must click the border of the node and drag it * to the desired width/height. * @param nResizeMode New resizing options; must be one of the values defined * by the XTPFlowGraphResize enumeration. */ void SetAllowResizeNodes(XTPFlowGraphResize nResizeMode); /** * @brief * Gets Node resizing options (drag/drop size of nodes). * @details * To resize a Node, you must click the border of the node and drag it * to the desired width/height. * @return * Current resizing options; returns one of the values defined * by the XTPFlowGraphResize enumeration. */ XTPFlowGraphResize GetAllowResizeNodes() const; /** * @brief * Specifies whether the user is allowed to drag/move/add/delete connections. * @param bAllowModifyConnections TRUE to allow the user to * drag/move/add/delete connections, * FALSE to lock them. */ void SetAllowModifyConnections(BOOL bAllowModifyConnections); /** * @brief * Checks whether the user is allowed to drag/move/add/delete connections. * @return * TRUE if the user is allowed to drag/move/add/delete connections, * FALSE if they are locked. */ BOOL GetAllowModifyConnections() const; /** * @brief * Sets the draw quality options for the flow graph. * @param nSmoothingMode Smoothing mode to use; must be an option from * XTPFlowGraphSmoothingMode. * @details * Set SmoothingMode to the setting that best matches your systems * capabilities. Use one of the XTPFlowGraphSmoothingMode options for * the smoothing mode that best suits your needs. * * These options greatly affect the performance of the control and * will, in part, be effected by the graphics capability of the machine * that uses the control. xtpFlowGraphSmoothingModeHighQuality is * recommended when you don't intend for the Nodes to be dragged by the * user. If dragging is enabled, then this setting is most affected * by the system's graphic capabilities. */ void SetSmoothingMode(XTPFlowGraphSmoothingMode nSmoothingMode); /** * @brief * Gets the draw quality options used for the flow graph. * @details * These options greatly affect the performance of the control and * will, in part, be effected by the graphics capability of the machine * that uses the control. xtpFlowGraphSmoothingModeHighQuality is * recommended when you don't intend for the Nodes to be dragged by the * user. If dragging is enabled, then this setting is most affected * by the system's graphic capabilities. * @return * Currently set smoothing mode; returns an option from * XTPFlowGraphSmoothingMode. */ XTPFlowGraphSmoothingMode GetSmoothingMode() const; public: /** * @brief * Selects all Nodes in the graph. * @details * This will select all Nodes in the graph. Selected Nodes have a * "bluish" color when selected. The current selection is stored in * the active page's selection property. */ virtual void SelectAll(); /** * @brief * Auto-arranges the Nodes in the active page. * @details * This will left-align all Nodes in the active page. Nodes with * connections will be placed to the right of the connected Node. */ virtual void Arrange(); /** * @brief * Call this method to place a Node into edit mode so the user can * edit the text. * @param pNode Reference to the Node to place into edit mode. */ virtual void RenameNode(CXTPFlowGraphNode* pNode); /** * @brief * Call this method to place a connection point into edit mode so the * user can edit the text. * @param pConnectionPoint Reference to the connection point to place into * edit mode. */ virtual void RenameConnectionPoint(CXTPFlowGraphConnectionPoint* pConnectionPoint); /** * @brief * Helper method to load a custom XAML shape from toolkit using * its resource ID. * @param uResShapeID Shape resource ID. * @param pPage A pointer to a CXTPFlowGraphPage. If not * defined, then the active page is used. * @return A custom graph node object pointer. */ CXTPFlowGraphNodeCustom* AddCustomNodeFromToolkitResource(UINT uResShapeID, CXTPFlowGraphPage* pPage = NULL); public: /** * @brief * Call this method to determine if there is a CXTPFlowGraphNode * at the specified point. * @param point Point to test. * @return * A reference to the CXTPFlowGraphNode found at the specified * point, or NULL if no CXTPFlowGraphNode is found. */ virtual CXTPFlowGraphNode* HitTestNode(CPoint point) const; /** * @brief * Call this method to determine if there is a CXTPFlowGraphConnection * at the specified point. * @param point Point to test. * @return * A reference to the CXTPFlowGraphConnection found at the specified * point, or NULL if no CXTPFlowGraphConnection is found. */ virtual CXTPFlowGraphConnection* HitTestConnection(CPoint point) const; /** * @brief * Call this method to determine if there is a CXTPFlowGraphConnectionPoint * at the specified point. * @param point Point to test. * @return * A reference to the CXTPFlowGraphConnectionPoint found at the specified * point, or NULL if no CXTPFlowGraphConnectionPoint is found. */ virtual CXTPFlowGraphConnectionPoint* HitTestConnectionArea(CPoint point) const; public: /** * @brief * Called after a label has been edited. * @param pItem Reference to the element that has finished editing. * @param str New label for the element. * @details * This will occur after the label is edited, but before it is * changed. */ virtual void OnEndLabelEdit(CXTPFlowGraphElement* pItem, LPCTSTR str); /** * @brief * Call this method to cancel a label edit. * @details * This method is used in the CXTPFlowGraphControl::Reposition * method. */ void CancelLabelEdit(); public: /** * @brief * Call this method to get a pointer to the tooltip context. * @return * A pointer to the tooltip context. */ CXTPToolTipContext* GetToolTipContext() const; /** * @brief * Save the picture to a specified file. * @param szFile File to save the picture to. * @return * TRUE if successful. */ BOOL SaveToFile(LPCTSTR szFile); public: /** * @brief * Enables/disables markup for the flow graph. * @param bEnable TRUE to enable markup for the flow graph, * FALSE to disable markup for the flow graph. */ void EnableMarkup(BOOL bEnable = TRUE); /** * @brief * Enables/disables the scrollbar. * @param nBar [in] The scrollbar identifier. * @param bEnable [in] TRUE to enable the scrollbar, FALSE to disable. * @details * If the window has a sibling scrollbar control, then that scrollbar * is used. Otherwise the window's own scrollbar is used. * @see * void ShowScrollBar(UINT nBar, BOOL bShow = TRUE); */ void EnableScrollBarCtrl(int nBar, BOOL bEnable = TRUE); BOOL GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, UINT nMask = SIF_ALL); BOOL SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE); /** * @brief * Call this member function to retrieve the maximum scrolling * position of the scroll bar. * @param nBar [in] Specifies the type of scroll bar. The parameter can take * one of the following values: * SB_HORZ: Retrieves the scroll limit of the horizontal * scrollbar. * SB_VERT: Retrieves the scroll limit of the vertical * scrollbar. * @return * An int value which specified the maximum scrolling position of * the scrollbar if successful, otherwise 0. */ int GetScrollLimit(int nBar); /** * @brief * Call this member function to obtain a pointer to the specified * sibling scroll bar. * @param nBar [in] Specifies the type of scrollbar. The parameter can take * one of the following values: * SB_HORZ: Retrieves the position of the horizontal scroll bar. * SB_VERT: Retrieves the position of the vertical scroll bar. * @details * This member function does not operate on scrollbars created when the * WS_HSCROLL or WS_VSCROLL bits are set during the creation of a window. * The CWnd implementation of this function simply returns NULL. Derived * classes, such as CView, implement the described functionality. * @return * A pointer to the specified sibling scrollbar control if successful, * or NULL if the specified sibling scrollbar does not exist. */ virtual CScrollBar* GetScrollBarCtrl(int nBar) const; /** * @brief * Retrieves a pointer to the markup context. * @return * A pointer to a CXTPMarkupContext object. */ CXTPMarkupContext* GetMarkupContext() const; /** * @brief * Call this method to retrieve a custom markup property from the * custom properties map. * @param property Identifies the property to retrieve. * @return * A pointer to the custom markup property. */ CXTPMarkupDependencyProperty* GetCustomMarkupProperty(XTPFlowGraphCustomProperty property) const; /** * @brief * Call this method to retrieve a default markup template. * @param tmpl Identifies the template to retrieve. * @return * A string containing the default markup template. */ CString GetDefaultMarkupTemplate(XTPFlowGraphDefaultXAMLTemplate tmpl) const; /** * @brief * Attaches custom properties to a control. */ void RegisterCustomMarkupProperties(); /** * @brief * Sets up default Node's markup templates for a Node and its rows * (used to be names connection points). */ void SetupDefaultMarkupTemplates(); /** * @brief * Loads a markup XAML template from a resource. * @param szTemplate A string defining a resource of type 'XML'. * @return * A string containing a markup string (applies to default Nodes). */ static CString AFX_CDECL LoadXamlTemplate(LPCTSTR szTemplate); public: /** * @brief * Sends the specified message to the window. * @param nMessage The message to be sent. * @param pNMHDR Notify header. * @return * Nonzero if successful, otherwise zero. */ virtual LRESULT SendNotifyMessage(UINT nMessage, NMHDR* pNMHDR = NULL) const; protected: /** * @brief * Adjusts scrollbars depending on currently visible elements * (nodes, connections, etc.). */ virtual void AdjustScrollBars(); protected: /** * @brief * Internal method that is called when Nodes are starting to get * dragged. */ virtual void StartDragNodes(); /** * @brief * Internal method that is called when a Node starts to get resized. * @param pNode Pointer to the Node that is starting to get resized. * @param hitTest Hit test information; must be one of the values * defined by the SelectionRectHitTest enumeration. */ virtual void StartResizeNode(CXTPFlowGraphNode* pNode, UINT hitTest); /** * @brief * Internal method that is called when the screen has begun to get * dragged. */ virtual void StartDragScreen(); /** * @brief * Internal method that is called when the selection starts to get * dragged. */ virtual void StartDragSelection(); /** * @brief * Internal method that is called when a connection starts to get * dragged. * @param pConnection Pointer to the connection that is starting to get * dragged. */ virtual void StartDragConnection(CXTPFlowGraphConnection* pConnection); /** * @brief * Internal method that is called when a connection point starts to * get dragged. * @param pPoint Pointer to the connection point that is starting to get * dragged. */ virtual void StartDragConnectionPoint(CXTPFlowGraphConnectionPoint* pPoint); /** * @brief * Called when the selection has changed. * @param pt Point where the selection changed. */ virtual void OnMoveSelection(CPoint pt); /** * @brief * Calculates the correct ScrollOffset and ZoomLevel needed for a * given rectangle. * @param lpRect [in] Rectangle within the client rectangle to * zoom to. * @param ptScrollOffset [out] Will contain the needed scroll offset for * the specified rectangle to zoom. * @param dZoomLevel [out] Will contain the needed zoom level for the * specified rectangle to zoom. * @details * This is a helper method that calculates the correct ScrollOffset * and ZoomLevel needed for a given rectangle. You supply the * rectangle and then GetZoomParam will populate ptScrollOffset and * dZoomLevel with the correct values. */ virtual void GetZoomParam(LPCRECT lpRect, CPoint& ptScrollOffset, double& dZoomLevel); /** * @brief * Creates a CXTPFlowGraphDrawContext object that will use the * specified dc to draw. * @param dc Pointer to a valid device context. * @details * This will retrieve CXTPFlowGraphDrawContext or * CXTPFlowGraphDrawContextGdiPlus depending * on the value of m_nSmoothingMode. * @return * Pointer to the CXTPFlowGraphDrawContext object that will use the * specified dc to draw. */ virtual CXTPFlowGraphDrawContext* CreateDrawContext(CDC& dc); // returns true when at least node was reset bool ResetSelectedNodes(CXTPFlowGraphNode* pNodeToSkip = NULL); void UpdateActiveNodeAtPoint(CPoint pt, CXTPFlowGraphNode* pNodeToSkip = NULL); CXTPFlowGraphNode* IsPointInSizeRectOfSelectedNode(CPoint point, UINT& uHitTest) const; /** @cond */ protected: DECLARE_MESSAGE_MAP() virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const; virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // custom scrollbars related: void RepositionCustomScrollBars(); void DeleteCustomScrollBars(); public: void GetClientRect(LPRECT lpRect) const; void SetScrollbarTheme(XTPScrollBarTheme theme); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // end protected: afx_msg void OnPaint(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnMButtonDown(UINT nFlags, CPoint point); afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); /** @endcond */ protected: CBitmap m_bmpCache; /**< Bitmap Cache. */ BOOL m_bReposition; /**< Specifies whether the control should reposition itself. */ CXTPFlowGraphPaintManager* m_pPaintManager; /**< Pointer to the paint manager used to draw the flow graph.*/ CXTPFlowGraphPage* m_pActivePage; /**< Pointer to the currently active page. */ CXTPFlowGraphPages* m_pPages; /**< Pointer to the flow graph's collection of pages. */ BOOL m_bAdjustScrollBars; /**< Specifies whether to adjust the scrollbars. */ CPoint m_ptStartDrag; /**< Point to start dragging. */ CPoint m_ptMouse; /**< Current point the mouse cursor is located. */ CRect m_rcSelectedArea; /**< Bounding rectangle of the currently selected area. */ CXTPFlowGraphUndoManager* m_pUndoManager; /**< The pointer to the undo manager object. */ CXTPFlowGraphImages* m_pImages; /**< Image collection for the flow graph control. */ double m_dMinZoom; /**< Minimum zoom level allowed for the flow graph control. */ double m_dMaxZoom; /**< Maximum zoom level allowed for the flow graph control. */ CXTPToolTipContext* m_pToolTipContext; /**< Tooltip Context. */ int m_nAnimationDelay; /**< Delay between animation steps used when zooming or scrolling. */ CXTPFlowGraphPageHistory* m_pHistory; /**< Object that keeps track of page history and allows the history to be navigated. */ BOOL m_bAllowMoveNodes; /**< Specifies whether the user can drag/move Nodes. TRUE to allow Nodes to be moved, FALSE to lock them. */ XTPFlowGraphResize m_nAllowResizeNodes; // Node resizing options (drag/drop size of Nodes). BOOL m_bAllowModifyConnections; /**< Specifies whether the user can drag/move/add/delete connections. TRUE to allow the user to drag/move/add/delete connections, FALSE to lock them. */ BOOL m_bInAction; /**< Internally used to tell the flow graph it is in animation (scrolling, zooming) or dragging. */ XTPFlowGraphSmoothingMode m_nSmoothingMode; /**< Draw quality options for the flow graph. */ CXTPMarkupContext* m_pMarkupContext; /**< Markup context of flow graph. */ static CMap m_mapCustomProperties; // Map of Nodes and its table rows markup templates (default connection points) that depend on a // connection point type. CMap m_mapDefaultXamlTemplates; BOOL m_bCreateScrollbarOnParent; /**< TRUE if parent window scrollbars are used, otherwise FALSE. */ CScrollBar* m_pCustomScrollBars[2]; private: /** @cond */ struct DRAGNODE { CPoint ptOrigin; CXTPFlowGraphElement* pElement; BOOL bNode; }; CArray m_arrDragNodes; /** @endcond */ friend class CFlowGraphCtrl; }; AFX_INLINE CXTPFlowGraphPaintManager* CXTPFlowGraphControl::GetPaintManager() const { return m_pPaintManager; } AFX_INLINE CXTPFlowGraphPages* CXTPFlowGraphControl::GetPages() const { return m_pPages; } AFX_INLINE CXTPFlowGraphPage* CXTPFlowGraphControl::GetActivePage() const { return m_pActivePage; } AFX_INLINE CXTPFlowGraphUndoManager* CXTPFlowGraphControl::GetUndoManager() const { return m_pUndoManager; } AFX_INLINE void CXTPFlowGraphControl::SetZoomRange(double dMinZoom, double dMaxZoom) { m_dMinZoom = dMinZoom; m_dMaxZoom = dMaxZoom; } AFX_INLINE CXTPToolTipContext* CXTPFlowGraphControl::GetToolTipContext() const { return m_pToolTipContext; } AFX_INLINE void CXTPFlowGraphControl::SetAnimationDelay(int nDelay) { m_nAnimationDelay = nDelay; } AFX_INLINE int CXTPFlowGraphControl::GetAnimationDelay() const { return m_nAnimationDelay; } AFX_INLINE CXTPFlowGraphImages* CXTPFlowGraphControl::GetImages() const { return m_pImages; } AFX_INLINE CXTPFlowGraphPageHistory* CXTPFlowGraphControl::GetHistory() const { return m_pHistory; } AFX_INLINE void CXTPFlowGraphControl::SetAllowMoveNodes(BOOL bAllow) { m_bAllowMoveNodes = bAllow; } AFX_INLINE BOOL CXTPFlowGraphControl::GetAllowMoveNodes() const { return m_bAllowMoveNodes; } AFX_INLINE void CXTPFlowGraphControl::SetAllowResizeNodes(XTPFlowGraphResize nResizeMode) { m_nAllowResizeNodes = nResizeMode; } AFX_INLINE XTPFlowGraphResize CXTPFlowGraphControl::GetAllowResizeNodes() const { return m_nAllowResizeNodes; } AFX_INLINE void CXTPFlowGraphControl::SetAllowModifyConnections(BOOL bAllowModifyConnections) { m_bAllowModifyConnections = bAllowModifyConnections; } AFX_INLINE BOOL CXTPFlowGraphControl::GetAllowModifyConnections() const { return m_bAllowModifyConnections; } AFX_INLINE XTPFlowGraphSmoothingMode CXTPFlowGraphControl::GetSmoothingMode() const { return m_nSmoothingMode; } AFX_INLINE CXTPMarkupContext* CXTPFlowGraphControl::GetMarkupContext() const { return m_pMarkupContext; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPFLOWGRAPHCONTROL_H__) /** @endcond */