/** * @file XTPGridGroupRow.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(__XTPGRIDGROUPROW_H__) # define __XTPGRIDGROUPROW_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPMarkupContext; class CXTPMarkupUIElement; /** * @brief * This class represents a 'group row' of the Grid control view. * A 'group row' is a row which has a special text caption * instead of an associated record item. * @details * CXTPGridGroupRow has a slightly different reaction on mouse events * and another draw logic. * All other behavior of the group row is similar to its parent. * @see * CXTPGridRow overview, CXTPGridControl overview */ class _XTP_EXT_CLASS CXTPGridGroupRow : public CXTPGridRow { DECLARE_DYNAMIC(CXTPGridGroupRow); public: /** * @brief * Constructs a CXTPGridGroupRow object. */ CXTPGridGroupRow(); /** * @brief * Destroys a CXTPGridGroupRow object, handles cleanup and deallocation. */ virtual ~CXTPGridGroupRow(); /** * @brief * Gets the text caption. * @return * The text caption. * @see * CXTPGridGroupRow::CXTPGridGroupRow */ virtual CString GetCaption() const; /** * @brief * Gets the optional native group caption value. * @return * The optional native group caption value. * @see * CXTPGridGroupRow::CXTPGridGroupRow */ virtual COleVariant GetCaptionValue() const; /** * @brief * Gets the tooltip text. * @return * The tooltip text. */ virtual CString GetTooltip() const; /** * @brief * Sets the text caption and, optionally, the group caption value. * @param lpszCaption Caption to be set. * @details * When a column that the GridRecordItem belongs to has been grouped, * the caption of the column is displayed as the group caption. * If you specify a caption with CXTPGridGroupRow::SetCaption for * the GridRecordItem, then the m_strGroupText text will be * displayed instead of the caption of the column. You can use * CXTPGridGroupRow::SetCaption to "sub group" your GridRecordItems * when the column that they belong to has been grouped. The * GridRecordItems will be "sub grouped" by the value in * m_strGroupText when the column that they belong to is grouped. */ void SetCaption(LPCTSTR lpszCaption); /** * @brief * Sets the text caption and, optionally, the group caption value. * @param lpszCaption Caption to be set. * @param vtValue Optional group caption value. * @details * When a column that the GridRecordItem belongs to has been grouped, * the caption of the column is displayed as the group caption. * If you specify a caption with CXTPGridGroupRow::SetCaption for * the GridRecordItem, then the m_strGroupText text will be * displayed instead of the caption of the column. You can use * CXTPGridGroupRow::SetCaption to "sub group" your GridRecordItems * when the column that they belong to has been grouped. The * GridRecordItems will be "sub grouped" by the value in * m_strGroupText when the column that they belong to is grouped. */ void SetCaption(LPCTSTR lpszCaption, COleVariant vtValue); /** * @brief * Causes formula computed value to be updated. */ void UpdateValue(); /** * @brief * Gets the group row formula. * @return * The group row formula. */ virtual CString GetFormula() const; /** * @brief * Sets the group row formula. * @param sFormula New group row formula to be set. */ virtual void SetFormula(LPCTSTR sFormula); /** * @brief * Gets the group row caption format string. * @return * The group row caption format string. */ virtual CString GetFormatString() const; /** * @brief * Sets the group row caption format string. * @param strFormat New group row caption format string to be set. */ virtual void SetFormatString(LPCTSTR strFormat); /** * @brief * Draws the group row on the specified device context. * @param pDC Pointer to the device context in which the drawing occurs. * @param rcRow Position of the row in client window coordinates. * @param rcClip Position of the row in client window coordinates. * @param nLeftOffset Left offset of the drawing, in pixels (horizontal scroll position). * @param mergeItems Reference to the set of merged grid records. * @param nColumnFrom Index of the column to begin drawing. * @param nColumnTo Index of the column to end drawing. * @see * CXTPGridRow::Draw */ virtual void Draw(CDC* pDC, CRect rcRow, CRect rcClip, int nLeftOffset, CXTPGridRecordMergeItems& mergeItems, int nColumnFrom, int nColumnTo); /** * @brief * Processes single mouse clicks. * @param ptClicked Point coordinates where the message was fired from. * @see * CXTPGridRow::OnClick */ void OnClick(CPoint ptClicked); /** * @brief * Processes double mouse clicks. * @param ptClicked Point coordinates where the message was fired from. * @details * The group row adds a collapse/expand function in the event * that the double-click occurs on a row. * @see * CXTPGridRow::OnDblClick */ void OnDblClick(CPoint ptClicked); /** * @brief * Determines if this row is a group row. * @return * TRUE since this row is a group row. * @see * CXTPGridRow::IsGroupRow */ BOOL IsGroupRow() const; /** @cond */ BOOL CalculateByChilds(CXTPGridRow* pPassedRow, int col_start, int col_end, double& dPassedValue); /** @endcond */ CXTPMarkupUIElement* m_pMarkupUIElement; /**< Store markup object. */ /** * @brief * Resets the Markup element. * @see * CXTPGridControl::EnableMarkup */ virtual void ResetMarkupUIElement(); /** * @brief * Sets a pointer to the parent Grid control. * @param pControl Pointer to the parent Grid control. * @see * CXTPGridControl overview */ virtual void SetControl(CXTPGridControl* pControl); /** * @brief * Sets a pointer to the LPCURRENCYFMT * (i.e. the information that defines the format of a currency string). * @param fmt Pointer to the LPCURRENCYFMT. */ void SetCurrencyFormat(LPCURRENCYFMT fmt); protected: /** * @brief * The framework calls this member function to determine whether * a point is in the bounding rectangle of the specified tool. * @param point Specifies the x- and y- coordinates of the cursor. These * coordinates are always relative to the upper-left * corner of the window. * @param pTI Pointer to a TOOLINFO structure. * @return * If the tooltip control was found, then the window control ID is returned. * If the tooltip control was not found, then a value of -1 is returned. */ virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI); /** * @brief * Converts a value into a formatted currency string using m_lpCurrencyFmt. * @param value Value to be converted. * @return * The formatted currency string. */ CString GetCurrencyString(double value); protected: CString m_strGroupText; /**< Group text label. */ CString m_strGroupLabel; /**< Group text label - used as formula prefix. */ CString m_strFormula; /**< The formula. */ CString m_strFormat; /**< The format string. */ COleVariant m_vtCaptionValue; /**< Native caption value. */ LPCURRENCYFMT m_lpCurrencyFmt; /**< Contains information that defines the format of a currency */ /** * string. */ friend class CXTPGridPaintManager; # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPGridGroupRow); BSTR OleGetCaption(); void OleSetCaption(LPCTSTR pcszCaption); BSTR OleGetFormat(); void OleSetFormat(LPCTSTR pcszFormat); BSTR OleGetFormula(); void OleSetFormula(LPCTSTR pcszFormula); /** @endcond */ # endif }; AFX_INLINE BOOL CXTPGridGroupRow::IsGroupRow() const { return TRUE; } AFX_INLINE CString CXTPGridGroupRow::GetTooltip() const { return GetCaption(); } AFX_INLINE CString CXTPGridGroupRow::GetFormula() const { return m_strFormula; } AFX_INLINE void CXTPGridGroupRow::SetFormula(LPCTSTR sFormula) { m_strFormula = sFormula; } AFX_INLINE CString CXTPGridGroupRow::GetFormatString() const { return m_strFormat; } AFX_INLINE void CXTPGridGroupRow::SetFormatString(LPCTSTR strFormat) { m_strFormat = strFormat; } AFX_INLINE void CXTPGridGroupRow::SetControl(CXTPGridControl* pControl) { CXTPGridRow::SetControl(pControl); ResetMarkupUIElement(); } AFX_INLINE void CXTPGridGroupRow::SetCurrencyFormat(LPCURRENCYFMT fmt) { m_lpCurrencyFmt = fmt; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPGRIDGROUPROW_H__) /** @endcond */