]>
git.saurik.com Git - wxWidgets.git/blob - src/common/msgout.cpp
2baffdcf32d7161177ea6e967c976726f96ffdc1
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: common/msgout.cpp
3 // Purpose: wxMessageOutput implementation
4 // Author: Mattia Barbon
8 // Copyright: (c) the wxWindows team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
21 #pragma implementation "msgout.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
27 #if defined(__BORLANDC__)
32 #include "wx/string.h"
37 #include "wx/msgdlg.h"
41 #include "wx/msgout.h"
47 // ===========================================================================
49 // ===========================================================================
53 // ----------------------------------------------------------------------------
55 // ----------------------------------------------------------------------------
57 wxMessageOutput
* wxMessageOutput::ms_msgOut
= 0;
59 wxMessageOutput
* wxMessageOutput::Get()
61 if ( !ms_msgOut
&& wxTheApp
)
63 ms_msgOut
= wxTheApp
->CreateMessageOutput();
69 wxMessageOutput
* wxMessageOutput::Set(wxMessageOutput
* msgout
)
71 wxMessageOutput
* old
= ms_msgOut
;
76 // ----------------------------------------------------------------------------
77 // wxMessageOutputStderr
78 // ----------------------------------------------------------------------------
80 void wxMessageOutputStderr::Printf(const wxChar
* format
, ...)
83 va_start(args
, format
);
86 out
.PrintfV(format
, args
);
89 fprintf(stderr
, "%s", (const char*) out
.mb_str());
92 // ----------------------------------------------------------------------------
93 // wxMessageOutputDebug
94 // ----------------------------------------------------------------------------
96 void wxMessageOutputDebug::Printf(const wxChar
* format
, ...)
101 va_start(args
, format
);
103 out
.PrintfV(format
, args
);
106 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
107 out
.Replace(wxT("\t"), wxT(" "));
109 ::OutputDebugString(out
);
110 #elif defined(__WXMAC__) && !defined(__DARWIN__)
111 if ( wxIsDebuggerRunning() )
114 wxString output
= str
+ wxT(";g") ;
115 wxMacStringToPascal(output
.c_str(), pstr
);
124 wxFputs(out
, stderr
);
129 // ----------------------------------------------------------------------------
130 // wxMessageOutputLog
131 // ----------------------------------------------------------------------------
133 void wxMessageOutputLog::Printf(const wxChar
* format
, ...)
138 va_start(args
, format
);
140 out
.PrintfV(format
, args
);
143 out
.Replace(wxT("\t"), wxT(" "));
145 ::wxLogMessage(wxT("%s"), out
.c_str());
150 // ----------------------------------------------------------------------------
151 // wxMessageOutputMessageBox
152 // ----------------------------------------------------------------------------
156 void wxMessageOutputMessageBox::Printf(const wxChar
* format
, ...)
159 va_start(args
, format
);
162 out
.PrintfV(format
, args
);
165 // the native MSW msg box understands the TABs, others don't
167 out
.Replace(wxT("\t"), wxT(" "));
172 title
.Printf(_("%s message"), wxTheApp
->GetAppName().c_str());
174 ::wxMessageBox(out
, title
);