]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/logg.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxLog-derived classes which need GUI support (the rest is in
5 // Author: Vadim Zeitlin
7 // Created: 20.09.99 (extracted from src/common/log.cpp)
9 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
13 // ============================================================================
15 // ============================================================================
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 // no #pragma implementation "log.h" because it's already in src/common/log.cpp
23 // For compilers that support precompilation, includes "wx.h".
24 #include "wx/wxprec.h"
31 #error "This file can't be compiled without GUI!"
36 #include "wx/button.h"
41 #include "wx/filedlg.h"
42 #include "wx/msgdlg.h"
43 #include "wx/textctrl.h"
45 #include "wx/statbmp.h"
46 #include "wx/button.h"
50 #include "wx/textfile.h"
51 #include "wx/statline.h"
54 // for OutputDebugString()
55 #include "wx/msw/private.h"
58 // may be defined to 0 for old behavior (using wxMessageBox) - shouldn't be
59 // changed normally (that's why it's here and not in setup.h)
60 #define wxUSE_LOG_DIALOG 1
63 #include "wx/datetime.h"
64 #include "wx/listctrl.h"
65 #include "wx/imaglist.h"
67 #else // !wxUSE_TEXTFILE
68 #include "wx/msgdlg.h"
69 #endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG
71 // ----------------------------------------------------------------------------
73 // ----------------------------------------------------------------------------
77 class wxLogDialog
: public wxDialog
80 wxLogDialog(wxWindow
*parent
,
81 const wxArrayString
& messages
,
82 const wxArrayInt
& severity
,
83 const wxArrayLong
& timess
,
84 const wxString
& caption
,
86 virtual ~wxLogDialog();
89 void OnOk(wxCommandEvent
& event
);
90 void OnDetails(wxCommandEvent
& event
);
92 void OnSave(wxCommandEvent
& event
);
94 void OnListSelect(wxListEvent
& event
);
97 // create controls needed for the details display
98 void CreateDetailsControls();
100 // the data for the listctrl
101 wxArrayString m_messages
;
102 wxArrayInt m_severity
;
105 // the "toggle" button and its state
106 wxButton
*m_btnDetails
;
107 bool m_showingDetails
;
109 // the controls which are not shown initially (but only when details
110 // button is pressed)
111 wxListCtrl
*m_listctrl
;
113 wxStaticLine
*m_statline
;
114 #endif // wxUSE_STATLINE
119 // the translated "Details" string
120 static wxString ms_details
;
122 DECLARE_EVENT_TABLE()
125 BEGIN_EVENT_TABLE(wxLogDialog
, wxDialog
)
126 EVT_BUTTON(wxID_CANCEL
, wxLogDialog::OnOk
)
127 EVT_BUTTON(wxID_MORE
, wxLogDialog::OnDetails
)
129 EVT_BUTTON(wxID_SAVE
, wxLogDialog::OnSave
)
131 EVT_LIST_ITEM_SELECTED(-1, wxLogDialog::OnListSelect
)
134 #endif // wxUSE_LOG_DIALOG
136 // ----------------------------------------------------------------------------
138 // ----------------------------------------------------------------------------
142 // pass an uninitialized file object, the function will ask the user for the
143 // filename and try to open it, returns TRUE on success (file was opened),
144 // FALSE if file couldn't be opened/created and -1 if the file selection
145 // dialog was cancelled
146 static int OpenLogFile(wxFile
& file
, wxString
*filename
= NULL
);
150 // ----------------------------------------------------------------------------
152 // ----------------------------------------------------------------------------
154 // we use a global variable to store the frame pointer for wxLogStatus - bad,
155 // but it's he easiest way
156 static wxFrame
*gs_pFrame
; // FIXME MT-unsafe
158 // ============================================================================
160 // ============================================================================
162 // ----------------------------------------------------------------------------
164 // ----------------------------------------------------------------------------
166 // accepts an additional argument which tells to which frame the output should
168 void wxLogStatus(wxFrame
*pFrame
, const wxChar
*szFormat
, ...)
172 wxLog
*pLog
= wxLog::GetActiveTarget();
173 if ( pLog
!= NULL
) {
175 va_start(argptr
, szFormat
);
176 msg
.PrintfV(szFormat
, argptr
);
179 wxASSERT( gs_pFrame
== NULL
); // should be reset!
181 wxLog::OnLog(wxLOG_Status
, msg
, time(NULL
));
182 gs_pFrame
= (wxFrame
*) NULL
;
186 // ----------------------------------------------------------------------------
187 // wxLogTextCtrl implementation
188 // ----------------------------------------------------------------------------
190 wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl
*pTextCtrl
)
192 m_pTextCtrl
= pTextCtrl
;
195 void wxLogTextCtrl::DoLogString(const wxChar
*szString
, time_t WXUNUSED(t
))
200 msg
<< szString
<< wxT('\r');
202 msg
<< szString
<< wxT('\n');
205 m_pTextCtrl
->AppendText(msg
);
208 // ----------------------------------------------------------------------------
209 // wxLogGui implementation (FIXME MT-unsafe)
210 // ----------------------------------------------------------------------------
217 void wxLogGui::Clear()
221 m_bHasMessages
= FALSE
;
228 void wxLogGui::Flush()
230 if ( !m_bHasMessages
)
233 // do it right now to block any new calls to Flush() while we're here
234 m_bHasMessages
= FALSE
;
236 wxString appName
= wxTheApp
->GetAppName();
238 appName
[0u] = wxToupper(appName
[0u]);
241 wxString titleFormat
;
243 titleFormat
= _("%s Error");
246 else if ( m_bWarnings
) {
247 titleFormat
= _("%s Warning");
248 style
= wxICON_EXCLAMATION
;
251 titleFormat
= _("%s Information");
252 style
= wxICON_INFORMATION
;
256 title
.Printf(titleFormat
, appName
.c_str());
258 // this is the best we can do here
259 wxWindow
*parent
= wxTheApp
->GetTopWindow();
261 size_t nMsgCount
= m_aMessages
.Count();
264 if ( nMsgCount
== 1 )
266 str
= m_aMessages
[0];
268 else // more than one message
271 wxLogDialog
dlg(parent
,
272 m_aMessages
, m_aSeverity
, m_aTimes
,
275 // clear the message list before showing the dialog because while it's
276 // shown some new messages may appear
279 (void)dlg
.ShowModal();
280 #else // !wxUSE_LOG_DIALOG
281 // concatenate all strings (but not too many to not overfill the msg box)
284 // start from the most recent message
285 for ( size_t n
= nMsgCount
; n
> 0; n
-- ) {
286 // for Windows strings longer than this value are wrapped (NT 4.0)
287 const size_t nMsgLineWidth
= 156;
289 nLines
+= (m_aMessages
[n
- 1].Len() + nMsgLineWidth
- 1) / nMsgLineWidth
;
291 if ( nLines
> 25 ) // don't put too many lines in message box
294 str
<< m_aMessages
[n
- 1] << wxT("\n");
296 #endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG
299 // this catches both cases of 1 message with wxUSE_LOG_DIALOG and any
300 // situation without it
303 wxMessageBox(str
, title
, wxOK
| style
, parent
);
305 // no undisplayed messages whatsoever
310 // log all kinds of messages
311 void wxLogGui::DoLog(wxLogLevel level
, const wxChar
*szString
, time_t t
)
319 m_aMessages
.Add(szString
);
320 m_aSeverity
.Add(wxLOG_Message
);
321 m_aTimes
.Add((long)t
);
322 m_bHasMessages
= TRUE
;
330 // find the top window and set it's status text if it has any
331 wxFrame
*pFrame
= gs_pFrame
;
332 if ( pFrame
== NULL
) {
333 wxWindow
*pWin
= wxTheApp
->GetTopWindow();
334 if ( pWin
!= NULL
&& pWin
->IsKindOf(CLASSINFO(wxFrame
)) ) {
335 pFrame
= (wxFrame
*)pWin
;
339 if ( pFrame
&& pFrame
->GetStatusBar() )
340 pFrame
->SetStatusText(szString
);
342 #endif // wxUSE_STATUSBAR
350 // don't prepend debug/trace here: it goes to the
351 // debug window anyhow, but do put a timestamp
354 str
<< szString
<< wxT("\r\n");
355 OutputDebugString(str
);
357 // send them to stderr
358 wxFprintf(stderr
, wxT("%s: %s\n"),
359 level
== wxLOG_Trace
? wxT("Trace")
365 #endif // __WXDEBUG__
369 case wxLOG_FatalError
:
370 // show this one immediately
371 wxMessageBox(szString
, _("Fatal error"), wxICON_HAND
);
377 #if !wxUSE_LOG_DIALOG
378 // discard earlier informational messages if this is the 1st
379 // error because they might not make sense any more and showing
380 // them in a message box might be confusing
384 #endif // wxUSE_LOG_DIALOG
391 // for the warning we don't discard the info messages
395 m_aMessages
.Add(szString
);
396 m_aSeverity
.Add((int)level
);
397 m_aTimes
.Add((long)t
);
398 m_bHasMessages
= TRUE
;
403 // ----------------------------------------------------------------------------
404 // wxLogWindow and wxLogFrame implementation
405 // ----------------------------------------------------------------------------
409 class wxLogFrame
: public wxFrame
413 wxLogFrame(wxFrame
*pParent
, wxLogWindow
*log
, const wxChar
*szTitle
);
414 virtual ~wxLogFrame();
417 void OnClose(wxCommandEvent
& event
);
418 void OnCloseWindow(wxCloseEvent
& event
);
420 void OnSave (wxCommandEvent
& event
);
422 void OnClear(wxCommandEvent
& event
);
424 void OnIdle(wxIdleEvent
&);
427 wxTextCtrl
*TextCtrl() const { return m_pTextCtrl
; }
430 // use standard ids for our commands!
433 Menu_Close
= wxID_CLOSE
,
434 Menu_Save
= wxID_SAVE
,
435 Menu_Clear
= wxID_CLEAR
438 // common part of OnClose() and OnCloseWindow()
441 wxTextCtrl
*m_pTextCtrl
;
444 DECLARE_EVENT_TABLE()
447 BEGIN_EVENT_TABLE(wxLogFrame
, wxFrame
)
448 // wxLogWindow menu events
449 EVT_MENU(Menu_Close
, wxLogFrame::OnClose
)
451 EVT_MENU(Menu_Save
, wxLogFrame::OnSave
)
453 EVT_MENU(Menu_Clear
, wxLogFrame::OnClear
)
455 EVT_CLOSE(wxLogFrame::OnCloseWindow
)
458 wxLogFrame::wxLogFrame(wxFrame
*pParent
, wxLogWindow
*log
, const wxChar
*szTitle
)
459 : wxFrame(pParent
, -1, szTitle
)
463 m_pTextCtrl
= new wxTextCtrl(this, -1, wxEmptyString
, wxDefaultPosition
,
470 wxMenuBar
*pMenuBar
= new wxMenuBar
;
471 wxMenu
*pMenu
= new wxMenu
;
473 pMenu
->Append(Menu_Save
, _("&Save..."), _("Save log contents to file"));
475 pMenu
->Append(Menu_Clear
, _("C&lear"), _("Clear the log contents"));
476 pMenu
->AppendSeparator();
477 pMenu
->Append(Menu_Close
, _("&Close"), _("Close this window"));
478 pMenuBar
->Append(pMenu
, _("&Log"));
479 SetMenuBar(pMenuBar
);
482 // status bar for menu prompts
484 #endif // wxUSE_STATUSBAR
486 m_log
->OnFrameCreate(this);
489 void wxLogFrame::DoClose()
491 if ( m_log
->OnFrameClose(this) )
493 // instead of closing just hide the window to be able to Show() it
499 void wxLogFrame::OnClose(wxCommandEvent
& WXUNUSED(event
))
504 void wxLogFrame::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
510 void wxLogFrame::OnSave(wxCommandEvent
& WXUNUSED(event
))
514 int rc
= OpenLogFile(file
, &filename
);
523 // retrieve text and save it
524 // -------------------------
525 int nLines
= m_pTextCtrl
->GetNumberOfLines();
526 for ( int nLine
= 0; bOk
&& nLine
< nLines
; nLine
++ ) {
527 bOk
= file
.Write(m_pTextCtrl
->GetLineText(nLine
) +
528 wxTextFile::GetEOL());
535 wxLogError(_("Can't save log contents to file."));
538 wxLogStatus(this, _("Log saved to the file '%s'."), filename
.c_str());
543 void wxLogFrame::OnClear(wxCommandEvent
& WXUNUSED(event
))
545 m_pTextCtrl
->Clear();
548 wxLogFrame::~wxLogFrame()
550 m_log
->OnFrameDelete(this);
555 wxLogWindow::wxLogWindow(wxFrame
*pParent
,
556 const wxChar
*szTitle
,
560 m_bPassMessages
= bDoPass
;
562 m_pLogFrame
= new wxLogFrame(pParent
, this, szTitle
);
563 m_pOldLog
= wxLog::SetActiveTarget(this);
566 m_pLogFrame
->Show(TRUE
);
569 void wxLogWindow::Show(bool bShow
)
571 m_pLogFrame
->Show(bShow
);
574 void wxLogWindow::Flush()
576 if ( m_pOldLog
!= NULL
)
579 m_bHasMessages
= FALSE
;
582 void wxLogWindow::DoLog(wxLogLevel level
, const wxChar
*szString
, time_t t
)
584 // first let the previous logger show it
585 if ( m_pOldLog
!= NULL
&& m_bPassMessages
) {
586 // bogus cast just to access protected DoLog
587 ((wxLogWindow
*)m_pOldLog
)->DoLog(level
, szString
, t
);
593 // by default, these messages are ignored by wxLog, so process
595 if ( !wxIsEmpty(szString
) )
598 str
<< _("Status: ") << szString
;
603 // don't put trace messages in the text window for 2 reasons:
604 // 1) there are too many of them
605 // 2) they may provoke other trace messages thus sending a program
606 // into an infinite loop
611 // and this will format it nicely and call our DoLogString()
612 wxLog::DoLog(level
, szString
, t
);
616 m_bHasMessages
= TRUE
;
619 void wxLogWindow::DoLogString(const wxChar
*szString
, time_t WXUNUSED(t
))
621 // put the text into our window
622 wxTextCtrl
*pText
= m_pLogFrame
->TextCtrl();
624 // remove selection (WriteText is in fact ReplaceSelection)
626 long nLen
= pText
->GetLastPosition();
627 pText
->SetSelection(nLen
, nLen
);
632 msg
<< szString
<< wxT('\n');
634 pText
->AppendText(msg
);
636 // TODO ensure that the line can be seen
639 wxFrame
*wxLogWindow::GetFrame() const
644 void wxLogWindow::OnFrameCreate(wxFrame
* WXUNUSED(frame
))
648 bool wxLogWindow::OnFrameClose(wxFrame
* WXUNUSED(frame
))
654 void wxLogWindow::OnFrameDelete(wxFrame
* WXUNUSED(frame
))
656 m_pLogFrame
= (wxLogFrame
*)NULL
;
659 wxLogWindow::~wxLogWindow()
663 // may be NULL if log frame already auto destroyed itself
667 // ----------------------------------------------------------------------------
669 // ----------------------------------------------------------------------------
673 static const size_t MARGIN
= 10;
675 wxString
wxLogDialog::ms_details
;
677 wxLogDialog::wxLogDialog(wxWindow
*parent
,
678 const wxArrayString
& messages
,
679 const wxArrayInt
& severity
,
680 const wxArrayLong
& times
,
681 const wxString
& caption
,
683 : wxDialog(parent
, -1, caption
)
685 if ( ms_details
.IsEmpty() )
687 // ensure that we won't loop here if wxGetTranslation()
688 // happens to pop up a Log message while translating this :-)
689 ms_details
= wxTRANSLATE("&Details");
690 ms_details
= wxGetTranslation(ms_details
);
693 size_t count
= messages
.GetCount();
694 m_messages
.Alloc(count
);
695 m_severity
.Alloc(count
);
696 m_times
.Alloc(count
);
698 for ( size_t n
= 0; n
< count
; n
++ )
700 wxString msg
= messages
[n
];
703 m_messages
.Add(msg
.BeforeFirst(_T('\n')));
704 msg
= msg
.AfterFirst(_T('\n'));
706 m_severity
.Add(severity
[n
]);
707 m_times
.Add(times
[n
]);
712 m_showingDetails
= FALSE
; // not initially
713 m_listctrl
= (wxListCtrl
*)NULL
;
716 m_statline
= (wxStaticLine
*)NULL
;
717 #endif // wxUSE_STATLINE
720 m_btnSave
= (wxButton
*)NULL
;
723 // create the controls which are always shown and layout them: we use
724 // sizers even though our window is not resizeable to calculate the size of
725 // the dialog properly
726 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
727 wxBoxSizer
*sizerButtons
= new wxBoxSizer(wxVERTICAL
);
728 wxBoxSizer
*sizerAll
= new wxBoxSizer(wxHORIZONTAL
);
730 // this "Ok" button has wxID_CANCEL id - not very logical, but this allows
731 // to close the log dialog with <Esc> which wouldn't work otherwise (as it
732 // translates into click on cancel button)
733 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _("OK"));
734 sizerButtons
->Add(btnOk
, 0, wxCENTRE
|wxBOTTOM
, MARGIN
/2);
735 m_btnDetails
= new wxButton(this, wxID_MORE
, ms_details
+ _T(" >>"));
736 sizerButtons
->Add(m_btnDetails
, 0, wxCENTRE
|wxTOP
, MARGIN
/2 - 1);
739 wxIcon icon
= wxTheApp
->GetStdIcon((int)(style
& wxICON_MASK
));
740 sizerAll
->Add(new wxStaticBitmap(this, -1, icon
), 0, wxCENTRE
);
743 const wxString
& message
= messages
.Last();
744 sizerAll
->Add(CreateTextSizer(message
), 0, wxCENTRE
|wxLEFT
|wxRIGHT
, MARGIN
);
745 sizerAll
->Add(sizerButtons
, 0, wxALIGN_RIGHT
|wxLEFT
, MARGIN
);
747 sizerTop
->Add(sizerAll
, 0, wxCENTRE
|wxALL
, MARGIN
);
752 sizerTop
->SetSizeHints(this);
757 // this can't happen any more as we don't use this dialog in this case
761 // no details... it's easier to disable a button than to change the
762 // dialog layout depending on whether we have details or not
763 m_btnDetails
->Disable();
770 void wxLogDialog::CreateDetailsControls()
772 // create the save button and separator line if possible
774 m_btnSave
= new wxButton(this, wxID_SAVE
, _("&Save..."));
778 m_statline
= new wxStaticLine(this, -1);
779 #endif // wxUSE_STATLINE
781 // create the list ctrl now
782 m_listctrl
= new wxListCtrl(this, -1,
783 wxDefaultPosition
, wxDefaultSize
,
789 // no need to translate these strings as they're not shown to the
790 // user anyhow (we use wxLC_NO_HEADER style)
791 m_listctrl
->InsertColumn(0, _T("Message"));
792 m_listctrl
->InsertColumn(1, _T("Time"));
794 // prepare the imagelist
795 static const int ICON_SIZE
= 16;
796 wxImageList
*imageList
= new wxImageList(ICON_SIZE
, ICON_SIZE
);
798 // order should be the same as in the switch below!
799 static const int icons
[] =
806 bool loadedIcons
= TRUE
;
809 for ( size_t icon
= 0; icon
< WXSIZEOF(icons
); icon
++ )
811 wxBitmap bmp
= wxTheApp
->GetStdIcon(icons
[icon
]);
813 // This may very well fail if there are insufficient
814 // colours available. Degrade gracefully.
819 imageList
->Add(wxImage(bmp
).
820 Rescale(ICON_SIZE
, ICON_SIZE
).
824 m_listctrl
->SetImageList(imageList
, wxIMAGE_LIST_SMALL
);
828 wxString fmt
= wxLog::GetTimestamp();
835 size_t count
= m_messages
.GetCount();
836 for ( size_t n
= 0; n
< count
; n
++ )
840 switch ( m_severity
[n
] )
859 m_listctrl
->InsertItem(n
, m_messages
[n
], image
);
861 m_listctrl
->InsertItem(n
, m_messages
[n
]);
863 m_listctrl
->SetItem(n
, 1,
864 wxDateTime((time_t)m_times
[n
]).Format(fmt
));
867 // let the columns size themselves
868 m_listctrl
->SetColumnWidth(0, wxLIST_AUTOSIZE
);
869 m_listctrl
->SetColumnWidth(1, wxLIST_AUTOSIZE
);
871 // get the approx height of the listctrl
872 wxFont font
= GetFont();
874 font
= *wxSWISS_FONT
;
877 GetTextExtent(_T("H"), (int*)NULL
, &y
, (int*)NULL
, (int*)NULL
, &font
);
878 int height
= wxMax(y
*(count
+ 3), 100);
879 m_listctrl
->SetSize(-1, height
);
882 void wxLogDialog::OnListSelect(wxListEvent
& event
)
884 // we can't just disable the control because this looks ugly under Windows
885 // (wrong bg colour, no scrolling...), but we still want to disable
886 // selecting items - it makes no sense here
887 m_listctrl
->SetItemState(event
.GetIndex(), 0, wxLIST_STATE_SELECTED
);
890 void wxLogDialog::OnOk(wxCommandEvent
& WXUNUSED(event
))
897 void wxLogDialog::OnSave(wxCommandEvent
& WXUNUSED(event
))
900 int rc
= OpenLogFile(file
);
909 wxString fmt
= wxLog::GetTimestamp();
916 size_t count
= m_messages
.GetCount();
917 for ( size_t n
= 0; ok
&& (n
< count
); n
++ )
920 line
<< wxDateTime((time_t)m_times
[n
]).Format(fmt
)
923 << wxTextFile::GetEOL();
925 ok
= file
.Write(line
);
932 wxLogError(_("Can't save log contents to file."));
937 void wxLogDialog::OnDetails(wxCommandEvent
& WXUNUSED(event
))
939 wxSizer
*sizer
= GetSizer();
941 if ( m_showingDetails
)
943 m_btnDetails
->SetLabel(ms_details
+ _T(">>"));
945 sizer
->Remove(m_listctrl
);
948 sizer
->Remove(m_statline
);
949 #endif // wxUSE_STATLINE
952 sizer
->Remove(m_btnSave
);
955 else // show details now
957 m_btnDetails
->SetLabel(wxString(_T("<< ")) + ms_details
);
961 CreateDetailsControls();
965 sizer
->Add(m_statline
, 0, wxEXPAND
| (wxALL
& ~wxTOP
), MARGIN
);
966 #endif // wxUSE_STATLINE
968 sizer
->Add(m_listctrl
, 1, wxEXPAND
| (wxALL
& ~wxTOP
), MARGIN
);
971 sizer
->Add(m_btnSave
, 0, wxALIGN_RIGHT
| (wxALL
& ~wxTOP
), MARGIN
);
975 m_showingDetails
= !m_showingDetails
;
977 // in any case, our size changed - update
978 sizer
->SetSizeHints(this);
982 // VS: this is neccessary in order to force frame redraw under
983 // WindowMaker or fvwm2 (and probably other broken WMs).
984 // Otherwise, detailed list wouldn't be displayed.
989 wxLogDialog::~wxLogDialog()
993 delete m_listctrl
->GetImageList(wxIMAGE_LIST_SMALL
);
997 #endif // wxUSE_LOG_DIALOG
1001 // pass an uninitialized file object, the function will ask the user for the
1002 // filename and try to open it, returns TRUE on success (file was opened),
1003 // FALSE if file couldn't be opened/created and -1 if the file selection
1004 // dialog was cancelled
1005 static int OpenLogFile(wxFile
& file
, wxString
*pFilename
)
1007 // get the file name
1008 // -----------------
1009 wxString filename
= wxSaveFileSelector(wxT("log"), wxT("txt"), wxT("log.txt"));
1018 if ( wxFile::Exists(filename
) ) {
1019 bool bAppend
= FALSE
;
1021 strMsg
.Printf(_("Append log to file '%s' (choosing [No] will overwrite it)?"),
1023 switch ( wxMessageBox(strMsg
, _("Question"),
1024 wxICON_QUESTION
| wxYES_NO
| wxCANCEL
) ) {
1037 wxFAIL_MSG(_("invalid message box return value"));
1041 bOk
= file
.Open(filename
, wxFile::write_append
);
1044 bOk
= file
.Create(filename
, TRUE
/* overwrite */);
1048 bOk
= file
.Create(filename
);
1052 *pFilename
= filename
;
1057 #endif // wxUSE_FILE