/** * @file XTPMarkupFrameworkElement.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(__XTPMARKUPFRAMEWORKELEMENT_H__) # define __XTPMARKUPFRAMEWORKELEMENT_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPMarkupResourceDictionary; class CXTPMarkupStyle; class CXTPMarkupTriggerCollection; class CXTPMarkupThickness; /** * @brief * This class represents the provided framework-level implementation * built on CXTPMarkupUIElement. */ class _XTP_EXT_CLASS CXTPMarkupFrameworkElement : public CXTPMarkupUIElement { private: struct MINMAX { public: MINMAX(); void Update(const CXTPMarkupFrameworkElement* pElement); public: int nMaxHeight; int nMinHeight; int nMaxWidth; int nMinWidth; }; private: /** @cond */ DECLARE_MARKUPCLASS(CXTPMarkupFrameworkElement) /** @endcond */ protected: /** * @brief * Initializes a new instance of the CXTPMarkupFrameworkElement class. */ CXTPMarkupFrameworkElement(); /** * @brief * Destroys a CXTPMarkupFrameworkElement object, handles cleanup and deallocation. */ virtual ~CXTPMarkupFrameworkElement(); public: /** * @brief * Call this method to set the outer margin of an element. * * @param nLeft Left margin. * @param nTop Top margin. * @param nRight Right margin. * @param nBottom Bottom margin. */ void SetMargin(int nLeft, int nTop, int nRight, int nBottom); /** * @brief * Call this method to set the outer margin of an element. * @param nMargin Width, in pixels, for the margin. */ void SetMargin(int nMargin); /** * @brief * Call this method to get the outer margin of an element * @return * A pointer to a CXTPMarkupThickness object containing outer margin values. */ CXTPMarkupThickness* GetMargin() const; /** * @brief * Sets the minimum width constraint for the element. * @param nWidth New minimum width constraint. */ void SetMinWidth(int nWidth); /** * @brief * Sets the maximum width constraint for the element. * @param nWidth New maximum width constraint. */ void SetMaxWidth(int nWidth); /** * @brief * Sets the width for the element. * @param nWidth New width for the element. */ void SetWidth(int nWidth); /** * @brief * Sets the minimum height constraint for the element. * @param nHeight New minimum height constraint. */ void SetMinHeight(int nHeight); /** * @brief * Sets the maximum height constraint for the element. * @param nHeight New maximum height constraint. */ void SetMaxHeight(int nHeight); /** * @brief * Sets the height for the element. * @param nHeight New height for the element. */ void SetHeight(int nHeight); /** * @brief * Gets the minimum width constraint of the element. * @return * The minimum width constraint. */ int GetMinWidth() const; /** * @brief * Gets the maximum width constraint of the element. * @return * The maximum width constraint. */ int GetMaxWidth() const; /** * @brief * Gets the width of the element. * @return * The width of the element. */ int GetWidth() const; /** * @brief * Gets the minimum height constraint of the element. * @return * The minimum height constraint. */ int GetMinHeight() const; /** * @brief * Gets the maximum height constraint of the element. * @return * The maximum height constraint. */ int GetMaxHeight() const; /** * @brief * Gets the height of the element. * @return * The height of the element. */ int GetHeight() const; /** * @brief * Gets the tag object of the element. * @return * The tag object. */ CXTPMarkupObject* GetTag() const; /** * @brief * Sets the tag object for the element. * * @param pTag New tag object to set. */ void SetTag(CXTPMarkupObject* pTag); /** * @brief * Sets the horizontal alignment characteristics applied to this element when * it is composed within a parent element (e.g. a panel or items control). * * @param alignment New XTPMarkupHorizontalAlignment enumeration value. */ void SetHorizontalAlignment(XTPMarkupHorizontalAlignment alignment); /** * @brief * Sets the vertical alignment characteristics applied to this element when * it is composed within a parent element (e.g. a panel or items control). * * @param alignment New XTPMarkupVerticalAlignment enumeration value. */ void SetVerticalAlignment(XTPMarkupVerticalAlignment alignment); /** * @brief * Gets the horizontal alignment characteristics applied to this element when * it is composed within a parent element (e.g. a panel or items control). * @return * An XTPMarkupHorizontalAlignment enumeration value. */ XTPMarkupHorizontalAlignment GetHorizontalAlignment() const; /** * @brief * Gets the vertical alignment characteristics applied to this element when * it is composed within a parent element (e.g. a panel or items control). * @return * An XTPMarkupVerticalAlignment enumeration value. */ XTPMarkupVerticalAlignment GetVerticalAlignment() const; /** * @brief * Retrieves the actual size of the element after it is measured and * arranged within a parent element (e.g. a panel or items control). * @return * A CSize object containing the actual size of the element. */ CSize GetActualSize() const; /** * @brief * Specifies if child elements should be clipped inside element bounds. * @param bClipToBounds TRUE to clip child elements inside element bounds. */ void SetClipToBounds(BOOL bClipToBounds); /** * @brief * Determines if child elements are clipped inside element bounds. * @return * TRUE if child elements are clipped inside element bounds. */ BOOL GetClipToBounds() const; /** * @brief * Gets the attached style of the element. * @return * The attached style of the element. */ CXTPMarkupStyle* GetStyle() const; protected: /** @cond */ // Implementation virtual CSize MeasureCore(CXTPMarkupDrawingContext* pDC, CSize szAvailableSize); virtual CSize MeasureOverride(CXTPMarkupDrawingContext* pDC, CSize szAvailableSize); virtual void ArrangeCore(CRect rcFinalRect); virtual CSize ArrangeOverride(CSize szFinalSize); BOOL GetLayoutClip(CRect& rc) const; virtual void OnPropertyChanged(CXTPMarkupDependencyProperty* pProperty, CXTPMarkupObject* pOldValue, CXTPMarkupObject* pNewValue); private: CPoint ComputeAlignmentOffset(CSize clientSize, CSize inkSize) const; protected: BOOL m_bNeedsClipBounds; CSize m_szUnclippedDesiredSize; BOOL m_bUnclippedDesiredSize; MINMAX m_mmBounds; public: static CXTPMarkupDependencyProperty* m_pMarginProperty; static CXTPMarkupDependencyProperty* m_pHorizontalAlignmentProperty; static CXTPMarkupDependencyProperty* m_pVerticalAlignmentProperty; static CXTPMarkupDependencyProperty* m_pWidthProperty; static CXTPMarkupDependencyProperty* m_pHeightProperty; static CXTPMarkupDependencyProperty* m_pMinWidthProperty; static CXTPMarkupDependencyProperty* m_pMinHeightProperty; static CXTPMarkupDependencyProperty* m_pMaxWidthProperty; static CXTPMarkupDependencyProperty* m_pMaxHeightProperty; static CXTPMarkupDependencyProperty* m_pTagProperty; /** @endcond */ /** @cond */ public: DECLARE_DISPATCH_MAP() # ifdef _XTP_ACTIVEX DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPMarkupFrameworkElement); # endif afx_msg long OleGetMinWidth(); afx_msg long OleGetWidth(); afx_msg long OleGetMaxWidth(); afx_msg void OleSetMinWidth(int nWidth); afx_msg void OleSetWidth(int nWidth); afx_msg void OleSetMaxWidth(int nWidth); afx_msg long OleGetMinHeight(); afx_msg long OleGetHeight(); afx_msg long OleGetMaxHeight(); afx_msg void OleSetMinHeight(int nHeight); afx_msg void OleSetHeight(int nHeight); afx_msg void OleSetMaxHeight(int nHeight); afx_msg LPDISPATCH OleGetMargin(); afx_msg void OleSetMargin(LPDISPATCH lpMarginDisp); afx_msg long OleGetHorizontalAlignment(); afx_msg long OleGetVerticalAlignment(); afx_msg void OleSetHorizontalAlignment(long nValue); afx_msg void OleSetVerticalAlignment(long nValue); afx_msg VARIANT OleGetTag(); afx_msg void OleSetTag(const VARIANT& va); /** @endcond */ }; AFX_INLINE CXTPMarkupStyle* CXTPMarkupFrameworkElement::GetStyle() const { return m_pStyleCache; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPMARKUPFRAMEWORKELEMENT_H__) /** @endcond */