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.

186 lines
4.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: favui.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // favui.h - favorites UI header
  11. #ifndef _FAVUI_H_
  12. #define _FAVUI_H_
  13. #include "trobimpl.h"
  14. #include "mmcres.h"
  15. class CAddFavDialog : public CDialog
  16. {
  17. public:
  18. enum { IDD = IDD_ADDFAVORITE };
  19. CAddFavDialog(LPCTSTR szName, CFavorites* pFavorites, CWnd* pParent = NULL);
  20. ~CAddFavDialog();
  21. HRESULT CreateFavorite(CFavObject** ppfavRet);
  22. protected:
  23. // method overrides
  24. virtual BOOL OnInitDialog();
  25. virtual void OnOK();
  26. afx_msg void OnAddFolder();
  27. afx_msg void OnChangeName();
  28. IMPLEMENT_CONTEXT_HELP(g_aHelpIDs_IDD_ADDFAVORITE);
  29. DECLARE_MESSAGE_MAP()
  30. CTreeObserverTreeImpl m_FavTree;
  31. CEdit m_FavName;
  32. CFavorites* m_pFavorites;
  33. LONG_PTR m_lAdviseCookie;
  34. HRESULT m_hr;
  35. CFavObject* m_pfavItem;
  36. CString m_strName;
  37. };
  38. class CAddFavGroupDialog : public CDialog
  39. {
  40. public:
  41. enum { IDD = IDD_NEWFAVFOLDER };
  42. CAddFavGroupDialog(CWnd* pParent);
  43. ~CAddFavGroupDialog();
  44. LPCTSTR GetGroupName() { return m_strName; }
  45. protected:
  46. // method overrides
  47. virtual BOOL OnInitDialog();
  48. virtual void OnOK();
  49. IMPLEMENT_CONTEXT_HELP(g_aHelpIDs_IDD_NEWFAVFOLDER);
  50. DECLARE_MESSAGE_MAP()
  51. afx_msg void OnChangeName();
  52. CEdit m_GrpName;
  53. TCHAR m_strName[MAX_PATH];
  54. };
  55. class COrganizeFavDialog : public CDialog
  56. {
  57. public:
  58. enum { IDD = IDD_FAVORGANIZE };
  59. COrganizeFavDialog(CFavorites* pFavorites, CWnd* pParent = NULL);
  60. ~COrganizeFavDialog();
  61. protected:
  62. // method overrides
  63. virtual BOOL OnInitDialog();
  64. virtual void OnOK();
  65. virtual void OnCancel();
  66. afx_msg void OnAddFolder();
  67. afx_msg void OnDelete();
  68. afx_msg void OnRename();
  69. afx_msg void OnMoveTo();
  70. afx_msg void OnSelChanged(NMHDR* pMNHDR, LRESULT* plResult);
  71. afx_msg void OnBeginLabelEdit(NMHDR* pMNHDR, LRESULT* plResult);
  72. afx_msg void OnEndLabelEdit(NMHDR* pMNHDR, LRESULT* plResult);
  73. IMPLEMENT_CONTEXT_HELP(g_aHelpIDs_IDD_FAVORGANIZE);
  74. DECLARE_MESSAGE_MAP()
  75. CTreeObserverTreeImpl m_FavTree;
  76. CStatic m_FavName;
  77. CStatic m_FavInfo;
  78. CFont m_FontBold;
  79. CFavorites* m_pFavorites;
  80. LONG_PTR m_lAdviseCookie;
  81. BOOL m_bRenameMode;
  82. TREEITEMID m_tidRenameItem;
  83. };
  84. class CFavFolderDialog : public CDialog
  85. {
  86. public:
  87. enum { IDD = IDD_FAVSELECTFOLDER };
  88. CFavFolderDialog(CFavorites* pFavorites, CWnd* pParent);
  89. ~CFavFolderDialog();
  90. TREEITEMID GetFolderID() { return m_tidFolder; }
  91. protected:
  92. // method overrides
  93. virtual BOOL OnInitDialog();
  94. virtual void OnOK();
  95. IMPLEMENT_CONTEXT_HELP(g_aHelpIDs_IDD_FAVSELECTFOLDER);
  96. DECLARE_MESSAGE_MAP()
  97. CTreeObserverTreeImpl m_FavTree;
  98. TREEITEMID m_tidFolder;
  99. CFavorites* m_pFavorites;
  100. LONG_PTR m_lAdviseCookie;
  101. };
  102. // Container for CTreeObserverTreeImpl control which makes it a favorites
  103. // tree viewer control. This class attaches the tree control to the
  104. // favorites data source and handles all the necessart notifications from
  105. // the tree control. It sends a MMC message to its parent whenever the tree
  106. // selection changes.
  107. // The primary purpose for this class is to provide a self-contained favorites
  108. // viewer that the node manager can use in a non-MFC dialog.
  109. class CFavTreeCtrl : public CWnd
  110. {
  111. private:
  112. /*
  113. * Make the ctor private so it's only accessible to CreateInstace.
  114. * That way, we can insure that instances of this class can only
  115. * be created in well-known ways (i.e. on the heap). Using this
  116. * technique means that this class can't be used as a base class
  117. * or member of another class, but we can live with those restrictions.
  118. *
  119. * We need to go to this trouble because this class is used (only)
  120. * on the nodemgr side of things, in the Task Wizard. It refers to
  121. * it only by handle (see CAMCView::ScCreateFavoriteObserver), and has
  122. * no access to this class, so it can't delete it. If we make the
  123. * class self-deleting, everything's copasetic.
  124. */
  125. CFavTreeCtrl() {}
  126. public:
  127. static CFavTreeCtrl* CreateInstance()
  128. { return (new CFavTreeCtrl); }
  129. SC ScInitialize(CFavorites* pFavorites, DWORD dwStyles);
  130. DECLARE_MESSAGE_MAP()
  131. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  132. afx_msg void OnSize(UINT nType, int cx, int cy);
  133. afx_msg void OnSetFocus(CWnd* pOldWnd);
  134. afx_msg void OnSelChanged(NMHDR* pMNHDR, LRESULT* plResult);
  135. virtual void PostNcDestroy();
  136. private:
  137. enum {IDC_FAVTREECTRL = 1000};
  138. CTreeObserverTreeImpl m_FavTree;
  139. };
  140. #endif // _FAVUI_H_