2 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
23 Change History (most recent first):
25 $Log: SecondPage.h,v $
26 Revision 1.6 2005/01/04 21:09:14 shersche
27 Fix problems in parsing text records. Fix problems in remove event handling. Ensure that the same service can't be resolved more than once.
29 Revision 1.5 2004/12/31 07:25:27 shersche
30 Tidy up printer management, and fix memory leaks when hitting 'Cancel'
32 Revision 1.4 2004/12/30 01:02:46 shersche
33 <rdar://problem/3734478> Add Printer information box that displays description and location information when printer name is selected
36 Revision 1.3 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
41 Revision 1.2 2004/09/13 21:23:42 shersche
42 <rdar://problem/3796483> Add moreComing argument to OnAddPrinter and OnRemovePrinter callbacks
45 Revision 1.1 2004/06/18 04:36:57 rpantos
53 #include "PrinterSetupWizardSheet.h"
54 #include "CommonServices.h"
55 #include "UtilTypes.h"
61 using namespace PrinterSetupWizard
;
65 class CSecondPage
: public CPropertyPage
67 DECLARE_DYNAMIC(CSecondPage
)
71 virtual ~CSecondPage();
74 enum { IDD
= IDD_SECOND_PAGE
};
79 DNSServiceFlags inFlags
,
80 uint32_t inInterfaceIndex
,
81 DNSServiceErrorType inErrorCode
,
84 const char * inDomain
,
90 DNSServiceFlags inFlags
,
91 uint32_t inInterfaceIndex
,
92 DNSServiceErrorType inErrorCode
,
93 const char * inFullName
,
94 const char * inHostName
,
100 static void DNSSD_API
103 DNSServiceFlags inFlags
,
104 uint32_t inInterfaceIndex
,
105 DNSServiceErrorType inErrorCode
,
106 const char * inFullName
,
110 const void * inRData
,
116 void InitBrowseList();
117 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
118 afx_msg BOOL
OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
);
119 virtual BOOL
OnSetActive();
120 virtual BOOL
OnKillActive();
122 DECLARE_MESSAGE_MAP()
126 HTREEITEM m_emptyListItem
;
128 CTreeCtrl m_browseList
;
129 DNSServiceRef m_resolver
;
133 LONG
OnServiceEvent(WPARAM inWParam
, LPARAM inLParam
);
134 afx_msg
void OnTvnSelchangedBrowseList(NMHDR
*pNMHDR
, LRESULT
*pResult
);
142 Lookup( const char * name
);
145 StartOperation( DNSServiceRef ref
);
148 StopOperation( DNSServiceRef
& ref
);
157 StartResolve( Printer
* printer
);
160 StartResolve( Service
* service
);
163 StopResolve( Printer
* printer
);
166 StopResolve( Service
* service
);
170 uint32_t inInterfaceIndex
,
173 const char * inDomain
,
180 const char * inDomain
,
184 OnResolveService( Service
* service
);
187 OrderServiceFunc( const Service
* a
, const Service
* b
);
190 OrderQueueFunc( const Queue
* q1
, const Queue
* q2
);
193 LoadTextAndDisableWindow( CString
& text
);
196 SetPrinterInformationState( BOOL state
);
199 ParseTextRecord( Service
* service
, uint16_t inTXTSize
, const char * inTXT
, bool & qtotalDefined
, CString
& qname
, uint32_t & qpriority
);
201 typedef std::map
<CString
,CString
> PrinterNameMap
;
202 typedef std::list
<DNSServiceRef
> ServiceRefList
;
203 typedef std::list
<Printer
*> Printers
;
206 PrinterNameMap m_printerNames
;
208 ServiceRefList m_serviceRefList
;
209 DNSServiceRef m_pdlBrowser
;
210 DNSServiceRef m_lprBrowser
;
211 DNSServiceRef m_ippBrowser
;
213 Printer
* m_selected
;
214 std::string m_selectedName
;
218 CStatic m_printerInformation
;
219 CStatic m_descriptionLabel
;
220 CStatic m_descriptionField
;
221 CStatic m_locationLabel
;
222 CStatic m_locationField
;