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.

93 lines
3.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000.
  5. //
  6. // File: ConfirmationUI.h
  7. //
  8. // Contents: Confirmation UI for storage based copy engine
  9. //
  10. // History: 20-Mar-2000 ToddB
  11. //
  12. //--------------------------------------------------------------------------
  13. #pragma once
  14. // these heights are in Dialog Uints, they get converted to pixels before use
  15. #define CX_DIALOG_PADDING 6
  16. #define CY_DIALOG_PADDING 6
  17. #define CY_STATIC_TEXT_HEIGHT 10
  18. // This is the max string length of the attribute fields for an item
  19. #define CCH_DESC_LENGTH MAX_PATH
  20. class CTransferConfirmation :
  21. public ITransferConfirmation,
  22. public CComObjectRootEx<CComSingleThreadModel>,
  23. public CComCoClass<CTransferConfirmation, &CLSID_TransferConfirmationUI>
  24. {
  25. public:
  26. typedef struct tagITEMINFO
  27. {
  28. LPWSTR pwszIntro; // resource ID of the intro string, or 0 if there is none
  29. LPWSTR pwszDisplayName; // The display name of the item
  30. LPWSTR pwszAttribs; // The attributes for this item. Can be a variable number of lines in length
  31. HBITMAP hBitmap;
  32. HICON hIcon;
  33. } ITEMINFO, * LPITEMINFO;
  34. BEGIN_COM_MAP(CTransferConfirmation)
  35. COM_INTERFACE_ENTRY(ITransferConfirmation)
  36. END_COM_MAP()
  37. // IStorageProcessor
  38. STDMETHOD(Confirm)(CONFIRMOP * pcop, LPCONFIRMATIONRESPONSE pcr, BOOL * pbAll);
  39. protected:
  40. CTransferConfirmation();
  41. ~CTransferConfirmation();
  42. static INT_PTR CALLBACK s_ConfirmDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  43. BOOL ConfirmDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  44. BOOL OnInitDialog(HWND hwndDlg, WPARAM wParam, LPARAM lParam);
  45. BOOL OnCommand(HWND hwndDlg, int wID, HWND hwndCtl);
  46. HRESULT _Init();
  47. HRESULT _ClearSettings();
  48. HRESULT _GetDialogSettings();
  49. HRESULT _FreeDialogSettings();
  50. HRESULT _AddItem(IShellItem *psi, int idIntro=0);
  51. BOOL _CalculateMetrics(HWND hwndDlg);
  52. DWORD _DisplayItem(int iItem, HWND hwndDlg, int x, int y);
  53. int _WindowWidthFromString(HWND hwnd, LPTSTR psz);
  54. int _WindowHeightFromString(HWND hwnd, int cx, LPTSTR psz);
  55. BOOL _IsCopyOperation(STGOP stgop);
  56. // Input information
  57. CONFIRMOP m_cop;
  58. IPropertyUI * m_pPropUI;
  59. // Output results
  60. CONFIRMATIONRESPONSE m_crResult;
  61. BOOL m_fApplyToAll;
  62. // Stuff to control the display of the dialog
  63. int m_cxControlPadding;
  64. int m_cyControlPadding;
  65. int m_cyText; // the height of a static text control (10 dialog units converted into pixels)
  66. RECT m_rcDlg; // we remember the size of the dialog's client area since we use this a lot
  67. HFONT m_hfont; // the font used by the dialog, used to calculate sizes
  68. TCHAR * m_pszTitle;
  69. HICON m_hIcon;
  70. TCHAR * m_pszDescription;
  71. int m_idDialog;
  72. ITEMINFO m_rgItemInfo[2];
  73. int m_cItems;
  74. BOOL m_fSingle;
  75. BOOL m_fShowARPLink;
  76. };