Leaked source code of windows server 2003
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.

151 lines
3.4 KiB

  1. /* @doc INTERNAL
  2. *
  3. * @module _DFREEZE.H Classes handle freezing the display |
  4. *
  5. * This module declares class used by logic to handle freezing the display
  6. *
  7. * History: <nl>
  8. * 2/8/96 ricksa Created
  9. *
  10. * Copyright (c) 1995-1997, Microsoft Corporation. All rights reserved.
  11. */
  12. #ifndef _DFREEZE_H
  13. #define _DFREEZE_H
  14. /*
  15. * CAccumDisplayChanges
  16. *
  17. * @class This class is used to accumulate of all update to the display so
  18. * so that at a later time the display can ask to be updated to
  19. * reflect all the previous updates.
  20. */
  21. class CAccumDisplayChanges
  22. {
  23. //@access Public Methods
  24. public:
  25. CAccumDisplayChanges(); //@cmember Constructor
  26. ~CAccumDisplayChanges(); //@cmember Destructor
  27. void AddRef(); //@cmember Add a reference
  28. LONG Release(); //@cmember Release a reference
  29. void UpdateRecalcRegion( //@cmember Update the region
  30. LONG cp, // for recalc
  31. LONG cchDel,
  32. LONG cchNew);
  33. void GetUpdateRegion( //@cmember Get the update
  34. LONG *pcpStart, // region
  35. LONG *pcchNew,
  36. LONG *pcchDel,
  37. BOOL *pfUpdateCaret = NULL,
  38. BOOL *pfScrollIntoView = NULL,
  39. BOOL *pfRedisplayOnThaw = NULL);
  40. void SaveUpdateCaret( //@cmember Save update
  41. BOOL fScrollIntoView); // caret state
  42. void SetNeedRedisplayOnThaw(BOOL fNeedRedisplay)
  43. {
  44. _fNeedRedisplay = fNeedRedisplay;
  45. }
  46. //@access Private Data
  47. private:
  48. LONG _cRefs; //@cmember Reference count
  49. LONG _cpMin; //@cmember Min cp of change w.r.t.
  50. // original text array
  51. LONG _cpMax; //@cmember Max cp of change w.r.t.
  52. // original text array
  53. LONG _delta; //@cmember net # of chars changed
  54. BOOL _fUpdateCaret:1; //@cmember Whether update
  55. // caret required
  56. BOOL _fScrollIntoView:1; //@cmember first parm to
  57. BOOL _fNeedRedisplay:1; //@cmember redisplay entire control on thaw
  58. };
  59. /*
  60. * CAccumDisplayChanges::CAccumDisplayChanges()
  61. *
  62. * @mfunc
  63. * Initialize object for accumulating display changes
  64. */
  65. inline CAccumDisplayChanges::CAccumDisplayChanges()
  66. : _cRefs(1), _cpMin(CP_INFINITE), _fUpdateCaret(FALSE)
  67. {
  68. // Header does all the work
  69. }
  70. /*
  71. * CAccumDisplayChanges::~CAccumDisplayChanges()
  72. *
  73. * @mfunc
  74. * Free object
  75. *
  76. * @devnote:
  77. * This only serves a purpose in debug mode
  78. *
  79. */
  80. inline CAccumDisplayChanges::~CAccumDisplayChanges()
  81. {
  82. // Nothing to clean up
  83. }
  84. /*
  85. * CAccumDisplayChanges::~CAccumDisplayChanges()
  86. *
  87. * @mfunc
  88. * Add another reference to this object
  89. */
  90. inline void CAccumDisplayChanges::AddRef()
  91. {
  92. ++_cRefs;
  93. }
  94. /*
  95. * CAccumDisplayChanges::Release()
  96. *
  97. * @mfunc
  98. * Release a reference to this object
  99. *
  100. * @rdesc
  101. * 0 - no more references
  102. * ~0 - there are still outstanding references
  103. *
  104. * @devnote:
  105. * If 0 is returned the information should be retrieved from
  106. * this object and passed on to the display so that it can
  107. * update itself.
  108. *
  109. */
  110. inline LONG CAccumDisplayChanges::Release()
  111. {
  112. // When the reference count is 0, it is time to update the display.
  113. return --_cRefs;
  114. }
  115. /*
  116. * CAccumDisplayChanges::SaveUpdateCaret()
  117. *
  118. * @mfunc
  119. * Save parameters for update caret
  120. */
  121. inline void CAccumDisplayChanges::SaveUpdateCaret(
  122. BOOL fScrollIntoView) //@parm First parm for UpdateCaret
  123. {
  124. _fUpdateCaret = TRUE;
  125. if (!_fScrollIntoView)
  126. _fScrollIntoView = fScrollIntoView;
  127. }
  128. #endif // _DFREEZE_H