X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4883dc77e1aa24601648ff0505b4fa901e969049..c200f9a3b7003a6ef27f079672b7d165b04a59b7:/samples/docview/docview.cpp diff --git a/samples/docview/docview.cpp b/samples/docview/docview.cpp index 19503d7e4a..b865b6f425 100644 --- a/samples/docview/docview.cpp +++ b/samples/docview/docview.cpp @@ -148,6 +148,8 @@ bool MyApp::OnInit() if ( !wxApp::OnInit() ) return false; + ::wxInitAllImageHandlers(); + SetAppName("DocView Sample"); //// Create a document manager @@ -157,7 +159,7 @@ bool MyApp::OnInit() new wxDocTemplate(docManager, "Drawing", "*.drw", "", "drw", "Drawing Doc", "Drawing View", CLASSINFO(DrawingDocument), CLASSINFO(DrawingView)); -#if defined __WXMAC__ ) && defined( wxOSX_USE_CARBON ) +#if defined( __WXMAC__ ) && wxOSX_USE_CARBON wxFileName::MacRegisterDefaultTypeAndCreator("drw" , 'WXMB' , 'WXMA'); #endif @@ -173,9 +175,13 @@ bool MyApp::OnInit() new wxDocTemplate(docManager, "Text", "*.txt;*.text", "", "txt;text", "Text Doc", "Text View", CLASSINFO(TextEditDocument), CLASSINFO(TextEditView)); -#if defined __WXMAC__ ) && defined( wxOSX_USE_CARBON ) +#if defined( __WXMAC__ ) && wxOSX_USE_CARBON wxFileName::MacRegisterDefaultTypeAndCreator("txt" , 'TEXT' , 'WXMA'); #endif + // Create a template relating image documents to their views + new wxDocTemplate(docManager, "Image", "*.png;*.jpg", "", "png;jpg", + "Image Doc", "Image View", + CLASSINFO(wxImageDocument), CLASSINFO(wxImageView)); } // create the main frame window @@ -216,6 +222,7 @@ bool MyApp::OnInit() { m_canvas = new MyCanvas(NULL, frame); m_menuEdit = CreateDrawingEditMenu(); + docManager->CreateNewDocument(); } CreateMenuBarForFrame(frame, menuFile, m_menuEdit);