19
|
1
|
|
2 // Filename : dirview.cpp
|
|
3 // Last Change: 24-Oct-2011.
|
|
4 //
|
|
5
|
|
6 #include "dirview.h"
|
|
7
|
|
8 // frame constructor
|
|
9 DirViewFrame::DirViewFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
|
|
10 {
|
|
11 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
|
12 this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
|
|
13
|
|
14 wxBoxSizer* bSizer;
|
|
15 bSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
16
|
|
17 m_listCtrlAll = new wxListCtrl( this, ID_LISTCTRLALL, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL );
|
|
18 itemCol.SetText( wxT("$BDLHV(B") );
|
|
19 m_listCtrlAll->InsertColumn( 0, itemCol );
|
|
20 m_listCtrlAll->SetColumnWidth( 0, 100 );
|
|
21 itemCol.SetText( wxT("$BHoJ]81<THV9f(B") );
|
|
22 m_listCtrlAll->InsertColumn( 1, itemCol );
|
|
23 m_listCtrlAll->SetColumnWidth( 1, 180 );
|
|
24 itemCol.SetText( wxT("$B%U%!%$%k?t(B") );
|
|
25 m_listCtrlAll->InsertColumn( 2, itemCol );
|
|
26 m_listCtrlAll->SetColumnWidth( 1, 100 );
|
|
27 bSizer->Add( m_listCtrlAll, 0, wxALL|wxEXPAND, 5 );
|
|
28
|
|
29 m_listCtrlThumbnail = new wxListCtrl( this, ID_LISTCTRLTHUMB, wxDefaultPosition, wxDefaultSize, wxLC_ICON );
|
|
30 bSizer->Add( m_listCtrlThumbnail, 0, wxALL|wxEXPAND, 5 );
|
|
31
|
|
32 m_bitmapPreview = new wxStaticBitmap( this, ID_BITMAPPREVIEW, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
|
33 bSizer->Add( m_bitmapPreview, 1, wxALL|wxEXPAND, 5 );
|
|
34
|
|
35 this->SetSizer( bSizer );
|
|
36 this->Layout();
|
|
37
|
|
38 this->Centre( wxBOTH );
|
|
39 }
|
|
40
|
|
41 // destructor
|
|
42 DirViewFrame::~DirViewFrame()
|
|
43 {
|
|
44 }
|
|
45
|
|
46 // Event Table
|
|
47 BEGIN_EVENT_TABLE( MyFrame, wxFrame )
|
|
48 EVT_LIST_ITEM_SELECTED( ID_LISTCTRLALL, DirViewFrame::OnThumbnail )
|
|
49 EVT_LIST_ITEM_SELECTED( ID_LISTCTRLTHUMB, DirViewFrame::OnPreview )
|
|
50 END_EVENT_TABLE()
|
|
51
|
|
52 // Event Handlers
|
|
53 void DirViewFrame::OnThumbnail(wxListEvent& event)
|
|
54 {
|
|
55 m_listCtrlThumbnail->DeleteAllItems();
|
|
56 /*
|
|
57 m_imageList->RemoveAll();
|
|
58 wxDir dir(m_dir);
|
|
59 wxString filename;
|
|
60 if ( !dir.IsOpened() ) return;
|
|
61
|
|
62 bool cout = dir.GetFirst( &filename, wxT("*.jpg"), wxDIR_FILES );
|
|
63
|
|
64 int i=0;
|
|
65 wxListItem item;
|
|
66 while ( cout ) {
|
|
67 wxString f = m_dir + wxFILE_SEP_PATH + filename;
|
|
68 wxFile file( f );
|
|
69 long len = file.Length();
|
|
70 if ( !m_checkBox->IsChecked() && len > 150000 ) {
|
|
71 cout = dir.GetNext( &filename );
|
|
72 continue;
|
|
73 }
|
|
74
|
|
75 item.SetId(i);
|
|
76 item.SetMask(wxLIST_MASK_STATE|wxLIST_MASK_TEXT|wxLIST_MASK_IMAGE);
|
|
77 item.SetStateMask(wxLIST_STATE_SELECTED);
|
|
78 item.SetState(wxLIST_STATE_SELECTED);
|
|
79 item.SetImage(i);
|
|
80 item.SetText(filename);
|
|
81 m_listCtrl->InsertItem( item );
|
|
82 m_listCtrl->SetItem( item );
|
|
83
|
|
84 wxImage img( f, wxBITMAP_TYPE_JPEG );
|
|
85 wxBitmap bmp( img.Scale( 63, 89, wxIMAGE_QUALITY_HIGH ) );
|
|
86 m_imageList->Add( bmp );
|
|
87 cout = dir.GetNext( &filename );
|
|
88 i++;
|
|
89 }
|
|
90 */
|
|
91
|
|
92 return;
|
|
93 }
|
|
94
|
|
95 void DirViewFrame::OnPreview(wxListEvent& event)
|
|
96 {
|
|
97 }
|
|
98
|
|
99 // Functions
|
|
100 void DirViewFrame::ListAll(void)
|
|
101 {
|
|
102 }
|