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