Mercurial > mercurial > hgweb_searcher03.cgi
comparison src/hist.cpp @ 0:0c0701a935f8
Start Development.
author | pyon@macmini |
---|---|
date | Sun, 21 Jul 2013 16:07:19 +0900 |
parents | |
children | 7b6dab24f4b8 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0c0701a935f8 |
---|---|
1 // Filename : hist.cpp | |
2 // Last Change: 21-Jul-2013. | |
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 ); | |
18 m_listCtrl->SetColumnWidth( 0, 50 ); | |
19 itemCol.SetText( wxT("被保険者番号") ); | |
20 m_listCtrl->InsertColumn( 1, itemCol ); | |
21 m_listCtrl->SetColumnWidth( 1, 80 ); | |
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 ); | |
27 m_listCtrl->SetColumnWidth( 3, 300 ); | |
28 itemCol.SetText( wxT("検索時刻") ); | |
29 m_listCtrl->InsertColumn( 4, itemCol ); | |
30 m_listCtrl->SetColumnWidth( 4, 100 ); | |
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 | |
39 m_buttonSet = new wxButton( this, wxID_OK, wxT("セット"), wxDefaultPosition, wxDefaultSize, 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 | |
49 SetupHistoryList(); | |
50 } | |
51 | |
52 HistDialog::~HistDialog() | |
53 { | |
54 } | |
55 | |
56 // Event Table | |
57 BEGIN_EVENT_TABLE( HistDialog, wxDialog ) | |
58 //EVT_LIST_ITEM_ACTIVATED( ID_LIST, MyFrame::OnOpenHhsDir ) | |
59 //EVT_BUTTON( ID_HIST, MyFrame::OnHistory ) | |
60 END_EVENT_TABLE() | |
61 | |
62 | |
63 void HistDialog::SetupHistoryList( void ) { | |
64 | |
65 wxTextFile file; | |
66 wxString filename = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("history"); | |
67 wxString buf; | |
68 | |
69 if ( file.Open( filename ) ) { | |
70 | |
71 for ( size_t i = 0; i<file.GetLineCount(); i++ ) { | |
72 | |
73 int col = 0; | |
74 m_listCtrl->InsertItem( i, -1 ); | |
75 buf.Printf( wxT("%02d"), i + 1 ); | |
76 m_listCtrl->SetItem( i, col, buf, -1 ); // No | |
77 | |
78 wxStringTokenizer tkz( file[i], wxT(":") ); | |
79 while ( tkz.HasMoreTokens() ) { | |
80 col++; | |
81 wxString token = tkz.GetNextToken(); | |
82 m_listCtrl->SetItem( i, col, token, -1 ); | |
83 } | |
84 if ( i % 2 ) m_listCtrl->SetItemBackgroundColour( i, wxColour(wxT("WHEAT")) ); | |
85 } | |
86 } | |
87 file.Close(); | |
88 } | |
89 |