0
|
1 // Filename : hist.cpp
|
1
|
2 // Last Change: 02-Aug-2013.
|
0
|
3 //
|
|
4 #include "hist.h"
|
|
5
|
|
6 HistDialog::HistDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
|
|
7 : wxDialog( parent, id, title, pos, size, style )
|
|
8 {
|
|
9 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
|
10
|
|
11 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
|
|
12
|
|
13 m_listCtrl = new wxListCtrl( this, ID_LISTHIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL );
|
|
14
|
|
15 wxListItem itemCol;
|
|
16 itemCol.SetText( wxT("歴番") );
|
|
17 m_listCtrl->InsertColumn( 0, itemCol );
|
1
|
18 m_listCtrl->SetColumnWidth( 0, 40 );
|
0
|
19 itemCol.SetText( wxT("被保険者番号") );
|
|
20 m_listCtrl->InsertColumn( 1, itemCol );
|
1
|
21 m_listCtrl->SetColumnWidth( 1, 90 );
|
0
|
22 itemCol.SetText( wxT("氏名") );
|
|
23 m_listCtrl->InsertColumn( 2, itemCol );
|
|
24 m_listCtrl->SetColumnWidth( 2, 80 );
|
|
25 itemCol.SetText( wxT("住所") );
|
|
26 m_listCtrl->InsertColumn( 3, itemCol );
|
1
|
27 m_listCtrl->SetColumnWidth( 3, 240 );
|
|
28 itemCol.SetText( wxT("検索日時") );
|
0
|
29 m_listCtrl->InsertColumn( 4, itemCol );
|
1
|
30 m_listCtrl->SetColumnWidth( 4, 80 );
|
0
|
31
|
|
32 bSizerTop->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 );
|
|
33
|
|
34 wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL );
|
|
35
|
|
36 m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
37 bSizerBtn->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
38
|
1
|
39 m_buttonSet = new wxButton( this, ID_SETHIST, wxT("セット"), wxDefaultPosition, wxDefaultSize, 0 );
|
0
|
40 bSizerBtn->Add( m_buttonSet, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
41
|
|
42 bSizerTop->Add( bSizerBtn, 0, wxALIGN_RIGHT|wxALL, 5 );
|
|
43
|
|
44 this->SetSizer( bSizerTop );
|
|
45 this->Layout();
|
|
46
|
|
47 this->Centre( wxBOTH );
|
|
48
|
1
|
49 ReadHistoryList();
|
0
|
50 }
|
|
51
|
|
52 HistDialog::~HistDialog()
|
|
53 {
|
|
54 }
|
|
55
|
|
56 // Event Table
|
|
57 BEGIN_EVENT_TABLE( HistDialog, wxDialog )
|
1
|
58 EVT_LIST_ITEM_ACTIVATED( ID_LISTHIST, HistDialog::OnSelectItem )
|
|
59 EVT_BUTTON( ID_SETHIST, HistDialog::OnSet )
|
0
|
60 END_EVENT_TABLE()
|
|
61
|
|
62
|
1
|
63 void HistDialog::OnSelectItem( wxListEvent& WXUNUSED(event) )
|
|
64 {
|
|
65 }
|
0
|
66
|
1
|
67 void HistDialog::OnSet( wxCommandEvent& WXUNUSED(event) )
|
|
68 {
|
|
69
|
|
70 }
|
|
71
|
|
72 void HistDialog::ReadHistoryList( void )
|
|
73 {
|
0
|
74 wxTextFile file;
|
|
75 wxString filename = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("history");
|
|
76 wxString buf;
|
|
77
|
|
78 if ( file.Open( filename ) ) {
|
|
79
|
|
80 for ( size_t i = 0; i<file.GetLineCount(); i++ ) {
|
|
81
|
|
82 int col = 0;
|
|
83 m_listCtrl->InsertItem( i, -1 );
|
|
84 buf.Printf( wxT("%02d"), i + 1 );
|
|
85 m_listCtrl->SetItem( i, col, buf, -1 ); // No
|
|
86
|
|
87 wxStringTokenizer tkz( file[i], wxT(":") );
|
|
88 while ( tkz.HasMoreTokens() ) {
|
|
89 col++;
|
|
90 wxString token = tkz.GetNextToken();
|
|
91 m_listCtrl->SetItem( i, col, token, -1 );
|
|
92 }
|
|
93 if ( i % 2 ) m_listCtrl->SetItemBackgroundColour( i, wxColour(wxT("WHEAT")) );
|
|
94 }
|
|
95 }
|
|
96 file.Close();
|
|
97 }
|
|
98
|