1// PasswordDialog.cpp 2 3#include "StdAfx.h" 4 5#include "PasswordDialog.h" 6 7#ifdef LANG 8#include "LangUtils.h" 9#endif 10 11#ifdef LANG 12static const UInt32 kLangIDs[] = 13{ 14 IDT_PASSWORD_ENTER, 15 IDX_PASSWORD_SHOW 16}; 17#endif 18 19void CPasswordDialog::ReadControls() 20{ 21 _passwordEdit.GetText(Password); 22 ShowPassword = IsButtonCheckedBool(IDX_PASSWORD_SHOW); 23} 24 25void CPasswordDialog::SetTextSpec() 26{ 27 _passwordEdit.SetPasswordChar(ShowPassword ? 0: TEXT('*')); 28 _passwordEdit.SetText(Password); 29} 30 31bool CPasswordDialog::OnInit() 32{ 33 #ifdef LANG 34 LangSetWindowText(*this, IDD_PASSWORD); 35 LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs)); 36 #endif 37 _passwordEdit.Attach(GetItem(IDE_PASSWORD_PASSWORD)); 38 CheckButton(IDX_PASSWORD_SHOW, ShowPassword); 39 SetTextSpec(); 40 return CModalDialog::OnInit(); 41} 42 43bool CPasswordDialog::OnButtonClicked(int buttonID, HWND buttonHWND) 44{ 45 if (buttonID == IDX_PASSWORD_SHOW) 46 { 47 ReadControls(); 48 SetTextSpec(); 49 return true; 50 } 51 return CDialog::OnButtonClicked(buttonID, buttonHWND); 52} 53 54void CPasswordDialog::OnOK() 55{ 56 ReadControls(); 57 CModalDialog::OnOK(); 58} 59