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.

219 lines
5.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1994-1994, Microsoft Corporation.
  4. //
  5. // File: wregion.hxx
  6. //
  7. // Contents: Watch region classes used in CLargeTable
  8. //
  9. // Classes: CWatchRegion, CWatchDblList, CWatchIter, CWatchList
  10. //
  11. // History: 19-Jun-95 BartoszM Created
  12. //
  13. //----------------------------------------------------------------------------
  14. #pragma once
  15. #include <querydef.hxx>
  16. //+-------------------------------------------------------------------------
  17. //
  18. // Class: CWatchRegion
  19. //
  20. // Purpose: Stores information about watch regions
  21. //
  22. // History: 19-Jun-95 BartoszM Created
  23. //
  24. //--------------------------------------------------------------------------
  25. class CTableSegment;
  26. class CTableWindow;
  27. class CWatchRegion: public CDoubleLink
  28. {
  29. public:
  30. CWatchRegion (ULONG mode);
  31. HWATCHREGION Handle () const { return (HWATCHREGION) this; }
  32. void SetMode (ULONG mode) { _mode = mode; }
  33. void SetSegment (CTableSegment* pSegment) { _pSegment = pSegment; }
  34. void Set (CI_TBL_CHAPT chapter, CI_TBL_BMK bookmark, long cRows)
  35. {
  36. _chapter = chapter;
  37. _bookmark = bookmark;
  38. _cRows = cRows;
  39. }
  40. void UpdateSegment( CTableSegment * pOld, CTableWindow *pNew,
  41. CI_TBL_BMK bmkNew );
  42. BOOL IsEqual (HWATCHREGION hreg) const { return hreg == (HWATCHREGION) this; }
  43. ULONG Mode() const { return _mode; }
  44. CI_TBL_CHAPT Chapter() const { return _chapter; }
  45. CI_TBL_BMK Bookmark () const { return _bookmark; }
  46. long RowCount () const { return _cRows; }
  47. CTableSegment* Segment () const { return _pSegment; }
  48. BOOL IsInit() const { return _pSegment != 0; }
  49. #ifdef CIEXTMODE
  50. void CiExtDump(void *ciExtSelf);
  51. #endif
  52. private:
  53. ULONG _mode;
  54. CI_TBL_CHAPT _chapter;
  55. CI_TBL_BMK _bookmark;
  56. long _cRows;
  57. CTableSegment* _pSegment; // starting segment
  58. };
  59. //+-------------------------------------------------------------------------
  60. //
  61. // Class: CWatchDblList
  62. //
  63. // Purpose: Double link list of watch regions
  64. //
  65. // History: 19-Jun-95 BartoszM Created
  66. //
  67. //--------------------------------------------------------------------------
  68. class CWatchDblList: public CDoubleList
  69. {
  70. friend class CWatchIter;
  71. public:
  72. void Add ( CWatchRegion* pRegion )
  73. {
  74. _Queue ( pRegion );
  75. }
  76. CWatchRegion* Pop ()
  77. {
  78. return (CWatchRegion*) _Pop();
  79. }
  80. #ifdef CIEXTMODE
  81. void CiExtDump(void *ciExtSelf);
  82. #endif
  83. };
  84. //+-------------------------------------------------------------------------
  85. //
  86. // Class: CWatchList
  87. //
  88. // Purpose: List of watch regions
  89. //
  90. // History: 19-Jun-95 BartoszM Created
  91. //
  92. //--------------------------------------------------------------------------
  93. class CTableSegList;
  94. class CFwdTableSegIter;
  95. class CWatchList: INHERIT_UNWIND
  96. {
  97. friend class CWatchIter;
  98. INLINE_UNWIND(CWatchList);
  99. public:
  100. CWatchList(CTableSegList& segList);
  101. ~CWatchList();
  102. BOOL IsEmpty () const { return _list.IsEmpty(); }
  103. HWATCHREGION NewRegion (ULONG mode);
  104. void BuildRegion ( HWATCHREGION hRegion,
  105. CTableSegment* pSegment,
  106. CI_TBL_CHAPT chapter,
  107. CI_TBL_BMK bookmark,
  108. LONG cRows );
  109. void ChangeMode ( HWATCHREGION hRegion, ULONG mode );
  110. void GetInfo (HWATCHREGION hRegion,
  111. CI_TBL_CHAPT* pChapter,
  112. CI_TBL_BMK* pBookmark,
  113. DBCOUNTITEM* pcRows);
  114. void ShrinkRegionToZero (HWATCHREGION hRegion);
  115. void DeleteRegion (HWATCHREGION hRegion);
  116. void ShrinkRegion ( HWATCHREGION hRegion,
  117. CI_TBL_CHAPT chapter,
  118. CI_TBL_BMK bookmark,
  119. LONG cRows );
  120. void VerifyRegion (HWATCHREGION hRegion)
  121. {
  122. if (hRegion != 0)
  123. FindVerify(hRegion);
  124. }
  125. CWatchRegion* GetRegion (HWATCHREGION hRegion)
  126. {
  127. return (CWatchRegion*) (void *) hRegion;
  128. }
  129. CWatchRegion* FindVerify (HWATCHREGION hRegion);
  130. CWatchRegion* FindRegion (HWATCHREGION hRegion);
  131. inline void Advance (CWatchIter& iter);
  132. inline BOOL AtEnd (CWatchIter& iter);
  133. #if CIDBG==1
  134. void CheckRegionConsistency( CWatchRegion * pRegion );
  135. #endif // CIDBG !=1
  136. #ifdef CIEXTMODE
  137. void CiExtDump(void *ciExtSelf);
  138. #endif
  139. private:
  140. CWatchDblList _list; // list of watch regions
  141. CTableSegList & _segList; // List of table segments
  142. };
  143. //+-------------------------------------------------------------------------
  144. //
  145. // Class: CWatchIter
  146. //
  147. // Purpose: Iterator over watch regions
  148. //
  149. // History: 19-Jun-95 BartoszM Created
  150. //
  151. //--------------------------------------------------------------------------
  152. class CWatchIter: public CForwardIter
  153. {
  154. public:
  155. CWatchIter (CWatchList& list): CForwardIter(list._list) {}
  156. CWatchIter (CWatchDblList& list): CForwardIter(list) {}
  157. CWatchRegion* operator->() { return (CWatchRegion*) _pLinkCur; }
  158. CWatchRegion* Get() { return (CWatchRegion*) _pLinkCur; }
  159. private:
  160. };
  161. inline void CWatchList::Advance (CWatchIter& iter)
  162. {
  163. _list.Advance(iter);
  164. }
  165. inline BOOL CWatchList::AtEnd (CWatchIter& iter)
  166. {
  167. return _list.AtEnd(iter);
  168. }