- //// Make a menubar
- wxMenu *file_menu = new wxMenu;
- wxMenu *edit_menu = (wxMenu *) NULL;
-
- file_menu->Append(wxID_NEW, "&New...");
- file_menu->Append(wxID_OPEN, "&Open...");
-
- if (singleWindowMode)
- {
- file_menu->Append(wxID_CLOSE, "&Close");
- file_menu->Append(wxID_SAVE, "&Save");
- file_menu->Append(wxID_SAVEAS, "Save &As...");
- file_menu->AppendSeparator();
- file_menu->Append(wxID_PRINT, "&Print...");
- file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
- file_menu->Append(wxID_PREVIEW, "Print Pre&view");
-
- edit_menu = new wxMenu;
- edit_menu->Append(wxID_UNDO, "&Undo");
- edit_menu->Append(wxID_REDO, "&Redo");
- edit_menu->AppendSeparator();
- edit_menu->Append(DOCVIEW_CUT, "&Cut last segment");
-
- frame->editMenu = edit_menu;
- }
-
- file_menu->AppendSeparator();
- file_menu->Append(wxID_EXIT, "E&xit");
-
- // A nice touch: a history of files visited. Use this menu.
- m_docManager->FileHistoryUseMenu(file_menu);
-
- wxMenu *help_menu = new wxMenu;
- help_menu->Append(DOCVIEW_ABOUT, "&About");
-
- wxMenuBar *menu_bar = new wxMenuBar;
-
- menu_bar->Append(file_menu, "&File");
- if (edit_menu)
- menu_bar->Append(edit_menu, "&Edit");
- menu_bar->Append(help_menu, "&Help");
-
- if (singleWindowMode)
- frame->canvas = frame->CreateCanvas((wxView *) NULL, frame);
-
- //// Associate the menu bar with the frame
- frame->SetMenuBar(menu_bar);
-
- frame->Centre(wxBOTH);
- frame->Show(TRUE);
-
- SetTopWindow(frame);
- return TRUE;
+const char * const MDI = "mdi";
+const char * const SDI = "sdi";
+const char * const SINGLE = "single";
+
+} // namespace CmdLineOption
+
+void MyApp::OnInitCmdLine(wxCmdLineParser& parser)
+{
+ wxApp::OnInitCmdLine(parser);
+
+ parser.AddSwitch("", CmdLineOption::MDI,
+ "run in MDI mode: multiple documents, single window");
+ parser.AddSwitch("", CmdLineOption::SDI,
+ "run in SDI mode: multiple documents, multiple windows");
+ parser.AddSwitch("", CmdLineOption::SINGLE,
+ "run in single document mode");