Mercurial > mercurial > hgweb_mover.cgi
diff src/testframe.cpp @ 6:99d612849255
v0.3
author | pyon@macmini |
---|---|
date | Sat, 08 Oct 2011 17:00:33 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/testframe.cpp Sat Oct 08 17:00:33 2011 +0900 @@ -0,0 +1,76 @@ +// Filename : testframe.cpp +// Last Change: 08-Oct-2011. +// +#include "common.h" + +class TestFrame : public wxFrame +{ + DECLARE_EVENT_TABLE() + private: + wxListCtrl* m_listCtrl; + + public: + TestFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLOSE_BOX ); + ~TestFrame(); + + void OnMessage(wxListEvent&); +}; + +// constructor +TestFrame::TestFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) + : wxFrame( parent, id, title, pos, size, style ) +{ + this->SetSize( 400, 600 ); + this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); + + wxBoxSizer* bSizer; + bSizer = new wxBoxSizer( wxVERTICAL ); + + m_listCtrl = new wxListCtrl( this, ID_LSWHITE, wxDefaultPosition, wxDefaultSize, wxLC_REPORT ); + wxListItem itemCol; + itemCol.SetText( wxT("通番") ); + m_listCtrl->InsertColumn( 0, itemCol ); + m_listCtrl->SetColumnWidth( 0, 100 ); + itemCol.SetText( wxT("被保険者番号") ); + m_listCtrl->InsertColumn( 1, itemCol ); + m_listCtrl->SetColumnWidth( 1, 180 ); + itemCol.SetText( wxT("ファイル数") ); + m_listCtrl->InsertColumn( 2, itemCol ); + m_listCtrl->SetColumnWidth( 1, 100 ); + bSizer->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); + + this->SetSizer( bSizer ); + this->Layout(); + + this->Centre( wxBOTH ); + + m_listCtrl->InsertItem( 1, wxT("aaa") ); + m_listCtrl->SetItem( 0, 1, wxT("bbb"), -1 ); + m_listCtrl->InsertItem( 1, wxT("aa2") ); + m_listCtrl->SetItem( 1, 1, wxT("bb2"), -1 ); +} + +// destructor +TestFrame::~TestFrame() +{ +} + +// Event Table +BEGIN_EVENT_TABLE( TestFrame, wxFrame ) + EVT_LIST_ITEM_ACTIVATED( ID_LSWHITE, TestFrame::OnMessage ) +END_EVENT_TABLE() + +// Event Handlers +void TestFrame::OnMessage(wxListEvent& event) +{ + wxListItem item = event.GetItem(); + item.SetColumn(1); + item.SetMask(wxLIST_MASK_TEXT); + //int n = item.GetColumn(); + //wxString msg_n = wxString::Format(wxT("%d"),n); + //wxMessageBox( msg_n ); + m_listCtrl->GetItem( item ); + wxString msg = item.GetText(); + wxMessageBox( msg ); +} +