1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 Change History (most recent first):
19 $Log: FourthPage.cpp,v $
20 Revision 1.8 2006/08/14 23:24:09 cheshire
21 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
23 Revision 1.7 2005/07/07 17:53:20 shersche
24 Fix problems associated with the CUPS printer workaround fix.
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
29 Revision 1.5 2005/01/06 08:17:08 shersche
30 Display the selected protocol ("Raw", "LPR", "IPP") rather than the port name
32 Revision 1.4 2004/07/13 20:15:04 shersche
33 <rdar://problem/3726363> Load large font name from resource
36 Revision 1.3 2004/07/12 06:59:03 shersche
37 <rdar://problem/3723695> Use resource strings for Yes/No
40 Revision 1.2 2004/06/26 23:27:12 shersche
41 support for installing multiple printers of the same name
43 Revision 1.1 2004/06/18 04:36:57 rpantos
50 #include "PrinterSetupWizardApp.h"
51 #include "PrinterSetupWizardSheet.h"
52 #include "FourthPage.h"
57 IMPLEMENT_DYNAMIC(CFourthPage
, CPropertyPage
)
58 CFourthPage::CFourthPage()
59 : CPropertyPage(CFourthPage::IDD
),
64 m_psp
.dwFlags
&= ~(PSP_HASHELP
);
65 m_psp
.dwFlags
|= PSP_DEFAULT
|PSP_HIDEHEADER
;
67 fontName
.LoadString(IDS_LARGE_FONT
);
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
);
75 CFourthPage::~CFourthPage()
79 void CFourthPage::DoDataExchange(CDataExchange
* pDX
)
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
);
91 BEGIN_MESSAGE_MAP(CFourthPage
, CPropertyPage
)
95 // CFourthPage message handlers
97 CFourthPage::OnInitPage()
104 CFourthPage::OnSetActive()
106 CPrinterSetupWizardSheet
* psheet
;
111 psheet
= reinterpret_cast<CPrinterSetupWizardSheet
*>(GetParent());
112 require_quiet( psheet
, exit
);
114 printer
= psheet
->GetSelectedPrinter();
115 require_quiet( psheet
, exit
);
117 psheet
->SetWizardButtons(PSWIZB_BACK
|PSWIZB_FINISH
);
119 if (m_initialized
== false)
121 m_initialized
= true;
125 m_goodbye
.SetFont(&m_largeFont
);
127 goodbyeText
.LoadString(IDS_GOODBYE
);
128 m_goodbye
.SetWindowText(goodbyeText
);
130 m_printerNameCtrl
.SetWindowText( printer
->actualName
);
131 m_printerManufacturerCtrl
.SetWindowText ( printer
->manufacturer
);
132 m_printerModelCtrl
.SetWindowText ( printer
->displayModelName
);
134 Service
* service
= printer
->services
.front();
135 require_quiet( service
, exit
);
136 m_printerProtocolCtrl
.SetWindowText ( service
->protocol
);
140 defaultText
.LoadString(IDS_YES
);
144 defaultText
.LoadString(IDS_NO
);
147 m_printerDefault
.SetWindowText ( defaultText
);
151 return CPropertyPage::OnSetActive();
156 CFourthPage::OnKillActive()
158 CPrinterSetupWizardSheet
* psheet
;
160 psheet
= reinterpret_cast<CPrinterSetupWizardSheet
*>(GetParent());
161 require_quiet( psheet
, exit
);
163 psheet
->SetLastPage(this);
167 return CPropertyPage::OnKillActive();