/** * @file XTPMarkupGridLength.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(__XTPMARKUPGRIDLENGTH_H__) # define __XTPMARKUPGRIDLENGTH_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPMarkupObject; class CXTPMarkupBuilder; /** * @brief * CXTPMarkupGridLength is a class defined length of grid rows and columns. */ class _XTP_EXT_CLASS CXTPMarkupGridLength : public CXTPMarkupObject { /** @cond */ DECLARE_MARKUPCLASS(CXTPMarkupGridLength); /** @endcond */ public: /** * @brief * Unit type of the length. */ enum GridUnitType { unitTypeAuto, /**< Automatically calculated length.*/ unitTypePixel, /**< Length in pixels.*/ unitTypeStar /**< Length in percents.*/ }; public: /** * @brief * Constructs a CXTPMarkupGridLength object. * @param nValue Length of the grid elements. * @param type Unit type of the length; must be one of the values * defined by the GridUnitType enumeration. */ CXTPMarkupGridLength(double nValue = 0, GridUnitType type = unitTypePixel); /** * @brief * Gets the unit type of the length. * @return * The unit type of the length; returns one of the values * defined by the GridUnitType enumeration. * unitTypePixel will be returned if the length is calculated in pixels, * unitTypeStar will be returned if the length is calculated in percents. */ GridUnitType GetUnitType() const; /** * @brief * Gets the value of the length. * @return * The value of the length, in pixels or percents. */ double GetValue() const; /** * @brief * Determines if the length is calculated in percents (unitTypeStar). * @return * TRUE if the unit type of the length is unitTypeStar. */ BOOL IsStar() const { return m_type == unitTypeStar; } /** * @brief * Determines if the length is calculated automatically (unitTypeAuto). * @return * TRUE if the unit type of the length is unitTypeAuto. */ BOOL IsAuto() const { return m_type == unitTypeAuto; } public: /** * @brief * Helper method used to convert string to length. * @param pBuilder Pointer to a builder object. * @param pObject String representation of the length. * * @return A pointer to a new CXTPMarkupGridLength object. */ CXTPMarkupObject* ConvertFrom(CXTPMarkupBuilder* pBuilder, CXTPMarkupObject* pObject) const; public: double m_nValue; /**< Value. */ GridUnitType m_type; /**< Unit type. */ }; AFX_INLINE CXTPMarkupGridLength::GridUnitType CXTPMarkupGridLength::GetUnitType() const { return m_type; }; AFX_INLINE double CXTPMarkupGridLength::GetValue() const { return m_nValue; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPMARKUPGRIDLENGTH_H__) /** @endcond */