Files

819 lines
20 KiB
C++

////////////////////////////////////////////////////////////////////////////
// File: CReportCtrl.h
// Version: 1.1.0
//
// Author: Maarten Hoeben
// E-mail: maarten.hoeben@nwn.com
//
// Implementation of the CReportCtrl and associated classes.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name and all copyright
// notices remains intact.
//
// An email letting me know how you are using it would be nice as well.
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability for any damage/loss of business that
// this product may cause.
//
////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_REPORTCTRL_H__279B1CA0_D7F2_11D2_88D7_ABB23645F26D__INCLUDED_)
#define AFX_REPORTCTRL_H__279B1CA0_D7F2_11D2_88D7_ABB23645F26D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ReportCtrl.h : header file
//
#include "FlatHeaderCtrl.h"
#define ID_HEADERCTRL 0
#define ID_REPORTCTRL 0
// Use this as the classname when inserting this control as a custom control
// in the MSVC++ dialog editor
#define REPORTCTRL_CLASSNAME _T("MFCReportCtrl")
#define REPORTCTRL_MAX_TEXT 256
// Properties
#define RVP_SPACING 1
#define RVP_CHECK 2
#define RVP_NOITEMTEXT 3
#define RVP_GRIDSTYLE 4
#define RVP_GRIDSTYLE_DOT 0
#define RVP_GRIDSTYLE_DASH 1
#define RVP_GRIDSTYLE_SOLID 2
// Styles
#define RVS_SINGLESELECT 0x0001
#define RVS_SHOWSELALWAYS 0x0002
#define RVS_SHOWCOLORALWAYS 0x0004
#define RVS_SHOWCOLORALTERNATE 0x0008
#define RVS_SHOWHGRID 0x0010
#define RVS_SHOWVGRID 0x0020
#define RVS_NOHEADER 0x0040
#define RVS_NOSORT 0x0080
#define RVS_ALLOWCOLUMNREMOVAL 0x0100
#define RVS_SHOWEDITROW 0x0200
#define RVS_SHOWHGRIDEX 0x0400
#define RVS_OWNERDATA 0x0800
#define RVS_FOCUSSUBITEMS 0x1000
#define RVS_EXPANDSUBITEMS 0x2000
// Column Format
#define RVCF_LEFT HDF_LEFT
#define RVCF_RIGHT HDF_RIGHT
#define RVCF_CENTER HDF_CENTER
#define RVCF_TEXT HDF_STRING
#define RVCF_IMAGE HDF_IMAGE
#define RVCF_JUSTIFYMASK HDF_JUSTIFYMASK
#define RVCF_MASK 0x0000ffff
#define RVCF_EX_AUTOWIDTH (HDF_EX_AUTOWIDTH<<16)
#define RVCF_EX_INCLUDESORT (HDF_EX_INCLUDESORT<<16)
#define RVCF_EX_FIXEDWIDTH (HDF_EX_FIXEDWIDTH<<16)
#define RVCF_EX_TOOLTIP (HDF_EX_TOOLTIP<<16)
#define RVCF_EX_MASK 0x00ff0000
#define RVCF_SUBITEM_IMAGE 0x01000000
#define RVCF_SUBITEM_CHECK 0x02000000
#define RVCF_SUBITEM_MASK 0xff000000
typedef struct _RVCOLUMN
{
UINT nFormat;
INT iWidth;
INT iMinWidth;
INT iMaxWidth;
INT iImage;
LPTSTR lpszText;
_RVCOLUMN() : nFormat(RVCF_LEFT|RVCF_TEXT), iWidth(-1), iMinWidth(0), iMaxWidth(-1), iImage(0), lpszText(NULL) {};
} RVCOLUMN, FAR* LPRVCOLUMN;
// Item Masks
#define RVIM_TEXT 0x0001
#define RVIM_TEXTCOLOR 0x0002
#define RVIM_IMAGE 0x0004
#define RVIM_CHECK 0x0008
#define RVIM_BKCOLOR 0x0010
#define RVIM_PREVIEW 0x0020
#define RVIM_STATE 0x0040
#define RVIM_LPARAM 0x0080
// Item Index
#define RVI_INVALID -2
#define RVI_EDIT -1
#define RVI_FIRST 0
#define RVI_LAST 0x7fffffff
// Item State
#define RVIS_FOCUSED 0x0001
#define RVIS_SELECTED 0x0002
#define RVIS_BOLD 0x0004
#define RVIS_READONLY 0x0008
typedef struct _RVITEM
{
UINT nMask;
INT iItem;
INT iSubItem;
LPTSTR lpszText;
INT iTextMax;
INT iTextColor;
INT iImage;
INT iCheck;
INT iBkColor;
UINT nPreview;
UINT nState;
LPARAM lParam;
_RVITEM() : nMask(0), iItem(RVI_INVALID), iSubItem(-1), lpszText(NULL), iTextMax(0), iTextColor(-1), iImage(-1), iCheck(-1), iBkColor(-1), nPreview(0), nState(0), lParam(0) {};
} RVITEM, FAR* LPRVITEM;
// Hit Test
#define RVHT_NOWHERE 0x0001
#define RVHT_ONITEMIMAGE 0x0002
#define RVHT_ONITEMCHECK 0x0004
#define RVHT_ONITEMTEXT 0x0008
#define RVHT_ONITEMPREVIEW 0x0010
#define RVHT_ONITEM (RVHT_ONITEMIMAGE|RVHT_ONITEMCHECK|RVHT_ONITEMTEXT|RVHT_ONITEMPREVIEW)
#define RVHT_ONITEMEDIT 0x0020
#define RVHT_ABOVE 0x0100
#define RVHT_BELOW 0x0200
#define RVHT_TORIGHT 0x0400
#define RVHT_TOLEFT 0x0800
typedef struct _RVHITTESTINFO
{
POINT point;
UINT nFlags;
INT iItem;
INT iSubItem;
INT iRow;
INT iColumn;
RECT rect;
} RVHITTESTINFO, FAR* LPRVHITTESTINFO;
// Notifications
#define RVN_ITEMDRAWPREVIEW (0U-2048U)
#define RVN_ITEMCLICK (0U-2049U)
#define RVN_ITEMDBCLICK (0U-2050U)
#define RVN_SELECTIONCHANGING (0U-2051U)
#define RVN_SELECTIONCHANGED (0U-2052U)
#define RVN_COLUMNCLICK (0U-2053U)
#define RVN_LAYOUTCHANGED (0U-2054U)
#define RVN_ITEMDELETED (0U-2055U)
#define RVN_ITEMCALLBACK (0U-2056U)
#define RVN_BEGINITEMEDIT (0U-2057U)
#define RVN_ENDITEMEDIT (0U-2058U)
typedef struct _NMRVDRAWPREVIEW
{
NMHDR hdr;
INT iItem;
UINT nState;
HDC hDC;
RECT rect;
LPARAM lParam;
} NMRVDRAWPREVIEW, FAR* LPNMRVDRAWPREVIEW;
typedef struct _NMREPORTVIEW
{
NMHDR hdr;
UINT nKeys;
POINT point;
UINT nFlags;
INT iItem;
INT iSubItem;
UINT nState;
LPARAM lParam;
} NMREPORTVIEW, FAR* LPNMREPORTVIEW;
typedef struct _NMRVITEMCALLBACK
{
NMHDR hdr;
RVITEM item;
} NMRVITEMCALLBACK, FAR* LPNMRVITEMCALLBACK;
typedef INT (CALLBACK* LPFNRVCOMPARE)(INT iColumn, INT iItem1, INT iItem2);
typedef struct _NMRVITEMEDIT
{
NMHDR hdr;
INT iItem;
INT iSubItem;
HWND hWnd;
RECT rect;
UINT nKey;
LPCTSTR lpszText;
LPARAM lParam;
} NMRVITEMEDIT, FAR* LPNMRVITEMEDIT;
// Item Rect
#define RVIR_BOUNDS 0
#define RVIR_IMAGE 1
#define RVIR_CHECK 2
#define RVIR_TEXT 3
class CReportCtrl;
class CReportColumnListCtrl;
/////////////////////////////////////////////////////////////////////////////
// CReportEditCtrl window
class CReportEditCtrl: public CEdit
{
public:
CReportEditCtrl(INT iItem, INT iSubItem);
// Operations
public:
void EndEdit();
// Overrides
public:
virtual ~CReportEditCtrl();
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReportEditCtrl)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void PostNcDestroy();
//}}AFX_VIRTUAL
// Implementation
protected:
BOOL m_bEndEdit;
INT m_iItem;
INT m_iSubItem;
UINT m_nLastKey;
//{{AFX_MSG(CReportEditCtrl)
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg UINT OnGetDlgCode();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CReportComboCtrl window
class CReportComboCtrl: public CComboBox
{
public:
CReportComboCtrl(INT iItem, INT iSubItem);
// Operations
public:
void EndEdit();
// Overrides
public:
virtual ~CReportComboCtrl();
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReportComboCtrl)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void PostNcDestroy();
//}}AFX_VIRTUAL
// Implementation
protected:
BOOL m_bEndEdit;
INT m_iItem;
INT m_iSubItem;
UINT m_nLastKey;
//{{AFX_MSG(CReportComboCtrl)
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg UINT OnGetDlgCode();
afx_msg void OnKillfocus();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CReportTipCtrl window
#define REPORTTIPCTRL_CLASSNAME _T("MFCReportTipCtrl")
class CReportTipCtrl : public CWnd
{
// Construction
public:
CReportTipCtrl();
BOOL Create(CReportCtrl *pReportCtrl);
// Attributes
public:
// Operations
public:
BOOL Show(CRect rectTitle, LPCTSTR lpszText, CFont* pFont = NULL);
void Hide();
// Overrides
public:
virtual ~CReportTipCtrl();
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReportTipCtrl)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
protected:
CReportCtrl *m_pReportCtrl;
CRect m_rectText;
DWORD m_dwLastLButtonDown;
DWORD m_dwDblClickMsecs;
// Generated message map functions
protected:
//{{AFX_MSG(CReportTipCtrl)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CReportData storage class
class CReportData : public CString
{
public:
CReportData();
~CReportData();
BOOL New(INT iSubItems);
BOOL GetSubItem(INT iSubItem, LPINT lpiImage, LPINT lpiCheck, LPINT lpiColor, LPTSTR lpszText, LPINT lpiTextMax);
BOOL SetSubItem(INT iSubItem, INT iImage, INT iCheck, INT iColor, LPCTSTR lpszText);
BOOL InsertSubItem(INT iSubItem, INT iImage, INT iCheck, INT iColor, LPCTSTR lpszText);
BOOL DeleteSubItem(INT iSubItem);
};
/////////////////////////////////////////////////////////////////////////////
// CReportCtrl window
class CReportCtrl : public CWnd
{
friend class CReportView;
friend class CReportTipCtrl;
friend class CReportColumnListCtrl;
// Construction
public:
DECLARE_DYNCREATE(CReportCtrl)
CReportCtrl();
public:
BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
INT PreviewHeight(CFont* pFont, UINT nLines);
INT PreviewHeight(CFont* pFont, LPCTSTR lpszText, LPRECT lpRect = NULL);
// Attributes
public:
BOOL ModifyProperty(WPARAM wParam, LPARAM lParam);
INT ActivateColumn(INT iColumn, INT iOrder = 0);
BOOL DeactivateColumn(INT iColumn);
BOOL IsActiveColumn(INT iColumn);
BOOL GetItem(LPRVITEM lprvi);
BOOL SetItem(LPRVITEM lprvi);
INT GetItemText(INT iItem, INT iSubItem, LPTSTR lpszText, INT iLen);
CString GetItemText(INT iItem, INT iSubItem);
BOOL SetItemText(INT iItem, INT iSubItem, LPCTSTR lpszText);
INT GetItemImage(INT iItem, INT iSubItem);
BOOL SetItemImage(INT iItem, INT iSubItem, INT iImage);
INT GetItemCheck(INT iItem, INT iSubItem);
BOOL SetItemCheck(INT iItem, INT iSubItem, INT iCheck = -1);
DWORD GetItemData(INT iItem);
BOOL SetItemData(INT iItem, DWORD dwData);
BOOL GetItemRect(INT iItem, INT iSubItem, LPRECT lpRect, UINT nCode = RVIR_BOUNDS);
void SetItemHeight(INT iHeight);
INT GetVisibleCount(BOOL bUnobstructed = TRUE);
INT GetItemCount();
void SetItemCount(INT iCount);
INT GetFirstSelectedItem();
INT GetNextSelectedItem(INT iItem);
void ClearSelection();
void SetSelection(INT iItem, BOOL bKeepSelection = FALSE);
void SetSelection(LPINT lpiItems, INT iCount, BOOL bKeepSelection = FALSE);
BOOL SetImageList(CImageList* pImageList);
CImageList* GetImageList();
BOOL SetBkImage(UINT nIDResource);
BOOL SetBkImage(LPCTSTR lpszResourceName);
BOOL HasFocus();
CFlatHeaderCtrl* GetHeaderCtrl();
BOOL SetReportColumnListCtrl(CReportColumnListCtrl* lprclc);
CReportColumnListCtrl* GetReportColumnListCtrl();
BOOL SetSortCallback(LPFNRVCOMPARE lpfnrvc);
LPFNRVCOMPARE GetSortCallback();
BOOL WriteProfile(CString* strpProfile);
BOOL GetProfile(CString* strpProfile);
// Operations
public:
BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
INT DefineColumn(INT iColumn, LPRVCOLUMN lprvc, BOOL bUpdateList = FALSE);
BOOL UndefineColumn(INT iColumn);
INT InsertItem(INT iItem, LPTSTR lpszText, INT iImage = -1, INT iCheck = -1, INT iTextColor = -1);
INT InsertItem(LPRVITEM lprvi);
BOOL DeleteItem(INT iItem);
BOOL DeleteAllItems();
void RedrawItems(INT iFirst, INT iLast = RVI_LAST);
BOOL EnsureVisible(INT iItem, BOOL bUnobstructed = TRUE);
INT InsertColor(INT iIndex, COLORREF crColor);
BOOL DeleteColor(INT iIndex);
INT HitTest(LPRVHITTESTINFO lprvhti);
BOOL SortItems(INT iColumn, BOOL bAscending);
BOOL SortAllColumns(BOOL bAscending /*=TRUE*/);
// Overrides
public:
virtual ~CReportCtrl();
INT FindColumnInHeader(INT iColumn);
virtual void DrawItem(CDC* pDC, CRect rect, LPRVITEM lprvi);
virtual BOOL DrawBkgnd(CDC* pDC, CRect rect, COLORREF crBackground);
virtual INT CompareItems(INT iColumn, INT iItem1, INT iItem2);
virtual BOOL BeginEdit(INT iRow, INT iColumn, UINT nKey);
virtual void EndEdit(BOOL bUpdate = TRUE, LPNMRVITEMEDIT lpnmrvie = NULL);
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReportCtrl)
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Structures
protected:
typedef struct structSUBITEM
{
UINT nFormat;
INT iWidth;
INT iMinWidth;
INT iMaxWidth;
INT iImage;
CString strText;
structSUBITEM() : nFormat(RVCF_LEFT), iWidth(-1), iMinWidth(0), iMaxWidth(-1), iImage(0) {};
} SUBITEM, FAR* LPSUBITEM;
typedef struct structITEM
{
CReportData rdData;
INT iBkColor;
UINT nState;
UINT nPreview;
LPARAM lParam;
structITEM() :
iBkColor(-1),
nPreview(0),
nState(0),
lParam(0)
{};
structITEM& operator = (structITEM& item)
{
rdData = item.rdData;
iBkColor = item.iBkColor;
nPreview = item.nPreview;
nState = item.nState;
lParam = item.lParam;
return *this;
}
} ITEM, FAR* LPITEM;
// Implementation
protected:
BOOL m_bSubclassFromCreate;
BOOL m_bDoubleBuffer;
INT m_iSpacing;
UINT m_nRowsPerWheelNotch;
DWORD m_dwStyle;
CFont m_font;
CFont m_fontBold;
CImageList* m_pImageList;
SIZE m_sizeImage;
SIZE m_sizeCheck;
COLORREF m_crBackground;
COLORREF m_crBkSelected;
COLORREF m_crBkSelectedNoFocus;
COLORREF m_crText;
COLORREF m_crTextSelected;
COLORREF m_crTextSelectedNoFocus;
COLORREF m_crGrid;
COLORREF m_cr3DFace;
COLORREF m_cr3DHiLight;
COLORREF m_cr3DDkShadow;
CArray<COLORREF, COLORREF> m_arrayColors;
CPalette m_palette;
INT m_iGridStyle;
CString m_strNoItems;
CRect m_rectTop;
CRect m_rectHeader;
CRect m_rectEdit;
CRect m_rectReport;
INT m_iDefaultWidth, m_iDefaultHeight;
INT m_iVirtualWidth, m_iVirtualHeight;
CArray<SUBITEM, SUBITEM> m_arraySubItems;
CArray<ITEM, ITEM> m_arrayItems;
ITEM m_itemEdit;
ITEM m_itemCache;
BOOL m_bColumnsReordered;
CArray<INT, INT> m_arrayColumns;
BOOL m_bFocus;
INT m_iFocusRow;
INT m_iFocusColumn;
INT m_iSelectRow;
CArray<INT, INT> m_arrayRows;
INT m_iEditItem;
INT m_iEditSubItem;
HWND m_hEditWnd;
LPFNRVCOMPARE m_lpfnrvc;
CFlatHeaderCtrl m_wndHeader;
CReportTipCtrl m_wndTip;
CReportColumnListCtrl* m_lprclc;
CBitmap m_bitmap;
SIZE m_sizeBitmap;
BOOL Create();
void GetSysColors();
UINT GetMouseScrollLines();
BOOL CreatePalette();
BOOL Notify(UINT nCode, INT iItem = -1, INT iSubItem = -1, UINT nState = 0, LPARAM lParam = 0);
BOOL Notify(UINT nCode, UINT nKeys, LPRVHITTESTINFO lprvhti);
void Layout(INT cx, INT cy);
ITEM& GetItemStruct(INT iItem, INT iSubItem, UINT nMask = 0);
void SetItemStruct(INT iItem, ITEM& item);
INT GetItemFromRow(INT iRow);
INT GetItemFromRow(INT iRow, ITEM& item);
INT GetRowFromItem(INT iItem);
INT GetSubItemFromColumn(INT iSubItem);
INT GetColumnFromSubItem(INT iColumn);
void SetState(INT iRow, UINT nState, UINT nMask);
UINT GetState(INT iRow);
INT GetVisibleRows(BOOL bUnobstructed = TRUE, LPINT lpiFirst = NULL, LPINT lpiLast = NULL, BOOL bReverse = FALSE);
void SelectRows(INT iFirst, INT iLast, BOOL bSelect = TRUE, BOOL bKeepSelection = FALSE, BOOL bInvert = FALSE, BOOL bNotify = TRUE);
INT GetScrollPos32(INT iBar, BOOL bGetTrackPos = FALSE);
BOOL SetScrollPos32(INT iBar, INT nPos, BOOL bRedraw = TRUE);
void ScrollWindow(INT iBar, INT iPos);
void EnsureVisibleColumn(INT iColumn);
void DrawCtrl(CDC* pDC);
void DrawRow(CDC* pDC, CRect rectRow, CRect rectClip, INT iRow, LPRVITEM lprvi, BOOL bAlternate);
INT DrawImage(CDC* pDC, CRect rect, LPRVITEM lprvi);
INT DrawCheck(CDC* pDC, CRect rect, LPRVITEM lprvi);
INT DrawText(CDC* pDC, CRect rect, LPRVITEM lprvi);
// Generated message map functions
protected:
//{{AFX_MSG(CReportCtrl)
afx_msg void OnDestroy();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnPaint();
afx_msg void OnSysColorChange();
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
afx_msg void OnHdnItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnHdnItemClick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnHdnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnHdnEndDrag(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRvnEndItemEdit(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg UINT OnGetDlgCode();
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg BOOL OnQueryNewPalette();
afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
afx_msg void OnNcPaint();
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
//}}AFX_MSG
afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnGetFont(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CReportView
class CReportView : public CView
{
protected:
DECLARE_DYNCREATE(CReportView)
CReportView(); // protected constructor used by dynamic creation
// Attributes
public:
CReportCtrl& GetReportCtrl();
CReportCtrl* GetReportCtrlPtr();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReportView)
public:
virtual void OnInitialUpdate();
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CReportView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
BOOL m_bCreated;
CReportCtrl m_wndReportCtrl;
// Generated message map functions
protected:
//{{AFX_MSG(CReportView)
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CReportColumnList window
class CReportColumnListCtrl : public CDragListBox
{
// Construction
public:
CReportColumnListCtrl();
~CReportColumnListCtrl();
// Attributes
public:
BOOL SetReportCtrl(CReportCtrl* pReportCtrl);
CReportCtrl* GetReportCtrl();
// Operations
public:
BOOL UpdateList();
// Overrides
virtual BOOL Include(INT iColumn);
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReportColumnListCtrl)
public:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
protected:
CReportCtrl* m_pReportCtrl;
INT m_iColumn;
HDITEM m_hdiColumn;
TCHAR m_szColumnText[FLATHEADER_TEXT_MAX];
CFHDragWnd* m_pDragWnd;
CRect m_rcDragWnd;
CRect m_rcDropTarget1;
CRect m_rcDropTarget2;
INT m_iDropIndex;
BOOL BeginDrag(CPoint pt);
UINT Dragging(CPoint pt);
void CancelDrag(CPoint pt);
void Dropped(INT iSrcIndex, CPoint pt);
// Generated message map functions
protected:
//{{AFX_MSG(CReportColumnListCtrl)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_REPORTCTRL_H__279B1CA0_D7F2_11D2_88D7_ABB23645F26D__INCLUDED_)