Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

devprop.h

Go to the documentation of this file.
00001 /****************************************************************************** 00002 00003 Header File: Device Property Page.H 00004 00005 Defines the class that handles the various device profile management pages. 00006 These derive from CShellExtensionPage. 00007 00008 Since much of the profile management process is common to all devices, a base 00009 class (CDeviceProfileManagement) provides these core services- filling the 00010 device list box, properly enabling and disabling the "Remove" button, and 00011 adding, associating, and dissociating profiles as needed. Virtual functions 00012 provide the means by which the individual device pages customize or modify 00013 this behavior. 00014 00015 Copyright (c) 1996 by Microsoft Corporation 00016 00017 A Pretty Penny Enterprises, Inc. Production 00018 00019 Change History: 00020 00021 11-27-96 [email protected] coded it 00022 00023 ******************************************************************************/ 00024 00025 #if !defined(DEVICE_PROFILE_UI) 00026 00027 #define DEVICE_PROFILE_UI 00028 00029 #include "PropPage.H" 00030 #include "Profile.H" 00031 00032 /****************************************************************************** 00033 00034 CDeviceProfileManagement class 00035 00036 This class provides the core services for these pages. 00037 00038 NOTES: 00039 00040 The profiles must be in a list box (not a combo box) with the ID ProfileList. 00041 If this isn't done, you must both override OnInit, and not call this class's 00042 OnInit function. 00043 00044 Most implementations of derived classes will call this class's version of 00045 functions they override. Whether they do that before or after they do their 00046 customizatins will probably require understanding what this class does. 00047 00048 ******************************************************************************/ 00049 00050 /* 00051 * m_bReadOnly == FALSE (default) 00052 * In this case the property page behaves normally - user input 00053 * is accepted. 00054 * m_bReadOnly == TRUE 00055 * In this case all the buttons for this page are greyed out and 00056 * the user can only inspect the data. 00057 * 00058 * The flag is used for locking out users without permission to 00059 * modify the settings - but still allows them to view the settings. 00060 * 00061 * m_bCMYK is true if the device is a printer and it supports 00062 * CMYK profiles 00063 */ 00064 00065 #define DEVLIST_ONINIT 0x0001 00066 #define DEVLIST_CHANGED 0x0002 00067 #define DEVLIST_NOSELECT 0x0004 00068 00069 class CDeviceProfileManagement : public CShellExtensionPage { 00070 00071 DWORD m_dwType; // Type class of target device 00072 00073 protected: 00074 00075 CUintArray m_cuaRemovals; // indices of dissociations to be done 00076 CProfileArray m_cpaAdds; // Profiles to be added 00077 CProfileArray m_cpaProfile; // Associated Profile Names 00078 CString m_csDevice; // Target Device Name 00079 HWND m_hwndList; // Profile list box in dialog 00080 BOOL m_bCMYK; // Printer support for CMYK 00081 BOOL m_bReadOnly; // Flag indicating that settings can be 00082 // modified by the user 00083 virtual void InitList(); 00084 virtual void FillList(DWORD dwFlags = 0); 00085 00086 void GetDeviceTypeString(DWORD dwType,CString& csDeviceName); 00087 00088 public: 00089 00090 CDeviceProfileManagement(LPCTSTR lpstrName, HINSTANCE hiWhere, int idPage, 00091 DWORD dwType); 00092 ~CDeviceProfileManagement() {} 00093 00094 00095 virtual BOOL OnInit(); 00096 virtual BOOL OnCommand(WORD wNotifyCode, WORD wid, HWND hwndCtl); 00097 virtual BOOL OnNotify(int idCtrl, LPNMHDR pnmh); 00098 }; 00099 00100 // This class encapsulates the required "Add Profile" old-style file open 00101 // dialog. Kind of a shame, Explorer's a much nicer interface... 00102 00103 class CAddProfileDialog { 00104 00105 CStringArray csa_Files; 00106 00107 static UINT_PTR APIENTRY OpenFileHookProc(HWND hDlg, UINT uMessage, WPARAM wp, 00108 LPARAM lp); 00109 00110 public: 00111 00112 CAddProfileDialog(HWND hwndOwner, HINSTANCE hi); 00113 ~CAddProfileDialog() { csa_Files.Empty(); } 00114 00115 unsigned ProfileCount() { return csa_Files.Count(); } 00116 LPCTSTR ProfileName(unsigned u) { return csa_Files[u]; } 00117 CString ProfileNameAndExtension(unsigned u) 00118 { return csa_Files[u].NameAndExtension(); } 00119 void AddProfile(LPCTSTR str) { csa_Files.Add(str); } 00120 }; 00121 00122 // The Printer Profile Management class uses the core class pretty much as is. 00123 // We override the OnInit member to disable all controls if the user lacks 00124 // administrative authority for the target printer. 00125 00126 class CPrinterProfileManagement : public CDeviceProfileManagement { 00127 00128 protected: 00129 00130 unsigned m_uDefault; // Default profile index 00131 BOOL m_bManualMode; // Manual profile selection mode 00132 BOOL m_bAdminAccess; 00133 BOOL m_bLocalPrinter; 00134 00135 virtual void InitList(); 00136 virtual void FillList(DWORD dwFlags = 0); 00137 00138 public: 00139 00140 CPrinterProfileManagement(LPCTSTR lpstrName, HINSTANCE hiWhere); 00141 ~CPrinterProfileManagement() {} 00142 00143 virtual BOOL OnInit(); 00144 virtual BOOL OnCommand(WORD wNotifyCode, WORD wid, HWND hwndCtl); 00145 virtual BOOL OnNotify(int idCtrl, LPNMHDR pnmh); 00146 00147 virtual BOOL OnHelp(LPHELPINFO pHelp); 00148 virtual BOOL OnContextMenu(HWND hwnd); 00149 }; 00150 00151 // The Scanner Profile Management class uses the core class pretty much as is. 00152 // We override the OnInit member to disable all controls if the user lacks 00153 // administrative authority for the target printer. 00154 00155 class CScannerProfileManagement : public CDeviceProfileManagement { 00156 00157 public: 00158 00159 CScannerProfileManagement(LPCTSTR lpstrName, HINSTANCE hiWhere); 00160 ~CScannerProfileManagement() {} 00161 00162 virtual BOOL OnInit(); 00163 00164 virtual BOOL OnHelp(LPHELPINFO pHelp); 00165 virtual BOOL OnContextMenu(HWND hwnd); 00166 }; 00167 00168 // The monitor profile class is a bit more complex, as it allows the 00169 // manipulation and setting of device default profiles as well as association 00170 // and dissociation of profiles. It also has some extra controls to 00171 // initialize. 00172 00173 class CMonitorProfileManagement : public CDeviceProfileManagement { 00174 00175 protected: 00176 00177 unsigned m_uDefault; // Default profile index 00178 CString m_csDeviceFriendlyName; // Target Device Friendly Name 00179 00180 virtual void InitList(); 00181 virtual void FillList(DWORD dwFlags = 0); 00182 00183 public: 00184 00185 CMonitorProfileManagement(LPCTSTR lpstrName, LPCTSTR lpstrFriendlyName, HINSTANCE hiWhere); 00186 ~CMonitorProfileManagement() {} 00187 00188 virtual BOOL OnInit(); 00189 virtual BOOL OnCommand(WORD wNotifyCode, WORD wid, HWND hwndCtl); 00190 virtual BOOL OnNotify(int idCtrl, LPNMHDR pnmh); 00191 00192 virtual BOOL OnHelp(LPHELPINFO pHelp); 00193 virtual BOOL OnContextMenu(HWND hwnd); 00194 }; 00195 00196 #endif

Generated on Sat May 15 19:39:41 2004 for test by doxygen 1.3.7