Mercurial > mercurial > hgweb_searcher03.cgi
diff src/hist.cpp @ 0:0c0701a935f8
Start Development.
author | pyon@macmini |
---|---|
date | Sun, 21 Jul 2013 16:07:19 +0900 |
parents | |
children | 7b6dab24f4b8 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hist.cpp Sun Jul 21 16:07:19 2013 +0900 @@ -0,0 +1,89 @@ +// Filename : hist.cpp +// Last Change: 21-Jul-2013. +// +#include "hist.h" + +HistDialog::HistDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) + : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL ); + + m_listCtrl = new wxListCtrl( this, ID_LISTHIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL ); + + wxListItem itemCol; + itemCol.SetText( wxT("歴番") ); + m_listCtrl->InsertColumn( 0, itemCol ); + m_listCtrl->SetColumnWidth( 0, 50 ); + itemCol.SetText( wxT("被保険者番号") ); + m_listCtrl->InsertColumn( 1, itemCol ); + m_listCtrl->SetColumnWidth( 1, 80 ); + itemCol.SetText( wxT("氏名") ); + m_listCtrl->InsertColumn( 2, itemCol ); + m_listCtrl->SetColumnWidth( 2, 80 ); + itemCol.SetText( wxT("住所") ); + m_listCtrl->InsertColumn( 3, itemCol ); + m_listCtrl->SetColumnWidth( 3, 300 ); + itemCol.SetText( wxT("検索時刻") ); + m_listCtrl->InsertColumn( 4, itemCol ); + m_listCtrl->SetColumnWidth( 4, 100 ); + + bSizerTop->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerBtn->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonSet = new wxButton( this, wxID_OK, wxT("セット"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerBtn->Add( m_buttonSet, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerTop->Add( bSizerBtn, 0, wxALIGN_RIGHT|wxALL, 5 ); + + this->SetSizer( bSizerTop ); + this->Layout(); + + this->Centre( wxBOTH ); + + SetupHistoryList(); +} + +HistDialog::~HistDialog() +{ +} + +// Event Table +BEGIN_EVENT_TABLE( HistDialog, wxDialog ) + //EVT_LIST_ITEM_ACTIVATED( ID_LIST, MyFrame::OnOpenHhsDir ) + //EVT_BUTTON( ID_HIST, MyFrame::OnHistory ) +END_EVENT_TABLE() + + +void HistDialog::SetupHistoryList( void ) { + + wxTextFile file; + wxString filename = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("history"); + wxString buf; + + if ( file.Open( filename ) ) { + + for ( size_t i = 0; i<file.GetLineCount(); i++ ) { + + int col = 0; + m_listCtrl->InsertItem( i, -1 ); + buf.Printf( wxT("%02d"), i + 1 ); + m_listCtrl->SetItem( i, col, buf, -1 ); // No + + wxStringTokenizer tkz( file[i], wxT(":") ); + while ( tkz.HasMoreTokens() ) { + col++; + wxString token = tkz.GetNextToken(); + m_listCtrl->SetItem( i, col, token, -1 ); + } + if ( i % 2 ) m_listCtrl->SetItemBackgroundColour( i, wxColour(wxT("WHEAT")) ); + } + } + file.Close(); +} +