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.

130 lines
3.4 KiB

  1. #ifndef __PLACE_H
  2. #define __PLACE_H
  3. class CPlaceCollection;
  4. class CMarsWindow;
  5. class CMarsDocument;
  6. class CMarsPanel;
  7. #include "pandef.h"
  8. class CPlacePanel
  9. {
  10. protected:
  11. CComBSTR m_bstrName;
  12. PANEL_PERSIST_VISIBLE m_PersistVisible;
  13. BOOL m_fWasVisible;
  14. public:
  15. CPlacePanel( MarsAppDef_PlacePanel* pp );
  16. VARIANT_BOOL ShowOnTransition( CMarsPanel *pPanel );
  17. void SaveLayout( class CMarsPanel* pPanel );
  18. CComBSTR &GetName() { return m_bstrName; }
  19. };
  20. typedef CSimpleArray<CPlacePanel *> CPlacePanelArray;
  21. class CPlacePanelCollection : public CPlacePanelArray
  22. {
  23. public:
  24. ~CPlacePanelCollection();
  25. };
  26. class CMarsPlace :
  27. public CMarsComObject,
  28. public MarsIDispatchImpl<IMarsPlace, &IID_IMarsPlace>
  29. {
  30. friend CPlaceCollection;
  31. CMarsPlace(CPlaceCollection *pParent, CMarsDocument *pMarsDocument);
  32. HRESULT DoPassivate();
  33. protected:
  34. virtual ~CMarsPlace() {}
  35. public:
  36. HRESULT Init(LPCWSTR pwszName);
  37. // IUnknown
  38. STDMETHOD_(ULONG, AddRef)();
  39. STDMETHOD_(ULONG, Release)();
  40. STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
  41. // IMarsPlace
  42. STDMETHODIMP get_name(/* out, retval */ BSTR *pbstrName);
  43. STDMETHODIMP transitionTo();
  44. HRESULT TranslateAccelerator(MSG *pMsg);
  45. BSTR GetName() { return m_bstrName; }
  46. HRESULT DoTransition();
  47. HRESULT AddPanel(CPlacePanel *pPlacePanel);
  48. void SaveLayout(void);
  49. protected:
  50. CComClassPtr<CPlaceCollection> m_spPlaceCollection;
  51. CComClassPtr<CMarsDocument> m_spMarsDocument;
  52. CComBSTR m_bstrName;
  53. // Each place has a set of panels that it would like to be visible
  54. CPlacePanelCollection m_PlacePanels;
  55. };
  56. typedef CSimpleArray<CMarsPlace *> CMarsPlaceArray;
  57. typedef MarsIDispatchImpl<IMarsPlaceCollection, &IID_IMarsPlaceCollection> IMarsPlaceCollectionImpl;
  58. class CPlaceCollection :
  59. public CMarsComObject,
  60. public IMarsPlaceCollectionImpl,
  61. protected CMarsPlaceArray
  62. {
  63. friend CMarsDocument;
  64. CPlaceCollection( CMarsDocument *pMarsDocument );
  65. HRESULT DoPassivate();
  66. protected:
  67. virtual ~CPlaceCollection() { ATLASSERT(GetSize() == 0); }
  68. public:
  69. // IUnknown
  70. STDMETHOD_(ULONG, AddRef)();
  71. STDMETHOD_(ULONG, Release)();
  72. STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
  73. // IDispatch
  74. IMPLEMENT_IDISPATCH_DELEGATE_TO_BASE(IMarsPlaceCollectionImpl);
  75. // IMarsPlaceCollection
  76. STDMETHODIMP place(/* in */ BSTR bstrName, /* out, retval */ IMarsPlace **ppMarsPlace);
  77. STDMETHODIMP get_currentPlace(/* out, retval */ IMarsPlace **ppMarsPlace);
  78. STDMETHODIMP transitionTo(/* in */ BSTR bstrName);
  79. CMarsDocument *Document() { ATLASSERT(m_spMarsDocument); return m_spMarsDocument; }
  80. HRESULT AddPlace(LPCWSTR pwszName, CMarsPlace **ppPlace);
  81. void FreePlaces();
  82. HRESULT GetPlace(LPCWSTR pwszName, /*optional*/ CMarsPlace **ppPlace);
  83. HRESULT FindPlaceIndex(LPCWSTR pwszName, long *plIndex);
  84. void OnPanelReady();
  85. CMarsPlace *GetCurrentPlace() { return (m_lCurrentPlaceIndex != -1) ? (*this)[m_lCurrentPlaceIndex] : NULL; }
  86. protected:
  87. CComClassPtr<CMarsDocument> m_spMarsDocument;
  88. long m_lCurrentPlaceIndex;
  89. long m_lOldPlaceIndex;
  90. };
  91. #endif