home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / MFC / SAMPLES / CHKBOOK / ROWVIEW.H_ / ROWVIEW.H
Encoding:
C/C++ Source or Header  |  1993-02-08  |  2.9 KB  |  80 lines

  1. // rowview.h : interface of the CRowView class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and Microsoft
  9. // QuickHelp and/or WinHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13.  
  14. // This class implements the behavior of a scrolling view that presents
  15. // multiple rows of fixed-height data.  A row view is similar to an
  16. // owner-draw listbox in its visual behavior; but unlike listboxes,
  17. // a row view has all of the benefits of a view (as well as scroll view),
  18. // including perhaps most importantly printing and print preview.
  19. /////////////////////////////////////////////////////////////////////////////
  20.  
  21. class CRowView : public CScrollView
  22. {
  23.     DECLARE_DYNAMIC(CRowView)
  24. public:
  25.     CRowView();
  26.  
  27. // Attributes
  28. protected:
  29.     int m_nRowWidth;            // width of row in current device units
  30.     int m_nRowHeight;           // height of row in current device untis
  31.     int m_nPrevSelectedRow;     // index of the most recently selected row
  32.     int m_nPrevRowCount;        // most recent row count, before update
  33.     int m_nRowsPerPrintedPage;  // how many rows fit on a printed page
  34.  
  35. // Operations
  36. public:
  37.     virtual void UpdateRow(int nInvalidRow);    // called by derived class's 
  38.                                                 // OnUpdate
  39.  
  40. // Overridables
  41. protected:
  42.     virtual void GetRowWidthHeight(CDC* pDC, int& nRowWidth, 
  43.         int& nRowHeight) = 0;
  44.     virtual int GetActiveRow() = 0;
  45.     virtual int GetRowCount() = 0;
  46.     virtual void OnDrawRow(CDC* pDC, int nRow, int y, BOOL bSelected) = 0;
  47.     virtual void ChangeSelectionNextRow(BOOL bNext) = 0;
  48.     virtual void ChangeSelectionToRow(int nRow) = 0;
  49.  
  50. // Implementation
  51. protected:
  52.     // standard overrides of MFC classes
  53.     void OnInitialUpdate();
  54.     virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  55.     virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
  56.     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  57.     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  58.     virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
  59.  
  60.     virtual void CalculateRowMetrics(CDC* pDC)
  61.         { GetRowWidthHeight(pDC, m_nRowWidth, m_nRowHeight); }
  62.     virtual void UpdateScrollSizes();
  63.     virtual CRect RowToWndRect(CDC* pDC, int nRow);
  64.     virtual int RowToYPos(int nRow);
  65.     virtual void RectLPtoRowRange(const CRect& rectLP, 
  66.             int& nFirstRow, int& nLastRow, BOOL bIncludePartiallyShownRows);
  67.     virtual int LastViewableRow();
  68.     virtual ~CRowView();
  69.  
  70. // Generated message map functions
  71. protected:
  72.     //{{AFX_MSG(CRowView)
  73.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  74.     afx_msg void OnSize(UINT nType, int cx, int cy);
  75.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  76.     //}}AFX_MSG
  77.     DECLARE_MESSAGE_MAP()
  78. };
  79.  
  80.