Mercurial > mercurial > hgweb_rsearcher.cgi
diff src/index.cpp @ 16:b651aa41b9d4 default tip
hhsinfo method (server)
author | pyon@macmini |
---|---|
date | Mon, 15 Jul 2019 07:03:05 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/index.cpp Mon Jul 15 07:03:05 2019 +0900 @@ -0,0 +1,130 @@ +// Filename : id.cpp +// Last Change: 2019-07-15 Mon 07:00:57. +// +#include <wx/textfile.h> +#include "id.h" +#include "index.h" + +IndexFrame::IndexFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) + : wxFrame( parent, id, title, pos, size, style ) +{ + wxTextFile file; + file.Open( wxT( "index.db" ) ); + for ( int i = 0; i < file.GetLineCount(); i++ ) { + wxArrayString buf = wxSplit( file.GetLine( i ), ':', '\\' ); + } + file.Close(); + + CreateControls(); +} + +IndexFrame::~IndexFrame() +{ +} + +// Event Table +BEGIN_EVENT_TABLE( IndexFrame, wxFrame ) + EVT_CHOICE( ID_DRIVE, IndexFrame::OnDrive ) + EVT_CHOICE( ID_YEAR, IndexFrame::OnYear ) + EVT_LISTBOX( ID_DATE, IndexFrame::OnDate ) + EVT_LISTBOX( ID_CCN, IndexFrame::OnCcn ) +END_EVENT_TABLE() + +// Event Handlers & Functions +// Event Handlers +void IndexFrame::OnDrive( wxCommandEvent& event ) +{ + m_dataViewListCtrl->DeleteAllItems(); + m_choiceYear->SetSelection( 0 ); + m_listBoxDate->Clear(); + + if ( m_choiceDrive->GetSelection() == 0 ) { + m_listBoxCcn->Enable( false ); + } else { + m_listBoxCcn->Enable( true ); + } +} + +void IndexFrame::OnYear( wxCommandEvent& event ) +{ + m_dataViewListCtrl->DeleteAllItems(); + + if ( m_choiceDrive->GetSelection() == 0 ) { + } else { + wxString drive = m_choiceDrive->GetStringSelection(); + wxString year = m_choiceYear->GetStringSelection(); + } +} + +void IndexFrame::OnDate( wxCommandEvent& event ) +{ +} + +void IndexFrame::OnCcn( wxCommandEvent& event ) +{ + m_dataViewListCtrl->DeleteAllItems(); +} + +// Functions +void IndexFrame::CreateControls() +{ + this->SetBackgroundColour( wxColour( 166, 126, 66 ) ); + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL ); + + wxFlexGridSizer* fgSizerSelect; + fgSizerSelect = new wxFlexGridSizer( 0, 2, 0, 0 ); + fgSizerSelect->SetFlexibleDirection( wxBOTH ); + fgSizerSelect->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + // Left + m_dataViewListCtrl = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_HORIZ_RULES|wxDV_ROW_LINES|wxDV_VERT_RULES ); + m_dataViewListColumnNo = m_dataViewListCtrl->AppendTextColumn( wxT("No"), wxDATAVIEW_CELL_INERT, 30, static_cast<wxAlignment>(wxALIGN_RIGHT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); + m_dataViewListColumnHno = m_dataViewListCtrl->AppendTextColumn( wxT("HNo"), wxDATAVIEW_CELL_INERT, 100, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); + m_dataViewListColumnName = m_dataViewListCtrl->AppendTextColumn( wxT("Name"), wxDATAVIEW_CELL_INERT, 120, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); + m_dataViewListColumnKana = m_dataViewListCtrl->AppendTextColumn( wxT("Kana"), wxDATAVIEW_CELL_INERT, 120, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); + bSizerTop->Add( m_dataViewListCtrl, 1, wxALL|wxEXPAND, 5 ); + + // Right + m_staticTextDrive = new wxStaticText( this, wxID_ANY, wxT("Drive"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerSelect->Add( m_staticTextDrive, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString choiceDrive[] = { wxT("server"), wxT("C:\\"), wxT("Y:\\"), wxT("Z:\\") }; + int n = sizeof( choiceDrive ) / sizeof( wxString ); + m_choiceDrive = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxSize( 100, -1 ), n, choiceDrive, 0 ); + m_choiceDrive->SetSelection( 0 ); + fgSizerSelect->Add( m_choiceDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextYear = new wxStaticText( this, wxID_ANY, wxT("Year"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerSelect->Add( m_staticTextYear, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + wxArrayString m_choiceYearChoices; + for ( int y = 2005; y < 2030; y++ ) + m_choiceYearChoices.Add( wxString::Format( "%d", y ) ); + m_choiceYear = new wxChoice( this, ID_DATE, wxDefaultPosition, wxSize( 100, -1 ), m_choiceYearChoices, 0 ); + m_choiceYear->SetSelection( 0 ); + fgSizerSelect->Add( m_choiceYear, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextDate = new wxStaticText( this, wxID_ANY, wxT("Date"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerSelect->Add( m_staticTextDate, 0, wxALL|wxALIGN_RIGHT, 5 ); + + m_listBoxDate = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxSize( 100, 300 ), 0, NULL, wxLB_ALWAYS_SB|wxLB_SINGLE ); + fgSizerSelect->Add( m_listBoxDate, 0, wxALL, 5 ); + + m_staticTextCcn = new wxStaticText( this, wxID_ANY, wxT("Ccn"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerSelect->Add( m_staticTextCcn, 0, wxALL|wxALIGN_RIGHT, 5 ); + + m_listBoxCcn = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxSize( 100, 100 ), 0, NULL, wxLB_ALWAYS_SB|wxLB_SINGLE ); + fgSizerSelect->Add( m_listBoxCcn, 0, wxALL, 5 ); + m_listBoxCcn->Enable( false ); + + bSizerTop->Add( fgSizerSelect, 0, wxEXPAND, 5 ); + + + this->SetSizer( bSizerTop ); + this->Layout(); + + this->Centre( wxBOTH ); +} +