Files

59 lines
1.1 KiB
C++
Raw Permalink Normal View History

2021-10-19 21:27:23 +01:00
// PasswordDialog.cpp
#include "StdAfx.h"
#include "PasswordDialog.h"
2023-09-24 03:13:03 +01:00
#ifdef Z7_LANG
2021-10-19 21:27:23 +01:00
#include "LangUtils.h"
#endif
2023-09-24 03:13:03 +01:00
#ifdef Z7_LANG
2021-10-19 21:27:23 +01:00
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()
{
2023-09-24 03:13:03 +01:00
#ifdef Z7_LANG
2021-10-19 21:27:23 +01:00
LangSetWindowText(*this, IDD_PASSWORD);
2023-09-24 03:13:03 +01:00
LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
2021-10-19 21:27:23 +01:00
#endif
_passwordEdit.Attach(GetItem(IDE_PASSWORD_PASSWORD));
CheckButton(IDX_PASSWORD_SHOW, ShowPassword);
SetTextSpec();
return CModalDialog::OnInit();
}
2023-09-24 03:13:03 +01:00
bool CPasswordDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
2021-10-19 21:27:23 +01:00
{
if (buttonID == IDX_PASSWORD_SHOW)
{
ReadControls();
SetTextSpec();
return true;
}
return CDialog::OnButtonClicked(buttonID, buttonHWND);
}
void CPasswordDialog::OnOK()
{
ReadControls();
CModalDialog::OnOK();
}