Mercurial > mercurial > hgweb_mover.cgi
view src/delwhite.cpp @ 2:1ea4f7981ff5
create window.
author | pyon@macmini |
---|---|
date | Sun, 02 Oct 2011 18:44:03 +0900 |
parents | |
children | a5bddd859104 |
line wrap: on
line source
// Filename : delwhite.cpp // Last Change: 02-Oct-2011. // #include "delwhite.h" // for all others, include the necessary headers (this file is usually all you // need because it includes almost all "standard" wxWidgets headers) #ifndef WX_PRECOMP #include "wx/utils.h" #include "wx/dir.h" #include "wx/file.h" #endif // constructor FrameDelWhite::FrameDelWhite( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { this->SetSize( 1200, 1000 ); //this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); //this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); wxBoxSizer* bSizer; bSizer = new wxBoxSizer( wxVERTICAL ); m_listCtrl = new wxListCtrl( this, ID_LSWHITE, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); bSizer->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); m_imageList = new wxImageList( 105, 148 ); m_listCtrl->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL ); wxBoxSizer* bSizerBtn; bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); m_checkBox = new wxCheckBox( this, ID_CHECK, wxT("全ての画像を表示"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer->Add( m_checkBox, 0, wxALL, 5 ); m_staticText = new wxStaticText( this, wxID_ANY, wxT("白紙ファイルを選択し,「削除」ボタンを押してください.") ); bSizerBtn->Add( m_staticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_buttonDelWhite = new wxButton( this, ID_DELETE, wxT("削除"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerBtn->Add( m_buttonDelWhite, 0, wxALL, 5 ); m_buttonCancel = new wxButton( this, ID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerBtn->Add( m_buttonCancel, 0, wxALL, 5 ); bSizer->Add( bSizerBtn, 0, wxEXPAND, 5 ); this->SetSizer( bSizer ); this->Layout(); this->Centre( wxBOTH ); } // destructor FrameDelWhite::~FrameDelWhite() { } // Event Table BEGIN_EVENT_TABLE( FrameDelWhite, wxFrame ) //EVT_LIST_ITEM_SELECTED( ID_LSTCTRL, FramePreview::ChageImage ) EVT_BUTTON( ID_DELETE, FrameDelWhite::DeleteImage ) EVT_BUTTON( ID_CANCEL, FrameDelWhite::CloseFrame ) END_EVENT_TABLE() // Event Handlers void FrameDelWhite::DeleteImage(wxCommandEvent& WXUNUSED(event)) { return; } void FrameDelWhite::CloseFrame(wxCommandEvent& WXUNUSED(event)) { this->Close(); return; } // Functions void FrameDelWhite::LoadImages( void ) { 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 < 2181468 ) { 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( 105, 148, wxIMAGE_QUALITY_HIGH ) ); m_imageList->Add( bmp ); cout = dir.GetNext( &filename ); i++; } return; }