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.

196 lines
6.6 KiB

  1. /******************************************************************************
  2. Header File: Device Property Page.H
  3. Defines the class that handles the various device profile management pages.
  4. These derive from CShellExtensionPage.
  5. Since much of the profile management process is common to all devices, a base
  6. class (CDeviceProfileManagement) provides these core services- filling the
  7. device list box, properly enabling and disabling the "Remove" button, and
  8. adding, associating, and dissociating profiles as needed. Virtual functions
  9. provide the means by which the individual device pages customize or modify
  10. this behavior.
  11. Copyright (c) 1996 by Microsoft Corporation
  12. A Pretty Penny Enterprises, Inc. Production
  13. Change History:
  14. 11-27-96 a-RobKj@microsoft.com coded it
  15. ******************************************************************************/
  16. #if !defined(DEVICE_PROFILE_UI)
  17. #define DEVICE_PROFILE_UI
  18. #include "PropPage.H"
  19. #include "Profile.H"
  20. /******************************************************************************
  21. CDeviceProfileManagement class
  22. This class provides the core services for these pages.
  23. NOTES:
  24. The profiles must be in a list box (not a combo box) with the ID ProfileList.
  25. If this isn't done, you must both override OnInit, and not call this class's
  26. OnInit function.
  27. Most implementations of derived classes will call this class's version of
  28. functions they override. Whether they do that before or after they do their
  29. customizatins will probably require understanding what this class does.
  30. ******************************************************************************/
  31. /*
  32. * m_bReadOnly == FALSE (default)
  33. * In this case the property page behaves normally - user input
  34. * is accepted.
  35. * m_bReadOnly == TRUE
  36. * In this case all the buttons for this page are greyed out and
  37. * the user can only inspect the data.
  38. *
  39. * The flag is used for locking out users without permission to
  40. * modify the settings - but still allows them to view the settings.
  41. *
  42. * m_bCMYK is true if the device is a printer and it supports
  43. * CMYK profiles
  44. */
  45. #define DEVLIST_ONINIT 0x0001
  46. #define DEVLIST_CHANGED 0x0002
  47. #define DEVLIST_NOSELECT 0x0004
  48. class CDeviceProfileManagement : public CShellExtensionPage {
  49. DWORD m_dwType; // Type class of target device
  50. protected:
  51. CUintArray m_cuaRemovals; // indices of dissociations to be done
  52. CProfileArray m_cpaAdds; // Profiles to be added
  53. CProfileArray m_cpaProfile; // Associated Profile Names
  54. CString m_csDevice; // Target Device Name
  55. HWND m_hwndList; // Profile list box in dialog
  56. BOOL m_bCMYK; // Printer support for CMYK
  57. BOOL m_bReadOnly; // Flag indicating that settings can be
  58. // modified by the user
  59. virtual void InitList();
  60. virtual void FillList(DWORD dwFlags = 0);
  61. void GetDeviceTypeString(DWORD dwType,CString& csDeviceName);
  62. public:
  63. CDeviceProfileManagement(LPCTSTR lpstrName, HINSTANCE hiWhere, int idPage,
  64. DWORD dwType);
  65. ~CDeviceProfileManagement() {}
  66. virtual BOOL OnInit();
  67. virtual BOOL OnCommand(WORD wNotifyCode, WORD wid, HWND hwndCtl);
  68. virtual BOOL OnNotify(int idCtrl, LPNMHDR pnmh);
  69. };
  70. // This class encapsulates the required "Add Profile" old-style file open
  71. // dialog. Kind of a shame, Explorer's a much nicer interface...
  72. class CAddProfileDialog {
  73. CStringArray csa_Files;
  74. static UINT_PTR APIENTRY OpenFileHookProc(HWND hDlg, UINT uMessage, WPARAM wp,
  75. LPARAM lp);
  76. public:
  77. CAddProfileDialog(HWND hwndOwner, HINSTANCE hi);
  78. ~CAddProfileDialog() { csa_Files.Empty(); }
  79. unsigned ProfileCount() { return csa_Files.Count(); }
  80. LPCTSTR ProfileName(unsigned u) { return csa_Files[u]; }
  81. CString ProfileNameAndExtension(unsigned u)
  82. { return csa_Files[u].NameAndExtension(); }
  83. void AddProfile(LPCTSTR str) { csa_Files.Add(str); }
  84. };
  85. // The Printer Profile Management class uses the core class pretty much as is.
  86. // We override the OnInit member to disable all controls if the user lacks
  87. // administrative authority for the target printer.
  88. class CPrinterProfileManagement : public CDeviceProfileManagement {
  89. protected:
  90. unsigned m_uDefault; // Default profile index
  91. BOOL m_bManualMode; // Manual profile selection mode
  92. BOOL m_bAdminAccess;
  93. BOOL m_bLocalPrinter;
  94. virtual void InitList();
  95. virtual void FillList(DWORD dwFlags = 0);
  96. public:
  97. CPrinterProfileManagement(LPCTSTR lpstrName, HINSTANCE hiWhere);
  98. ~CPrinterProfileManagement() {}
  99. virtual BOOL OnInit();
  100. virtual BOOL OnCommand(WORD wNotifyCode, WORD wid, HWND hwndCtl);
  101. virtual BOOL OnNotify(int idCtrl, LPNMHDR pnmh);
  102. virtual BOOL OnHelp(LPHELPINFO pHelp);
  103. virtual BOOL OnContextMenu(HWND hwnd);
  104. };
  105. // The Scanner Profile Management class uses the core class pretty much as is.
  106. // We override the OnInit member to disable all controls if the user lacks
  107. // administrative authority for the target printer.
  108. class CScannerProfileManagement : public CDeviceProfileManagement {
  109. public:
  110. CScannerProfileManagement(LPCTSTR lpstrName, HINSTANCE hiWhere);
  111. ~CScannerProfileManagement() {}
  112. virtual BOOL OnInit();
  113. virtual BOOL OnHelp(LPHELPINFO pHelp);
  114. virtual BOOL OnContextMenu(HWND hwnd);
  115. };
  116. // The monitor profile class is a bit more complex, as it allows the
  117. // manipulation and setting of device default profiles as well as association
  118. // and dissociation of profiles. It also has some extra controls to
  119. // initialize.
  120. class CMonitorProfileManagement : public CDeviceProfileManagement {
  121. protected:
  122. unsigned m_uDefault; // Default profile index
  123. CString m_csDeviceFriendlyName; // Target Device Friendly Name
  124. virtual void InitList();
  125. virtual void FillList(DWORD dwFlags = 0);
  126. public:
  127. CMonitorProfileManagement(LPCTSTR lpstrName, LPCTSTR lpstrFriendlyName, HINSTANCE hiWhere);
  128. ~CMonitorProfileManagement() {}
  129. virtual BOOL OnInit();
  130. virtual BOOL OnCommand(WORD wNotifyCode, WORD wid, HWND hwndCtl);
  131. virtual BOOL OnNotify(int idCtrl, LPNMHDR pnmh);
  132. virtual BOOL OnHelp(LPHELPINFO pHelp);
  133. virtual BOOL OnContextMenu(HWND hwnd);
  134. };
  135. #endif