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.

206 lines
7.7 KiB

  1. #ifndef _DCOMP_H_
  2. #define _DCOMP_H_
  3. #include <cowsite.h>
  4. EXTERN_C IActiveDesktop * g_pActiveDeskAdv;
  5. //
  6. // Whether a particular desktop icon is shown or not depends on whether start panel is on or off.
  7. // So, the individual preferences are persisted in two different registry locations given below!
  8. #define REGSTR_PATH_HIDDEN_DESKTOP_ICONS REGSTR_PATH_EXPLORER TEXT("\\HideDesktopIcons\\%s")
  9. #define REGSTR_VALUE_STARTPANEL TEXT("NewStartPanel")
  10. #define REGSTR_VALUE_CLASSICMENU TEXT("ClassicStartMenu")
  11. #define REGSTR_PATH_HIDDEN_MYCOMP_ICONS REGSTR_PATH_EXPLORER TEXT("\\HideMyComputerIcons")
  12. #define REGSTR_PATH_EXP_SHELLFOLDER REGSTR_PATH_EXPLORER TEXT("\\CLSID\\%s\\ShellFolder")
  13. #define REGVAL_ATTRIBUTES TEXT("Attributes")
  14. // The following array has the two registry sub-locations where the desktop icon on/off data
  15. // is stored based on whether start panel is off/on.
  16. const LPTSTR c_apstrRegLocation[] =
  17. {
  18. REGSTR_VALUE_CLASSICMENU, // Use this if classic menu is on.
  19. REGSTR_VALUE_STARTPANEL // Use this if start panel is on.
  20. };
  21. // Name of the file that holds each icon, and an index for which icon to use in the file
  22. typedef struct tagIconKeys
  23. {
  24. TCHAR szOldFile[MAX_PATH];
  25. int iOldIndex;
  26. TCHAR szNewFile[MAX_PATH];
  27. int iNewIndex;
  28. }ICONDATA;
  29. extern GUID CLSID_EffectsPage;
  30. // Registry Info for the icons
  31. typedef struct tagIconRegKeys
  32. {
  33. const CLSID* pclsid;
  34. TCHAR szIconValue[16];
  35. int iTitleResource;
  36. int iDefaultTitleResource;
  37. LPCWSTR pszDefault;
  38. int nDefaultIndex;
  39. }ICONREGKEYS;
  40. static const ICONREGKEYS c_aIconRegKeys[] =
  41. {
  42. { &CLSID_MyComputer, TEXT("\0"), 0, IDS_MYCOMPUTER, L"%WinDir%\\explorer.exe", 0},
  43. { &CLSID_MyDocuments, TEXT("\0"), 0, IDS_MYDOCUMENTS2, L"%WinDir%\\system32\\mydocs.dll", 0},
  44. { &CLSID_NetworkPlaces, TEXT("\0"), 0, IDS_NETNEIGHBOUR, L"%WinDir%\\system32\\shell32.dll", 17},
  45. { &CLSID_RecycleBin, TEXT("full"), IDS_FULL, IDS_TRASHFULL, L"%WinDir%\\system32\\shell32.dll", 32},
  46. { &CLSID_RecycleBin, TEXT("empty"), IDS_EMPTY2, IDS_TRASHEMPTY, L"%WinDir%\\system32\\shell32.dll", 31},
  47. };
  48. #define NUM_ICONS (ARRAYSIZE(c_aIconRegKeys))
  49. enum ICON_SIZE_TYPES {
  50. ICON_DEFAULT = 0,
  51. ICON_LARGE = 1,
  52. ICON_INDETERMINATE = 2
  53. };
  54. #define ICON_DEFAULT_SMALL 16
  55. #define ICON_DEFAULT_NORMAL 32
  56. #define ICON_DEFAULT_LARGE 48
  57. typedef struct tagDeskIconId {
  58. int iDeskIconDlgItemId;
  59. LPCWSTR pwszCLSID;
  60. const CLSID *pclsid;
  61. BOOL fCheckNonEnumAttrib;
  62. BOOL fCheckNonEnumPolicy;
  63. } DESKICONID;
  64. // Array if desktop icons we would like to turn-on/off individually
  65. static const DESKICONID c_aDeskIconId[] =
  66. {
  67. {IDC_DESKTOP_ICON_MYDOCS, L"{450D8FBA-AD25-11D0-98A8-0800361B1103}", &CLSID_MyDocuments, TRUE , TRUE }, // My Documents
  68. {IDC_DESKTOP_ICON_MYCOMP, L"{20D04FE0-3AEA-1069-A2D8-08002B30309D}", &CLSID_MyComputer, FALSE , TRUE }, // My Computer
  69. {IDC_DESKTOP_ICON_MYNET, L"{208D2C60-3AEA-1069-A2D7-08002B30309D}", &CLSID_NetworkPlaces, TRUE , TRUE }, // Network Places
  70. {IDC_DESKTOP_ICON_IE, L"{871C5380-42A0-1069-A2EA-08002B30309D}", &CLSID_Internet, TRUE , TRUE } // Internet Explorer
  71. };
  72. // The sub-string that preceeds the CLSID when passed as the property name.
  73. // For example, when "SP_1{645FF040-5081-101B-9F08-00AA002F954E}" is passed as the property name,
  74. // it refers to the recycle icon when StartPage is ON.
  75. //
  76. static const LPWSTR c_awszSP[] =
  77. {
  78. L"SP_0", //Indicates StartPage Off.
  79. L"SP_1", //Indicates StartPage On.
  80. L"POLI" //Indicates that we want the policy info!
  81. };
  82. static const LPWSTR c_wszPropNameFormat = L"%s%s";
  83. #define STARTPAGE_ON_PREFIX c_awszSP[1] //The prefix string for StartPage_On.
  84. #define STARTPAGE_OFF_PREFIX c_awszSP[0] //The prefix string for StartPage_Off.
  85. #define LEN_PROP_PREFIX lstrlenW(c_awszSP[0]) //Length of the prefix string.
  86. #define POLICY_PREFIX c_awszSP[2]
  87. #define NUM_DESKICONS (ARRAYSIZE(c_aDeskIconId))
  88. #ifndef EXCLUDE_COMPPROPSHEET
  89. class CCompPropSheetPage : public CObjectWithSite
  90. , public IAdvancedDialog
  91. {
  92. public:
  93. //////////////////////////////////////////////////////
  94. // Public Interfaces
  95. //////////////////////////////////////////////////////
  96. // *** IUnknown ***
  97. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  98. virtual STDMETHODIMP_(ULONG) AddRef(void);
  99. virtual STDMETHODIMP_(ULONG) Release(void);
  100. // *** IAdvancedDialog ***
  101. virtual STDMETHODIMP DisplayAdvancedDialog(IN HWND hwndParent, IN IPropertyBag * pAdvPage, IN BOOL * pfEnableApply);
  102. CCompPropSheetPage(void);
  103. protected:
  104. int _cRef;
  105. ICONDATA _IconData[NUM_ICONS];
  106. HWND _hwndLV;
  107. BOOL _fAllowAdd;
  108. BOOL _fAllowDel;
  109. BOOL _fAllowEdit;
  110. BOOL _fAllowClose;
  111. BOOL _fAllowReset;
  112. BOOL _fLockDesktopItems;
  113. BOOL _fForceAD;
  114. BOOL _fLaunchGallery; // Did we launch the gallery at any time?
  115. BOOL _fInitialized; // Did we finished adding the items to the list view?
  116. HWND _hWndList; // handle to the list view window
  117. HIMAGELIST _hIconList; // handles to image lists for large icons
  118. BOOL _fCustomizeDesktopOK; // was OK clicked when the customize desktop property sheet dialog was closed?
  119. int _iStartPanelOn;
  120. BOOL _afHideIcon[2][NUM_DESKICONS];
  121. BOOL _afDisableCheckBox[NUM_DESKICONS];
  122. int _iPreviousSelection;
  123. int m_nIndex;
  124. void _AddComponentToLV(COMPONENTA *pcomp);
  125. void _SetUIFromDeskState(BOOL fEmpty);
  126. void _OnInitDialog(HWND hwnd, INT iPage);
  127. void _OnNotify(HWND hwnd, WPARAM wParam, LPNMHDR lpnm);
  128. void _OnCommand(HWND hwnd, WORD wNotifyCode, WORD wID, HWND hwndCtl);
  129. void _OnDestroy(INT iPage);
  130. void _OnGetCurSel(int *piIndex);
  131. void _EnableControls(HWND hwnd);
  132. BOOL _VerifyFolderOptions(void);
  133. void _SelectComponent(LPWSTR pwszUrl);
  134. HRESULT _OnInitDesktopOptionsUI(HWND hwnd);
  135. HRESULT _LoadIconState(IN IPropertyBag * pAdvPage);
  136. HWND _CreateListView(HWND hWndParent);
  137. void _NewComponent(HWND hwnd);
  138. void _EditComponent(HWND hwnd);
  139. void _DeleteComponent(HWND hwnd);
  140. void _SynchronizeAllComponents(IActiveDesktop *pActDesktop);
  141. void _TryIt(void);
  142. void _DesktopCleaner(HWND hwnd);
  143. HRESULT _IsDirty(IN BOOL * pIsDirty);
  144. HRESULT _MergeIconState(IN IPropertyBag * pAdvPage);
  145. HRESULT _LoadDeskIconState(IN IPropertyBag * pAdvPage);
  146. HRESULT _MergeDeskIconState(IN IPropertyBag * pAdvPage);
  147. HRESULT _UpdateDesktopIconsUI(HWND hwnd);
  148. private:
  149. virtual ~CCompPropSheetPage(void);
  150. // Private Member Functions
  151. INT_PTR _CustomizeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam, INT iPage);
  152. static INT_PTR _CustomizeDlgProcHelper(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam, INT iPage);
  153. static INT_PTR CALLBACK CustomizeDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
  154. static INT_PTR CALLBACK WebDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
  155. };
  156. BOOL FindComponent(IN LPCTSTR pszUrl, IN IActiveDesktop * pActiveDesktop);
  157. void CreateComponent(COMPONENTA *pcomp, LPCTSTR pszUrl);
  158. INT_PTR NewComponent(HWND hwndOwner, IActiveDesktop * pad, BOOL fDeferGallery, COMPONENT * pcomp);
  159. BOOL LooksLikeFile(LPCTSTR psz);
  160. BOOL IsUrlPicture(LPCTSTR pszUrl);
  161. #endif // EXCLUDE_COMPPROPSHEET
  162. #define WM_COMP_GETCURSEL (WM_USER+1)
  163. #endif