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.

141 lines
3.5 KiB

  1. /*--------------------------------------------------------------------------*
  2. *
  3. * Microsoft Windows
  4. * Copyright (C) Microsoft Corporation, 1992 - 1999
  5. *
  6. * File: tbtrack.h
  7. *
  8. * Contents: Interface file for CToolbarTracker
  9. *
  10. * History: 15-May-98 JeffRo Created
  11. *
  12. *--------------------------------------------------------------------------*/
  13. #if !defined(AFX_TBTRACK_H__E1BC376B_EAB5_11D1_8080_0000F875A9CE__INCLUDED_)
  14. #define AFX_TBTRACK_H__E1BC376B_EAB5_11D1_8080_0000F875A9CE__INCLUDED_
  15. #if _MSC_VER >= 1000
  16. #pragma once
  17. #endif // _MSC_VER >= 1000
  18. #include "subclass.h" // for CSubclasser
  19. class CMMCToolBarCtrlEx;
  20. class CRebarWnd;
  21. class CToolbarTracker;
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CToolbarTrackerAuxWnd window
  24. class CToolbarTrackerAuxWnd : public CWnd
  25. {
  26. friend class CToolbarTracker;
  27. friend class std::auto_ptr<CToolbarTrackerAuxWnd>;
  28. typedef std::vector<CMMCToolBarCtrlEx*> ToolbarVector;
  29. private:
  30. // only created and destroyed by CToolbarTracker
  31. CToolbarTrackerAuxWnd(CToolbarTracker* pTracker);
  32. virtual ~CToolbarTrackerAuxWnd();
  33. bool BeginTracking();
  34. void EndTracking();
  35. public:
  36. enum
  37. {
  38. ID_CMD_NEXT_TOOLBAR = 0x5300, // could be anything
  39. ID_CMD_PREV_TOOLBAR,
  40. ID_CMD_NOP,
  41. };
  42. public:
  43. void TrackToolbar (CMMCToolBarCtrlEx* pwndNewToolbar);
  44. CMMCToolBarCtrlEx* GetTrackedToolbar() const
  45. { return (m_pTrackedToolbar); }
  46. // Overrides
  47. // ClassWizard generated virtual function overrides
  48. //{{AFX_VIRTUAL(CToolbarTrackerAuxWnd)
  49. public:
  50. virtual BOOL PreTranslateMessage(MSG* pMsg);
  51. //}}AFX_VIRTUAL
  52. // Generated message map functions
  53. protected:
  54. //{{AFX_MSG(CToolbarTrackerAuxWnd)
  55. //}}AFX_MSG
  56. protected:
  57. afx_msg void OnNextToolbar ();
  58. afx_msg void OnPrevToolbar ();
  59. afx_msg void OnNop ();
  60. DECLARE_MESSAGE_MAP()
  61. private:
  62. const CAccel& GetTrackAccel ();
  63. CMMCToolBarCtrlEx* GetToolbar (CMMCToolBarCtrlEx* pCurrentToolbar, bool fNext);
  64. void EnumerateToolbars (CRebarWnd* pRebar);
  65. CToolbarTracker* const m_pTracker;
  66. CMMCToolBarCtrlEx* m_pTrackedToolbar;
  67. ToolbarVector m_vToolbars;
  68. bool m_fMessagesHooked;
  69. };
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CToolbarTracker window
  72. class CToolbarTracker : public CObject
  73. {
  74. public:
  75. CToolbarTracker(CWnd* pMainFrame);
  76. virtual ~CToolbarTracker();
  77. bool BeginTracking();
  78. void EndTracking();
  79. bool IsTracking() const
  80. { return (m_pAuxWnd != NULL); }
  81. CToolbarTrackerAuxWnd* GetAuxWnd() const
  82. { return (m_pAuxWnd); }
  83. private:
  84. /*
  85. * CFrameSubclasser
  86. */
  87. class CFrameSubclasser : public CSubclasser
  88. {
  89. HWND m_hwnd;
  90. CToolbarTracker* m_pTracker;
  91. public:
  92. CFrameSubclasser(CToolbarTracker*, CWnd*);
  93. ~CFrameSubclasser();
  94. virtual LRESULT Callback (HWND& hwnd, UINT& msg, WPARAM& wParam,
  95. LPARAM& lParam, bool& fPassMessageOn);
  96. };
  97. private:
  98. CToolbarTrackerAuxWnd* m_pAuxWnd;
  99. CFrameSubclasser m_Subclasser;
  100. bool m_fTerminating;
  101. };
  102. CToolbarTrackerAuxWnd* GetMainAuxWnd();
  103. /////////////////////////////////////////////////////////////////////////////
  104. //{{AFX_INSERT_LOCATION}}
  105. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  106. #endif // !defined(AFX_TBTRACK_H__E1BC376B_EAB5_11D1_8080_0000F875A9CE__INCLUDED_)