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// MFC Debugging 26 27#ifdef _DEBUG 28#define new DEBUG_NEW 29#undef THIS_FILE 30static char THIS_FILE[] = __FILE__; 31#endif 32 33//=========================================================================================================================== 34// Message Map 35//=========================================================================================================================== 36 37BEGIN_MESSAGE_MAP( LoginDialog, CDialog ) 38END_MESSAGE_MAP() 39 40//=========================================================================================================================== 41// LoginDialog 42//=========================================================================================================================== 43 44LoginDialog::LoginDialog( CWnd *inParent ) 45 : CDialog( LoginDialog::IDD, inParent ) 46{ 47 // 48} 49 50//=========================================================================================================================== 51// OnInitDialog 52//=========================================================================================================================== 53 54BOOL LoginDialog::OnInitDialog( void ) 55{ 56 CDialog::OnInitDialog(); 57 return( TRUE ); 58} 59 60//=========================================================================================================================== 61// DoDataExchange 62//=========================================================================================================================== 63 64void LoginDialog::DoDataExchange( CDataExchange *inDX ) 65{ 66 CDialog::DoDataExchange( inDX ); 67} 68 69//=========================================================================================================================== 70// OnOK 71//=========================================================================================================================== 72 73void LoginDialog::OnOK( void ) 74{ 75 const CWnd * control; 76 77 // Username 78 79 control = GetDlgItem( IDC_LOGIN_USERNAME_TEXT ); 80 assert( control ); 81 if( control ) 82 { 83 control->GetWindowText( mUsername ); 84 } 85 86 // Password 87 88 control = GetDlgItem( IDC_LOGIN_PASSWORD_TEXT ); 89 assert( control ); 90 if( control ) 91 { 92 control->GetWindowText( mPassword ); 93 } 94 95 CDialog::OnOK(); 96} 97 98//=========================================================================================================================== 99// GetLogin 100//=========================================================================================================================== 101 102BOOL LoginDialog::GetLogin( CString &outUsername, CString &outPassword ) 103{ 104 if( DoModal() == IDOK ) 105 { 106 outUsername = mUsername; 107 outPassword = mPassword; 108 return( TRUE ); 109 } 110 return( FALSE ); 111} 112