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