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.

136 lines
4.4 KiB

  1. /*
  2. *
  3. * @doc INTERNAL
  4. *
  5. * @module _CALLMGR.H CCallMgr declaration |
  6. *
  7. * Purpose: The call manager controls various aspects of
  8. * a client call chain, including re-entrancy management,
  9. * undo contexts, and change notifications.
  10. *
  11. * Author: <nl>
  12. * alexgo 2/8/96
  13. *
  14. * Copyright (c) 1995-1998, Microsoft Corporation. All rights reserved.
  15. */
  16. #ifndef _CALLMGR_H
  17. #define _CALLMGR_H
  18. class CTxtEdit;
  19. class CCallMgr;
  20. #include "textserv.h"
  21. enum CompName
  22. {
  23. COMP_UNDOBUILDER = 1, // currently, these two are only compatible
  24. COMP_REDOBUILDER = 2, // with CGenUndoBuilder undo contexts
  25. COMP_UNDOGUARD = 3,
  26. COMP_SELPHASEADJUSTER = 4
  27. };
  28. /*
  29. * IReEntrantComponent
  30. *
  31. * @class A base class/interface for objects that want to work with the call
  32. * manager for special re-entrancy requirements.
  33. *
  34. * This class is similar in spirit to ITxNotify, thus, it contains
  35. * private data only accessible to CCallMgr
  36. */
  37. class IReEntrantComponent
  38. {
  39. friend class CCallMgr;
  40. //@access Public Data
  41. public:
  42. virtual void OnEnterContext() = 0; //@cmember Called when a
  43. // context is entered
  44. //@access Private Data
  45. private:
  46. CompName _idName; //@cmember Name for this component
  47. IReEntrantComponent * _pnext; //@cmember Next one in list
  48. };
  49. /*
  50. *
  51. * CCallMgr
  52. *
  53. * @class A stack-based class to handle re-entrancy and notification
  54. * management. CCallMgr's are created on the stack on every
  55. * important entry point. If one already exists (i.e. the
  56. * edit control has been re-entered), the Call Manager will
  57. * adjust appropriately.
  58. */
  59. class CCallMgr
  60. {
  61. friend class CGenUndoBuilder;
  62. //@access Public Methods
  63. public:
  64. // Notification Methods
  65. void SetChangeEvent(CHANGETYPE fType); //@cmember Something changed
  66. void ClearChangeEvent(); //@cmember Ignore change
  67. //@cmember Did something change?
  68. BOOL GetChangeEvent() {return _pPrevcallmgr ?
  69. _pPrevcallmgr->GetChangeEvent() : _fChange;}
  70. BOOL GetMaxText() {return _pPrevcallmgr ?
  71. _pPrevcallmgr->GetMaxText() : _fMaxText;}
  72. BOOL GetOutOfMemory() {return _pPrevcallmgr ?
  73. _pPrevcallmgr->GetOutOfMemory() : _fOutOfMemory;}
  74. void SetNewUndo(); //@cmember New undo action added
  75. void SetNewRedo(); //@cmember New redo action added
  76. void SetMaxText(); //@cmember Max text length reached
  77. void SetSelectionChanged(); //@cmember Selection changed
  78. void SetOutOfMemory(); //@cmember Out of memory hit
  79. void SetInProtected(BOOL f); //@cmember Set if in protected
  80. // notification callback
  81. BOOL GetInProtected(); //@cmember Get InProtected flag
  82. // SubSystem Management methods
  83. //@cmember Register a component
  84. // for this call context
  85. void RegisterComponent(IReEntrantComponent *pcomp, CompName name);
  86. //@cmember Revoke a component from
  87. // this call context
  88. void RevokeComponent(IReEntrantComponent *pcomp);
  89. IReEntrantComponent *GetComponent(CompName name);//@cmember Get registered
  90. // component by name
  91. // General Methods
  92. BOOL IsReEntered() { return !!_pPrevcallmgr;} //@cmember Return TRUE if
  93. // in a re-entrant state
  94. BOOL IsZombie() { return !_ped;} //@cmember Zombie call
  95. // Constructor/Destructor
  96. CCallMgr(CTxtEdit *ped); //@cmember constructor
  97. ~CCallMgr(); //@cmember destructor
  98. //@access Private Methods and data
  99. private:
  100. void SendAllNotifications(); //@cmember Flush any cached
  101. // notifications
  102. void NotifyEnterContext(); //@cmember Notify registered
  103. // components of a new context.
  104. CTxtEdit * _ped; //@cmember Current edit context
  105. CCallMgr * _pPrevcallmgr; //@cmember Next highest call mgr
  106. IReEntrantComponent *_pcomplist; //@cmember List of components
  107. // registered for this call context
  108. unsigned long _fTextChanged :1; //@cmember Text changed
  109. unsigned long _fChange :1; //@cmember Generic change
  110. unsigned long _fNewUndo :1; //@cmember New undo action added
  111. unsigned long _fNewRedo :1; //@cmember New redo action added
  112. unsigned long _fMaxText :1; //@cmember Max text length reached
  113. unsigned long _fSelChanged :1; //@cmember Selection changed
  114. unsigned long _fOutOfMemory :1; //@cmember Out of memory
  115. unsigned long _fInProtected :1; //@cmember if in EN_PROTECTED not.
  116. };
  117. #endif // _CALLMGR_H