Mercurial > mercurial > hgweb_rsearcher.cgi
comparison src/auth.cpp @ 0:d3b8cd5aeb70
make repo.
author | pyon@macmini |
---|---|
date | Sun, 30 Sep 2018 17:27:04 +0900 |
parents | |
children | eaa27e4ed5be |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d3b8cd5aeb70 |
---|---|
1 // Filename : auth.cpp | |
2 // Last Change: 2018-09-29 Sat 06:18:31. | |
3 // | |
4 | |
5 #include "auth.h" | |
6 | |
7 AuthDialog::AuthDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) | |
8 : wxDialog( parent, id, title, pos, size, style ) | |
9 { | |
10 CreateControls(); | |
11 LoadUserID(); | |
12 InDevelop(); | |
13 } | |
14 | |
15 AuthDialog::~AuthDialog() | |
16 { | |
17 } | |
18 | |
19 // Event Table | |
20 BEGIN_EVENT_TABLE( AuthDialog, wxDialog ) | |
21 EVT_TEXT( ID_UID, AuthDialog::OnCheckUserID ) | |
22 EVT_TEXT( ID_PW, AuthDialog::OnCheckPassword ) | |
23 EVT_TEXT_ENTER( ID_UID, AuthDialog::OnEnter ) | |
24 EVT_TEXT_ENTER( ID_PW, AuthDialog::OnEnter ) | |
25 END_EVENT_TABLE() | |
26 | |
27 // Event Handler | |
28 void AuthDialog::OnCheckUserID( wxCommandEvent& WXUNUSED(event) ) | |
29 { | |
30 wxString id = m_textCtrlId->GetValue(); | |
31 if ( 1 ) { | |
32 m_staticTextIdmsg->SetLabel( "ok" ); | |
33 m_staticTextPwmsg->SetLabel( wxT("← input") ); | |
34 } | |
35 else { | |
36 m_staticTextIdmsg->SetLabel( wxT("← input") ); | |
37 m_staticTextIdmsg->SetLabel( wxEmptyString ); | |
38 } | |
39 } | |
40 | |
41 void AuthDialog::OnCheckPassword( wxCommandEvent& WXUNUSED(event) ) | |
42 { | |
43 wxString pw = m_textCtrlPw->GetValue(); | |
44 if ( pw.Len() < 4 ) { | |
45 m_staticTextPwmsg->SetLabel( wxT("← too short") ); | |
46 } | |
47 else { | |
48 m_staticTextPwmsg->SetLabel( wxEmptyString ); | |
49 } | |
50 } | |
51 | |
52 void AuthDialog::OnEnter( wxCommandEvent& WXUNUSED(event) ) | |
53 { | |
54 Close(); | |
55 } | |
56 | |
57 // Functions | |
58 void AuthDialog::LoadUserID( void ) | |
59 { | |
60 // ファイルから UserID を読み込む | |
61 } | |
62 | |
63 void AuthDialog::InDevelop( void ) | |
64 { | |
65 SetTitle( "now on test" ); | |
66 m_textCtrlId->SetValue( "test" ); | |
67 m_textCtrlPw->SetValue( "test" ); | |
68 m_textCtrlPw->SetFocus(); | |
69 } | |
70 | |
71 void AuthDialog::CreateControls( void ) | |
72 { | |
73 this->SetIcon( wxIcon( wxT( "sample" ) ) ); | |
74 this->SetSizeHints( wxDefaultSize, wxDefaultSize ); | |
75 this->SetBackgroundColour( wxColour( 0, 150, 230 ) ); | |
76 | |
77 wxGridSizer* gSizer = new wxGridSizer( 0, 3, 0, 0 ); | |
78 | |
79 // user id | |
80 m_staticTextId = new wxStaticText( this, wxID_ANY, wxT("User ID"), wxDefaultPosition, wxDefaultSize, 0 ); | |
81 gSizer->Add( m_staticTextId, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); | |
82 | |
83 m_textCtrlId = new wxTextCtrl( this, ID_UID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); | |
84 gSizer->Add( m_textCtrlId, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | |
85 | |
86 m_staticTextIdmsg = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); | |
87 m_staticTextIdmsg->SetForegroundColour( wxColour( 250, 0, 0 ) ); | |
88 gSizer->Add( m_staticTextIdmsg, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | |
89 | |
90 // password | |
91 m_staticTextPw = new wxStaticText( this, wxID_ANY, wxT("Password"), wxDefaultPosition, wxDefaultSize, 0 ); | |
92 gSizer->Add( m_staticTextPw, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); | |
93 | |
94 m_textCtrlPw = new wxTextCtrl( this, ID_PW, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD|wxTE_PROCESS_ENTER ); | |
95 gSizer->Add( m_textCtrlPw, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | |
96 | |
97 m_staticTextPwmsg = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); | |
98 m_staticTextPwmsg->SetForegroundColour( wxColour( 250, 0, 0 ) ); | |
99 gSizer->Add( m_staticTextPwmsg, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | |
100 | |
101 this->SetSizer( gSizer ); | |
102 this->Layout(); | |
103 gSizer->Fit( this ); | |
104 | |
105 this->Centre( wxBOTH ); | |
106 } | |
107 |