]>
git.saurik.com Git - wxWidgets.git/blob - src/common/msgout.cpp
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"
42 #include "wx/apptrait.h"
49 #include "wx/msw/private.h"
52 // ===========================================================================
54 // ===========================================================================
58 // ----------------------------------------------------------------------------
60 // ----------------------------------------------------------------------------
62 wxMessageOutput
* wxMessageOutput::ms_msgOut
= 0;
64 wxMessageOutput
* wxMessageOutput::Get()
66 if ( !ms_msgOut
&& wxTheApp
)
68 ms_msgOut
= wxTheApp
->GetTraits()->CreateMessageOutput();
74 wxMessageOutput
* wxMessageOutput::Set(wxMessageOutput
* msgout
)
76 wxMessageOutput
* old
= ms_msgOut
;
81 // ----------------------------------------------------------------------------
82 // wxMessageOutputStderr
83 // ----------------------------------------------------------------------------
85 void wxMessageOutputStderr::Printf(const wxChar
* format
, ...)
88 va_start(args
, format
);
91 out
.PrintfV(format
, args
);
94 fprintf(stderr
, "%s", (const char*) out
.mb_str());
97 // ----------------------------------------------------------------------------
98 // wxMessageOutputDebug
99 // ----------------------------------------------------------------------------
101 void wxMessageOutputDebug::Printf(const wxChar
* format
, ...)
106 va_start(args
, format
);
108 out
.PrintfV(format
, args
);
111 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
112 out
.Replace(wxT("\t"), wxT(" "));
114 ::OutputDebugString(out
);
115 #elif defined(__WXMAC__) && !defined(__DARWIN__)
116 if ( wxIsDebuggerRunning() )
119 wxString output
= str
+ wxT(";g") ;
120 wxMacStringToPascal(output
.c_str(), pstr
);
129 // FIXME: why is wxFputs() not defined under Linux?
130 fputs(out
.mb_str(), stderr
);
135 // ----------------------------------------------------------------------------
136 // wxMessageOutputLog
137 // ----------------------------------------------------------------------------
139 void wxMessageOutputLog::Printf(const wxChar
* format
, ...)
144 va_start(args
, format
);
146 out
.PrintfV(format
, args
);
149 out
.Replace(wxT("\t"), wxT(" "));
151 ::wxLogMessage(wxT("%s"), out
.c_str());
156 // ----------------------------------------------------------------------------
157 // wxMessageOutputMessageBox
158 // ----------------------------------------------------------------------------
162 void wxMessageOutputMessageBox::Printf(const wxChar
* format
, ...)
165 va_start(args
, format
);
168 out
.PrintfV(format
, args
);
171 // the native MSW msg box understands the TABs, others don't
173 out
.Replace(wxT("\t"), wxT(" "));
178 title
.Printf(_("%s message"), wxTheApp
->GetAppName().c_str());
180 ::wxMessageBox(out
, title
);