Mercurial > mercurial > hgweb_rsearcher.cgi
diff src/auth.cpp @ 0:d3b8cd5aeb70
make repo.
author | pyon@macmini |
---|---|
date | Sun, 30 Sep 2018 17:27:04 +0900 |
parents | |
children | eaa27e4ed5be |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/auth.cpp Sun Sep 30 17:27:04 2018 +0900 @@ -0,0 +1,107 @@ +// Filename : auth.cpp +// Last Change: 2018-09-29 Sat 06:18:31. +// + +#include "auth.h" + +AuthDialog::AuthDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) + : wxDialog( parent, id, title, pos, size, style ) +{ + CreateControls(); + LoadUserID(); + InDevelop(); +} + +AuthDialog::~AuthDialog() +{ +} + +// Event Table +BEGIN_EVENT_TABLE( AuthDialog, wxDialog ) + EVT_TEXT( ID_UID, AuthDialog::OnCheckUserID ) + EVT_TEXT( ID_PW, AuthDialog::OnCheckPassword ) + EVT_TEXT_ENTER( ID_UID, AuthDialog::OnEnter ) + EVT_TEXT_ENTER( ID_PW, AuthDialog::OnEnter ) +END_EVENT_TABLE() + +// Event Handler +void AuthDialog::OnCheckUserID( wxCommandEvent& WXUNUSED(event) ) +{ + wxString id = m_textCtrlId->GetValue(); + if ( 1 ) { + m_staticTextIdmsg->SetLabel( "ok" ); + m_staticTextPwmsg->SetLabel( wxT("← input") ); + } + else { + m_staticTextIdmsg->SetLabel( wxT("← input") ); + m_staticTextIdmsg->SetLabel( wxEmptyString ); + } +} + +void AuthDialog::OnCheckPassword( wxCommandEvent& WXUNUSED(event) ) +{ + wxString pw = m_textCtrlPw->GetValue(); + if ( pw.Len() < 4 ) { + m_staticTextPwmsg->SetLabel( wxT("← too short") ); + } + else { + m_staticTextPwmsg->SetLabel( wxEmptyString ); + } +} + +void AuthDialog::OnEnter( wxCommandEvent& WXUNUSED(event) ) +{ + Close(); +} + +// Functions +void AuthDialog::LoadUserID( void ) +{ + // ファイルから UserID を読み込む +} + +void AuthDialog::InDevelop( void ) +{ + SetTitle( "now on test" ); + m_textCtrlId->SetValue( "test" ); + m_textCtrlPw->SetValue( "test" ); + m_textCtrlPw->SetFocus(); +} + +void AuthDialog::CreateControls( void ) +{ + this->SetIcon( wxIcon( wxT( "sample" ) ) ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetBackgroundColour( wxColour( 0, 150, 230 ) ); + + wxGridSizer* gSizer = new wxGridSizer( 0, 3, 0, 0 ); + + // user id + m_staticTextId = new wxStaticText( this, wxID_ANY, wxT("User ID"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_staticTextId, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + + m_textCtrlId = new wxTextCtrl( this, ID_UID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); + gSizer->Add( m_textCtrlId, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextIdmsg = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextIdmsg->SetForegroundColour( wxColour( 250, 0, 0 ) ); + gSizer->Add( m_staticTextIdmsg, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + // password + m_staticTextPw = new wxStaticText( this, wxID_ANY, wxT("Password"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_staticTextPw, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + + m_textCtrlPw = new wxTextCtrl( this, ID_PW, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD|wxTE_PROCESS_ENTER ); + gSizer->Add( m_textCtrlPw, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextPwmsg = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPwmsg->SetForegroundColour( wxColour( 250, 0, 0 ) ); + gSizer->Add( m_staticTextPwmsg, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + this->SetSizer( gSizer ); + this->Layout(); + gSizer->Fit( this ); + + this->Centre( wxBOTH ); +} +