From e3e7f6e573df7b30bf8077ddc74cdd5a44a73a0c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 11 Jul 2012 11:42:47 +0000 Subject: [PATCH] Allow saving images under a different name in the image sample. Also allow saving in XPM format. See #13905. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72030 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/image/image.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 28afeb1d1f..e9de0eecc7 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -150,7 +150,7 @@ private: m_zoom = 1.; wxMenu *menu = new wxMenu; - menu->Append(wxID_SAVE); + menu->Append(wxID_SAVEAS); menu->AppendSeparator(); menu->AppendCheckItem(ID_PAINT_BG, wxT("&Paint background"), "Uncheck this for transparent images"); @@ -214,7 +214,7 @@ private: wxString savefilename = wxFileSelector( wxT("Save Image"), wxEmptyString, wxEmptyString, - (const wxChar *)NULL, + wxEmptyString, wxT("BMP files (*.bmp)|*.bmp|") #if wxUSE_LIBPNG wxT("PNG files (*.png)|*.png|") @@ -230,10 +230,13 @@ private: #endif #if wxUSE_PCX wxT("PCX files (*.pcx)|*.pcx|") +#endif +#if wxUSE_XPM + wxT("X PixMap files (*.xpm)|*.xpm|") #endif wxT("ICO files (*.ico)|*.ico|") wxT("CUR files (*.cur)|*.cur"), - wxFD_SAVE, + wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this); if ( savefilename.empty() ) @@ -590,7 +593,7 @@ BEGIN_EVENT_TABLE(MyImageFrame, wxFrame) EVT_ERASE_BACKGROUND(MyImageFrame::OnEraseBackground) EVT_PAINT(MyImageFrame::OnPaint) - EVT_MENU(wxID_SAVE, MyImageFrame::OnSave) + EVT_MENU(wxID_SAVEAS, MyImageFrame::OnSave) EVT_MENU_RANGE(ID_ROTATE_LEFT, ID_ROTATE_RIGHT, MyImageFrame::OnRotate) EVT_MENU(ID_RESIZE, MyImageFrame::OnResize) -- 2.45.2