123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650 |
- #if !defined(AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
- #define AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
- #if _MSC_VER >= 1000
- #pragma once
- #endif
- #include "CellRange.h"
- #include <afxtempl.h>
- #ifdef _WIN32_WCE
- #define GRIDCONTROL_NO_TITLETIPS
- #define GRIDCONTROL_NO_DRAGDROP
- #define GRIDCONTROL_NO_CLIPBOARD
- #define GRIDCONTROL_NO_PRINTING
- #ifdef WCE_NO_PRINTING
- #define _WIN32_WCE_NO_PRINTING
- #endif
- #ifdef WCE_NO_CURSOR
- #define _WIN32_WCE_NO_CURSOR
- #endif
- #else
- #undef TRY
- #undef CATCH
- #undef END_CATCH
- #define TRY try
- #define CATCH(ex_class, ex_object) catch(ex_class* ex_object)
- #define END_CATCH
- #endif
- #ifndef GRIDCONTROL_NO_TITLETIPS
- #include "TitleTip.h"
- #endif
- #ifndef GRIDCONTROL_NO_DRAGDROP
- #include "GridDropTarget.h"
- #undef GRIDCONTROL_NO_CLIPBOARD
- #endif
- #ifndef GRIDCONTROL_NO_CLIPBOARD
- #include <afxole.h>
- #endif
- #define GRIDCTRL_CLASSNAME _T("MFCGridCtrl")
- #define IDC_INPLACE_CONTROL 8
- #define IsSHIFTpressed() ( (GetKeyState(VK_SHIFT) & (1 << (sizeof(SHORT)*8-1))) != 0 )
- #define IsCTRLpressed() ( (GetKeyState(VK_CONTROL) & (1 << (sizeof(SHORT)*8-1))) != 0 )
- typedef struct _GV_ITEM {
- int row,col;
- UINT mask;
- UINT state;
- UINT nFormat;
- CString szText;
- int iImage;
- COLORREF crBkClr;
- COLORREF crFgClr;
- LPARAM lParam;
- LOGFONT lfFont;
- } GV_ITEM;
- #define GVL_NONE 0
- #define GVL_HORZ 1
- #define GVL_VERT 2
- #define GVL_BOTH 3
- #define GVIF_TEXT LVIF_TEXT
- #define GVIF_IMAGE LVIF_IMAGE
- #define GVIF_PARAM LVIF_PARAM
- #define GVIF_STATE LVIF_STATE
- #define GVIF_BKCLR (GVIF_STATE<<1)
- #define GVIF_FGCLR (GVIF_STATE<<2)
- #define GVIF_FORMAT (GVIF_STATE<<3)
- #define GVIF_FONT (GVIF_STATE<<4)
- #define GVIS_FOCUSED 0x0001
- #define GVIS_SELECTED 0x0002
- #define GVIS_DROPHILITED 0x0004
- #define GVIS_READONLY 0x0008
- #define GVIS_FIXED 0x0010
- #define GVIS_MODIFIED 0x0020
- #define GVNI_FOCUSED 0x0001
- #define GVNI_SELECTED 0x0002
- #define GVNI_DROPHILITED 0x0004
- #define GVNI_READONLY 0x0008
- #define GVNI_FIXED 0x0010
- #define GVNI_MODIFIED 0x0020
- #define GVNI_ABOVE LVNI_ABOVE
- #define GVNI_BELOW LVNI_BELOW
- #define GVNI_TOLEFT LVNI_TOLEFT
- #define GVNI_TORIGHT LVNI_TORIGHT
- #define GVNI_ALL (LVNI_BELOW|LVNI_TORIGHT|LVNI_TOLEFT)
- #define GVNI_AREA (LVNI_BELOW|LVNI_TORIGHT)
- #define GVHT_DATA 0x0000
- #define GVHT_TOPLEFT 0x0001
- #define GVHT_COLHDR 0x0002
- #define GVHT_ROWHDR 0x0004
- #define GVHT_COLSIZER 0x0008
- #define GVHT_ROWSIZER 0x0010
- #define GVHT_LEFT 0x0020
- #define GVHT_RIGHT 0x0040
- #define GVHT_ABOVE 0x0080
- #define GVHT_BELOW 0x0100
- typedef struct tagNM_GRIDVIEW {
- NMHDR hdr;
- int iRow;
- int iColumn;
- } NM_GRIDVIEW;
- typedef struct tagGV_DISPINFO {
- NMHDR hdr;
- GV_ITEM item;
- } GV_DISPINFO;
- #define GVN_BEGINDRAG LVN_BEGINDRAG
- #define GVN_BEGINLABELEDIT LVN_BEGINLABELEDIT
- #define GVN_BEGINRDRAG LVN_BEGINRDRAG
- #define GVN_COLUMNCLICK LVN_COLUMNCLICK
- #define GVN_DELETEITEM LVN_DELETEITEM
- #define GVN_ENDLABELEDIT LVN_ENDLABELEDIT
- #define GVN_SELCHANGING LVN_ITEMCHANGING
- #define GVN_SELCHANGED LVN_ITEMCHANGED
- class CGridCell : public CObject
- {
- public:
- CGridCell()
- {
- state = 0;
- nFormat = 0;
- szText.Empty();
- iImage = -1;
- crBkClr = CLR_DEFAULT;
- crFgClr = CLR_DEFAULT;
- lParam = 0;
- }
- UINT state;
- UINT nFormat;
- CString szText;
- int iImage;
- COLORREF crBkClr;
- COLORREF crFgClr;
- LOGFONT lfFont;
- LPARAM lParam;
- };
- typedef CTypedPtrArray<CObArray, CGridCell*> GRID_ROW;
- class CGridCtrl;
- void AFXAPI DDX_GridControl(CDataExchange* pDX, int nIDC, CGridCtrl& rControl);
- class CGridCtrl : public CWnd
- {
- DECLARE_DYNCREATE(CGridCtrl)
- public:
- CGridCtrl(int nRows = 0, int nCols = 0, int nFixedRows = 0, int nFixedCols = 0);
- BOOL Create(const RECT& rect, CWnd* parent, UINT nID,
- DWORD dwStyle = WS_CHILD | WS_BORDER | WS_TABSTOP | WS_VISIBLE);
- BOOL SubclassWindow(HWND hWnd);
- public:
- int GetRowCount() const { return m_nRows; }
- int GetColumnCount() const { return m_nCols; }
- int GetFixedRowCount() const { return m_nFixedRows; }
- int GetFixedColumnCount() const { return m_nFixedCols; }
- BOOL SetRowCount(int nRows = 10);
- BOOL SetColumnCount(int nCols = 10);
- BOOL SetFixedRowCount(int nFixedRows = 1);
- BOOL SetFixedColumnCount(int nFixedCols = 1);
- int GetRowHeight(int nRow) const;
- BOOL SetRowHeight(int row, int height);
- int GetColumnWidth(int nCol) const;
- BOOL SetColumnWidth(int col, int width);
- BOOL GetCellOrigin(int nRow, int nCol, LPPOINT p) const;
- BOOL GetCellOrigin(const CCellID& cell, LPPOINT p) const;
- BOOL GetCellRect(int nRow, int nCol, LPRECT pRect) const;
- BOOL GetCellRect(const CCellID& cell, LPRECT pRect) const;
- BOOL GetTextRect(const CCellID& cell, LPRECT pRect);
- BOOL GetTextRect(int nRow, int nCol, LPRECT pRect);
- int GetFixedRowHeight() const;
- int GetFixedColumnWidth() const;
- long GetVirtualWidth() const;
- long GetVirtualHeight() const;
- void SetTextColor(COLORREF clr) { m_crTextColour = clr; }
- COLORREF GetTextColor() const { return m_crTextColour; }
- void SetTextBkColor(COLORREF clr) { m_crTextBkColour = clr; }
- COLORREF GetTextBkColor() const { return m_crTextBkColour; }
- void SetBkColor(COLORREF clr) { m_crBkColour = clr; }
- COLORREF GetBkColor() const { return m_crBkColour; }
- void SetFixedTextColor(COLORREF clr) { m_crFixedTextColour = clr; }
- COLORREF GetFixedTextColor() const { return m_crFixedTextColour; }
- void SetFixedBkColor(COLORREF clr) { m_crFixedBkColour = clr; }
- COLORREF GetFixedBkColor() const { return m_crFixedBkColour; }
- void SetGridColor(COLORREF clr) { m_crGridColour = clr; }
- COLORREF GetGridColor() const { return m_crGridColour; }
- int GetSelectedCount() const { return m_SelectedCellMap.GetCount(); }
- CCellID GetFocusCell() const { return m_idCurrentCell; }
- void SetImageList(CImageList* pList) { m_pImageList = pList; }
- CImageList* GetImageList() const { return m_pImageList; }
- void SetGridLines(int nWhichLines = GVL_BOTH) { m_nGridLines = nWhichLines;
- if (::IsWindow(GetSafeHwnd())) Invalidate(); }
- int GetGridLines() const { return m_nGridLines; }
- void SetEditable(BOOL bEditable = TRUE) { m_bEditable = bEditable; }
- BOOL IsEditable() const { return m_bEditable; }
- void SetListMode(BOOL bEnableListMode = TRUE) { m_bListMode = bEnableListMode; }
- BOOL GetListMode() const { return m_bListMode; }
- void SetSingleRowSelection(BOOL bSing = TRUE) { m_bSingleRowSelection = bSing; }
- BOOL GetSingleRowSelection() { return m_bSingleRowSelection; }
- void EnableSelection(BOOL bEnable = TRUE) { ResetSelectedRange(); m_bEnableSelection = bEnable; ResetSelectedRange(); }
- BOOL IsSelectable() const { return m_bEnableSelection; }
- void EnableDragAndDrop(BOOL bAllow = TRUE) { m_bAllowDragAndDrop = bAllow; }
- BOOL GetDragAndDrop() const { return m_bAllowDragAndDrop; }
- void SetRowResize(BOOL bResize = TRUE) { m_bAllowRowResize = bResize; }
- BOOL GetRowResize() const { return m_bAllowRowResize; }
- void SetColumnResize(BOOL bResize = TRUE) { m_bAllowColumnResize = bResize; }
- BOOL GetColumnResize() const { return m_bAllowColumnResize; }
- void SetHeaderSort(BOOL bSortOnClick = TRUE) { m_bSortOnClick = bSortOnClick; }
- BOOL GetHeaderSort() const { return m_bSortOnClick; }
- void SetHandleTabKey(BOOL bHandleTab = TRUE) { m_bHandleTabKey = bHandleTab; }
- BOOL GetHandleTabKey() const { return m_bHandleTabKey; }
- void SetDoubleBuffering(BOOL bBuffer = TRUE) { m_bDoubleBuffer = bBuffer; }
- BOOL GetDoubleBuffering() const { return m_bDoubleBuffer; }
- void EnableTitleTips(BOOL bEnable = TRUE) { m_bTitleTips = bEnable; }
- BOOL GetTitleTips() { return m_bTitleTips; }
- void SetModified(BOOL bModified = TRUE, int nRow = -1, int nCol = -1);
- BOOL GetModified(int nRow = -1, int nCol = -1);
- BOOL IsCellFixed(int nRow, int nCol);
- virtual BOOL SetItem(const GV_ITEM* pItem);
- BOOL GetItem(GV_ITEM* pItem);
- virtual BOOL SetItemText(int nRow, int nCol, LPCTSTR str);
- virtual CString GetItemText(int nRow, int nCol);
- BOOL SetItemData(int nRow, int nCol, LPARAM lParam);
- LPARAM GetItemData(int nRow, int nCol) const;
- BOOL SetItemImage(int nRow, int nCol, int iImage);
- int GetItemImage(int nRow, int nCol) const;
- BOOL SetItemState(int nRow, int nCol, UINT state);
- UINT GetItemState(int nRow, int nCol) const;
- BOOL SetItemFormat(int nRow, int nCol, UINT nFormat);
- UINT GetItemFormat(int nRow, int nCol) const;
- BOOL SetItemBkColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
- COLORREF GetItemBkColour(int nRow, int nCol) const;
- BOOL SetItemFgColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
- COLORREF GetItemFgColour(int nRow, int nCol) const;
- BOOL SetItemFont(int nRow, int nCol, LOGFONT* lf);
- LOGFONT* GetItemFont(int nRow, int nCol);
- public:
- int InsertColumn(LPCTSTR strHeading, UINT nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE,
- int nColumn = -1);
- int InsertRow(LPCTSTR strHeading, int nRow = -1);
- BOOL DeleteColumn(int nColumn);
- BOOL DeleteRow(int nRow);
- BOOL DeleteNonFixedRows();
- BOOL DeleteAllItems();
- BOOL AutoSizeRow(int nRow);
- BOOL AutoSizeColumn(int nCol);
- void AutoSizeRows();
- void AutoSizeColumns();
- void AutoSize();
- void ExpandColumnsToFit();
- void ExpandRowsToFit();
- void ExpandToFit();
- CSize GetTextExtent(LPCTSTR str, BOOL bUseSelectedFont = TRUE);
- void EnsureVisible(CCellID &cell) { EnsureVisible(cell.row, cell.col); }
- void EnsureVisible(int nRow, int nCol);
- BOOL IsCellVisible(int nRow, int nCol) const;
- BOOL IsCellVisible(CCellID cell) const;
- BOOL IsCellEditable(int nRow, int nCol) const;
- BOOL IsCellEditable(CCellID &cell) const;
-
-
- void SetRedraw(BOOL bAllowDraw, BOOL bResetScrollBars = FALSE);
- BOOL RedrawCell(int nRow, int nCol, CDC* pDC = NULL);
- BOOL RedrawCell(const CCellID& cell, CDC* pDC = NULL);
- BOOL RedrawRow(int row);
- BOOL RedrawColumn(int col);
- #if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
- void Print();
- #endif
- #ifndef _WIN32_WCE
- BOOL Save(LPCTSTR filename);
- BOOL Load(LPCTSTR filename);
- #endif
- CCellRange GetCellRange() const;
- CCellRange GetSelectedCellRange() const;
- void SetSelectedRange(const CCellRange& Range, BOOL bForceRepaint = FALSE);
- void SetSelectedRange(int nMinRow, int nMinCol, int nMaxRow, int nMaxCol,
- BOOL bForceRepaint = FALSE);
- BOOL IsValid(int nRow, int nCol) const;
- BOOL IsValid(const CCellID& cell) const;
- BOOL IsValid(const CCellRange& range) const;
- #ifndef GRIDCONTROL_NO_CLIPBOARD
-
- virtual void CutSelectedText();
- virtual COleDataSource* CopyTextFromGrid();
- virtual BOOL PasteTextToGrid(CCellID cell, COleDataObject* pDataObject);
- #endif
- #ifndef GRIDCONTROL_NO_DRAGDROP
- void OnBeginDrag();
- DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
- DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
- void OnDragLeave();
- BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
- #endif
- #ifndef GRIDCONTROL_NO_CLIPBOARD
- virtual void OnEditCut();
- virtual void OnEditCopy();
- virtual void OnEditPaste();
- #endif
- virtual void OnEditSelectAll();
- CCellID GetNextItem(CCellID& cell, int nFlags) const;
- BOOL SortTextItems(int nCol, BOOL bAscending);
- BOOL SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data = 0);
-
-
- protected:
- virtual void PreSubclassWindow();
-
- #if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
- public:
- virtual void OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo);
- virtual void OnPrint(CDC *pDC, CPrintInfo *pInfo);
- virtual void OnEndPrinting(CDC *pDC, CPrintInfo *pInfo);
- #endif
- public:
- virtual ~CGridCtrl();
- protected:
- BOOL RegisterWindowClass();
- LRESULT SendMessageToParent(int nRow, int nCol, int nMessage);
- BOOL InvalidateCellRect(const CCellID& cell);
- BOOL InvalidateCellRect(const CCellRange& cellRange);
- void EraseBkgnd(CDC* pDC);
- BOOL GetCellRangeRect(const CCellRange& cellRange, LPRECT lpRect) const;
- CGridCell* GetCell(int nRow, int nCol) const;
- BOOL SetCell(int nRow, int nCol, CGridCell* pCell);
- int SetMouseMode(int nMode) { int nOldMode = m_MouseMode; m_MouseMode = nMode; return nOldMode; }
- int GetMouseMode() const { return m_MouseMode; }
- BOOL MouseOverRowResizeArea(CPoint& point) const;
- BOOL MouseOverColumnResizeArea(CPoint& point) const;
- CCellID GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck = TRUE) const;
- CCellID GetTopleftNonFixedCell() const;
- CCellRange GetUnobstructedNonFixedCellRange() const;
- CCellRange GetVisibleNonFixedCellRange(LPRECT pRect = NULL) const;
- CCellID SetFocusCell(CCellID cell);
- CCellID SetFocusCell(int nRow, int nCol);
- void ResetSelectedRange();
- void ResetScrollBars();
- int GetScrollPos32(int nBar, BOOL bGetTrackPos = FALSE);
- BOOL SetScrollPos32(int nBar, int nPos, BOOL bRedraw = TRUE);
- BOOL SortTextItems(int nCol, BOOL bAscending, int low, int high);
- BOOL SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data,
- int low, int high);
- protected:
-
- #if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
- virtual void PrintColumnHeadings(CDC *pDC, CPrintInfo *pInfo);
- virtual void PrintHeader(CDC *pDC, CPrintInfo *pInfo);
- virtual void PrintFooter(CDC *pDC, CPrintInfo *pInfo);
- #endif
- #ifndef GRIDCONTROL_NO_DRAGDROP
-
- virtual CImageList* CreateDragImage(CPoint *pHotSpot);
- #endif
-
- virtual void OnFixedColumnClick(CCellID& cell);
- virtual void OnFixedRowClick(CCellID& cell);
-
- virtual CSize GetCellExtent(int nRow, int nCol, CDC* pDC);
- virtual void OnEndEditCell(int nRow, int nCol, CString str);
- virtual void OnEditCell(int nRow, int nCol, UINT nChar);
- virtual void CreateInPlaceEditControl(CRect& rect, DWORD dwStyle, UINT nID,
- int nRow, int nCol,
- LPCTSTR szText, int nChar);
-
- virtual void OnDraw(CDC* pDC);
- virtual BOOL DrawFixedCell(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBk=FALSE);
- virtual BOOL DrawCell(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBk=FALSE);
-
- virtual CGridCell* CreateCell(int nRow, int nCol);
- virtual void EmptyCell(CGridCell* pCell, int nRow, int nCol);
- protected:
-
- COLORREF m_crTextColour, m_crTextBkColour, m_crBkColour,
- m_crFixedTextColour, m_crFixedBkColour, m_crGridColour;
- COLORREF m_crWindowText, m_crWindowColour, m_cr3DFace,
- m_crShadow;
- int m_nGridLines;
- BOOL m_bEditable;
- BOOL m_bModified;
- BOOL m_bAllowDragAndDrop;
- BOOL m_bListMode;
- BOOL m_bSingleRowSelection;
- BOOL m_bAllowDraw;
- BOOL m_bEnableSelection;
- BOOL m_bSortOnClick;
- BOOL m_bHandleTabKey;
- BOOL m_bDoubleBuffer;
- BOOL m_bTitleTips;
-
- int m_nRows, m_nFixedRows, m_nCols, m_nFixedCols;
- CUIntArray m_arRowHeights, m_arColWidths;
- int m_nMargin;
- int m_nDefCellWidth, m_nDefCellHeight;
- int m_nVScrollMax, m_nHScrollMax;
-
- LOGFONT m_Logfont;
- CFont m_PrinterFont,
- m_Font;
- CImageList* m_pImageList;
-
- CTypedPtrArray<CObArray, GRID_ROW*> m_RowData;
-
- int m_MouseMode;
- CPoint m_LeftClickDownPoint, m_LastMousePoint;
- CCellID m_LeftClickDownCell, m_SelectionStartCell;
- CCellID m_idCurrentCell;
- int m_nTimerID;
- int m_nTimerInterval;
- int m_nResizeCaptureRange;
- BOOL m_bAllowRowResize, m_bAllowColumnResize;
- int m_nRowsPerWheelNotch;
- CMap<DWORD,DWORD, CCellID, CCellID&> m_SelectedCellMap, m_PrevSelectedCellMap;
- #ifndef GRIDCONTROL_NO_TITLETIPS
- CTitleTip m_TitleTip;
- #endif
-
- BOOL m_bMustUninitOLE;
- CCellID m_LastDragOverCell;
- #ifndef GRIDCONTROL_NO_DRAGDROP
- CGridDropTarget m_DropTarget;
- #endif
-
- CSize m_CharSize;
- int m_nPageHeight;
- CSize m_LogicalPageSize,
- m_PaperSize;
-
- int m_bAscending;
- int m_SortColumn;
- protected:
- void SelectAllCells();
- void SelectColumns(CCellID currentCell);
- void SelectRows(CCellID currentCell);
- void SelectCells(CCellID currentCell);
- void OnSelecting(const CCellID& currentCell);
-
-
- afx_msg void OnPaint();
- afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
- afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- afx_msg void OnTimer(UINT nIDEvent);
- afx_msg UINT OnGetDlgCode();
- afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
- afx_msg void OnSysColorChange();
- afx_msg void OnCaptureChanged(CWnd *pWnd);
- afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
- afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
- afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
- afx_msg void OnUpdateEditSelectAll(CCmdUI* pCmdUI);
-
- #if (_MFC_VER >= 0x0421) || (_WIN32_WCE >= 210)
- afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
- #endif
- #if !defined(_WIN32_WCE) && (_MFC_VER >= 0x0421)
- afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
- #endif
- afx_msg LRESULT OnSetFont(WPARAM hFont, LPARAM lParam);
- afx_msg LRESULT OnGetFont(WPARAM hFont, LPARAM lParam);
- afx_msg void OnEndInPlaceEdit(NMHDR* pNMHDR, LRESULT* pResult);
- DECLARE_MESSAGE_MAP()
- enum eMouseModes { MOUSE_NOTHING, MOUSE_SELECT_ALL, MOUSE_SELECT_COL, MOUSE_SELECT_ROW,
- MOUSE_SELECT_CELLS, MOUSE_SCROLLING_CELLS,
- MOUSE_OVER_ROW_DIVIDE, MOUSE_SIZING_ROW,
- MOUSE_OVER_COL_DIVIDE, MOUSE_SIZING_COL,
- MOUSE_PREPARE_EDIT,
- #ifndef GRIDCONTROL_NO_DRAGDROP
- MOUSE_PREPARE_DRAG, MOUSE_DRAGGING
- #endif
- };
- };
- inline CGridCell* CGridCtrl::GetCell(int nRow, int nCol) const
- {
- if (nRow < 0 || nRow >= m_nRows || nCol < 0 || nCol >= m_nCols) return NULL;
- GRID_ROW* pRow = m_RowData[nRow];
- if (!pRow) return NULL;
- return pRow->GetAt(nCol);
- }
- inline BOOL CGridCtrl::SetCell(int nRow, int nCol, CGridCell* pCell)
- {
- if (nRow < 0 || nRow >= m_nRows || nCol < 0 || nCol >= m_nCols) return FALSE;
- GRID_ROW* pRow = m_RowData[nRow];
- if (!pRow) return FALSE;
- pRow->SetAt(nCol, pCell);
- return TRUE;
- }
- #endif
|