]> git.saurik.com Git - apple/mdnsresponder.git/blob - Clients/PrinterSetupWizard/PrinterSetupWizardSheet.h
mDNSResponder-98.tar.gz
[apple/mdnsresponder.git] / Clients / PrinterSetupWizard / PrinterSetupWizardSheet.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: PrinterSetupWizardSheet.h,v $
26 Revision 1.6 2005/01/03 19:05:01 shersche
27 Store pointer to instance of wizard sheet so that print driver install thread sends a window message to the correct window
28
29 Revision 1.5 2004/12/29 18:53:38 shersche
30 <rdar://problem/3725106>
31 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
32 Bug #: 3725106, 3737413
33
34 Revision 1.4 2004/07/13 21:24:23 rpantos
35 Fix for <rdar://problem/3701120>.
36
37 Revision 1.3 2004/06/28 00:51:47 shersche
38 Move call to EnumPrinters out of browse callback into standalone function
39
40 Revision 1.2 2004/06/24 20:12:07 shersche
41 Clean up source code
42 Submitted by: herscher
43
44 Revision 1.1 2004/06/18 04:36:57 rpantos
45 First checked in
46
47
48 */
49
50 #pragma once
51
52
53 #include "firstpage.h"
54 #include "secondpage.h"
55 #include "thirdpage.h"
56 #include "fourthpage.h"
57 #include "UtilTypes.h"
58 #include "dns_sd.h"
59 #include <stdexcept>
60 #include <map>
61
62 using namespace PrinterSetupWizard;
63
64 // CPrinterSetupWizardSheet
65
66 class CPrinterSetupWizardSheet : public CPropertySheet
67 {
68 DECLARE_DYNAMIC(CPrinterSetupWizardSheet)
69
70 public:
71
72 struct WizardException
73 {
74 CString text;
75 CString caption;
76 };
77
78 public:
79
80 CPrinterSetupWizardSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
81 virtual ~CPrinterSetupWizardSheet();
82
83 void
84 SetSelectedPrinter(Printer * printer);
85
86 Printer*
87 GetSelectedPrinter();
88
89 OSStatus
90 LoadPrinterDriver(const CString & filename);
91
92 HCURSOR
93 GetCursor();
94
95 //
96 // handles end of process event
97 //
98 virtual LONG
99 OnProcessEvent(WPARAM inWParam, LPARAM inLParam);
100
101 virtual BOOL
102 OnCommand(WPARAM wParam, LPARAM lParam);
103
104 virtual BOOL
105 OnInitDialog();
106
107 virtual BOOL
108 OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT message);
109
110 virtual void
111 OnContextMenu(CWnd * pWnd, CPoint pos);
112
113 afx_msg void
114 OnOK();
115
116 HCURSOR m_active;
117 HCURSOR m_arrow;
118 HCURSOR m_wait;
119
120 protected:
121 DECLARE_MESSAGE_MAP()
122 CFirstPage m_pgFirst;
123 CSecondPage m_pgSecond;
124 CThirdPage m_pgThird;
125 CFourthPage m_pgFourth;
126
127 void
128 OnServiceResolved(
129 Service * service);
130
131 void Init(void);
132
133 private:
134
135 OSStatus
136 InstallPrinter(Printer * printer);
137
138 OSStatus
139 InstallPrinterPDLAndLPR(Printer * printer, Service * service, DWORD protocol);
140
141 OSStatus
142 InstallPrinterIPP(Printer * printer, Service * service);
143
144 static unsigned WINAPI
145 InstallDriverThread( LPVOID inParam );
146
147 static CPrinterSetupWizardSheet * m_self;
148 Printer * m_selectedPrinter;
149 bool m_driverThreadFinished;
150 DWORD m_driverThreadExitCode;
151 };
152
153
154 inline Printer*
155 CPrinterSetupWizardSheet::GetSelectedPrinter()
156 {
157 return m_selectedPrinter;
158 }
159
160
161 inline HCURSOR
162 CPrinterSetupWizardSheet::GetCursor()
163 {
164 return m_active;
165 }
166
167
168 // Service Types
169
170 #define kPDLServiceType "_pdl-datastream._tcp."
171 #define kLPRServiceType "_printer._tcp."
172 #define kIPPServiceType "_ipp._tcp."