// BEGIN_MESSAGE_MAP(CReportSampleView, CXTPReportView)
// ON_NOTIFY(XTP_NM_REPORT_GETITEMMETRICS, XTP_ID_REPORT_CONTROL, OnReportGetItemMetrics)
// END_MESSAGE_MAP()
//
// void CReportSampleView::OnReportGetItemMetrics(NMHDR* pNotifyStruct, LRESULT* /*result*/)
// {
// XTP_NM_REPORTITEMMETRICS* pItemNotify = (XTP_NM_REPORTITEMMETRICS*)pNotifyStruct;
//
// ASSERT(pItemNotify->pDrawArgs);
// ASSERT(pItemNotify->pDrawArgs->pControl);
// ASSERT(pItemNotify->pDrawArgs->pRow);
//
// // pItemNotify->pDrawArgs->pColumn - may be NULL (for a group row)
// // pItemNotify->pDrawArgs->pItem - may be NULL (for a group row)
//
// ASSERT(pItemNotify->pItemMetrics);
//
// // TODO: customize members of pItemNotify->pItemMetrics.
// }
//
// See Also:
// CXTPReportControl, CXTPReportControl::GetItemMetrics(),
// XTP_NM_REPORT_GETITEMMETRICS
//===========================================================================
struct XTP_NM_REPORTITEMMETRICS
{
NMHDR hdr; // Standard structure, containing information about a notification message.
XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs; // Pointer to XTP_REPORTRECORDITEM_DRAWARGS structure.
XTP_REPORTRECORDITEM_METRICS* pItemMetrics; // Pointer to XTP_REPORTRECORDITEM_METRICS structure to be filled.
};
//===========================================================================
// Summary:
// This structure is sent to main window in a WM_NOTIFY message from from report control
// to determine Records was dragged or dropped
// Example:
//
// BEGIN_MESSAGE_MAP(CReportSampleView, CXTPReportView)
// ON_NOTIFY(XTP_NM_REPORT_BEGINDRAG, XTP_ID_REPORT_CONTROL, OnReportBeginDrag)
// END_MESSAGE_MAP()
//
// void CReportSampleView::OnReportBeginDrag(NMHDR* pNotifyStruct, LRESULT* /*result*/)
// {
// XTP_NM_REPORTDRAGDROP* pItemNotify = (XTP_NM_REPORTDRAGDROP*)pNotifyStruct;
//
// ASSERT(pItemNotify->pRecords);
// }
//
// See Also:
// XTP_NM_REPORT_DROP, XTP_NM_REPORT_BEGINDRAG, CXTPReportControl::EnableDragDrop
//===========================================================================
struct XTP_NM_REPORTDRAGDROP
{
NMHDR hdr; // Standard structure, containing information about a notification message.
CXTPReportRecords* pRecords; // Records will be dragged/dropped
CXTPReportRecord* pTargetRecord; // Target record (if any)
BOOL bAbove; // Where to insert (relative to the target record)
DROPEFFECT dropEffect; // The DropEffect flags.
CPoint pt; // The current location of the cursor in client coordinates.
int nState; // The transition state (0 - enter, 1 - leave, 2 - over).
};
//===========================================================================
// Summary:
// This structure is sent to Main window in a WM_NOTIFY message before
// processing OnKeyDown event.
// See Also:
// CXTPReportControl::OnPreviewKeyDown, XTP_NM_REPORT_PREVIEWKEYDOWN,
// CXTPReportControl::OnKeyDown, CWnd::OnKeyDown.
//===========================================================================
struct XTP_NM_REPORTPREVIEWKEYDOWN
{
NMHDR hdr; // Standard structure, containing information about a notification message.
// OnKeyDown parameters
UINT nChar; // [in/out] Specifies the virtual key code of the given key.
UINT nRepCnt; // [in] Repeat count.
UINT nFlags; // [in] Specifies the scan code, key-transition code, previous key state, and context code.
BOOL bCancel; // [out] TRUE to cancel processing key, FALSE to continue.
};
//===========================================================================
// Summary:
// Enumeration of operational mouse modes.
// Remarks:
// ReportControl has several
// Mouse states that handled by control. This enumeration helps to
// clearly identify each of these
// - Sends Notifications:
// - Sends Messages:
// See Also: CXTPReportControl::SetMouseMode, CXTPReportControl::GetMouseMode
//
// m_wndReport.EnableDragDrop("MyApplication", xtpReportAllowDrop | xtpReportAllowDrag);
// See Also: CXTPReportControl::EnableDragDrop
//-----------------------------------------------------------------------
enum XTPReportDragDrop
{
xtpReportAllowDrop = 1, // Allow Drop records to report
xtpReportAllowDragCopy = 2, // Allow copy records from report
xtpReportAllowDragMove = 4, // Allow move records from report
xtpReportAllowDrag = 6 // Allow copy and move records from report
};
//-----------------------------------------------------------------------
// Summary:
// Enumeration of watermark alignment flags
// Remarks:
// Call CXTPReportControl::SetWatermarkAlignment to modify watermark alignment
// Example:
// m_wndReport.SetWatermarkAlignment(xtpWatermarkCenter | xtpWatermarkBottom);
// See Also: CXTPReportControl::SetWatermarkAlignment, GetWatermarkAlignment
//-----------------------------------------------------------------------
enum XTPReportWatermarkAlignment
{
xtpReportWatermarkUnknown = 0, // Unknown (empty) value.
xtpReportWatermarkLeft = 0x0001, // Horizontal alignment: left side of report control client rect.
xtpReportWatermarkCenter = 0x0002, // Horizontal alignment: center of report control client rect.
xtpReportWatermarkRight = 0x0004, // Horizontal alignment: right side of report control client rect.
xtpReportWatermarkHmask = 0x000F, // A mask for horizontal alignment flags.
xtpReportWatermarkTop = 0x0010, // Vertical alignment: top side of report control client rect.
xtpReportWatermarkVCenter = 0x0020, // Vertical alignment: center of report control client rect.
xtpReportWatermarkBottom = 0x0040, // Vertical alignment: bottom side of report control client rect.
xtpReportWatermarkVmask = 0x00F0, // A mask for vertical alignment flags.
xtpReportWatermarkStretch = 0x0100, // Stretch watermark to entire report control client rect.
xtpReportWatermarkEnlargeOnly = 0x0200, // Watermark can be enlarged only, shrinking is disabled.
xtpReportWatermarkShrinkOnly = 0x0400, // Watermark can be shrinked only, enlarging is disabled.
xtpReportWatermarkPreserveRatio = 0x0800, // Watermark aspect ratio is preserved.
};
//-----------------------------------------------------------------------
// Summary:
// Enumeration of GetElementRect flags
// Remarks:
// Call CXTPReportControl::GetElementRect to get report element rectangle
// Example:
// m_wndReport.GetElementRect(xtpReportRectGroupByArea, rc);
// See Also: CXTPReportControl::GetElementRect
//-----------------------------------------------------------------------
enum XTPReportElementRect
{
xtpReportElementRectReportArea = 0, // report area rectangle
xtpReportElementRectGroupByArea, // report area rectangle
xtpReportElementRectHeaderArea, // report area rectangle
xtpReportElementRectFooterArea, // report area rectangle
xtpReportElementRectHeaderRecordsArea, // report area rectangle
xtpReportElementRectFooterRecordsArea, // report area rectangle
xtpReportElementRectHeaderRecordsDividerArea, // report area rectangle
xtpReportElementRectFooterRecordsDividerArea, // report area rectangle
};
//===========================================================================
// Summary:
// The CXTPReportControl class provides an implementation of
// the Report control.
//
// Remarks:
// A "report control" is a window that displays a hierarchical list
// of items, such as emails in the inbox. Each item is called a CXTPReportRow
// and consists of its properties and corresponding CXTPReportRecord,
// which contains all the corresponding data (mostly text).
// Each Row item (as well as Record) can have a list of sub-items
// associated with it. By clicking a Row item, the user can expand and
// collapse the associated list of sub-items.
//
// The CXTPReportRecords collection holds all the CXTPReportRecord objects
// that are assigned to the Report control. It could be accessible via
// GetRecords() method. The records in this collection
// are referred to as the root records. Any record that is subsequently
// added to a root record is referred to as a child record. Because each
// CXTPReportRecord can contain a collection of other CXTPReportRecord
// objects, you might find it difficult to determine your location in the
// tree structure when you iterate through the collection.
//
// Record nodes can be expanded to display the next level of child records.
// The user can expand the CXTPReportRecord by clicking the plus-sign (+)
// button, if one is displayed, or you can expand the CXTPReportRecord by
// calling the CXTPReportRecord::SetExpanded method.
// To expand all the child records, call the ExpandAll method.
// You can collapse the child CXTPReportRecord level by calling the
// CXTPReportRecord::SetExpanded(FALSE) method, or the user can press
// the minus-sign (-) button, if one is displayed. You can also call
// CollapseAll method to collapse all child records.
//
// Each record contains an array of record items which are implemented
// with CXTPReportRecordItem and its descendants. You can create your own
// types of items simply by inheritance from the base record item class.
//
// Each record item has an association with corresponding CXTPReportColumn
// item. The item will be shown below the corresponding column header
// depending on its position in report control columns array. If a column
// has not an associated item in the record, there will be an empty item
// shown in the corresponding cell.
//
// Columns array is represented by CXTPReportColumns collection and could
// be accessed via GetColumns() method.
//
// As a finalization of adding data to the report control, which means
// adding columns and records, Populate() method should be called. It
// performs population of control rows with data - creates a rows tree if
// necessary, rebuilds groups if grouping if enabled, and sorts rows
// on a specified manner. See Also an example below.
//
// Handling notification messages sent by the control to the parent
// window is allowed with ON_NOTIFY handler. The control is using
// SendMessageToParent function to send notifications. See below for
// the example of how messages could be handled in a parent window:
//
//
// ON_NOTIFY(NM_CLICK, ID_REPORT_CONTROL, OnReportItemClick)
// ON_NOTIFY(NM_RCLICK, ID_REPORT_CONTROL, OnReportItemRClick)
// ON_NOTIFY(NM_DBLCLK, ID_REPORT_CONTROL, OnReportItemDblClick)
// ON_NOTIFY(XTP_NM_SHOWFIELDCHOOSER, ID_REPORT_CONTROL, OnShowFieldChooser)
// ON_NOTIFY(XTP_NM_HEADER_RCLICK, ID_REPORT_CONTROL, OnReportColumnRClick)
// ON_NOTIFY(NM_KEYDOWN, ID_REPORT_CONTROL, OnReportKeyDown)
//
//
// You can also change the appearance of the CXTPReportControl control
// by setting some of its display and style properties.
//
// Also Report control has an ability to store and restore its
// settings, which includes all columns with their settings, and some
// required control's settings. It is implemented via standard MFC and XTP
// serialization and available with the member functions
// SerializeState(CArchive& ar), DoPropExchange(CXTPPropExchange* pPX);
//
// Report control supports Copy/Paste clipboard operations.
// See methods: CanCut(), CanCopy(), CanPaste(), Cut(), Copy(), Paste().
// There are 2 clipboard formats are supported:
// Binary - contains all record(s) data;
// Text - contains visible columns texts.
//
// To support binary format the XTP serialization is used -
// DoPropExchange() methods are implemented for CXTPReportRecord,
// CXTPReportRecordItem and derived CXTPReportRecordItemXXX classes.
// Also some part of standard MFC serialization is used
// (see DECLARE_SERIAL macro) to automatically create classes when
// loading from the data source.
//
// If you are creating custom records and records items classes you have
// to use DECLARE_SERIAL macro and may need to override DoPropExchange()
// methods to serialize custom data as well as standard records data.
//
// The storing records way is simple: CXTPReportRecord (or derived class)
// is stored first, then record items (CXTPReportRecordItemXXX classes)
// are stored one by one.
// The class information, which allow to create object instances when
// loading, is stored for all classes. See CArchive::WriteClass(),
// CArchive::ReadClass() and other CArchive members for more details
// about this idea.
//
// When report control loads records from the data source:
// The record class is created automatically (using stored
// class information).
// Then items collection cleared and record items are created
// automatically and added to items collection.
// For example see ReportSample project: CMessageRecord class.
//
// We support text format with '\t' dividers for record items and
// "\r\n" dividers for records (simple tab-separated text).
// Such format is also supported by Excel and some other applications.
//
// There are few methods and corresponding notifications which allow to
// customize copy/paste operations:
// OnBeforeCopyToText(); OnBeforePasteFromText(); OnBeforePaste();
//
// See Also:
// CXTPReportView, CXTPReportHeader, CXTPReportRow, CXTPReportRecord,
// CXTPReportColumn,
// CXTPReportRecords, CXTPReportRows, CXTPReportColumns,
// CXTPReportSubListControl, CXTPReportFilterEditControl
//===========================================================================
class _XTP_EXT_CLASS CXTPReportControl : public CWnd
{
//{{AFX_CODEJOCK_PRIVATE
DECLARE_DYNCREATE(CXTPReportControl)
friend class CXTPReportSubListControl;
friend class CXTPReportRow;
friend class CXTPReportGroupRow;
friend class CXTPReportHeader;
friend class CXTPReportNavigator;
friend class CXTPReportInplaceEdit;
friend class CXTPReportHeaderDragWnd;
friend class CXTPReportInplaceList;
friend class CXTPReportColumn;
friend class CXTPReportView;
class CReportDropTarget;
//}}AFX_CODEJOCK_PRIVATE
public:
//===========================================================================
// Summary:
// Internal report update helper.
//===========================================================================
class _XTP_EXT_CLASS CUpdateContext
{
public:
//-----------------------------------------------------------------------
// Summary:
// Constructs a CXTPReportControlUpdateContext object.
// Parameters:
// pControl - Pointer to a Report Control object.
//-----------------------------------------------------------------------
CUpdateContext(CXTPReportControl* pControl)
{
m_pControl = pControl;
pControl->BeginUpdate();
}
//-------------------------------------------------------------------------
// Summary:
// Destroys a CXTPReportControlUpdateContext object, handles cleanup and deallocation.
//-------------------------------------------------------------------------
~CUpdateContext()
{
m_pControl->EndUpdate();
}
protected:
CXTPReportControl* m_pControl; // Updated report control pointer
};
public:
//-------------------------------------------------------------------------
// Summary:
// Call this function to use custom heap feature.
//
// Remarks:
// If it is enabled, report data will be allocated in custom (separate)
// heap instead of standard application heap. This optimize memory
// using (fragmentation) for big amount of data.
// For custom heap used for classes derived from CXTPHeapObjectT template,
// like CXTPReportRecord, CXTPReportRecordItem, CXTPReportRow and so others.
// This template just overrides operators new and delete.
// It must be called on initialization before any allocations of classes // which use custom heap. OnInitInstance is a fine place for this. // Returns: // TRUE if custom heap feature is enabled for all report allocators, // FALSE otherwise. //------------------------------------------------------------------------- static BOOL AFX_CDECL UseReportCustomHeap(); //------------------------------------------------------------------------- // Summary: // Call this function to enable batch allocation feature for report rows. // // Remarks: // Batch allocation means that memory allocated not for one object only, // but for many objects at one time (for 1024 objects by default). // Next allocations take memory from this big block. New blocks allocated // when necessary. This increase performance and reduce heap fragmentation. // Batch allocation mechanism responsible for allocation/deallocation // blocks of memory from heap and internally organize free/busy lists of // memory pieces. When object deleted, its memory stored in free list and // used for new objects. // When all memory pieces from block free, it may be deallocated from // heap automatically (this depends on options in _TBatchAllocData) // or by FreeExtraData call, //
It must be called on initialization before any allocations of classes
// which use batch allocation. OnInitInstance is a fine place for this.
// Returns:
// TRUE if batch allocation feature is enabled for report rows,
// FALSE otherwise.
//-------------------------------------------------------------------------
static BOOL AFX_CDECL UseRowBatchAllocation();
//-----------------------------------------------------------------------
// Summary:
// This member function when rows batch allocation enabled to check
// all allocated blocks and deallocate which are completely free.
// See Also:
// UseRowBatchAllocation, CXTPBatchAllocObjT
//-----------------------------------------------------------------------
static void AFX_CDECL FreeRowBatchExtraData();
public:
//-----------------------------------------------------------------------
// Summary:
// Constructs a CXTPReportControl object.
// Remarks:
// You construct a CXTPReportControl object in two steps.
// First, call the constructor CXTPReportControl and then call
// Create method, which initializes the window.
//
// Example:
//
// // Declare a local CXTPReportControl object.
// CXTPReportControl myReport;
//
// // Declare a dynamic CXTPReportControl object.
// CXTPReportControl* pMyReport = new CXTPReportControl();
//
// if (!myReport.Create(WS_CHILD | WS_TABSTOP | WS_VISIBLE | WM_VSCROLL, CRect(0, 0, 0, 0), this, ID_REPORT_CONTROL))
// {
// TRACE(_T("Failed to create view window\n"));
// }
//
// See Also: Create
//-----------------------------------------------------------------------
CXTPReportControl();
//-----------------------------------------------------------------------
// Summary:
// Destroys a CXTPReportControl object, handles cleanup and deallocation.
//-----------------------------------------------------------------------
virtual ~CXTPReportControl();
//-----------------------------------------------------------------------
// Summary:
// This method is called to create a report control.
// Parameters:
// dwStyle - Specifies the window style attributes.
// It could be a combination of standard window styles.
// rect - The size and position of the window, in client
// coordinates of pParentWnd.
// pParentWnd - Specifies the report control parent window.
// nID - Specifies the report control identifier.
// pContext - The create context of the window.
// Remarks:
// You construct a CXTPReportControl object in two steps.
// First, call the constructor CXTPReportControl and then call
// Create method, which initializes the window.
// Example:
// See the example for CXTPReportControl::CXTPReportControl
// Returns:
// Nonzero if successful; otherwise 0.
// See Also: CXTPReportControl::CXTPReportControl
//-----------------------------------------------------------------------
BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
//-----------------------------------------------------------------------
// Summary:
// (Re)Stores control configuration to/from the provided archive stream.
// Parameters:
// ar - Archive stream for serializing.
//-----------------------------------------------------------------------
virtual void SerializeState(CArchive& ar);
//-----------------------------------------------------------------------
// Summary:
// Reads or writes configuration to/from the provided data source.
// Parameters:
// pPX - A CXTPPropExchange object to serialize to or from.
//----------------------------------------------------------------------
virtual void DoPropExchange(CXTPPropExchange* pPX);
public:
//-----------------------------------------------------------------------
// Summary:
// Adds new column to the end of the columns array.
// Parameters:
// pColumn - Pointer to the specified column class object.
// Remarks:
// Call this member function if you want to add a new column
// to a report control. It will be added to the end of the columns array.
// Example:
//
// // this function adds a column with "Subject" caption and 250 pixels initial width
// void AddSubjectColumn(CXTPReportControl* pReportCtrl)
// {
// pReportCtrl->AddColumn(new CXTPReportColumn(1, _T("Subject"), 250));
// }
//
// See Also: CXTPReportColumn overview
//-----------------------------------------------------------------------
CXTPReportColumn* AddColumn(CXTPReportColumn* pColumn);
//-----------------------------------------------------------------------
// Summary:
// Adds record to records collection.
// Parameters:
// pRecord - Record data with items.
// Remarks:
// Call this member function if you want to add a data record to the
// report control's internal storage.
// Example:
//
// // this function adds 2 empty records to a report control
// void Add2Empties(CXTPReportControl* pReportCtrl)
// {
// pReportCtrl->AddRecord(new CXTPReportRecord());
// pReportCtrl->AddRecord(new CXTPReportRecord());
// }
//
// Returns:
// Pointer to the recently added record object.
// See Also: CXTPReportRecord overview, GetRecords
//-----------------------------------------------------------------------
virtual CXTPReportRecord* AddRecord(CXTPReportRecord* pRecord);
//-----------------------------------------------------------------------
// Summary:
// Adds record to records collection and associates a row with it.
// Parameters:
// pRecord - Record data with items.
// pParentRecord - Parent record.
// nChildIndex - child index a record to be inserted at.
// Remarks:
// Call this member function if you want to add a data record to the
// report control's internal storage and associate a row with it.
// Example:
//
// // this function adds 2 empty records to a report control
// void Add2Empties(CXTPReportControl* pReportCtrl)
// {
// pReportCtrl->AddRecordEx(new CXTPReportRecord());
// pReportCtrl->AddRecordEx(new CXTPReportRecord());
// }
//
// See Also: CXTPReportRecord overview, GetRecords, RemoveRecordEx, RemoveRowEx
// UpdateRecord
//-----------------------------------------------------------------------
virtual void AddRecordEx(CXTPReportRecord* pRecord, CXTPReportRecord* pParentRecord = NULL, int nChildIndex = -1);
//-----------------------------------------------------------------------
// Summary:
// Removes record with data and associated row. It also remove all
// children records and their rows.
// Parameters:
// pRecord - Pointer to a record object.
// bAdjustLayout - If TRUE AdjustLayout will be called.
// bRemoveFromParent - If TRUE the record is to be removed from the parent.
// Remarks:
// Call this member function if you want to remove record on the fly,
// without Populate call.
// Returns:
// TRUE if operation succeeded, FALSE otherwise.
// See Also: RemoveRowEx, AddRecordEx, CXTPReportRecords::RemoveRecord,
// UpdateRecord
//-----------------------------------------------------------------------
virtual BOOL RemoveRecordEx(CXTPReportRecord* pRecord, BOOL bAdjustLayout = TRUE, BOOL bRemoveFromParent = TRUE);
//-----------------------------------------------------------------------
// Summary:
// Removes row and associated record. It also remove all
// children records and rows.
// Parameters:
// pRow - Pointer to a row object.
// bAdjustLayout - If TRUE AdjustLayout will be called.
// Remarks:
// Call this member function if you want to remove row and record on the fly,
// without Populate call.
// Returns:
// TRUE if operation succeeded, FALSE otherwise.
// See Also: RemoveRecordEx, AddRecordEx, CXTPReportRecords::RemoveRecord,
// UpdateRecord
//-----------------------------------------------------------------------
virtual BOOL RemoveRowEx(CXTPReportRow* pRow, BOOL bAdjustLayout = TRUE);
//-----------------------------------------------------------------------
// Summary:
// Updates record.
// Parameters:
// pRecord - Record data with items.
// bUpdateChildren - If TRUE the children will be updated as well.
// Remarks:
// Call this member function if you modified a record and want it
// to be updated accordingly to the current grouping and sorting.
// See Also: CXTPReportRecord overview, GetRecords
//-----------------------------------------------------------------------
virtual void UpdateRecord(CXTPReportRecord* pRecord, BOOL bUpdateChildren);
//-----------------------------------------------------------------------
// Summary:
// Prevents the control from redrawing until the EndUpdate
// method is called.
// Remarks:
// If you want to add items one at a time using the AddRecord method,
// or to make some another operations in a single sequence,
// you can use the BeginUpdate method to prevent the control
// from repainting the CXTPReportControl each time an item is added.
// Once you have completed the task of adding items to the control,
// call the EndUpdate method to enable the CXTPReportControl to repaint.
// This way of adding items can prevent flickered drawing of
// the CXTPReportControl when a large number of items are being
// added to the control.
// Example:
//
// // This function collapses all rows for the specified report control
// void CollapseAll(CXTPReportControl* pReportCtrl)
// {
// pReportCtrl->BeginUpdate();
// for (int i = pReportCtrl->GetRows()->GetCount() - 1; i >= 0; i --)
// pReportCtrl->GetRows()->GetAt(i)->SetExpanded(FALSE);
//
// pReportCtrl->EndUpdate();
// }
//
// See Also: EndUpdate, RedrawControl, AddRecord
//-----------------------------------------------------------------------
void BeginUpdate();
//-----------------------------------------------------------------------
// Summary:
// This method deletes all rows and records from Report Control.
// Parameters:
// bUpdateControl - Set TRUE to redraw control, otherwise FALSE.
//-----------------------------------------------------------------------
void ResetContent(BOOL bUpdateControl = TRUE);
//-----------------------------------------------------------------------
// Summary:
// Resumes drawing of the report control after drawing is
// suspended by the BeginUpdate method.
// Remarks:
// If you want to add items one at a time using the AddRecord method,
// or to make some other operations in a single sequence,
// you can use the BeginUpdate method to prevent the control
// from repainting the CXTPReportControl each time an item is added.
// Once you have completed the task of adding items to the control,
// call the EndUpdate method to enable the CXTPReportControl to repaint.
// This way of adding items can prevent flickered drawing of
// the CXTPReportControl when a large number of items are being
// added to the control.
// Example: See example for CXTPReportControl::BeginUpdate method.
// See Also: BeginUpdate, RedrawControl
//-----------------------------------------------------------------------
void EndUpdate();
//-----------------------------------------------------------------------
// Summary:
// Returns TRUE if control in Update state.
//-----------------------------------------------------------------------
int GetLockUpdateCount() const;
//-----------------------------------------------------------------------
// Summary:
// Initiates report control redrawing.
// Remarks:
// Call this member function if you want to initialize the
// report control redrawing. The control will be redrawn taking
// into account its latest state.
// See Also: BeginUpdate, EndUpdate
//-----------------------------------------------------------------------
void RedrawControl();
//-----------------------------------------------------------------------
// Summary:
// Call this method to get tooltip context pointer.
//-----------------------------------------------------------------------
CXTPToolTipContext* GetToolTipContext() const;
//-----------------------------------------------------------------------
// Summary:
// Call this method to enable built in drag and drop operations
// Parameters:
// lpszClipboardFormat - Name of clipboard format to be used for Report Control
// dwFlags - Combination of XTPReportDragDrop flags, can be one or more of following:
// xtpReportAllowDrop - Allow Drop records to report
// xtpReportAllowDragCopy - Allow copy records from report
// xtpReportAllowDragMove - Allow move records from report
// xtpReportAllowDrag - Allow copy and move records from report
// Returns:
// Clipboard format that will be used with Report Control
// See Also: XTPReportDragDrop
//-----------------------------------------------------------------------
CLIPFORMAT EnableDragDrop(LPCTSTR lpszClipboardFormat, DWORD dwFlags);
//-----------------------------------------------------------------------
// Summary:
// Set or clear grid drawing style.
// Parameters:
// bVertical - TRUE for changing vertical grid style,
// FALSE for changing horizontal grid style.
// gridStyle - New grid style. Can be any of the values listed in the Remarks section.
// Remarks:
// Call this member function if you want to change a style
// of report grid lines.
//
// Possible grid line styles are the following:
// * xtpReportGridNoLines Empty line
// * xtpReportGridSmallDots Line is drawn with small dots
// * xtpReportGridLargeDots Line is drawn with large dots
// * xtpReportGridDashes Line is drawn with dashes
// * xtpReportGridSolid Draws solid line
//
// See Also: XTPReportGridStyle overview, GetGridStyle, SetGridColor
//-----------------------------------------------------------------------
void SetGridStyle(BOOL bVertical, XTPReportGridStyle gridStyle);
//-----------------------------------------------------------------------
// Summary:
// Returns current grid drawing mode.
// Parameters:
// bVertical - TRUE for vertical grid style,
// FALSE for horizontal grid style.
// Remarks:
// Call this member function if you want to retrieve current
// grid lines drawing style for the report control.
// Returns:
// Current grid drawing style.
// See Also: XTPReportGridStyle overview, SetGridStyle, SetGridColor
//-----------------------------------------------------------------------
XTPReportGridStyle GetGridStyle(BOOL bVertical) const;
//-----------------------------------------------------------------------
// Summary:
// Change color of GridLines.
// Parameters:
// clrGridLine - New Grid Lines color.
// Remarks:
// Call this member function if you want to change a color of
// report control grid lines.
// Returns:
// Old Grid Lines color.
// See Also: SetGridStyle, GetGridStyle
//-----------------------------------------------------------------------
COLORREF SetGridColor(COLORREF clrGridLine);
//-----------------------------------------------------------------------
// Summary:
// Returns the collection of the data records.
// Returns:
// The data records collection.
// Remarks:
// Call this member function if you want to retrieve an access
// to the collection of report records. You may then perform
// standard operations on the collection like adding, removing, etc.
// See Also: CXTPReportRecords overview, AddRecord
//-----------------------------------------------------------------------
CXTPReportRecords* GetRecords() const;
//-----------------------------------------------------------------------
// Summary:
// Returns the collection of the report rows
// Remarks:
// Use this member function to retrieve an access to the collection
// of report rows, representing current control view.
//
// Note that rows collection could be rebuilt automatically
// on executing Populate method.
// Returns:
// The report rows collection.
// Example:
// See example for CXTPReportControl::BeginUpdate method.
// See Also: CXTPReportRows overview, Populate
//-----------------------------------------------------------------------
CXTPReportRows* GetRows() const;
//-----------------------------------------------------------------------
// Summary:
// Interface for accessing list columns.
// Remarks:
// Use this member function to retrieve an access to the collection
// of report columns.
// Returns:
// The report Columns collection.
// Example:
//
// // this function adds a column with "Subject" caption and 250 pixels initial width
// void AddSubjectColumn(CXTPReportControl* pReportCtrl)
// {
// pReportCtrl->GetColumns()->Add(new CXTPReportColumn(1, _T("Subject"), 250));
// }
//
// See Also: CXTPReportColumns overview
//-----------------------------------------------------------------------
CXTPReportColumns* GetColumns() const;
//-----------------------------------------------------------------------
// Summary:
// Returns the currently used control's Paint Manager.
// Remarks:
// Call this member function to get the paint manager object used
// for drawing a report control window.
// Returns:
// Pointer to the paint manager object.
// See Also: CXTPReportPaintManager overview
//-----------------------------------------------------------------------
CXTPReportPaintManager* GetPaintManager() const;
//-----------------------------------------------------------------------
// Summary:
// Call this method to set custom paint manager.
// Parameters:
// pPaintManager - A pointer to the custom paint manager.
//-----------------------------------------------------------------------
void SetPaintManager(CXTPReportPaintManager* pPaintManager);
//-----------------------------------------------------------------------
// Summary:
// Returns the control's Navigator.
// Remarks:
// Call this member function to get the navigator object used
// for cell navigation.
// Returns:
// Pointer to the navigator object.
// See Also: CXTPReportNavigator overview
//-----------------------------------------------------------------------
CXTPReportNavigator* GetNavigator() const;
//-----------------------------------------------------------------------
// Summary:
// Performs control population, creating view from the data.
// Remarks:
// Call this member function to populate control's Rows collection
// with the data containing in Records collection.
// It automatically creates Tree View references if necessary
// (for example, in Grouping mode).
// , it is the main function which should be called for
// (re)populating all data changes that you have made into the
// Records collection.
// See Also: CXTPReportPaintManager overview
//-----------------------------------------------------------------------
virtual void Populate();
//-----------------------------------------------------------------------
// Summary:
// Performs control's header rows population, creating view from the data.
// Remarks:
// Call this member function to populate control's header rows collection
// with the data containing in HeaderRecords collection. Useful when main
// rows are controlled through AddRecordEx/RemoveRecordEx/UpdateRecord
// methods.
// See Also: Populate, PopulateFooterRows, AddRecordEx, RemoveRecordEx, UpdateRecord
//-----------------------------------------------------------------------
virtual void PopulateHeaderRows();
//-----------------------------------------------------------------------
// Summary:
// Performs control's footer rows population, creating view from the data.
// Remarks:
// Call this member function to populate control's footer rows collection
// with the data containing in FooterRecords collection. Useful when main
// rows are controlled through AddRecordEx/RemoveRecordEx/UpdateRecord
// methods.
// See Also: Populate, PopulateHeaderRows, AddRecordEx, RemoveRecordEx, UpdateRecord
//-----------------------------------------------------------------------
virtual void PopulateFooterRows();
//-----------------------------------------------------------------------
// Summary:
// Ensures that a report control row is at least partially visible.
// Parameters:
// pCheckRow - A pointer to the row that is to be visible.
// Remarks:
// Ensures that a report row item is at least partially visible.
// The list view control is scrolled if necessary.
// See Also: MoveDown, MoveUp, MovePageDown, MovePageUp, MoveFirst, MoveLast
//-----------------------------------------------------------------------
void EnsureVisible(CXTPReportRow* pCheckRow);
//-----------------------------------------------------------------------
// Summary:
// Ensures that a report control column is at least partially visible.
// Parameters:
// pCheckColumn - A pointer to the column that is to be visible.
// Remarks:
// Ensures that a report column item is at least partially visible.
// The list view control is scrolled if necessary.
// See Also: MoveRight, MoveLeft, MoveToColumn, MoveFirstColumn, MoveLastColumn
//-----------------------------------------------------------------------
void EnsureVisible(CXTPReportColumn* pCheckColumn);
//-----------------------------------------------------------------------
// Summary:
// Determines which report row item, if any, is at a specified position.
// Parameters:
// pt - A point to test.
// Returns:
// The row item at the position specified by pt, if any,
// or NULL otherwise.
//-----------------------------------------------------------------------
CXTPReportRow* HitTest(CPoint pt) const;
//-----------------------------------------------------------------------
// Summary:
// Returns the collection of the selected rows.
// Remarks:
// Use this member function to retrieve an access to the collection
// of currently selected report rows.
// Returns:
// The selected rows collection.
// See Also: CXTPReportSelectedRows overview.
//-----------------------------------------------------------------------
CXTPReportSelectedRows* GetSelectedRows() const;
//-----------------------------------------------------------------------
// Summary:
// Retrieves the index of the row that currently has focus
// in the report control's view.
// Returns:
// Returns pointer to the focused row, or NULL otherwise.
// See Also: SetFocusedRow
//-----------------------------------------------------------------------
CXTPReportRow* GetFocusedRow() const;
//-----------------------------------------------------------------------
// Summary:
// Makes the provided row as currently focused.
// Parameters:
// pRow - The row to set as focused to.
// bIgnoreSelection - TRUE if select new focused row.
// bSelectBlock - TRUE when selecting rows up to new focused row,
// FALSE otherwise.
// Returns:
// TRUE if specified row has been focused, FALSE otherwise.
// See Also: GetFocusedRow
//-----------------------------------------------------------------------
BOOL SetFocusedRow(CXTPReportRow* pRow, BOOL bIgnoreSelection = FALSE);
BOOL SetFocusedRow(CXTPReportRow* pRow, BOOL bSelectBlock, BOOL bIgnoreSelection);//
// CXTPImageManager* pImageManager = new CXTPImageManager();
// pImageManager->SetIcons(IDR_MAINFRAME);
// m_wndReport.SetImageManager(pImageManager);
//
// See Also: GetImageManager
//-----------------------------------------------------------------------
void SetImageManager(CXTPImageManager* pImageManager);
//-----------------------------------------------------------------------
// Summary:
// Initiates ImageList of Paint Manager.
// Parameters:
// pImageList - Image list.
// Remarks:
// You use this function to set up your own ImageList
// with set bitmaps that represent various states of rows
// and depict any other information.
// Note:
// Recommended to use SetImageManager/GetImageManager methods instead.
// Example:
//
// CImageList listIcons;
// listIcons.Create(16, 16, ILC_COLOR24 | ILC_MASK, 0, 1));
// CBitmap bmp;
// // load bitmap by id
// bmp.LoadBitmap(IDB_BMREPORT);
// ilIcons.Add(&bmp, RGB(255, 0, 255));
// m_wndReport.SetImageList(&lIcons);
//
// See Also: GetImageManager
//-----------------------------------------------------------------------
void SetImageList(CImageList* pImageList);
public:
//-----------------------------------------------------------------------
// Summary:
// Returns a pointer to the associated report header object.
// Remarks:
// Call this member function if you want to retrieve access
// to the report header object properties and methods.
// Returns:
// A pointer to the associated report header.
// See Also: CXTPReportHeader overview
//-----------------------------------------------------------------------
CXTPReportHeader* GetReportHeader() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to change report header of Report Control
// Parameters:
// pReportHeader - Report header to be set
// Example:
// m_wndReport.SetReportHeader(new CMyReportHeader());
// See Also: CXTPReportHeader overview
//-----------------------------------------------------------------------
void SetReportHeader(CXTPReportHeader* pReportHeader);
//-----------------------------------------------------------------------
// Summary:
// Returns indentation for the tree view row of the specified depth level.
// Parameters:
// nLevel - Tree depth level.
// Remarks:
// Calculates row indentation in pixels based on the provided
// indentation level.
// Returns:
// Row indentation in pixels.
// See Also: Populate
//-----------------------------------------------------------------------
int GetIndent(int nLevel) const;
//-----------------------------------------------------------------------
// Summary:
// Notifies parent control of some event that has happened.
// Parameters:
// pRow - Specified row of event if used.
// pItem - Specified item of event if used.
// pColumn - Specified column of event if used.
// nMessage - A message to sent to parent window.
// pPoint - A point where the message was sent from in
// client coordinates.
// nHyperlink - Hyperlink order number, where the message was sent
// from (-1 if message was not send from the hyperlink).
// Remarks:
// Sends a message to the parent in the form of a WM_NOTIFY message
// with a specific structure attached.
// Returns:
// The result of the message processing;
// its value depends on the message sent. (see CWnd::SendMessage)
// See Also: CXTPReportControl overview, SendNotifyMessage
//-----------------------------------------------------------------------
LRESULT SendMessageToParent(CXTPReportRow* pRow, CXTPReportRecordItem* pItem, CXTPReportColumn* pColumn, UINT nMessage, CPoint* pPoint, int nHyperlink = -1) const;
//-----------------------------------------------------------------------
// Summary:
// Sends the specified message to the window.
// Parameters:
// nMessage - The message to be sent.
// pNMHDR - Notify header
// Returns:
// Nonzero if successful; otherwise returns zero.
//-----------------------------------------------------------------------
LRESULT SendNotifyMessage(UINT nMessage, NMHDR* pNMHDR = NULL) const;
//-----------------------------------------------------------------------
// Summary:
// Collapses all rows.
// Remarks:
// The CollapseAll method collapses all the CXTPReportRow objects,
// including all the child rows, that are in the report control.
// See Also: ExpandAll, CXTPReportRow::SetExpanded
//-----------------------------------------------------------------------
void CollapseAll();
//-----------------------------------------------------------------------
// Summary:
// Expands all rows.
// Remarks:
// The ExpandAll method expands all the CXTPReportRow objects,
// including all the child rows, that are in the report control.
// See Also: CollapseAll, CXTPReportRow::SetExpanded
//-----------------------------------------------------------------------
void ExpandAll();
//-----------------------------------------------------------------------
// Summary:
// Determines if the report allows multiple selections.
// Returns:
// TRUE if the report allows multiple selections.
// See Also: SetMultipleSelection, GetSelectedRows
//-----------------------------------------------------------------------
BOOL IsMultipleSelection() const;
//-----------------------------------------------------------------------
// Summary:
// Changes allowing multiple selections for the control.
// Parameters:
// bMultipleSelection - TRUE for enabling, FALSE for disabling.
// Remarks:
// Sets the flag that determines whether the report allows multiple selections.
// See Also: IsMultipleSelection, GetSelectedRows
//-----------------------------------------------------------------------
void SetMultipleSelection(BOOL bMultipleSelection);
//-----------------------------------------------------------------------
// Summary:
// Determines if the multiple selection mode is enabled.
// Returns:
// TRUE if the multiple selection mode is enabled.
// See Also: SetMultiSelectionMode
//-----------------------------------------------------------------------
BOOL IsMultiSelectionMode() const;
//-----------------------------------------------------------------------
// Summary:
// Enables/disables the multiple selection mode for the control.
// Parameters:
// bMultiSelectionMode - TRUE for enabling, FALSE for disabling.
// Remarks:
// Sets the flag that determines whether the report is in multiple selection mode.
// See Also: IsMultiSelectionMode
//-----------------------------------------------------------------------
void SetMultiSelectionMode(BOOL bMultiSelectionMode);
//-----------------------------------------------------------------------
// Summary:
// Enables/disables showing tooltips for the control.
// Parameters:
// bEnable - TRUE for enabling, FALSE for disabling.
// Remarks:
// Call this member function to enable or disable tooltips
// show for the report control window.
//-----------------------------------------------------------------------
void EnableToolTips(BOOL bEnable);
//-----------------------------------------------------------------------
// Summary:
// Call this member to specify whether groups are skipped when navigating
// the ReportControl with the Up and Down keys.
// Parameters:
// bSkipFocus - If TRUE, when navigating the rows with the Up and Down
// keys in the ReportControl the group headings will be skipped
// and the next non-group heading row will be selected.
// If FALSE, when navigating the rows with the Up and Down
// keys in the ReportControlall rows will be selected,
// even group headings.
//-----------------------------------------------------------------------
void SkipGroupsFocus(BOOL bSkipFocus);
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine is groups are skipped when navigating the
// with the Up and Down arrow keys.
// Returns:
// TRUE if groups are skipped, FALSE is groups receive focus when navigating
// the report control with the Up and Down arrow keys.
//-----------------------------------------------------------------------
BOOL IsSkipGroupsFocusEnabled() const;
//-----------------------------------------------------------------------
// Summary:
// Call this method to retrieve indentation of the header
// Returns:
// Header indent.
//-----------------------------------------------------------------------
int GetHeaderIndent() const;
//-----------------------------------------------------------------------
// Summary:
// Call this method to retrieve Report bounding rectangle.
// Returns:
// Report bounding rectangle.
//-----------------------------------------------------------------------
CRect GetReportRectangle() const;
//-----------------------------------------------------------------------
// Summary:
// Adjusts scroll bars depending on currently visible rows.
//-----------------------------------------------------------------------
virtual void AdjustScrollBars();
//-----------------------------------------------------------------------
// Summary:
// Adjusts main control areas depending on current control size.
//-----------------------------------------------------------------------
void AdjustLayout();
public:
//-----------------------------------------------------------------------
// Summary:
// Call this method to retrieve Header records bounding rectangle.
// Returns:
// Header records bounding rectangle.
//-----------------------------------------------------------------------
CRect GetHeaderRowsRect() const;
//-----------------------------------------------------------------------
// Summary:
// Call this method to retrieve footer rows bounding rectangle.
// Returns:
// Footer rows bounding rectangle.
//-----------------------------------------------------------------------
CRect GetFooterRowsRect() const;
public:
//-----------------------------------------------------------------------
// Summary:
// Call this member to retrieve a pointer to the currently selected column.
// Returns:
// A pointer to the currently selected item.
//-----------------------------------------------------------------------
CXTPReportColumn* GetFocusedColumn() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to set selected column.
// Parameters:
// pColumn - column to be selected.
// Returns:
// TRUE if specified column has been focused, FALSE otherwise.
//-----------------------------------------------------------------------
BOOL SetFocusedColumn(CXTPReportColumn* pColumn);
//-----------------------------------------------------------------------
// Summary:
// Call this member to specify whether each individual CXTPReportRecordItem
// will show focus when the item in a row is clicked.
// Parameters:
// bFocusSubItems - If TRUE, when a ReportRecordItem is clicked, the
// entire row will become highlighted except the individual
// item that was clicked.
// If FALSE, the entire row will become highlighted when
// an item is clicked, including the item that was clicked.
// See Also: IsFocusSubItems
//-----------------------------------------------------------------------
void FocusSubItems(BOOL bFocusSubItems);
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if individual CXTPReportRecordItem(s) will
// receive focus when that item in the CXTPReportRow that they belong to is clicked.
// Returns:
// TRUE if individual items can receive focus, FALSE if only the entire row can receive focus.
// See Also: FocusSubItems
//-----------------------------------------------------------------------
BOOL IsFocusSubItems() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if the CXTPReportRecordItem(s)are editable.
// Returns:
// TRUE is the CXTPReportRecordItem(s) are editable, FALSE otherwise.
// See Also: AllowEdit, EditOnClick, IsEditOnClick
//-----------------------------------------------------------------------
BOOL IsAllowEdit() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to allow the text in all CXTPReportRecordItem(s) to be edited. This will
// add an edit box to the item where the text can be edited.
// Parameters:
// bAllowEdit - TRUE to add an edit box to the CXTPReportRecordItem(s) so they are editable.
// FALSE to remove the edit box and not allow them to be edited.
// See Also: IsAllowEdit, EditOnClick, IsEditOnClick
//-----------------------------------------------------------------------
void AllowEdit(BOOL bAllowEdit);
//-----------------------------------------------------------------------
// Summary:
// Call this member to specify whether a CXTPReportRecordItem can be edited by
// single-clicking on the item.
// Parameters:
// bEditOnClick - If TRUE, when the CXTPReportRecordItem is single-clicked,
// the item will become editable. The entire ReportControl
// or the specific CXTPReportRecordItem must have the bAllowEdit
// property set to TRUE for this to work.
// If FALSE, the item must be double-clicked to become editable.
// See Also: AllowEdit, IsAllowEdit, IsEditOnClick
//-----------------------------------------------------------------------
void EditOnClick(BOOL bEditOnClick);
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine whether items are edited with a single-click.
// Returns:
// TRUE it items can be edited with a single-click, FALSE is a
// double-click is needed to edit items.
// See Also: AllowEdit, IsAllowEdit, EditOnClick
//-----------------------------------------------------------------------
BOOL IsEditOnClick() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to enable auto check mode for check box items.
// Parameters:
// bAutoCheck - TRUE to enable auto check mode, FALSE to disable auto check mode.
// Remarks:
// When TRUE, the check box will become checked or unchecked automatically when the
// user clicks on the check box.
// See Also: IsAutoCheckItems, CXTPReportRecordItem::OnClick, CXTPReportRecordItem::OnChar
//-----------------------------------------------------------------------
void SetAutoCheckItems(BOOL bAutoCheck);
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine id auto check mode for check box items is enabled.
// Remarks:
// If TRUE is returned, the check box will become checked or unchecked automatically when the
// user clicks on the check box.
// Returns:
// TRUE if auto check mode is enabled, FALSE if auto check mode is disable.
// See Also: SetAutoCheckItems, CXTPReportRecordItem::OnClick, CXTPReportRecordItem::OnChar
//-----------------------------------------------------------------------
BOOL IsAutoCheckItems() const;
//-----------------------------------------------------------------------
// Summary:
// This method is called to start editing a report cell.
// It makes a specified cell focused and starts in-place editing
// control which was specified there.
// Remarks:
// Note that all editing options should be enabled for this method
// to be executed successfully.
// Parameters:
// pItemArgs - Arguments of item to be edit.
// Remarks:
// Call this method with NULL as parameter to stop item edit.
// See Also: AllowEdit, CXTPReportColumn::SetEditable
//-----------------------------------------------------------------------
void EditItem(XTP_REPORTRECORDITEM_ARGS* pItemArgs);
//-----------------------------------------------------------------------
// Summary:
// Retrieves in-place edit pointer
// Returns:in-place
// Pointer to in-place edit control
//-----------------------------------------------------------------------
CXTPReportInplaceEdit* GetInplaceEdit() const;
//-----------------------------------------------------------------------
// Summary:
// Retrieves in-place buttons of report control
// Returns:
// Collection of in-place buttons.
//-----------------------------------------------------------------------
CXTPReportInplaceButtons* GetInplaceButtons() const;
//-----------------------------------------------------------------------
// Summary:
// Retrieves in-place list of report controls
// Returns:
// Pointer to in-place list.
//-----------------------------------------------------------------------
CXTPReportInplaceList* GetInplaceList() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if the ReportControl has focus.
// Returns:
// TRUE if the ReportControl has focus, FALSE otherwise.
//-----------------------------------------------------------------------
BOOL HasFocus() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to retrieve the currently active item, which
// is the item that has focus.
// Returns:
// A pointer to the currently active(focused) CXTPReportRecordItem.
//-----------------------------------------------------------------------
CXTPReportRecordItem* GetActiveItem() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to specifies the indentation placed before the
// text of each child node in a hierarchical tree structure.
// Parameters:
// nIndent - Indentation used when displaying child nodes.
//-----------------------------------------------------------------------
void SetTreeIndent(int nIndent);
//-----------------------------------------------------------------------
// Summary:
// Call this method to enable virtual mode of the control
// Parameters:
// pVirtualRecord - record to be used as virtual for all rows.
// nCount - Count of virtual records.
// Example:
//
// class CVirtualRecord : public CXTPReportRecord
// {
// public:
// CVirtualRecord()
// {
// AddItem(new CXTPReportRecordItem());
// AddItem(new CXTPReportRecordItem());
// AddItem(new CXTPReportRecordItem());
// }
//
// void GetItemMetrics (XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pItemMetrics)
// {
// // Draw virtual record
// }
// }
// ...
// m_wndReport.SetVirtualMode(new CVirtualRecord(), 540);
//
// See Also: IsVirtualMode
//-----------------------------------------------------------------------
void SetVirtualMode(CXTPReportRecord* pVirtualRecord, int nCount);
//-----------------------------------------------------------------------
// Summary:
// Determines if control in virtual mode
// Returns;
// TRUE if virtual mode is enabled; FALSE otherwise.
// See Also: IsVirtualMode
//-----------------------------------------------------------------------
BOOL IsVirtualMode() const;
//-----------------------------------------------------------------------
// Summary:
// Returns the text from the associated filter edit control.
// Returns:
// Text string entered by user inside filter edit control.
// See Also: SetFilterText
//-----------------------------------------------------------------------
virtual CString GetFilterText();
//-----------------------------------------------------------------------
// Summary:
// Call this method to set new filter for control.
// Parameters:
// strFilterText - Filter text to be applied for control.
// Remarks:
// You must call Populate method to update rows.
// See Also: GetFilterText, Populate
//-----------------------------------------------------------------------
virtual void SetFilterText(LPCTSTR strFilterText);
//-----------------------------------------------------------------------
// Summary:
// Determine if control search filter text in hidden columns too.
// This option is disabled by default.
// Returns;
// TRUE if control search filter text in hidden columns; FALSE otherwise.
// See Also: SetFilterHiddenColumns, GetFilterText, SetFilterText
//-----------------------------------------------------------------------
virtual BOOL IsFilterHiddenColumns() const;
//-----------------------------------------------------------------------
// Summary:
// Call this method to enable or disable search filter text in hidden
// columns.
// Parameters:
// bFilterHidden - TRUE to search filter text in hidden columns;
// FALSE to search in visible columns only.
// Remarks:
// This option is disabled by default.
// You must call Populate method to update rows.
// See Also: IsFilterHiddenColumns, GetFilterText, SetFilterText, Populate
//-----------------------------------------------------------------------
virtual void SetFilterHiddenColumns(BOOL bFilterHidden);
//-----------------------------------------------------------------------
// Summary:
// Register the window class if it has not already been registered.
// Parameters:
// hInstance - Instance of resource where control is located
// Returns:
// TRUE if the window class was successfully registered.
//-----------------------------------------------------------------------
BOOL RegisterWindowClass(HINSTANCE hInstance = NULL);
//-----------------------------------------------------------------------
// Summary:
// Returns TRUE if one or more records are selected indicating the
// Cut command can be used.
// See Also:
// CanPaste, Cut, Copy, Paste.
//-----------------------------------------------------------------------
virtual BOOL CanCut();
//-----------------------------------------------------------------------
// Summary:
// Returns TRUE if one or more records are selected indicating the
// Copy command can be used.
// See Also:
// CanPaste, Cut, Copy, Paste.
//-----------------------------------------------------------------------
virtual BOOL CanCopy();
//-----------------------------------------------------------------------
// Summary:
// Returns TRUE if BinaryRecords or Text data exists in the clipboard.
// See Also:
// CanCut, CanCopy, Cut, Copy, Paste.
//-----------------------------------------------------------------------
virtual BOOL CanPaste();
//-----------------------------------------------------------------------
// Summary:
// Copy selected records data (in the Binary and Text data formats) to
// the clipboard and delete records.
// See Also:
// CanCut, CanCopy, CanPaste, Copy, Paste,
// OnBeforeCopyToText, OnBeforePasteFromText, OnBeforePaste.
//-----------------------------------------------------------------------
virtual void Cut();
//-----------------------------------------------------------------------
// Summary:
// Copy selected records data (in the Binary and Text data formats) to
// the clipboard.
// See Also:
// CanCut, CanCopy, CanPaste, Cut, Paste,
// OnBeforeCopyToText, OnBeforePasteFromText, OnBeforePaste.
//-----------------------------------------------------------------------
virtual void Copy();
//-----------------------------------------------------------------------
// Summary:
// Reads records from the clipboard and add them to records collection.
// The Binary data format is used rather than Text format.
// See Also:
// CanCut, CanCopy, CanPaste, Cut, Copy,
// OnBeforeCopyToText, OnBeforePasteFromText, OnBeforePaste.
//-----------------------------------------------------------------------
virtual void Paste();
//-----------------------------------------------------------------------
// Summary:
// Returns TRUE if inplace edit control is active (visible and focused),
// FALSE otherwise.
// See Also:
// GetInplaceEdit.
//-----------------------------------------------------------------------
virtual BOOL IsEditMode();
//-----------------------------------------------------------------------
// Summary:
// Set compare function to sort.
// Parameters:
// pCompareFunc - A T_CompareFunc function pointer that is used
// to compare rows or NULL to use the default one.
// Remarks:
// This method uses Visual C++ run-time library (MSVCRT)
// implementation of the quick-sort function, qsort, for sorting
// stored CXTPReportRow objects.
// If pCompareFunc = NULL the default compare function is used.
// Call Populate() method to resort items.
//
// See Also:
// SortRows, CXTPReportRows::SortEx, CXTPReportRows::Sort,
// CXTPReportRows::T_CompareFunc
//-----------------------------------------------------------------------
virtual void SetRowsCompareFunc(CXTPReportRows::T_CompareFunc pCompareFunc);
//-----------------------------------------------------------------------
// Summary:
// Use this function to determine is sort order applied for record children.
// Returns:
// TRUE if sort order applied for record children, FALSE otherwise.
//-----------------------------------------------------------------------
virtual BOOL IsSortRecordChilds();
//-----------------------------------------------------------------------
// Summary:
// Call this method to apply sort order for record children
// Parameters:
// bSortRecordChilds - TRUE to sort record children.
//-----------------------------------------------------------------------
virtual void SetSortRecordChilds(BOOL bSortRecordChilds);
//-----------------------------------------------------------------------
// Summary:
// Use this function to get horizontal scrolling step.
// Returns:
// Horizontal scrolling step in pixels.
//-----------------------------------------------------------------------
virtual int GetHScrollStep();
//-----------------------------------------------------------------------
// Summary:
// Use this function to set horizontal scrolling step.
// Parameters:
// nStep - Horizontal scrolling step in pixels.
//-----------------------------------------------------------------------
virtual void SetHScrollStep(int nStep);
//-----------------------------------------------------------------------
// Summary:
// Call this member to allow the text in all CXTPReportRecordItem(s) to be edited (for header records only).
// This will add an edit box to the item where the text can be edited.
// Parameters:
// bAllowEdit - TRUE to add an edit box to the CXTPReportRecordItem(s) so they are editable.
// FALSE to remove the edit box and not allow them to be edited.
// See Also: IsHeaderRowsAllowEdit, EditOnClick, IsEditOnClick
//-----------------------------------------------------------------------
void HeaderRowsAllowEdit(BOOL bAllowEdit);
//-----------------------------------------------------------------------
// Summary:
// Call this member to allow the text in all CXTPReportRecordItem(s) to be edited (for footer records only).
// This will add an edit box to the item where the text can be edited.
// Parameters:
// bAllowEdit - TRUE to add an edit box to the CXTPReportRecordItem(s) so they are editable.
// FALSE to remove the edit box and not allow them to be edited.
// See Also: IsFooterRowsAllowEdit, EditOnClick, IsEditOnClick
//-----------------------------------------------------------------------
void FooterRowsAllowEdit(BOOL bAllowEdit);
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if the CXTPReportRecordItem(s) are editable (for header records only).
// Returns:
// TRUE is the CXTPReportRecordItem(s) are editable, FALSE otherwise.
// See Also: HeaderRowsAllowEdit, EditOnClick, IsEditOnClick
//-----------------------------------------------------------------------
BOOL IsHeaderRowsAllowEdit() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if the CXTPReportRecordItem(s) are editable (for footer records only).
// Returns:
// TRUE is the CXTPReportRecordItem(s) are editable, FALSE otherwise.
// See Also: FooterRowsAllowEdit, EditOnClick, IsEditOnClick
//-----------------------------------------------------------------------
BOOL IsFooterRowsAllowEdit() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if rows selection is enabled.
// Returns:
// TRUE if rows selection is enabled, FALSE otherwise.
// See Also: SelectionEnable
//-----------------------------------------------------------------------
BOOL IsSelectionEnabled() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to enable rows selection.
// Parameters:
// bEnable - TRUE to enable rows selection.
// FALSE to disable rows selection.
// See Also: IsSelectionEnabled
//-----------------------------------------------------------------------
void SelectionEnable(BOOL bEnable);
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if the row focus is visible.
// Returns:
// TRUE if the the row focus is visible, FALSE otherwise.
// See Also: ShowRowFocus
//-----------------------------------------------------------------------
BOOL IsRowFocusVisible() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to enable showing the row focus.
// Parameters:
// bEnable - TRUE to enable showing the row focus.
// FALSE to disable showing the row focus.
// See Also: IsRowFocusVisible
//-----------------------------------------------------------------------
void ShowRowFocus(BOOL bShow);
//-----------------------------------------------------------------------
// Summary:
// Call this member to allow user moving the selection to header rows.
// Parameters:
// bAllowAccess - TRUE - selection of header rows is allowed, FALSE otherwise.
// See Also: IsHeaderRowsAllowAccess
//-----------------------------------------------------------------------
void HeaderRowsAllowAccess(BOOL bAllowAccess);
//-----------------------------------------------------------------------
// Summary:
// Call this member to allow user moving the selection to footer rows.
// Parameters:
// bAllowAccess - TRUE - selection of footer rows is allowed, FALSE otherwise.
// See Also: IsFooterRowsAllowAccess
//-----------------------------------------------------------------------
void FooterRowsAllowAccess(BOOL bAllowAccess);
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if user can move selection to header rows.
// Returns:
// TRUE if user can move selection to header rows, FALSE otherwise.
// See Also: HeaderRowsAllowAccess.
//-----------------------------------------------------------------------
BOOL IsHeaderRowsAllowAccess() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if user can move selection to footer rows.
// Returns:
// TRUE if user can move selection to footer rows, FALSE otherwise.
// See Also: FooterRowsAllowAccess.
//-----------------------------------------------------------------------
BOOL IsFooterRowsAllowAccess() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to enable selection in header rows.
// Parameters:
// bEnable - TRUE - selection of header rows is enabled, FALSE otherwise.
// See Also: IsHeaderRowsSelectionEnabled
//-----------------------------------------------------------------------
void HeaderRowsEnableSelection(BOOL bEnable);
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if selection in header rows is enabled.
// Returns:
// TRUE if selection in header rows is enabled, FALSE otherwise.
// See Also: HeaderRowsEnableSelection.
//-----------------------------------------------------------------------
BOOL IsHeaderRowsSelectionEnabled() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to enable selection in footer rows.
// Parameters:
// bEnable - TRUE - selection of footer rows is enabled, FALSE otherwise.
// See Also: IsFooterRowsSelectionEnabled
//-----------------------------------------------------------------------
void FooterRowsEnableSelection(BOOL bEnable);
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine if selection in footer rows is enabled.
// Returns:
// TRUE if selection in footer rows is enabled, FALSE otherwise.
// See Also: FooterRowsEnableSelection.
//-----------------------------------------------------------------------
BOOL IsFooterRowsSelectionEnabled() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to determine current watermark alignment flags.
// Returns:
// Current watermark alignment.
// See Also: XTPReportWatermarkAlignment, SetWatermarkAlignment.
//-----------------------------------------------------------------------
int GetWatermarkAlignment() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to set watermark alignment flags.
// Parameters:
// nWatermarkAlignment - watermark alignment flags.
// See Also: XTPReportWatermarkAlignment, GetWatermarkAlignment.
//-----------------------------------------------------------------------
void SetWatermarkAlignment(int nWatermarkAlignment);
protected:
//-----------------------------------------------------------------------
// Summary:
// Sets new operational control mouse mode.
// Parameters:
// nMode - New mouse mode. For available values, see XTPReportMouseMode enum.
// See Also: XTPReportMouseMode overview, GetMouseMode
//-----------------------------------------------------------------------
void SetMouseMode(XTPReportMouseMode nMode);
//-----------------------------------------------------------------------
// Summary:
// Returns the current control mouse mode.
// Returns:
// Current control mouse mode.
// For available values, see XTPReportMouseMode enum.
// See Also: XTPReportMouseMode overview, SetMouseMode
//-----------------------------------------------------------------------
XTPReportMouseMode GetMouseMode() const;
//-----------------------------------------------------------------------
// Summary:
// Performs all drawing logic.
// Parameters:
// pDC - Provided DC to draw control image with.
//-----------------------------------------------------------------------
virtual void OnDraw(CDC* pDC);
//-----------------------------------------------------------------------
// Summary:
// Draws all rows on the provided DC.
// Parameters:
// pDC - Provided DC to draw rows image with.
// rcClient - A rectangle to draw rows image into.
//-----------------------------------------------------------------------
virtual void DrawRows(CDC* pDC, CRect& rcClient);
//-----------------------------------------------------------------------
// Summary:
// Draws 'NoItems' text on the provided DC.
// Parameters:
// pDC - Provided DC to draw text.
// rcClient - A rectangle to draw text into.
//-----------------------------------------------------------------------
virtual void DrawNoItems(CDC* pDC, const CRect& rcClient);
//-----------------------------------------------------------------------
// Summary:
// Returns changed status flag of the control. Used for caching control image drawing.
// Returns:
// TRUE if the internal control state was changed since last drawing, FALSE otherwise.
//-----------------------------------------------------------------------
BOOL IsChanged() const;
//-----------------------------------------------------------------------
// Summary:
// Sets new changed status flag for the control. Used for caching control image drawing.
// Parameters:
// bChanged - TRUE when something was changed in the control contents and control needs to be republished.
//-----------------------------------------------------------------------
void SetChanged(BOOL bChanged = TRUE);
//-----------------------------------------------------------------------
// Summary:
// Sorts rows corresponding to the sort order taken from columns.
// Parameters:
// pRows - A rows collection to sort.
//-----------------------------------------------------------------------
virtual void SortRows(CXTPReportRows* pRows);
//-----------------------------------------------------------------------
// Summary:
// Sorts rows tree corresponding to the sort order taken from columns.
// Parameters:
// pTree - A rows tree collection to sort.
//-----------------------------------------------------------------------
virtual void SortTree(CXTPReportRows* pTree);
//-----------------------------------------------------------------------
// Summary:
// ReSorts rows tree corresponding to the sort order taken from columns.
// Works faster than Populate.
//-----------------------------------------------------------------------
virtual void ReSortRows();
//-----------------------------------------------------------------------
// Summary:
// Update field chooser control with its content.
//-----------------------------------------------------------------------
void UpdateSubList();
//-----------------------------------------------------------------------
// Summary:
// Builds rows tree based on provided data record.
// Parameters:
// pTree - Rows tree to add items into.
// pParentRow - Parent tree row.
// pRecords - Records collection for transferring to rows.
// Remarks:
// Builds rows tree based on provided data record.
// Recursively calls itself when build nested branches of rows
//-----------------------------------------------------------------------
virtual void BuildTree(CXTPReportRows* pTree, CXTPReportRow* pParentRow, CXTPReportRecords* pRecords);
//-----------------------------------------------------------------------
// Summary:
// Collapses all children of the specified row.
// Parameters:
// pRow - A row to collapse.
//-----------------------------------------------------------------------
virtual void _DoCollapse(CXTPReportRow* pRow);
//-----------------------------------------------------------------------
// Summary:
// Expands all children of the specified row.
// Parameters:
// nIndex - An index to insert rows from.
// pRow - A row to expand.
// Returns:
// A count of the newly added rows or void.
//-----------------------------------------------------------------------
virtual int _DoExpand(int nIndex, CXTPReportRow* pRow);
virtual void _DoExpand(CXTPReportRow* pRow); // int nHeaderRowsHeight = GetRowHeight(pDC, pRow)
//-----------------------------------------------------------------------
virtual int GetRowsHeight(CXTPReportRows* pRows, int nTotalWidth, int nMaxHeight = -1);
//-----------------------------------------------------------------------
// Summary:
// Returns header divider height.
// Parameters:
// pDC - Pointer to the used Device Context.
// Returns:
// The height of the header divider, depending on the chosen header divider style.
// See Also:
// XTPReportFixedRowsDividerStyle in XTPReportPaintManager.h
//-----------------------------------------------------------------------
virtual int GetHeaderRowsDividerHeight();
//-----------------------------------------------------------------------
// Summary:
// Returns footer divider height.
// Parameters:
// pDC - Pointer to the used Device Context.
// Returns:
// The height of the header divider, depending on the chosen footer divider style.
// See Also:
// XTPReportFixedRowsDividerStyle in XTPReportPaintManager.h
//-----------------------------------------------------------------------
virtual int GetFooterRowsDividerHeight();
//-----------------------------------------------------------------------
// Summary:
// Sets a watermark bitmap to be shown in the report control background.
// Parameters:
// hBitmap - bitmap handle.
// szPath - path to bitmap file.
// Transparency - transparency value.
// Returns:
// TRUE if watermark bitmap successfully added or removed, FALSE otherwise.
//-----------------------------------------------------------------------
virtual BOOL SetWatermarkBitmap(HBITMAP hBitmap, BYTE Transparency);
virtual BOOL SetWatermarkBitmap(LPCTSTR szPath, BYTE Transparency); //