1/* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
4 *
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
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17
18#include	<assert.h>
19#include	<stdlib.h>
20
21#include	"stdafx.h"
22
23#include	"LoginDialog.h"
24
25#ifdef _DEBUG
26#define new DEBUG_NEW
27#undef THIS_FILE
28static char THIS_FILE[] = __FILE__;
29#endif
30
31//===========================================================================================================================
32//	Message Map
33//===========================================================================================================================
34
35BEGIN_MESSAGE_MAP( LoginDialog, CDialog )
36END_MESSAGE_MAP()
37
38//===========================================================================================================================
39//	LoginDialog
40//===========================================================================================================================
41
42LoginDialog::LoginDialog( CWnd *inParent )
43	: CDialog( LoginDialog::IDD, inParent )
44{
45	//
46}
47
48//===========================================================================================================================
49//	OnInitDialog
50//===========================================================================================================================
51
52BOOL	LoginDialog::OnInitDialog( void )
53{
54	CDialog::OnInitDialog();
55	return( TRUE );
56}
57
58//===========================================================================================================================
59//	DoDataExchange
60//===========================================================================================================================
61
62void	LoginDialog::DoDataExchange( CDataExchange *inDX )
63{
64	CDialog::DoDataExchange( inDX );
65}
66
67//===========================================================================================================================
68//	OnOK
69//===========================================================================================================================
70
71void	LoginDialog::OnOK( void )
72{
73	const CWnd *		control;
74
75	// Username
76
77	control = GetDlgItem( IDC_LOGIN_USERNAME_TEXT );
78	assert( control );
79	if( control )
80	{
81		control->GetWindowText( mUsername );
82	}
83
84	// Password
85
86	control = GetDlgItem( IDC_LOGIN_PASSWORD_TEXT );
87	assert( control );
88	if( control )
89	{
90		control->GetWindowText( mPassword );
91	}
92
93	CDialog::OnOK();
94}
95
96//===========================================================================================================================
97//	GetLogin
98//===========================================================================================================================
99
100BOOL	LoginDialog::GetLogin( CString &outUsername, CString &outPassword )
101{
102	if( DoModal() == IDOK )
103	{
104		outUsername = mUsername;
105		outPassword = mPassword;
106		return( TRUE );
107	}
108	return( FALSE );
109}
110