Mercurial > mercurial > hgweb_mover.cgi
comparison src/delwhite.cpp @ 3:a5bddd859104
implement delwhtie
| author | pyon@macmini |
|---|---|
| date | Tue, 04 Oct 2011 07:43:08 +0900 |
| parents | 1ea4f7981ff5 |
| children | a505f7417742 |
comparison
equal
deleted
inserted
replaced
| 2:1ea4f7981ff5 | 3:a5bddd859104 |
|---|---|
| 1 // Filename : delwhite.cpp | 1 // Filename : delwhite.cpp |
| 2 // Last Change: 02-Oct-2011. | 2 // Last Change: 03-Oct-2011. |
| 3 // | 3 // |
| 4 | 4 |
| 5 #include "delwhite.h" | 5 #include "delwhite.h" |
| 6 | 6 |
| 7 // for all others, include the necessary headers (this file is usually all you | 7 // for all others, include the necessary headers (this file is usually all you |
| 15 | 15 |
| 16 // constructor | 16 // 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 ) | 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 ) |
| 18 { | 18 { |
| 19 this->SetSize( 1200, 1000 ); | 19 this->SetSize( 1200, 1000 ); |
| 20 //this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); | 20 this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); |
| 21 //this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); | |
| 22 | 21 |
| 23 wxBoxSizer* bSizer; | 22 wxBoxSizer* bSizer; |
| 24 bSizer = new wxBoxSizer( wxVERTICAL ); | 23 bSizer = new wxBoxSizer( wxVERTICAL ); |
| 25 | 24 |
| 26 m_listCtrl = new wxListCtrl( this, ID_LSWHITE, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); | 25 m_listCtrl = new wxListCtrl( this, ID_LSWHITE, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); |
| 27 bSizer->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); | 26 bSizer->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); |
| 28 m_imageList = new wxImageList( 105, 148 ); | 27 m_imageList = new wxImageList( 63, 89 ); |
| 29 m_listCtrl->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL ); | 28 m_listCtrl->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL ); |
| 30 | 29 |
| 31 wxBoxSizer* bSizerBtn; | 30 wxBoxSizer* bSizerBtn; |
| 32 bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); | 31 bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); |
| 33 | 32 |
| 57 } | 56 } |
| 58 | 57 |
| 59 // Event Table | 58 // Event Table |
| 60 BEGIN_EVENT_TABLE( FrameDelWhite, wxFrame ) | 59 BEGIN_EVENT_TABLE( FrameDelWhite, wxFrame ) |
| 61 //EVT_LIST_ITEM_SELECTED( ID_LSTCTRL, FramePreview::ChageImage ) | 60 //EVT_LIST_ITEM_SELECTED( ID_LSTCTRL, FramePreview::ChageImage ) |
| 61 EVT_CHECKBOX( ID_CHECK, FrameDelWhite::UpdateList ) | |
| 62 EVT_BUTTON( ID_DELETE, FrameDelWhite::DeleteImage ) | 62 EVT_BUTTON( ID_DELETE, FrameDelWhite::DeleteImage ) |
| 63 EVT_BUTTON( ID_CANCEL, FrameDelWhite::CloseFrame ) | 63 EVT_BUTTON( ID_CANCEL, FrameDelWhite::CloseFrame ) |
| 64 END_EVENT_TABLE() | 64 END_EVENT_TABLE() |
| 65 | 65 |
| 66 // Event Handlers | 66 // Event Handlers |
| 67 void FrameDelWhite::UpdateList(wxCommandEvent& WXUNUSED(event)) | |
| 68 { | |
| 69 LoadImages(); | |
| 70 } | |
| 71 | |
| 67 void FrameDelWhite::DeleteImage(wxCommandEvent& WXUNUSED(event)) | 72 void FrameDelWhite::DeleteImage(wxCommandEvent& WXUNUSED(event)) |
| 68 { | 73 { |
| 69 return; | 74 return; |
| 70 } | 75 } |
| 71 | 76 |
| 76 } | 81 } |
| 77 | 82 |
| 78 // Functions | 83 // Functions |
| 79 void FrameDelWhite::LoadImages( void ) | 84 void FrameDelWhite::LoadImages( void ) |
| 80 { | 85 { |
| 86 m_listCtrl->DeleteAllItems(); | |
| 87 m_imageList->RemoveAll(); | |
| 81 wxDir dir(m_dir); | 88 wxDir dir(m_dir); |
| 82 wxString filename; | 89 wxString filename; |
| 83 if ( !dir.IsOpened() ) return; | 90 if ( !dir.IsOpened() ) return; |
| 84 | 91 |
| 85 bool cout = dir.GetFirst( &filename, wxT("*.jpg"), wxDIR_FILES ); | 92 bool cout = dir.GetFirst( &filename, wxT("*.jpg"), wxDIR_FILES ); |
| 88 wxListItem item; | 95 wxListItem item; |
| 89 while ( cout ) { | 96 while ( cout ) { |
| 90 wxString f = m_dir + wxFILE_SEP_PATH + filename; | 97 wxString f = m_dir + wxFILE_SEP_PATH + filename; |
| 91 wxFile file( f ); | 98 wxFile file( f ); |
| 92 long len = file.Length(); | 99 long len = file.Length(); |
| 93 if ( !m_checkBox->IsChecked() && len < 2181468 ) { | 100 if ( !m_checkBox->IsChecked() && len > 150000 ) { |
| 94 cout = dir.GetNext( &filename ); | 101 cout = dir.GetNext( &filename ); |
| 95 continue; | 102 continue; |
| 96 } | 103 } |
| 97 | 104 |
| 98 item.SetId(i); | 105 item.SetId(i); |
| 103 item.SetText(filename); | 110 item.SetText(filename); |
| 104 m_listCtrl->InsertItem( item ); | 111 m_listCtrl->InsertItem( item ); |
| 105 m_listCtrl->SetItem( item ); | 112 m_listCtrl->SetItem( item ); |
| 106 | 113 |
| 107 wxImage img( f, wxBITMAP_TYPE_JPEG ); | 114 wxImage img( f, wxBITMAP_TYPE_JPEG ); |
| 108 wxBitmap bmp( img.Scale( 105, 148, wxIMAGE_QUALITY_HIGH ) ); | 115 wxBitmap bmp( img.Scale( 63, 89, wxIMAGE_QUALITY_HIGH ) ); |
| 109 m_imageList->Add( bmp ); | 116 m_imageList->Add( bmp ); |
| 110 cout = dir.GetNext( &filename ); | 117 cout = dir.GetNext( &filename ); |
| 111 i++; | 118 i++; |
| 112 } | 119 } |
| 113 | 120 |
