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.
19 #include "PrinterSetupWizardApp.h"
20 #include "PrinterSetupWizardSheet.h"
21 #include "FourthPage.h"
23 #if !defined( PBS_MARQUEE )
24 # define PBS_MARQUEE 0x08
27 #if !defined( PBM_SETMARQUEE )
28 # define PBM_SETMARQUEE WM_USER + 10
35 IMPLEMENT_DYNAMIC(CFourthPage
, CPropertyPage
)
36 CFourthPage::CFourthPage()
37 : CPropertyPage(CFourthPage::IDD
),
42 m_psp
.dwFlags
&= ~(PSP_HASHELP
);
43 m_psp
.dwFlags
|= PSP_DEFAULT
|PSP_HIDEHEADER
;
45 fontName
.LoadString(IDS_LARGE_FONT
);
47 // create the large font
48 m_largeFont
.CreateFont(-16, 0, 0, 0,
49 FW_BOLD
, FALSE
, FALSE
, 0, DEFAULT_CHARSET
, OUT_DEFAULT_PRECIS
,
50 CLIP_DEFAULT_PRECIS
, DEFAULT_QUALITY
, DEFAULT_PITCH
, fontName
);
53 CFourthPage::~CFourthPage()
57 void CFourthPage::DoDataExchange(CDataExchange
* pDX
)
59 CPropertyPage::DoDataExchange(pDX
);
60 DDX_Control(pDX
, IDC_GOODBYE
, m_goodbye
);
61 DDX_Control(pDX
, IDC_PRINTER_NAME
, m_printerNameCtrl
);
62 DDX_Control(pDX
, IDC_PRINTER_MANUFACTURER
, m_printerManufacturerCtrl
);
63 DDX_Control(pDX
, IDC_PRINTER_MODEL
, m_printerModelCtrl
);
64 DDX_Control(pDX
, IDC_PRINTER_PROTOCOL
, m_printerProtocolCtrl
);
65 DDX_Control(pDX
, IDC_PRINTER_DEFAULT
, m_printerDefault
);
69 BEGIN_MESSAGE_MAP(CFourthPage
, CPropertyPage
)
73 // CFourthPage message handlers
75 CFourthPage::OnInitPage()
78 OSStatus err
= kNoErr
;
80 window
= GetDlgItem( IDC_INSTALLING
);
81 require_action( window
, exit
, err
= kUnknownErr
);
82 window
->ShowWindow( SW_HIDE
);
84 window
= GetDlgItem( IDC_PROGRESS
);
85 require_action( window
, exit
, err
= kUnknownErr
);
86 SetWindowLong( *window
, GWL_STYLE
, GetWindowLong( *window
, GWL_STYLE
) | PBS_MARQUEE
);
87 SetWindowLongPtr( *window
, GWL_STYLE
, GetWindowLongPtr( *window
, GWL_STYLE
) | PBS_MARQUEE
);
88 window
->SendMessage( ( UINT
) PBM_SETMARQUEE
, ( WPARAM
) FALSE
,( LPARAM
) 35 );
89 window
->ShowWindow( SW_HIDE
);
98 CFourthPage::OnSetActive()
100 CPrinterSetupWizardSheet
* psheet
;
105 psheet
= reinterpret_cast<CPrinterSetupWizardSheet
*>(GetParent());
106 require_quiet( psheet
, exit
);
108 printer
= psheet
->GetSelectedPrinter();
109 require_quiet( psheet
, exit
);
111 psheet
->SetWizardButtons(PSWIZB_BACK
|PSWIZB_FINISH
);
113 if (m_initialized
== false)
115 m_initialized
= true;
119 m_goodbye
.SetFont(&m_largeFont
);
121 goodbyeText
.LoadString(IDS_GOODBYE
);
122 m_goodbye
.SetWindowText(goodbyeText
);
124 m_printerNameCtrl
.SetWindowText( printer
->actualName
);
125 m_printerManufacturerCtrl
.SetWindowText ( printer
->manufacturer
);
126 m_printerModelCtrl
.SetWindowText ( printer
->displayModelName
);
128 Service
* service
= printer
->services
.front();
129 require_quiet( service
, exit
);
130 m_printerProtocolCtrl
.SetWindowText ( service
->protocol
);
134 defaultText
.LoadString(IDS_YES
);
138 defaultText
.LoadString(IDS_NO
);
141 m_printerDefault
.SetWindowText ( defaultText
);
145 return CPropertyPage::OnSetActive();
150 CFourthPage::OnKillActive()
152 CPrinterSetupWizardSheet
* psheet
;
154 psheet
= reinterpret_cast<CPrinterSetupWizardSheet
*>(GetParent());
155 require_quiet( psheet
, exit
);
157 psheet
->SetLastPage(this);
161 return CPropertyPage::OnKillActive();
166 CFourthPage::StartActivityIndicator()
171 window
= GetDlgItem( IDC_COMPLETE1
);
172 require_action( window
, exit
, ok
= FALSE
);
173 window
->ShowWindow( SW_HIDE
);
175 window
= GetDlgItem( IDC_COMPLETE2
);
176 require_action( window
, exit
, ok
= FALSE
);
177 window
->ShowWindow( SW_HIDE
);
179 window
= GetDlgItem( IDC_INSTALLING
);
180 require_action( window
, exit
, ok
= FALSE
);
181 window
->ShowWindow( SW_SHOW
);
183 window
= GetDlgItem( IDC_PROGRESS
);
184 require_action( window
, exit
, ok
= FALSE
);
185 window
->SendMessage( ( UINT
) PBM_SETMARQUEE
, ( WPARAM
) TRUE
,( LPARAM
) 50 );
186 window
->ShowWindow( SW_SHOW
);
195 CFourthPage::StopActivityIndicator()
200 window
= GetDlgItem( IDC_INSTALLING
);
201 require_action( window
, exit
, ok
= FALSE
);
202 window
->ShowWindow( SW_HIDE
);
204 window
= GetDlgItem( IDC_PROGRESS
);
205 require_action( window
, exit
, ok
= FALSE
);
206 window
->SendMessage( ( UINT
) PBM_SETMARQUEE
, ( WPARAM
) FALSE
,( LPARAM
) 35 );
207 window
->ShowWindow( SW_HIDE
);