/** * @file XTPFlowGraphImage.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(__XTPFLOWGRAPHIMAGE_H__) # define __XTPFLOWGRAPHIMAGE_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" namespace Gdiplus { class Image; class Bitmap; } // namespace Gdiplus class CXTPImageManager; class CXTPImageManagerIcon; class CXTPFlowGraphControl; /** * @brief * Object used to represent an image displayed in a Node or * connection point. */ class _XTP_EXT_CLASS CXTPFlowGraphImage : public CXTPCmdTarget { public: /** * @brief * Constructs a CXTPFlowGraphImage object. */ CXTPFlowGraphImage(); /** * @brief * Destroys a CXTPFlowGraphImage object, handles cleanup and * deallocation. */ virtual ~CXTPFlowGraphImage(); public: /** * @brief * Loads an image from a resource. * @param hInstance Handle to an instance of the module that contains * the image to be loaded. * @param nResourceName The ID of the buffer containing the name of the * resource to load. */ void LoadFromResource(HINSTANCE hInstance, UINT nResourceName); /** * @brief * Loads an image from a resource. * @param hInstance Handle to an instance of the module that * contains the image to be loaded. * @param lpszResourceName Pointer to the string containing the name of * the resource containing the image to load. * @param lpszResourceType The type of the resource. */ void LoadFromResource(HINSTANCE hInstance, LPCTSTR lpszResourceName, LPCTSTR lpszResourceType); /** * @brief * Loads an image so that it can be used in the flow graph. * @param lpszFileName Filename and path to the file with the image to load. */ void LoadFromFile(LPCTSTR lpszFileName); /** * @brief * Call this method to assign a bitmap handle to the CXTPFlowGraphImage * class. * @param hBitmap Bitmap handle. */ void SetBitmap(HBITMAP hBitmap); /** * @brief * Call this method to assign an icon handle to the CXTPFlowGraphImage * class. * @param hIcon Icon handle to assign. */ void SetIcon(HICON hIcon); /** * @brief * Gets the size of this image. * @return * A CSize object containing the size of this image. */ CSize GetSize() const; /** * @brief * Gets a reference to a Gdiplus::Image for this flow graph image. * @return * A reference to a Gdiplus::Image for this flow graph image. */ Gdiplus::Image* GetImage() const; /** * @brief * Gets a reference to a CXTPImageManagerIcon for this flow graph image. * @return * A reference to a CXTPImageManagerIcon for this flow graph image. */ CXTPImageManagerIcon* GetIcon() const; protected: /** * @brief * This method is called when the image is removed from the flow * graph's collection of images. */ void OnRemoved(); /** * @brief * This method is called whenever the image has been changed. * @details * This is called when a bitmap/icon is set or when an image is * loaded from a resource or file. */ void ImageChanged(); friend class CXTPFlowGraphImages; protected: Gdiplus::Bitmap* m_pImage; /**< Reference to a Gdiplus::Image for this flow graph image. */ CXTPImageManagerIcon* m_pIcon; /**< Reference to a CXTPImageManagerIcon for this flow graph image. */ CSize m_szImage; /**< Size of the image. */ CXTPFlowGraphImages* m_pParent; /**< Reference to the collection of images that this image belongs to. */ # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPFlowGraphImage) /** @endcond */ # endif friend class CXTPFlowGraphImages; UINT m_nCommandId; }; /** * @brief * Collection of images that can be used in the flow graph. * @details * Images can be loaded and displayed next to the Node's caption or * connection point captions. */ class _XTP_EXT_CLASS CXTPFlowGraphImages : public CXTPCmdTarget { protected: /** * @brief * Constructs a CXTPFlowGraphImages object. * @param pControl Pointer to the flow graph control. */ CXTPFlowGraphImages(CXTPFlowGraphControl* pControl); /** * @brief * Destroys a CXTPFlowGraphImage object, handles cleanup and * deallocation. */ virtual ~CXTPFlowGraphImages(); public: /** * @brief * Adds an image object that can then be used to load an image file. * @details * AddImage must first be used to create a FlowGraphImage. You can * use this object to load an image file. * @param pPage Reference to the page to add this image to. * @return * A reference to the FlowGraphImage that was just added. */ CXTPFlowGraphImage* AddImage(CXTPFlowGraphImage* pPage); /** * @brief * Removes all images from the flow graph. */ void RemoveAll(); /** * @brief * Retrieves the total number of images added to the flow graph. * @return * The total number of images added to the flow graph. */ int GetCount() const; /** * @brief * Retrieves the specified image from the collection of all images added * to the flow graph. * @param nIndex Index of the desired image to retrieve. * @return * A reference to the specified image. */ CXTPFlowGraphImage* GetAt(int nIndex) const; /** * @brief * Removes all images from the specified page. * @param pPage Reference to the page to remove images from. */ void Remove(CXTPFlowGraphImage* pPage); /** * @brief * Removes the specified images from the collection of images. * @param nIndex Index of the image to remove. */ void RemoveAt(int nIndex); /** * @brief * Retrieves the image manager associated with the flow graph. * @return * A pointer to the image manager object that stores the images in * the flow graph. */ CXTPImageManager* GetImageManager() const; protected: CArray m_arrImages; /**< List of images for the flow graph. */ CXTPImageManager* m_pImageManager; /**< Pointer to the image manager associated with the graph. */ CXTPFlowGraphControl* m_pControl; friend class CXTPFlowGraphControl; # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPFlowGraphImages) DECLARE_ENUM_VARIANT(CXTPFlowGraphImages) afx_msg int OleGetItemCount(); afx_msg LPDISPATCH OleGetItem(int nIndex); afx_msg LPDISPATCH OleAddImage(); /** @endcond */ # endif }; AFX_INLINE int CXTPFlowGraphImages::GetCount() const { return (int)m_arrImages.GetSize(); } AFX_INLINE CXTPFlowGraphImage* CXTPFlowGraphImages::GetAt(int nIndex) const { return nIndex >= 0 && nIndex < m_arrImages.GetSize() ? m_arrImages[nIndex] : NULL; } AFX_INLINE CXTPImageManager* CXTPFlowGraphImages::GetImageManager() const { return m_pImageManager; } AFX_INLINE CSize CXTPFlowGraphImage::GetSize() const { return m_szImage; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPFLOWGRAPHIMAGE_H__) /** @endcond */