- // wxLogWindow menu events
- EVT_MENU(Menu_Close, wxLogFrame::OnClose)
- EVT_MENU(Menu_Save, wxLogFrame::OnSave)
- EVT_MENU(Menu_Clear, wxLogFrame::OnClear)
-
- EVT_CLOSE(wxLogFrame::OnClose)
-END_EVENT_TABLE()
-
-wxLogFrame::wxLogFrame(const char *szTitle)
- : wxFrame(NULL, -1, szTitle)
-{
- // we don't want to be a top-level frame because it would prevent the
- // application termination when all other frames are closed
- wxTopLevelWindows.DeleteObject(this);
-
- // @@ kludge: wxSIMPLE_BORDER is simply to prevent wxWindows from creating
- // a rich edit control instead of a normal one we want
- m_pTextCtrl = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition,
- wxDefaultSize,
- wxSIMPLE_BORDER |
- wxTE_MULTILINE |
- wxHSCROLL |
- wxTE_READONLY);
- /*
- m_pTextCtrl->SetEditable(FALSE);
- m_pTextCtrl->SetRichEdit(FALSE);
- */
-
- // create menu
- wxMenuBar *pMenuBar = new wxMenuBar;
- wxMenu *pMenu = new wxMenu;
- pMenu->Append(Menu_Save, "&Save...");
- pMenu->Append(Menu_Clear, "C&lear");
- pMenu->AppendSeparator();
- pMenu->Append(Menu_Close, "&Close");
- pMenuBar->Append(pMenu, "&Log");
- SetMenuBar(pMenuBar);
-
- // @@ what about status bar? needed (for menu prompts)?
-}
-
-void wxLogFrame::OnClose(wxCommandEvent& event)
-{
- // just hide the window
- Show(FALSE);
-}
-
-void wxLogFrame::OnSave(wxCommandEvent& event)
-{
- // get the file name
- // -----------------
- const char *szFileName = wxSaveFileSelector("log", "txt", "log.txt");
- if ( szFileName == NULL ) {
- // cancelled
- return;
- }
+ // wxLogWindow menu events
+ EVT_MENU(Menu_Close, wxLogFrame::OnClose)
+#if wxUSE_FILE
+ EVT_MENU(Menu_Save, wxLogFrame::OnSave)
+#endif // wxUSE_FILE
+ EVT_MENU(Menu_Clear, wxLogFrame::OnClear)
+
+ EVT_CLOSE(wxLogFrame::OnCloseWindow)
+END_EVENT_TABLE()
+
+wxLogFrame::wxLogFrame(wxFrame *pParent, wxLogWindow *log, const wxChar *szTitle)
+ : wxFrame(pParent, -1, szTitle)
+{
+ m_log = log;
+
+ m_pTextCtrl = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition,
+ wxDefaultSize,
+ wxTE_MULTILINE |
+ wxHSCROLL |
+ wxTE_READONLY);
+
+ // create menu
+ wxMenuBar *pMenuBar = new wxMenuBar;
+ wxMenu *pMenu = new wxMenu;
+#if wxUSE_FILE
+ pMenu->Append(Menu_Save, _("&Save..."), _("Save log contents to file"));
+#endif // wxUSE_FILE
+ pMenu->Append(Menu_Clear, _("C&lear"), _("Clear the log contents"));
+ pMenu->AppendSeparator();
+ pMenu->Append(Menu_Close, _("&Close"), _("Close this window"));
+ pMenuBar->Append(pMenu, _("&Log"));
+ SetMenuBar(pMenuBar);
+
+#if wxUSE_STATUSBAR
+ // status bar for menu prompts
+ CreateStatusBar();
+#endif // wxUSE_STATUSBAR
+
+ m_log->OnFrameCreate(this);
+}