Mercurial > mercurial > hgweb_mover2.cgi
diff src/dirview.cpp @ 19:868ccd73e238 v2.2dev
directory viewer
author | pyon@macmini |
---|---|
date | Tue, 25 Oct 2011 07:48:39 +0900 |
parents | |
children | 044cc2f5af81 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/dirview.cpp Tue Oct 25 07:48:39 2011 +0900 @@ -0,0 +1,102 @@ + +// Filename : dirview.cpp +// Last Change: 24-Oct-2011. +// + +#include "dirview.h" + +// frame constructor +DirViewFrame::DirViewFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); + + wxBoxSizer* bSizer; + bSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_listCtrlAll = new wxListCtrl( this, ID_LISTCTRLALL, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL ); + itemCol.SetText( wxT("$BDLHV(B") ); + m_listCtrlAll->InsertColumn( 0, itemCol ); + m_listCtrlAll->SetColumnWidth( 0, 100 ); + itemCol.SetText( wxT("$BHoJ]81<THV9f(B") ); + m_listCtrlAll->InsertColumn( 1, itemCol ); + m_listCtrlAll->SetColumnWidth( 1, 180 ); + itemCol.SetText( wxT("$B%U%!%$%k?t(B") ); + m_listCtrlAll->InsertColumn( 2, itemCol ); + m_listCtrlAll->SetColumnWidth( 1, 100 ); + bSizer->Add( m_listCtrlAll, 0, wxALL|wxEXPAND, 5 ); + + m_listCtrlThumbnail = new wxListCtrl( this, ID_LISTCTRLTHUMB, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); + bSizer->Add( m_listCtrlThumbnail, 0, wxALL|wxEXPAND, 5 ); + + m_bitmapPreview = new wxStaticBitmap( this, ID_BITMAPPREVIEW, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer->Add( m_bitmapPreview, 1, wxALL|wxEXPAND, 5 ); + + this->SetSizer( bSizer ); + this->Layout(); + + this->Centre( wxBOTH ); +} + +// destructor +DirViewFrame::~DirViewFrame() +{ +} + +// Event Table +BEGIN_EVENT_TABLE( MyFrame, wxFrame ) + EVT_LIST_ITEM_SELECTED( ID_LISTCTRLALL, DirViewFrame::OnThumbnail ) + EVT_LIST_ITEM_SELECTED( ID_LISTCTRLTHUMB, DirViewFrame::OnPreview ) +END_EVENT_TABLE() + +// Event Handlers +void DirViewFrame::OnThumbnail(wxListEvent& event) +{ + m_listCtrlThumbnail->DeleteAllItems(); + /* + m_imageList->RemoveAll(); + wxDir dir(m_dir); + wxString filename; + if ( !dir.IsOpened() ) return; + + bool cout = dir.GetFirst( &filename, wxT("*.jpg"), wxDIR_FILES ); + + int i=0; + wxListItem item; + while ( cout ) { + wxString f = m_dir + wxFILE_SEP_PATH + filename; + wxFile file( f ); + long len = file.Length(); + if ( !m_checkBox->IsChecked() && len > 150000 ) { + cout = dir.GetNext( &filename ); + continue; + } + + item.SetId(i); + item.SetMask(wxLIST_MASK_STATE|wxLIST_MASK_TEXT|wxLIST_MASK_IMAGE); + item.SetStateMask(wxLIST_STATE_SELECTED); + item.SetState(wxLIST_STATE_SELECTED); + item.SetImage(i); + item.SetText(filename); + m_listCtrl->InsertItem( item ); + m_listCtrl->SetItem( item ); + + wxImage img( f, wxBITMAP_TYPE_JPEG ); + wxBitmap bmp( img.Scale( 63, 89, wxIMAGE_QUALITY_HIGH ) ); + m_imageList->Add( bmp ); + cout = dir.GetNext( &filename ); + i++; + } + */ + + return; +} + +void DirViewFrame::OnPreview(wxListEvent& event) +{ +} + +// Functions +void DirViewFrame::ListAll(void) +{ +}