Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
5.4 KiB

  1. /*******************************************************************************
  2. *
  3. * rowview.h
  4. *
  5. * interface of the CRowView class and CRowViewHeaderBar class
  6. *
  7. * Modified from the Microsoft Foundation Classes C++ library.
  8. * Copyright (C) 1992 Microsoft Corporation
  9. * All rights reserved.
  10. *
  11. * This class implements the behavior of a scrolling view that presents
  12. * multiple rows of fixed-height data. A row view is similar to an
  13. * owner-draw listbox in its visual behavior; but unlike listboxes,
  14. * a row view has all of the benefits of a view (as well as scroll view),
  15. * including perhaps most importantly printing and print preview.
  16. *
  17. * additional copyright notice: Copyright 1995, Citrix Systems Inc.
  18. *
  19. * Citrix modifications include optional horizontal scrolling header bar
  20. * (derived from MFC CStatusBar class) and horizontal scrolling keyboard
  21. * control.
  22. *
  23. * $Author: butchd $ Butch Davis
  24. *
  25. * $Log: N:\NT\PRIVATE\UTILS\CITRIX\WINUTILS\COMMON\VCS\ROWVIEW.H $
  26. *
  27. * Rev 1.1 18 Jul 1995 06:50:16 butchd
  28. * Scrolling fix for Windows95 / MFC 3.0
  29. *
  30. * Rev 1.0 01 Mar 1995 10:54:50 butchd
  31. * Initial revision.
  32. *
  33. * Rev 1.0 02 Aug 1994 18:18:34 butchd
  34. * (Initial revision: was duplicated in each app directory).
  35. *
  36. *******************************************************************************/
  37. #define IDW_HEADER_BAR 100
  38. ////////////////////////////////////////////////////////////////////////////////
  39. // CRowViewHeaderBar class
  40. //
  41. class CRowViewHeaderBar : public CStatusBar
  42. {
  43. DECLARE_DYNAMIC(CRowViewHeaderBar)
  44. /*
  45. * Member variables.
  46. */
  47. public:
  48. CView * m_pView;
  49. /*
  50. * Implementation
  51. */
  52. public:
  53. CRowViewHeaderBar();
  54. virtual ~CRowViewHeaderBar();
  55. /*
  56. * Overrides of MFC CStatusBar class
  57. */
  58. protected:
  59. virtual void DoPaint(CDC* pDC);
  60. /*
  61. * Message map / commands.
  62. */
  63. protected:
  64. //{{AFX_MSG(CRowViewHeaderBar)
  65. #if _MFC_VER >= 0x400
  66. afx_msg void OnPaint();
  67. #endif
  68. //}}AFX_MSG
  69. DECLARE_MESSAGE_MAP()
  70. }; // end CRowViewHeaderBar class interface
  71. ////////////////////////////////////////////////////////////////////////////////
  72. ////////////////////////////////////////////////////////////////////////////////
  73. // CRowView class
  74. //
  75. class CRowView : public CScrollView
  76. {
  77. DECLARE_DYNAMIC(CRowView)
  78. /*
  79. * Member variables.
  80. */
  81. protected:
  82. int m_nRowWidth; // width of row in current device units
  83. int m_nRowHeight; // height of row in current device untis
  84. int m_nPrevSelectedRow; // index of the most recently selected row
  85. int m_nPrevRowCount; // most recent row count, before update
  86. int m_nPageScrollRows; // # rows to PageUp/PageDown scroll (>=1).
  87. int m_nRowsPerPrintedPage; // how many rows fit on a printed page
  88. BOOL m_bThumbTrack; // Flag to handle SB_THUMBTRACK or not.
  89. CRowViewHeaderBar * m_pHeaderBar; // Optional header bar.
  90. /*
  91. * Implementation
  92. */
  93. public:
  94. CRowView();
  95. protected:
  96. virtual ~CRowView();
  97. BOOL CreateHeaderBar();
  98. /*
  99. * Mandantory overridables (must be overridden in the CRowView derived class)
  100. */
  101. protected:
  102. virtual void GetRowWidthHeight( CDC* pDC, int& nRowWidth,
  103. int& nRowHeight ) = 0;
  104. virtual int GetActiveRow() = 0;
  105. virtual int GetRowCount() = 0;
  106. virtual void OnDrawRow( CDC* pDC, int nRow, int y, BOOL bSelected ) = 0;
  107. virtual void ChangeSelectionNextRow( BOOL bNext ) = 0;
  108. virtual void ChangeSelectionToRow( int nRow ) = 0;
  109. /*
  110. * Optional overridables (must be overridden in the CRowView derived class if
  111. * a header bar is desired).
  112. */
  113. public:
  114. virtual void OnDrawHeaderBar( CDC* pDC, int y ) = 0;
  115. /*
  116. * Optional overridables (may be overridden in the CRowView derived class)
  117. */
  118. public:
  119. virtual void ResetHeaderBar();
  120. /*
  121. * Overrides of MFC CScrollView class
  122. */
  123. public:
  124. void OnScroll(int nBar, UINT nSBCode, UINT nPos);
  125. /*
  126. * Overrides of MFC CView class
  127. */
  128. void OnInitialUpdate();
  129. virtual void OnPrepareDC( CDC* pDC, CPrintInfo* pInfo = NULL );
  130. virtual void OnDraw( CDC* pDC );
  131. virtual BOOL OnPreparePrinting( CPrintInfo* pInfo );
  132. virtual void OnBeginPrinting( CDC* pDC, CPrintInfo* pInfo );
  133. virtual void OnPrint( CDC* pDC, CPrintInfo* pInfo );
  134. /*
  135. * Operations
  136. */
  137. protected:
  138. virtual void UpdateRow( int nInvalidRow );
  139. BOOL IsScrollingNeeded( int nBar );
  140. #ifndef MFC300
  141. int GetScrollLimit( int nBar );
  142. #endif
  143. virtual void CalculateRowMetrics( CDC* pDC );
  144. virtual void UpdateScrollSizes();
  145. virtual int RowToYPos( int nRow );
  146. virtual CRect RowToWndRect( CDC* pDC, int nRow );
  147. virtual int LastViewableRow();
  148. virtual void RectLPtoRowRange( const CRect& rectLP,
  149. int& nFirstRow,
  150. int& nLastRow,
  151. BOOL bIncludePartiallyShownRows );
  152. /*
  153. * Message map / commands
  154. */
  155. protected:
  156. //{{AFX_MSG(CRowView)
  157. afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
  158. afx_msg void OnSize( UINT nType, int cx, int cy );
  159. afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
  160. afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  161. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  162. afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  163. //}}AFX_MSG
  164. DECLARE_MESSAGE_MAP()
  165. }; // end CRowView class interface
  166. ////////////////////////////////////////////////////////////////////////////////