comparison src/delwhite.cpp @ 4:a505f7417742

v0.1 release
author pyon@macmini
date Thu, 06 Oct 2011 07:56:12 +0900
parents a5bddd859104
children
comparison
equal deleted inserted replaced
3:a5bddd859104 4:a505f7417742
1 // Filename : delwhite.cpp 1 // Filename : delwhite.cpp
2 // Last Change: 03-Oct-2011. 2 // Last Change: 05-Oct-2011.
3 // 3 //
4 4
5 #include "delwhite.h" 5 #include "delwhite.h"
6
7 // for all others, include the necessary headers (this file is usually all you
8 // need because it includes almost all "standard" wxWidgets headers)
9 #ifndef WX_PRECOMP
10 #include "wx/utils.h"
11 #include "wx/dir.h"
12 #include "wx/file.h"
13 #endif
14
15 6
16 // constructor 7 // constructor
17 FrameDelWhite::FrameDelWhite( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) 8 FrameDelWhite::FrameDelWhite( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
18 { 9 {
19 this->SetSize( 1200, 1000 ); 10 this->SetSize( 1200, 1000 );
69 LoadImages(); 60 LoadImages();
70 } 61 }
71 62
72 void FrameDelWhite::DeleteImage(wxCommandEvent& WXUNUSED(event)) 63 void FrameDelWhite::DeleteImage(wxCommandEvent& WXUNUSED(event))
73 { 64 {
65 wxDateTime now = wxDateTime::Now();
66 wxString trash = wxGetCwd() + wxFILE_SEP_PATH + wxT("trash") + wxFILE_SEP_PATH + now.Format(wxT("%Y%m%d%H%M%S"));
67 wxMkdir( trash );
68
69 long item = -1;
70 for ( ; ; ) {
71 item = m_listCtrl->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
72 if ( item == -1 )
73 break;
74 wxString file = m_listCtrl->GetItemText( item );
75
76 wxString from = m_dir + wxFILE_SEP_PATH + file;
77 wxString to = trash + wxFILE_SEP_PATH + file;
78 wxRenameFile( from, to, false );
79 }
80 LoadImages();
74 return; 81 return;
75 } 82 }
76 83
77 void FrameDelWhite::CloseFrame(wxCommandEvent& WXUNUSED(event)) 84 void FrameDelWhite::CloseFrame(wxCommandEvent& WXUNUSED(event))
78 { 85 {