| | |
| | | |
| | | #include "../res/add_image.png.h" |
| | | #include "../res/fullscreen.png.h" |
| | | #include "../res/reset_zoom.png.h" |
| | | #include "../res/rotate_left.png.h" |
| | | #include "../res/rotate_right.png.h" |
| | | #include "../res/zoom_in.png.h" |
| | |
| | | ImageWindow::ImageWindow( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) |
| | | { |
| | | this->SetSizeHints( wxDefaultSize, wxDefaultSize ); |
| | | this->SetBackgroundColour( wxColour( 60, 60, 60 ) ); |
| | | this->DragAcceptFiles( true ); |
| | | |
| | | wxBoxSizer* bSizer1; |
| | | bSizer1 = new wxBoxSizer( wxVERTICAL ); |
| | | |
| | | m_bitmap1 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); |
| | | bSizer1->Add( m_bitmap1, 1, wxALL|wxEXPAND, 5 ); |
| | | wxBoxSizer* bSizer6; |
| | | bSizer6 = new wxBoxSizer( wxHORIZONTAL ); |
| | | |
| | | m_scrolledWindow1 = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); |
| | | m_scrolledWindow1->SetScrollRate( 5, 5 ); |
| | | wxBoxSizer* bSizer3; |
| | | bSizer3 = new wxBoxSizer( wxVERTICAL ); |
| | | |
| | | m_bitmap1 = new wxStaticBitmap( m_scrolledWindow1, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); |
| | | bSizer3->Add( m_bitmap1, 1, wxEXPAND, 5 ); |
| | | |
| | | |
| | | m_scrolledWindow1->SetSizer( bSizer3 ); |
| | | m_scrolledWindow1->Layout(); |
| | | bSizer3->Fit( m_scrolledWindow1 ); |
| | | bSizer6->Add( m_scrolledWindow1, 1, wxEXPAND, 5 ); |
| | | |
| | | m_scrolledWindow3 = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHSCROLL|wxVSCROLL ); |
| | | m_scrolledWindow3->SetScrollRate( 5, 5 ); |
| | | m_scrolledWindow3->SetMinSize( wxSize( 100,-1 ) ); |
| | | |
| | | wxBoxSizer* bSizer7; |
| | | bSizer7 = new wxBoxSizer( wxVERTICAL ); |
| | | |
| | | m_details = new wxListCtrl( m_scrolledWindow3, wxID_ANY, wxDefaultPosition, wxSize( 100,-1 ), wxLC_SINGLE_SEL ); |
| | | bSizer7->Add( m_details, 1, wxEXPAND, 5 ); |
| | | |
| | | |
| | | m_scrolledWindow3->SetSizer( bSizer7 ); |
| | | m_scrolledWindow3->Layout(); |
| | | bSizer7->Fit( m_scrolledWindow3 ); |
| | | bSizer6->Add( m_scrolledWindow3, 0, wxEXPAND, 5 ); |
| | | |
| | | |
| | | bSizer1->Add( bSizer6, 1, wxEXPAND, 5 ); |
| | | |
| | | wxBoxSizer* bSizer5; |
| | | bSizer5 = new wxBoxSizer( wxVERTICAL ); |
| | | |
| | | bSizer5->SetMinSize( wxSize( -1,100 ) ); |
| | | m_image_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( -1,140 ), wxLC_ICON ); |
| | | bSizer5->Add( m_image_list, 1, wxEXPAND, 5 ); |
| | | |
| | | |
| | | bSizer1->Add( bSizer5, 0, wxEXPAND, 5 ); |
| | | |
| | | |
| | | this->SetSizer( bSizer1 ); |
| | | this->Layout(); |
| | | m_statusBar1 = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY ); |
| | | m_toolBar1 = this->CreateToolBar( wxTB_DOCKABLE|wxTB_HORIZONTAL, wxID_ANY ); |
| | | m_open_image = m_toolBar1->AddTool( wxID_ANY, _("Open image"), add_image_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); |
| | | m_open_image = m_toolBar1->AddTool( wxID_ANY, _("Open image"), add_image_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, _("Open an image (jpeg,png)"), _("Open a supported image file. (png, jpeg)"), NULL ); |
| | | |
| | | m_toolBar1->AddSeparator(); |
| | | |
| | | m_rotate_left = m_toolBar1->AddTool( wxID_ANY, _("Rotate -90"), rotate_left_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); |
| | | m_rotate_left = m_toolBar1->AddTool( wxID_ANY, _("Rotate -90"), rotate_left_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, _("Rotate the image -90°"), wxEmptyString, NULL ); |
| | | |
| | | m_rotate_right = m_toolBar1->AddTool( wxID_ANY, _("Rotate +90"), rotate_right_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); |
| | | m_rotate_right = m_toolBar1->AddTool( wxID_ANY, _("Rotate +90"), rotate_right_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, _("Rotate the image +90°"), wxEmptyString, NULL ); |
| | | |
| | | m_zoom_in = m_toolBar1->AddTool( wxID_ANY, _("Zoom in"), zoom_in_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); |
| | | m_zoom_in = m_toolBar1->AddTool( wxID_ANY, _("Zoom in"), zoom_in_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, _("Zoom-in the image by 5%"), wxEmptyString, NULL ); |
| | | |
| | | m_zoom_out = m_toolBar1->AddTool( wxID_ANY, _("Zoom out"), zoom_out_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); |
| | | m_reset_zoom = m_toolBar1->AddTool( wxID_ANY, _("Reset zoom"), reset_zoom_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, _("Reset the zoom to fit into the window"), wxEmptyString, NULL ); |
| | | |
| | | m_fullscreen = m_toolBar1->AddTool( wxID_ANY, _("Fullscreen"), fullscreen_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); |
| | | m_zoom_out = m_toolBar1->AddTool( wxID_ANY, _("Zoom out"), zoom_out_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, _("Zoom-out the image by 5%"), wxEmptyString, NULL ); |
| | | |
| | | m_fullscreen = m_toolBar1->AddTool( wxID_ANY, _("Fullscreen"), fullscreen_png_to_wx_bitmap(), wxNullBitmap, wxITEM_NORMAL, _("Show in fullscreen"), wxEmptyString, NULL ); |
| | | |
| | | m_toolBar1->Realize(); |
| | | |
| | | |
| | | this->Centre( wxBOTH ); |
| | | |
| | | // Connect Events |
| | | this->Connect( wxEVT_DROP_FILES, wxDropFilesEventHandler( ImageWindow::OnDropFile ) ); |
| | | this->Connect( wxEVT_KEY_UP, wxKeyEventHandler( ImageWindow::OnWindowKeyUp ) ); |
| | | this->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( ImageWindow::OnWindowMouseWheel ) ); |
| | | m_scrolledWindow1->Connect( wxEVT_KEY_UP, wxKeyEventHandler( ImageWindow::OnWindowKeyUp ), NULL, this ); |
| | | m_scrolledWindow1->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( ImageWindow::WindowOnSize ), NULL, this ); |
| | | m_bitmap1->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ImageWindow::OnBitmapDoubleLeftClick ), NULL, this ); |
| | | m_image_list->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( ImageWindow::OnListItemSelected ), NULL, this ); |
| | | this->Connect( m_rotate_left->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnRotateLeftClicked ) ); |
| | | this->Connect( m_rotate_right->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnRotateRightClicked ) ); |
| | | this->Connect( m_zoom_in->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnZoomInClicked ) ); |
| | | this->Connect( m_reset_zoom->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnZoomResetClicked ) ); |
| | | this->Connect( m_zoom_out->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnZoomOutClicked ) ); |
| | | this->Connect( m_fullscreen->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnShowFullScreenClick ) ); |
| | | } |
| | | |
| | | ImageWindow::~ImageWindow() |
| | | { |
| | | // Disconnect Events |
| | | this->Disconnect( wxEVT_DROP_FILES, wxDropFilesEventHandler( ImageWindow::OnDropFile ) ); |
| | | this->Disconnect( wxEVT_KEY_UP, wxKeyEventHandler( ImageWindow::OnWindowKeyUp ) ); |
| | | this->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( ImageWindow::OnWindowMouseWheel ) ); |
| | | m_scrolledWindow1->Disconnect( wxEVT_KEY_UP, wxKeyEventHandler( ImageWindow::OnWindowKeyUp ), NULL, this ); |
| | | m_scrolledWindow1->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( ImageWindow::WindowOnSize ), NULL, this ); |
| | | m_bitmap1->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ImageWindow::OnBitmapDoubleLeftClick ), NULL, this ); |
| | | m_image_list->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( ImageWindow::OnListItemSelected ), NULL, this ); |
| | | this->Disconnect( m_rotate_left->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnRotateLeftClicked ) ); |
| | | this->Disconnect( m_rotate_right->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnRotateRightClicked ) ); |
| | | this->Disconnect( m_zoom_in->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnZoomInClicked ) ); |
| | | this->Disconnect( m_reset_zoom->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnZoomResetClicked ) ); |
| | | this->Disconnect( m_zoom_out->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnZoomOutClicked ) ); |
| | | this->Disconnect( m_fullscreen->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( ImageWindow::OnShowFullScreenClick ) ); |
| | | |
| | | } |