]>
git.saurik.com Git - wxWidgets.git/blob - src/common/msgout.cpp
19f45aa4e3d5f97cb336948181f509e60e07a914
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 // FIXME: why is wxFputs() not defined under Linux?
125 fputs(out
.mb_str(), stderr
);
130 // ----------------------------------------------------------------------------
131 // wxMessageOutputLog
132 // ----------------------------------------------------------------------------
134 void wxMessageOutputLog::Printf(const wxChar
* format
, ...)
139 va_start(args
, format
);
141 out
.PrintfV(format
, args
);
144 out
.Replace(wxT("\t"), wxT(" "));
146 ::wxLogMessage(wxT("%s"), out
.c_str());
151 // ----------------------------------------------------------------------------
152 // wxMessageOutputMessageBox
153 // ----------------------------------------------------------------------------
157 void wxMessageOutputMessageBox::Printf(const wxChar
* format
, ...)
160 va_start(args
, format
);
163 out
.PrintfV(format
, args
);
166 // the native MSW msg box understands the TABs, others don't
168 out
.Replace(wxT("\t"), wxT(" "));
173 title
.Printf(_("%s message"), wxTheApp
->GetAppName().c_str());
175 ::wxMessageBox(out
, title
);