| 0 | 1 // Filename   : iv.cpp | 
|  | 2 // Last Change: 2020-08-13 木 12:33:22. | 
|  | 3 // | 
|  | 4 #include <wx/msgdlg.h> | 
|  | 5 #include "iv.h" | 
|  | 6 | 
|  | 7 ivFrame::ivFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) | 
|  | 8 	: wxFrame(parent, id, title, pos, size, style) | 
|  | 9 { | 
|  | 10 	this->SetSizeHints(wxDefaultSize, wxDefaultSize); | 
|  | 11 	this->SetBackgroundColour(wxColour(165, 165, 205)); | 
|  | 12 | 
|  | 13 	wxBoxSizer* bSizerTop = new wxBoxSizer(wxHORIZONTAL); | 
|  | 14 | 
|  | 15 	m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL); | 
|  | 16 	m_scrolledWindow->SetScrollRate(5, 5); | 
|  | 17 	bSizerTop->Add(m_scrolledWindow, 1, wxEXPAND|wxALL, 5); | 
|  | 18 | 
|  | 19 	wxBoxSizer* bSizerRight; | 
|  | 20 	bSizerRight = new wxBoxSizer(wxVERTICAL); | 
|  | 21 | 
|  | 22 	m_dirPicker = new wxDirPickerCtrl(this, wxID_ANY, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DIR_MUST_EXIST|wxDIRP_SMALL|wxDIRP_USE_TEXTCTRL); | 
|  | 23 	bSizerRight->Add(m_dirPicker, 0, wxALL|wxEXPAND, 5); | 
|  | 24 | 
|  | 25 	m_treeCtrl = new wxTreeCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxTR_SINGLE); | 
|  | 26 	bSizerRight->Add(m_treeCtrl, 0, wxALL|wxEXPAND, 5); | 
|  | 27 | 
|  | 28 	m_dataViewListCtrl = new wxDataViewListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_HORIZ_RULES|wxDV_ROW_LINES|wxDV_SINGLE); | 
|  | 29 	m_dataViewListColumnName = m_dataViewListCtrl->AppendTextColumn(wxT("Name"), wxDATAVIEW_CELL_EDITABLE, -1, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE); | 
|  | 30 	m_dataViewListColumnSize = m_dataViewListCtrl->AppendTextColumn(wxT("Size"), wxDATAVIEW_CELL_INERT, -1, static_cast<wxAlignment>(wxALIGN_RIGHT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE); | 
|  | 31 	m_dataViewListColumnTime = m_dataViewListCtrl->AppendTextColumn(wxT("Time"), wxDATAVIEW_CELL_INERT, -1, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE); | 
|  | 32 	bSizerRight->Add(m_dataViewListCtrl, 1, wxALL|wxEXPAND, 5); | 
|  | 33 | 
|  | 34 	m_textCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY); | 
|  | 35 	bSizerRight->Add(m_textCtrl, 0, wxALL|wxEXPAND, 5); | 
|  | 36 | 
|  | 37 	wxGridBagSizer* gbSizerManip; | 
|  | 38 	gbSizerManip = new wxGridBagSizer(0, 0); | 
|  | 39 	gbSizerManip->SetFlexibleDirection(wxBOTH); | 
|  | 40 	gbSizerManip->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED); | 
|  | 41 | 
|  | 42 	m_staticTextType = new wxStaticText(this, wxID_ANY, wxT("Type"), wxDefaultPosition, wxDefaultSize, 0); | 
|  | 43 	gbSizerManip->Add(m_staticTextType, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5); | 
|  | 44 | 
|  | 45 	wxString m_choiceChoices[] = { wxT("PNG"), wxT("JPEG"), wxT("TIFF"), wxT("BMP"), wxT("GIF"), wxT("XPM"), wxT("ICON") }; | 
|  | 46 	int m_choiceNChoices = sizeof(m_choiceChoices) / sizeof(wxString); | 
|  | 47 	m_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceNChoices, m_choiceChoices, 0); | 
|  | 48 	m_choice->SetSelection(0); | 
|  | 49 	gbSizerManip->Add(m_choice, wxGBPosition(0, 1), wxGBSpan(1, 2), wxALL, 5); | 
|  | 50 | 
|  | 51 	m_buttonConv = new wxButton(this, wxID_ANY, wxT("Convert"), wxDefaultPosition, wxDefaultSize, 0); | 
|  | 52 	gbSizerManip->Add(m_buttonConv, wxGBPosition(0, 4), wxGBSpan(1, 2), wxALL, 5); | 
|  | 53 | 
|  | 54 	m_staticTextW = new wxStaticText(this, wxID_ANY, wxT("W"), wxDefaultPosition, wxDefaultSize, 0); | 
|  | 55 	gbSizerManip->Add(m_staticTextW, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); | 
|  | 56 | 
|  | 57 	m_textCtrlW = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40, -1), 0); | 
|  | 58 	m_textCtrlW->SetMaxLength(4); | 
|  | 59 	gbSizerManip->Add(m_textCtrlW, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5); | 
|  | 60 | 
|  | 61 	m_staticTextH = new wxStaticText(this, wxID_ANY, wxT("H"), wxDefaultPosition, wxDefaultSize, 0); | 
|  | 62 	gbSizerManip->Add(m_staticTextH, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); | 
|  | 63 | 
|  | 64 	m_textCtrlH = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40, -1), 0); | 
|  | 65 	m_textCtrlH->SetMaxLength(4); | 
|  | 66 	gbSizerManip->Add(m_textCtrlH, wxGBPosition(1, 3), wxGBSpan(1, 1), wxALL, 5); | 
|  | 67 | 
|  | 68 	m_buttonResize = new wxButton(this, wxID_ANY, wxT("Resize"), wxDefaultPosition, wxDefaultSize, 0); | 
|  | 69 	gbSizerManip->Add(m_buttonResize, wxGBPosition(1, 4), wxGBSpan(1, 1), wxALL, 5); | 
|  | 70 | 
|  | 71 | 
|  | 72 	bSizerRight->Add(gbSizerManip, 1, wxEXPAND, 5); | 
|  | 73 | 
|  | 74 | 
|  | 75 	bSizerTop->Add(bSizerRight, 0, wxEXPAND, 5); | 
|  | 76 | 
|  | 77 | 
|  | 78 	this->SetSizer(bSizerTop); | 
|  | 79 	this->Layout(); | 
|  | 80 | 
|  | 81 	this->Centre(wxBOTH); | 
|  | 82 | 
|  | 83 	// Connect Events | 
|  | 84 	m_dirPicker->Connect(wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(ivFrame::OnDirChanged), NULL, this); | 
|  | 85 	m_buttonConv->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ivFrame::OnConvert), NULL, this); | 
|  | 86 	m_buttonResize->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ivFrame::OnResize), NULL, this); | 
|  | 87 } | 
|  | 88 | 
|  | 89 ivFrame::~ivFrame() | 
|  | 90 { | 
|  | 91 	// Disconnect Events | 
|  | 92 	m_dirPicker->Disconnect(wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(ivFrame::OnDirChanged), NULL, this); | 
|  | 93 	m_buttonConv->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ivFrame::OnConvert), NULL, this); | 
|  | 94 	m_buttonResize->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ivFrame::OnResize), NULL, this); | 
|  | 95 } | 
|  | 96 | 
|  | 97 // Event-Handlers | 
|  | 98 void ivFrame::OnDirChanged(wxFileDirPickerEvent& WXUNUSED(event)) | 
|  | 99 { | 
|  | 100 } | 
|  | 101 | 
|  | 102 void ivFrame::OnConvert(wxCommandEvent& WXUNUSED(event)) | 
|  | 103 { | 
|  | 104 } | 
|  | 105 | 
|  | 106 void ivFrame::OnResize(wxCommandEvent& WXUNUSED(event)) | 
|  | 107 { | 
|  | 108 } | 
|  | 109 | 
|  | 110 // Functions | 
|  | 111 void ivFrame::Initialize(wxString file) | 
|  | 112 { | 
|  | 113 	if (file.IsEmpty()) return; | 
|  | 114 	wxMessageBox(file); | 
|  | 115 } | 
|  | 116 |