/** * @file XTPMarkupImage.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(__XTPMARKUPIMAGE_H__) # define __XTPMARKUPIMAGE_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPMarkupDeviceDependentImage; class CXTPMarkupDependencyProperty; class CXTPMarkupObject; class CXTPMarkupDrawingContext; class CXTPMarkupContext; /** * @brief * CXTPMarkupImage is a CXTPMarkupFrameworkElement derived class. * It implements the Image XAML Tag. */ class _XTP_EXT_CLASS CXTPMarkupImage : public CXTPMarkupFrameworkElement , private IXTPMarkupDeviceDependentImageSite { /** @cond */ DECLARE_MARKUPCLASS(CXTPMarkupImage) /** @endcond */ protected: /** * @brief * Constructs a CXTPMarkupImage object. */ CXTPMarkupImage(); /** * @brief * Destroys a CXTPMarkupImage object, handles cleanup and deallocation. */ virtual ~CXTPMarkupImage(); public: /** * @brief * Sets the source of the image to load. * @param lpszSource String contained URI of the image to load. * * Example: *
	 * pImage->SetSource("file://c:\\image.bmp); // Load from file
	 * pImage->SetSource("res://#125"); // Load from resources
	 * pImage->SetSource("125");  // Use Image manager index
	 * 
*/ void SetSource(LPCTSTR lpszSource); /** * @brief * Retrieves the source of the image to load. * @return * The string contained URI of the image to load. */ CString GetSource(); /** * @brief * Sets the stretch type of the image. * @param stretch New stretch type. */ void SetStretch(XTPMarkupStretch stretch); /** * @brief * Gets the current stretch type of the image. * @return * The current stretch type. */ XTPMarkupStretch GetStretch() const; /** * @brief * Retrieves the original size of the image (not scaled). * @return * A CSize object containing the original size of the image. */ CSize GetOriginalSize() const; /** @cond */ // Implementation public: virtual CSize MeasureOverride(CXTPMarkupDrawingContext* pDC, CSize constraint); virtual CSize ArrangeOverride(CSize arrangeSize); virtual void OnPropertyChanged(CXTPMarkupDependencyProperty* pProperty, CXTPMarkupObject* pOldValue, CXTPMarkupObject* pNewValue); virtual void OnRender(CXTPMarkupDrawingContext* pDC); protected: void CreateImageInstance(CXTPMarkupDrawingContext* pDC); CSize MeasureArrangeHelper(CSize inputSize); protected: // IXTPMarkupDeviceDependentImageSite overrides virtual CXTPMarkupContext* GetMarkupContext(); virtual void OnImageUpdateRequired(); private: CXTPMarkupDeviceDependentImage* m_pDeviceImage; CSize m_ConstraintSize; public: static CXTPMarkupDependencyProperty* m_pSourceProperty; static CXTPMarkupDependencyProperty* m_pStretchProperty; /** @endcond */ /** @cond */ public: DECLARE_DISPATCH_MAP() # ifdef _XTP_ACTIVEX DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPMarkupImage); # endif afx_msg void OleSetSource(LPCTSTR lpszSource); afx_msg BSTR OleGetSource(); afx_msg long OleGetStretch(); afx_msg void OleSetStretch(long stretch); /** @endcond */ }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPMARKUPIMAGE_H__) /** @endcond */