1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: samples/image/image.cpp
3 // Purpose: sample showing operations with wxImage
4 // Author: Robert Roebling
5 // Modified by: Francesco Montorsi
8 // Copyright: (c) 1998-2005 Robert Roebling
9 // (c) 2005-2009 Vadim Zeitlin
10 // License: wxWindows licence
11 ///////////////////////////////////////////////////////////////////////////////
13 // For compilers that support precompilation, includes "wx/wx.h".
14 #include "wx/wxprec.h"
26 #include "wx/filename.h"
27 #include "wx/mstream.h"
28 #include "wx/wfstream.h"
29 #include "wx/quantize.h"
30 #include "wx/stopwatch.h"
33 #include "wx/dataobj.h"
34 #include "wx/clipbrd.h"
35 #endif // wxUSE_CLIPBOARD
37 #if defined(__WXMSW__)
38 #ifdef wxHAVE_RAW_BITMAP
39 #include "wx/rawbmp.h"
43 #if defined(__WXMAC__) || defined(__WXGTK__)
44 #define wxHAVE_RAW_BITMAP
45 #include "wx/rawbmp.h"
51 #include "../sample.xpm"
54 // ============================================================================
56 // ============================================================================
58 //-----------------------------------------------------------------------------
60 //-----------------------------------------------------------------------------
62 class MyApp
: public wxApp
65 virtual bool OnInit();
68 // ----------------------------------------------------------------------------
70 // ----------------------------------------------------------------------------
72 class MyFrame
: public wxFrame
77 void OnAbout( wxCommandEvent
&event
);
78 void OnNewFrame( wxCommandEvent
&event
);
79 void OnImageInfo( wxCommandEvent
&event
);
80 void OnThumbnail( wxCommandEvent
&event
);
82 #ifdef wxHAVE_RAW_BITMAP
83 void OnTestRawBitmap( wxCommandEvent
&event
);
84 #endif // wxHAVE_RAW_BITMAP
85 void OnQuit( wxCommandEvent
&event
);
88 void OnCopy(wxCommandEvent
& event
);
89 void OnPaste(wxCommandEvent
& event
);
90 #endif // wxUSE_CLIPBOARD
95 // ask user for the file name and try to load an image from it
97 // return the file path on success, empty string if we failed to load the
98 // image or were cancelled by user
99 static wxString
LoadUserImage(wxImage
& image
);
102 DECLARE_DYNAMIC_CLASS(MyFrame
)
103 DECLARE_EVENT_TABLE()
106 // ----------------------------------------------------------------------------
107 // Frame used for showing a standalone image
108 // ----------------------------------------------------------------------------
112 ID_ROTATE_LEFT
= wxID_HIGHEST
+1,
118 class MyImageFrame
: public wxFrame
121 MyImageFrame(wxFrame
*parent
, const wxString
& desc
, const wxImage
& image
)
123 Create(parent
, desc
, wxBitmap(image
), image
.GetImageCount(desc
));
126 MyImageFrame(wxFrame
*parent
, const wxString
& desc
, const wxBitmap
& bitmap
)
128 Create(parent
, desc
, bitmap
);
132 bool Create(wxFrame
*parent
,
133 const wxString
& desc
,
134 const wxBitmap
& bitmap
,
137 if ( !wxFrame::Create(parent
, wxID_ANY
,
138 wxString::Format(_T("Image from %s"), desc
),
139 wxDefaultPosition
, wxDefaultSize
,
140 wxDEFAULT_FRAME_STYLE
| wxFULL_REPAINT_ON_RESIZE
) )
146 wxMenu
*menu
= new wxMenu
;
147 menu
->Append(wxID_SAVE
);
148 menu
->AppendSeparator();
149 menu
->AppendCheckItem(ID_PAINT_BG
, _T("&Paint background"),
150 "Uncheck this for transparent images");
151 menu
->AppendSeparator();
152 menu
->Append(ID_RESIZE
, _T("&Fit to window\tCtrl-F"));
153 menu
->Append(wxID_ZOOM_IN
, "Zoom &in\tCtrl-+");
154 menu
->Append(wxID_ZOOM_OUT
, "Zoom &out\tCtrl--");
155 menu
->Append(wxID_ZOOM_100
, "Reset zoom to &100%\tCtrl-1");
156 menu
->AppendSeparator();
157 menu
->Append(ID_ROTATE_LEFT
, _T("Rotate &left\tCtrl-L"));
158 menu
->Append(ID_ROTATE_RIGHT
, _T("Rotate &right\tCtrl-R"));
160 wxMenuBar
*mbar
= new wxMenuBar
;
161 mbar
->Append(menu
, _T("&Image"));
164 mbar
->Check(ID_PAINT_BG
, true);
167 if ( numImages
!= 1 )
168 SetStatusText(wxString::Format("%d images", numImages
), 1);
170 SetClientSize(bitmap
.GetWidth(), bitmap
.GetHeight());
179 void OnEraseBackground(wxEraseEvent
& WXUNUSED(event
))
181 // do nothing here to be able to see how transparent images are shown
184 void OnPaint(wxPaintEvent
& WXUNUSED(event
))
188 if ( GetMenuBar()->IsChecked(ID_PAINT_BG
) )
191 dc
.SetUserScale(m_zoom
, m_zoom
);
193 const wxSize size
= GetClientSize();
197 dc
.DeviceToLogicalX((size
.x
- m_zoom
*m_bitmap
.GetWidth())/2),
198 dc
.DeviceToLogicalY((size
.y
- m_zoom
*m_bitmap
.GetHeight())/2),
203 void OnSave(wxCommandEvent
& WXUNUSED(event
))
206 wxImage image
= m_bitmap
.ConvertToImage();
208 wxString savefilename
= wxFileSelector( wxT("Save Image"),
211 (const wxChar
*)NULL
,
212 wxT("BMP files (*.bmp)|*.bmp|")
213 wxT("PNG files (*.png)|*.png|")
214 wxT("JPEG files (*.jpg)|*.jpg|")
215 wxT("GIF files (*.gif)|*.gif|")
216 wxT("TIFF files (*.tif)|*.tif|")
217 wxT("PCX files (*.pcx)|*.pcx|")
218 wxT("ICO files (*.ico)|*.ico|")
219 wxT("CUR files (*.cur)|*.cur"),
223 if ( savefilename
.empty() )
227 wxFileName::SplitPath(savefilename
, NULL
, NULL
, &extension
);
230 if ( extension
== _T("bmp") )
232 static const int bppvalues
[] =
244 const wxString bppchoices
[] =
250 _T("8 bpp greyscale"),
252 _T("8 bpp own palette"),
256 int bppselection
= wxGetSingleChoiceIndex(_T("Set BMP BPP"),
257 _T("Image sample: save file"),
258 WXSIZEOF(bppchoices
),
261 if ( bppselection
!= -1 )
263 int format
= bppvalues
[bppselection
];
264 image
.SetOption(wxIMAGE_OPTION_BMP_FORMAT
, format
);
266 if ( format
== wxBMP_8BPP_PALETTE
)
268 unsigned char *cmap
= new unsigned char [256];
269 for ( int i
= 0; i
< 256; i
++ )
270 cmap
[i
] = (unsigned char)i
;
271 image
.SetPalette(wxPalette(256, cmap
, cmap
, cmap
));
277 else if ( extension
== _T("png") )
279 static const int pngvalues
[] =
289 const wxString pngchoices
[] =
296 _T("Grey red 16bpp"),
299 int sel
= wxGetSingleChoiceIndex(_T("Set PNG format"),
300 _T("Image sample: save file"),
301 WXSIZEOF(pngchoices
),
306 image
.SetOption(wxIMAGE_OPTION_PNG_FORMAT
, pngvalues
[sel
]);
307 image
.SetOption(wxIMAGE_OPTION_PNG_BITDEPTH
, sel
% 2 ? 16 : 8);
309 // these values are taken from OptiPNG with -o3 switch
310 const wxString compressionChoices
[] =
312 _T("compression = 9, memory = 8, strategy = 0, filter = 0"),
313 _T("compression = 9, memory = 9, strategy = 0, filter = 0"),
314 _T("compression = 9, memory = 8, strategy = 1, filter = 0"),
315 _T("compression = 9, memory = 9, strategy = 1, filter = 0"),
316 _T("compression = 1, memory = 8, strategy = 2, filter = 0"),
317 _T("compression = 1, memory = 9, strategy = 2, filter = 0"),
318 _T("compression = 9, memory = 8, strategy = 0, filter = 5"),
319 _T("compression = 9, memory = 9, strategy = 0, filter = 5"),
320 _T("compression = 9, memory = 8, strategy = 1, filter = 5"),
321 _T("compression = 9, memory = 9, strategy = 1, filter = 5"),
322 _T("compression = 1, memory = 8, strategy = 2, filter = 5"),
323 _T("compression = 1, memory = 9, strategy = 2, filter = 5"),
326 int sel
= wxGetSingleChoiceIndex(_T("Select compression option (Cancel to use default)\n"),
327 _T("PNG Compression Options"),
328 WXSIZEOF(compressionChoices
),
333 const int zc
[] = {9, 9, 9, 9, 1, 1, 9, 9, 9, 9, 1, 1};
334 const int zm
[] = {8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9};
335 const int zs
[] = {0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2};
336 const int f
[] = {0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
337 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8};
339 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL
, zc
[sel
]);
340 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL
, zm
[sel
]);
341 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY
, zs
[sel
]);
342 image
.SetOption(wxIMAGE_OPTION_PNG_FILTER
, f
[sel
]);
343 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE
, 1048576); // 1 MB
347 else if ( extension
== _T("cur") )
349 image
.Rescale(32,32);
350 image
.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X
, 0);
351 image
.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y
, 0);
352 // This shows how you can save an image with explicitly
353 // specified image format:
354 saved
= image
.SaveFile(savefilename
, wxBITMAP_TYPE_CUR
);
359 // This one guesses image format from filename extension
360 // (it may fail if the extension is not recognized):
361 image
.SaveFile(savefilename
);
363 #endif // wxUSE_FILEDLG
366 void OnResize(wxCommandEvent
& WXUNUSED(event
))
368 wxImage
img(m_bitmap
.ConvertToImage());
370 const wxSize size
= GetClientSize();
371 img
.Rescale(size
.x
, size
.y
, wxIMAGE_QUALITY_HIGH
);
372 m_bitmap
= wxBitmap(img
);
377 void OnZoom(wxCommandEvent
& event
)
379 if ( event
.GetId() == wxID_ZOOM_IN
)
381 else if ( event
.GetId() == wxID_ZOOM_OUT
)
383 else // wxID_ZOOM_100
389 void OnRotate(wxCommandEvent
& event
)
392 if ( event
.GetId() == ID_ROTATE_LEFT
)
395 wxImage
img(m_bitmap
.ConvertToImage());
396 img
= img
.Rotate(angle
, wxPoint(img
.GetWidth() / 2, img
.GetHeight() / 2));
399 wxLogWarning(_T("Rotation failed"));
403 m_bitmap
= wxBitmap(img
);
408 void UpdateStatusBar()
410 wxLogStatus(this, _T("Image size: (%d, %d), zoom %.2f"),
412 m_bitmap
.GetHeight(),
420 DECLARE_EVENT_TABLE()
423 #ifdef wxHAVE_RAW_BITMAP
425 #include "wx/rawbmp.h"
427 class MyRawBitmapFrame
: public wxFrame
434 REAL_SIZE
= SIZE
- 2*BORDER
437 MyRawBitmapFrame(wxFrame
*parent
)
438 : wxFrame(parent
, wxID_ANY
, _T("Raw bitmaps (how exciting)")),
439 m_bitmap(SIZE
, SIZE
, 24),
440 m_alphaBitmap(SIZE
, SIZE
, 32)
442 SetClientSize(SIZE
, SIZE
*2+25);
449 void InitAlphaBitmap()
451 // First, clear the whole bitmap by making it alpha
453 wxAlphaPixelData
data( m_alphaBitmap
, wxPoint(0,0), wxSize(SIZE
, SIZE
) );
456 wxLogError(_T("Failed to gain raw access to bitmap data"));
459 wxAlphaPixelData::Iterator
p(data
);
460 for ( int y
= 0; y
< SIZE
; ++y
)
462 wxAlphaPixelData::Iterator rowStart
= p
;
463 for ( int x
= 0; x
< SIZE
; ++x
)
466 ++p
; // same as p.OffsetX(1)
473 // Then, draw colourful alpha-blended stripes
474 wxAlphaPixelData
data(m_alphaBitmap
, wxPoint(BORDER
, BORDER
),
475 wxSize(REAL_SIZE
, REAL_SIZE
));
478 wxLogError(_T("Failed to gain raw access to bitmap data"));
482 wxAlphaPixelData::Iterator
p(data
);
484 for ( int y
= 0; y
< REAL_SIZE
; ++y
)
486 wxAlphaPixelData::Iterator rowStart
= p
;
488 int r
= y
< REAL_SIZE
/3 ? 255 : 0,
489 g
= (REAL_SIZE
/3 <= y
) && (y
< 2*(REAL_SIZE
/3)) ? 255 : 0,
490 b
= 2*(REAL_SIZE
/3) <= y
? 255 : 0;
492 for ( int x
= 0; x
< REAL_SIZE
; ++x
)
494 // note that RGB must be premultiplied by alpha
495 unsigned a
= (wxAlphaPixelData::Iterator::ChannelType
)((x
*255.)/REAL_SIZE
);
496 p
.Red() = r
* a
/ 256;
497 p
.Green() = g
* a
/ 256;
498 p
.Blue() = b
* a
/ 256;
501 ++p
; // same as p.OffsetX(1)
511 // draw some colourful stripes without alpha
512 wxNativePixelData
data(m_bitmap
);
515 wxLogError(_T("Failed to gain raw access to bitmap data"));
519 wxNativePixelData::Iterator
p(data
);
520 for ( int y
= 0; y
< SIZE
; ++y
)
522 wxNativePixelData::Iterator rowStart
= p
;
524 int r
= y
< SIZE
/3 ? 255 : 0,
525 g
= (SIZE
/3 <= y
) && (y
< 2*(SIZE
/3)) ? 255 : 0,
526 b
= 2*(SIZE
/3) <= y
? 255 : 0;
528 for ( int x
= 0; x
< SIZE
; ++x
)
533 ++p
; // same as p.OffsetX(1)
541 void OnPaint(wxPaintEvent
& WXUNUSED(event
))
543 wxPaintDC
dc( this );
544 dc
.DrawText(_T("This is alpha and raw bitmap test"), 0, BORDER
);
545 dc
.DrawText(_T("This is alpha and raw bitmap test"), 0, SIZE
/2 - BORDER
);
546 dc
.DrawText(_T("This is alpha and raw bitmap test"), 0, SIZE
- 2*BORDER
);
547 dc
.DrawBitmap( m_alphaBitmap
, 0, 0, true /* use mask */ );
549 dc
.DrawText(_T("Raw bitmap access without alpha"), 0, SIZE
+5);
550 dc
.DrawBitmap( m_bitmap
, 0, SIZE
+5+dc
.GetCharHeight());
555 wxBitmap m_alphaBitmap
;
557 DECLARE_EVENT_TABLE()
560 #endif // wxHAVE_RAW_BITMAP
563 // ============================================================================
565 // ============================================================================
567 //-----------------------------------------------------------------------------
569 //-----------------------------------------------------------------------------
571 BEGIN_EVENT_TABLE(MyImageFrame
, wxFrame
)
572 EVT_ERASE_BACKGROUND(MyImageFrame::OnEraseBackground
)
573 EVT_PAINT(MyImageFrame::OnPaint
)
575 EVT_MENU(wxID_SAVE
, MyImageFrame::OnSave
)
576 EVT_MENU_RANGE(ID_ROTATE_LEFT
, ID_ROTATE_RIGHT
, MyImageFrame::OnRotate
)
577 EVT_MENU(ID_RESIZE
, MyImageFrame::OnResize
)
579 EVT_MENU(wxID_ZOOM_IN
, MyImageFrame::OnZoom
)
580 EVT_MENU(wxID_ZOOM_OUT
, MyImageFrame::OnZoom
)
581 EVT_MENU(wxID_ZOOM_100
, MyImageFrame::OnZoom
)
584 //-----------------------------------------------------------------------------
586 //-----------------------------------------------------------------------------
588 #ifdef wxHAVE_RAW_BITMAP
590 BEGIN_EVENT_TABLE(MyRawBitmapFrame
, wxFrame
)
591 EVT_PAINT(MyRawBitmapFrame::OnPaint
)
594 #endif // wxHAVE_RAW_BITMAP
596 //-----------------------------------------------------------------------------
598 //-----------------------------------------------------------------------------
603 ID_ABOUT
= wxID_ABOUT
,
610 IMPLEMENT_DYNAMIC_CLASS( MyFrame
, wxFrame
)
611 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
612 EVT_MENU (ID_ABOUT
, MyFrame::OnAbout
)
613 EVT_MENU (ID_QUIT
, MyFrame::OnQuit
)
614 EVT_MENU (ID_NEW
, MyFrame::OnNewFrame
)
615 EVT_MENU (ID_INFO
, MyFrame::OnImageInfo
)
616 EVT_MENU (ID_SHOWTHUMBNAIL
, MyFrame::OnThumbnail
)
617 #ifdef wxHAVE_RAW_BITMAP
618 EVT_MENU (ID_SHOWRAW
, MyFrame::OnTestRawBitmap
)
621 EVT_MENU(wxID_COPY
, MyFrame::OnCopy
)
622 EVT_MENU(wxID_PASTE
, MyFrame::OnPaste
)
623 #endif // wxUSE_CLIPBOARD
627 : wxFrame( (wxFrame
*)NULL
, wxID_ANY
, _T("wxImage sample"),
628 wxPoint(20, 20), wxSize(950, 700) )
630 SetIcon(wxICON(sample
));
632 wxMenuBar
*menu_bar
= new wxMenuBar();
634 wxMenu
*menuImage
= new wxMenu
;
635 menuImage
->Append( ID_NEW
, _T("&Show any image...\tCtrl-O"));
636 menuImage
->Append( ID_INFO
, _T("Show image &information...\tCtrl-I"));
637 #ifdef wxHAVE_RAW_BITMAP
638 menuImage
->AppendSeparator();
639 menuImage
->Append( ID_SHOWRAW
, _T("Test &raw bitmap...\tCtrl-R"));
641 menuImage
->AppendSeparator();
642 menuImage
->Append( ID_SHOWTHUMBNAIL
, _T("Test &thumbnail...\tCtrl-T"),
643 "Test scaling the image during load (try with JPEG)");
644 menuImage
->AppendSeparator();
645 menuImage
->Append( ID_ABOUT
, _T("&About..."));
646 menuImage
->AppendSeparator();
647 menuImage
->Append( ID_QUIT
, _T("E&xit\tCtrl-Q"));
648 menu_bar
->Append(menuImage
, _T("&Image"));
651 wxMenu
*menuClipboard
= new wxMenu
;
652 menuClipboard
->Append(wxID_COPY
, _T("&Copy test image\tCtrl-C"));
653 menuClipboard
->Append(wxID_PASTE
, _T("&Paste image\tCtrl-V"));
654 menu_bar
->Append(menuClipboard
, _T("&Clipboard"));
655 #endif // wxUSE_CLIPBOARD
657 SetMenuBar( menu_bar
);
661 int widths
[] = { -1, 100 };
662 SetStatusWidths( 2, widths
);
663 #endif // wxUSE_STATUSBAR
665 m_canvas
= new MyCanvas( this, wxID_ANY
, wxPoint(0,0), wxSize(10,10) );
667 // 500 width * 2750 height
668 m_canvas
->SetScrollbars( 10, 10, 50, 275 );
671 void MyFrame::OnQuit( wxCommandEvent
&WXUNUSED(event
) )
676 void MyFrame::OnAbout( wxCommandEvent
&WXUNUSED(event
) )
678 (void)wxMessageBox( "wxImage demo\n"
679 "(c) Robert Roebling 1998-2005"
680 "(c) Vadim Zeitlin 2005-2009",
681 "About wxImage Demo",
682 wxICON_INFORMATION
| wxOK
);
685 wxString
MyFrame::LoadUserImage(wxImage
& image
)
690 filename
= wxLoadFileSelector(_T("image"), wxEmptyString
);
691 if ( !filename
.empty() )
693 if ( !image
.LoadFile(filename
) )
695 wxLogError(_T("Couldn't load image from '%s'."), filename
.c_str());
697 return wxEmptyString
;
700 #endif // wxUSE_FILEDLG
705 void MyFrame::OnNewFrame( wxCommandEvent
&WXUNUSED(event
) )
708 wxString filename
= LoadUserImage(image
);
709 if ( !filename
.empty() )
710 new MyImageFrame(this, filename
, image
);
713 void MyFrame::OnImageInfo( wxCommandEvent
&WXUNUSED(event
) )
716 if ( !LoadUserImage(image
).empty() )
718 // TODO: show more information about the file
719 wxString info
= wxString::Format("Image size: %dx%d",
723 int xres
= image
.GetOptionInt(wxIMAGE_OPTION_RESOLUTIONX
),
724 yres
= image
.GetOptionInt(wxIMAGE_OPTION_RESOLUTIONY
);
727 info
+= wxString::Format("\nResolution: %dx%d", xres
, yres
);
728 switch ( image
.GetOptionInt(wxIMAGE_OPTION_RESOLUTIONUNIT
) )
731 wxFAIL_MSG( "unknown image resolution units" );
734 case wxIMAGE_RESOLUTION_NONE
:
735 info
+= " in default units";
738 case wxIMAGE_RESOLUTION_INCHES
:
742 case wxIMAGE_RESOLUTION_CM
:
748 wxLogMessage("%s", info
);
752 #ifdef wxHAVE_RAW_BITMAP
754 void MyFrame::OnTestRawBitmap( wxCommandEvent
&WXUNUSED(event
) )
756 (new MyRawBitmapFrame(this))->Show();
759 #endif // wxHAVE_RAW_BITMAP
763 void MyFrame::OnCopy(wxCommandEvent
& WXUNUSED(event
))
765 wxBitmapDataObject
*dobjBmp
= new wxBitmapDataObject
;
766 dobjBmp
->SetBitmap(m_canvas
->my_horse_png
);
768 wxTheClipboard
->Open();
770 if ( !wxTheClipboard
->SetData(dobjBmp
) )
772 wxLogError(_T("Failed to copy bitmap to clipboard"));
775 wxTheClipboard
->Close();
778 void MyFrame::OnPaste(wxCommandEvent
& WXUNUSED(event
))
780 wxBitmapDataObject dobjBmp
;
782 wxTheClipboard
->Open();
783 if ( !wxTheClipboard
->GetData(dobjBmp
) )
785 wxLogMessage(_T("No bitmap data in the clipboard"));
789 new MyImageFrame(this, _T("Clipboard"), dobjBmp
.GetBitmap());
791 wxTheClipboard
->Close();
794 #endif // wxUSE_CLIPBOARD
796 void MyFrame::OnThumbnail( wxCommandEvent
&WXUNUSED(event
) )
799 wxString filename
= wxLoadFileSelector(_T("image"), wxEmptyString
, wxEmptyString
, this);
800 if ( filename
.empty() )
803 static const int THUMBNAIL_WIDTH
= 320;
804 static const int THUMBNAIL_HEIGHT
= 240;
807 image
.SetOption(wxIMAGE_OPTION_MAX_WIDTH
, THUMBNAIL_WIDTH
);
808 image
.SetOption(wxIMAGE_OPTION_MAX_HEIGHT
, THUMBNAIL_HEIGHT
);
811 if ( !image
.LoadFile(filename
) )
813 wxLogError(_T("Couldn't load image from '%s'."), filename
.c_str());
817 const long loadTime
= sw
.Time();
819 MyImageFrame
* const frame
= new MyImageFrame(this, filename
, image
);
820 wxLogStatus(frame
, "Loaded \"%s\" in %ldms", filename
, loadTime
);
822 wxLogError( _T("Couldn't create file selector dialog") );
824 #endif // wxUSE_FILEDLG
827 //-----------------------------------------------------------------------------
829 //-----------------------------------------------------------------------------
835 if ( !wxApp::OnInit() )
838 wxInitAllImageHandlers();
840 wxFrame
*frame
= new MyFrame();