comparison src/index.cpp @ 16:b651aa41b9d4 default tip

hhsinfo method (server)
author pyon@macmini
date Mon, 15 Jul 2019 07:03:05 +0900
parents
children
comparison
equal deleted inserted replaced
15:c262e17de9b1 16:b651aa41b9d4
1 // Filename : id.cpp
2 // Last Change: 2019-07-15 Mon 07:00:57.
3 //
4 #include <wx/textfile.h>
5 #include "id.h"
6 #include "index.h"
7
8 IndexFrame::IndexFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
9 : wxFrame( parent, id, title, pos, size, style )
10 {
11 wxTextFile file;
12 file.Open( wxT( "index.db" ) );
13 for ( int i = 0; i < file.GetLineCount(); i++ ) {
14 wxArrayString buf = wxSplit( file.GetLine( i ), ':', '\\' );
15 }
16 file.Close();
17
18 CreateControls();
19 }
20
21 IndexFrame::~IndexFrame()
22 {
23 }
24
25 // Event Table
26 BEGIN_EVENT_TABLE( IndexFrame, wxFrame )
27 EVT_CHOICE( ID_DRIVE, IndexFrame::OnDrive )
28 EVT_CHOICE( ID_YEAR, IndexFrame::OnYear )
29 EVT_LISTBOX( ID_DATE, IndexFrame::OnDate )
30 EVT_LISTBOX( ID_CCN, IndexFrame::OnCcn )
31 END_EVENT_TABLE()
32
33 // Event Handlers & Functions
34 // Event Handlers
35 void IndexFrame::OnDrive( wxCommandEvent& event )
36 {
37 m_dataViewListCtrl->DeleteAllItems();
38 m_choiceYear->SetSelection( 0 );
39 m_listBoxDate->Clear();
40
41 if ( m_choiceDrive->GetSelection() == 0 ) {
42 m_listBoxCcn->Enable( false );
43 } else {
44 m_listBoxCcn->Enable( true );
45 }
46 }
47
48 void IndexFrame::OnYear( wxCommandEvent& event )
49 {
50 m_dataViewListCtrl->DeleteAllItems();
51
52 if ( m_choiceDrive->GetSelection() == 0 ) {
53 } else {
54 wxString drive = m_choiceDrive->GetStringSelection();
55 wxString year = m_choiceYear->GetStringSelection();
56 }
57 }
58
59 void IndexFrame::OnDate( wxCommandEvent& event )
60 {
61 }
62
63 void IndexFrame::OnCcn( wxCommandEvent& event )
64 {
65 m_dataViewListCtrl->DeleteAllItems();
66 }
67
68 // Functions
69 void IndexFrame::CreateControls()
70 {
71 this->SetBackgroundColour( wxColour( 166, 126, 66 ) );
72 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
73
74 wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL );
75
76 wxFlexGridSizer* fgSizerSelect;
77 fgSizerSelect = new wxFlexGridSizer( 0, 2, 0, 0 );
78 fgSizerSelect->SetFlexibleDirection( wxBOTH );
79 fgSizerSelect->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
80
81 // Left
82 m_dataViewListCtrl = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_HORIZ_RULES|wxDV_ROW_LINES|wxDV_VERT_RULES );
83 m_dataViewListColumnNo = m_dataViewListCtrl->AppendTextColumn( wxT("No"), wxDATAVIEW_CELL_INERT, 30, static_cast<wxAlignment>(wxALIGN_RIGHT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
84 m_dataViewListColumnHno = m_dataViewListCtrl->AppendTextColumn( wxT("HNo"), wxDATAVIEW_CELL_INERT, 100, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
85 m_dataViewListColumnName = m_dataViewListCtrl->AppendTextColumn( wxT("Name"), wxDATAVIEW_CELL_INERT, 120, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
86 m_dataViewListColumnKana = m_dataViewListCtrl->AppendTextColumn( wxT("Kana"), wxDATAVIEW_CELL_INERT, 120, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
87 bSizerTop->Add( m_dataViewListCtrl, 1, wxALL|wxEXPAND, 5 );
88
89 // Right
90 m_staticTextDrive = new wxStaticText( this, wxID_ANY, wxT("Drive"), wxDefaultPosition, wxDefaultSize, 0 );
91 fgSizerSelect->Add( m_staticTextDrive, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
92
93 wxString choiceDrive[] = { wxT("server"), wxT("C:\\"), wxT("Y:\\"), wxT("Z:\\") };
94 int n = sizeof( choiceDrive ) / sizeof( wxString );
95 m_choiceDrive = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxSize( 100, -1 ), n, choiceDrive, 0 );
96 m_choiceDrive->SetSelection( 0 );
97 fgSizerSelect->Add( m_choiceDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
98
99 m_staticTextYear = new wxStaticText( this, wxID_ANY, wxT("Year"), wxDefaultPosition, wxDefaultSize, 0 );
100 fgSizerSelect->Add( m_staticTextYear, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
101
102 wxArrayString m_choiceYearChoices;
103 for ( int y = 2005; y < 2030; y++ )
104 m_choiceYearChoices.Add( wxString::Format( "%d", y ) );
105 m_choiceYear = new wxChoice( this, ID_DATE, wxDefaultPosition, wxSize( 100, -1 ), m_choiceYearChoices, 0 );
106 m_choiceYear->SetSelection( 0 );
107 fgSizerSelect->Add( m_choiceYear, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
108
109 m_staticTextDate = new wxStaticText( this, wxID_ANY, wxT("Date"), wxDefaultPosition, wxDefaultSize, 0 );
110 fgSizerSelect->Add( m_staticTextDate, 0, wxALL|wxALIGN_RIGHT, 5 );
111
112 m_listBoxDate = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxSize( 100, 300 ), 0, NULL, wxLB_ALWAYS_SB|wxLB_SINGLE );
113 fgSizerSelect->Add( m_listBoxDate, 0, wxALL, 5 );
114
115 m_staticTextCcn = new wxStaticText( this, wxID_ANY, wxT("Ccn"), wxDefaultPosition, wxDefaultSize, 0 );
116 fgSizerSelect->Add( m_staticTextCcn, 0, wxALL|wxALIGN_RIGHT, 5 );
117
118 m_listBoxCcn = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxSize( 100, 100 ), 0, NULL, wxLB_ALWAYS_SB|wxLB_SINGLE );
119 fgSizerSelect->Add( m_listBoxCcn, 0, wxALL, 5 );
120 m_listBoxCcn->Enable( false );
121
122 bSizerTop->Add( fgSizerSelect, 0, wxEXPAND, 5 );
123
124
125 this->SetSizer( bSizerTop );
126 this->Layout();
127
128 this->Centre( wxBOTH );
129 }
130