]> git.saurik.com Git - apple/mdnsresponder.git/blob - Clients/PrinterSetupWizard/FourthPage.cpp
mDNSResponder-107.4.tar.gz
[apple/mdnsresponder.git] / Clients / PrinterSetupWizard / FourthPage.cpp
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: FourthPage.cpp,v $
26 Revision 1.6 2005/02/08 21:45:06 shersche
27 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
28
29 Revision 1.5 2005/01/06 08:17:08 shersche
30 Display the selected protocol ("Raw", "LPR", "IPP") rather than the port name
31
32 Revision 1.4 2004/07/13 20:15:04 shersche
33 <rdar://problem/3726363> Load large font name from resource
34 Bug #: 3726363
35
36 Revision 1.3 2004/07/12 06:59:03 shersche
37 <rdar://problem/3723695> Use resource strings for Yes/No
38 Bug #: 3723695
39
40 Revision 1.2 2004/06/26 23:27:12 shersche
41 support for installing multiple printers of the same name
42
43 Revision 1.1 2004/06/18 04:36:57 rpantos
44 First checked in
45
46
47 */
48
49 #include "stdafx.h"
50 #include "PrinterSetupWizardApp.h"
51 #include "PrinterSetupWizardSheet.h"
52 #include "FourthPage.h"
53
54
55 // CFourthPage dialog
56
57 IMPLEMENT_DYNAMIC(CFourthPage, CPropertyPage)
58 CFourthPage::CFourthPage()
59 : CPropertyPage(CFourthPage::IDD),
60 m_initialized(false)
61 {
62 CString fontName;
63
64 m_psp.dwFlags &= ~(PSP_HASHELP);
65 m_psp.dwFlags |= PSP_DEFAULT|PSP_HIDEHEADER;
66
67 fontName.LoadString(IDS_LARGE_FONT);
68
69 // create the large font
70 m_largeFont.CreateFont(-16, 0, 0, 0,
71 FW_BOLD, FALSE, FALSE, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
72 CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontName);
73 }
74
75 CFourthPage::~CFourthPage()
76 {
77 }
78
79 void CFourthPage::DoDataExchange(CDataExchange* pDX)
80 {
81 CPropertyPage::DoDataExchange(pDX);
82 DDX_Control(pDX, IDC_GOODBYE, m_goodbye);
83 DDX_Control(pDX, IDC_PRINTER_NAME, m_printerNameCtrl);
84 DDX_Control(pDX, IDC_PRINTER_MANUFACTURER, m_printerManufacturerCtrl);
85 DDX_Control(pDX, IDC_PRINTER_MODEL, m_printerModelCtrl);
86 DDX_Control(pDX, IDC_PRINTER_PROTOCOL, m_printerProtocolCtrl);
87 DDX_Control(pDX, IDC_PRINTER_DEFAULT, m_printerDefault);
88 }
89
90
91 BEGIN_MESSAGE_MAP(CFourthPage, CPropertyPage)
92 END_MESSAGE_MAP()
93
94
95 // CFourthPage message handlers
96 OSStatus
97 CFourthPage::OnInitPage()
98 {
99 return kNoErr;
100 }
101
102
103 BOOL
104 CFourthPage::OnSetActive()
105 {
106 CPrinterSetupWizardSheet * psheet;
107 CString goodbyeText;
108 Printer * printer;
109 CString defaultText;
110
111 psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
112 require_quiet( psheet, exit );
113
114 printer = psheet->GetSelectedPrinter();
115 require_quiet( psheet, exit );
116
117 psheet->SetWizardButtons(PSWIZB_BACK|PSWIZB_FINISH);
118
119 if (m_initialized == false)
120 {
121 m_initialized = true;
122 OnInitPage();
123 }
124
125 m_goodbye.SetFont(&m_largeFont);
126
127 goodbyeText.LoadString(IDS_GOODBYE);
128 m_goodbye.SetWindowText(goodbyeText);
129
130 m_printerNameCtrl.SetWindowText( printer->actualName );
131 m_printerManufacturerCtrl.SetWindowText ( printer->manufacturer );
132 m_printerModelCtrl.SetWindowText ( printer->displayModelName );
133
134 Service * service = printer->services.front();
135 require_quiet( service, exit );
136 m_printerProtocolCtrl.SetWindowText ( service->protocol );
137
138 if (printer->deflt)
139 {
140 defaultText.LoadString(IDS_YES);
141 }
142 else
143 {
144 defaultText.LoadString(IDS_NO);
145 }
146
147 m_printerDefault.SetWindowText ( defaultText );
148
149 exit:
150
151 return CPropertyPage::OnSetActive();
152 }