]>
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"
48 #include "wx/msw/private.h"
51 // ===========================================================================
53 // ===========================================================================
57 // ----------------------------------------------------------------------------
59 // ----------------------------------------------------------------------------
61 wxMessageOutput
* wxMessageOutput::ms_msgOut
= 0;
63 wxMessageOutput
* wxMessageOutput::Get()
65 if ( !ms_msgOut
&& wxTheApp
)
67 ms_msgOut
= wxTheApp
->CreateMessageOutput();
73 wxMessageOutput
* wxMessageOutput::Set(wxMessageOutput
* msgout
)
75 wxMessageOutput
* old
= ms_msgOut
;
80 // ----------------------------------------------------------------------------
81 // wxMessageOutputStderr
82 // ----------------------------------------------------------------------------
84 void wxMessageOutputStderr::Printf(const wxChar
* format
, ...)
87 va_start(args
, format
);
90 out
.PrintfV(format
, args
);
93 fprintf(stderr
, "%s", (const char*) out
.mb_str());
96 // ----------------------------------------------------------------------------
97 // wxMessageOutputDebug
98 // ----------------------------------------------------------------------------
100 void wxMessageOutputDebug::Printf(const wxChar
* format
, ...)
105 va_start(args
, format
);
107 out
.PrintfV(format
, args
);
110 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
111 out
.Replace(wxT("\t"), wxT(" "));
113 ::OutputDebugString(out
);
114 #elif defined(__WXMAC__) && !defined(__DARWIN__)
115 if ( wxIsDebuggerRunning() )
118 wxString output
= str
+ wxT(";g") ;
119 wxMacStringToPascal(output
.c_str(), pstr
);
128 // FIXME: why is wxFputs() not defined under Linux?
129 fputs(out
.mb_str(), stderr
);
134 // ----------------------------------------------------------------------------
135 // wxMessageOutputLog
136 // ----------------------------------------------------------------------------
138 void wxMessageOutputLog::Printf(const wxChar
* format
, ...)
143 va_start(args
, format
);
145 out
.PrintfV(format
, args
);
148 out
.Replace(wxT("\t"), wxT(" "));
150 ::wxLogMessage(wxT("%s"), out
.c_str());
155 // ----------------------------------------------------------------------------
156 // wxMessageOutputMessageBox
157 // ----------------------------------------------------------------------------
161 void wxMessageOutputMessageBox::Printf(const wxChar
* format
, ...)
164 va_start(args
, format
);
167 out
.PrintfV(format
, args
);
170 // the native MSW msg box understands the TABs, others don't
172 out
.Replace(wxT("\t"), wxT(" "));
177 title
.Printf(_("%s message"), wxTheApp
->GetAppName().c_str());
179 ::wxMessageBox(out
, title
);