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