]> git.saurik.com Git - apple/mdnsresponder.git/blob - Clients/PrinterSetupWizard/ThirdPage.h
mDNSResponder-108.tar.gz
[apple/mdnsresponder.git] / Clients / PrinterSetupWizard / ThirdPage.h
1 /*
2 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22
23 Change History (most recent first):
24
25 $Log: ThirdPage.h,v $
26 Revision 1.5 2005/07/07 17:53:20 shersche
27 Fix problems associated with the CUPS printer workaround fix.
28
29 Revision 1.4 2005/02/08 21:45:06 shersche
30 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
31
32 Revision 1.3 2005/01/25 08:57:28 shersche
33 <rdar://problem/3911084> Add m_printerControl member for dynamic loading of icons from resource DLLs
34 Bug #: 3911084
35
36 Revision 1.2 2004/12/29 18:53:38 shersche
37 <rdar://problem/3725106>
38 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
39 Bug #: 3725106, 3737413
40
41 Revision 1.1 2004/06/18 04:36:58 rpantos
42 First checked in
43
44
45 */
46
47 #pragma once
48 #include "afxcmn.h"
49 #include "UtilTypes.h"
50 #include <CommonServices.h>
51 #include <DebugServices.h>
52 #include <dns_sd.h>
53 #include <map>
54 #include "afxwin.h"
55
56
57 // CThirdPage dialog
58
59 class CThirdPage : public CPropertyPage
60 {
61 DECLARE_DYNAMIC(CThirdPage)
62
63 public:
64 CThirdPage();
65 virtual ~CThirdPage();
66
67 // Dialog Data
68 enum { IDD = IDD_THIRD_PAGE };
69
70 protected:
71 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
72 virtual BOOL OnSetActive();
73 virtual BOOL OnKillActive();
74
75 DECLARE_MESSAGE_MAP()
76
77 private:
78
79 typedef std::map<CString, Manufacturer*> Manufacturers;
80
81 //
82 // LoadPrintDriverDefsFromFile
83 //
84 // Parses INF file and populates manufacturers
85 //
86 OSStatus LoadPrintDriverDefsFromFile(Manufacturers & manufacturers, const CString & filename, bool checkForDuplicateModels );
87
88 //
89 // LoadPrintDriverDefs
90 //
91 // Loads extant print driver definitions
92 //
93 OSStatus LoadPrintDriverDefs(Manufacturers & manufacturers);
94
95 //
96 // LoadGenericPrintDriversDefs
97 //
98 // Loads generic postscript and pcl print driver defs
99 //
100 OSStatus LoadGenericPrintDriverDefs( Manufacturers & manufacturers );
101
102 //
103 // PopulateUI
104 //
105 // Load print driver defs into UI for browsing/selection
106 //
107 OSStatus PopulateUI(Manufacturers & manufacturers);
108
109 //
110 // MatchPrinter
111 //
112 // Tries to match printer based on manufacturer and model
113 //
114 OSStatus MatchPrinter(Manufacturers & manufacturers, Printer * printer, Service * service, bool useCUPSWorkaround);
115
116 //
117 // OnInitPage
118 //
119 // Called first time page is activated.
120 OSStatus OnInitPage();
121
122 //
123 // these functions will tweak the names so that everything is
124 // consistent
125 //
126 CString ConvertToManufacturerName( const CString & name );
127 CString ConvertToModelName( const CString & name );
128 CString NormalizeManufacturerName( const CString & name );
129
130 Manufacturer * MatchManufacturer( Manufacturers & manufacturer, const CString & name );
131 Model * MatchModel( Manufacturer * manufacturer, const CString & name );
132 BOOL MatchGeneric( Manufacturers & manufacturers, Printer * printer, Service * service, Manufacturer ** manufacturer, Model ** model );
133 void SelectMatch(Printer * printer, Service * service, Manufacturer * manufacturer, Model * model);
134 void SelectMatch(Manufacturers & manufacturers, Printer * printer, Service * service, Manufacturer * manufacturer, Model * model);
135 void CopyPrinterSettings(Printer * printer, Service * service, Manufacturer * manufacturer, Model * model);
136
137 Manufacturers m_manufacturers;
138
139 CListCtrl m_manufacturerListCtrl;
140 Manufacturer * m_manufacturerSelected;
141
142 CListCtrl m_modelListCtrl;
143 Model * m_modelSelected;
144
145 Model * m_genericPostscript;
146 Model * m_genericPCL;
147
148 bool m_initialized;
149
150 public:
151
152 afx_msg void OnLvnItemchangedManufacturer(NMHDR *pNMHDR, LRESULT *pResult);
153 CStatic m_printerName;
154 afx_msg void OnLvnItemchangedPrinterModel(NMHDR *pNMHDR, LRESULT *pResult);
155 afx_msg void OnBnClickedDefaultPrinter();
156 private:
157 CButton m_defaultPrinterCtrl;
158 public:
159 CStatic m_printerSelectionText;
160 CStatic * m_printerImage;
161 afx_msg void OnBnClickedHaveDisk();
162 };