]>
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"
36 #include "wx/msgdlg.h"
40 #include "wx/msgout.h"
45 // ===========================================================================
47 // ===========================================================================
49 wxMessageOutput
* wxMessageOutput::ms_msgOut
= 0;
51 wxMessageOutput
* wxMessageOutput::Get()
53 // FIXME this is an hack
54 static bool inGet
= FALSE
;
56 if(!ms_msgOut
&& wxTheApp
&& !inGet
)
66 wxMessageOutput
* wxMessageOutput::Set(wxMessageOutput
* msgout
)
68 wxMessageOutput
* old
= ms_msgOut
;
73 // ----------------------------------------------------------------------------
74 // wxMessageOutputStderr
75 // ----------------------------------------------------------------------------
77 void wxMessageOutputStderr::Printf(const wxChar
* format
, ...)
80 va_start(args
, format
);
83 out
.PrintfV(format
, args
);
86 fprintf(stderr
, "%s", out
.mb_str());
89 // ----------------------------------------------------------------------------
90 // wxMessageOutputMessageBox
91 // ----------------------------------------------------------------------------
95 void wxMessageOutputMessageBox::Printf(const wxChar
* format
, ...)
98 va_start(args
, format
);
101 out
.PrintfV(format
, args
);
105 out
.Replace("\t"," ");
112 // ----------------------------------------------------------------------------
113 // wxMessageOutputLog
114 // ----------------------------------------------------------------------------
116 void wxMessageOutputLog::Printf(const wxChar
* format
, ...)
119 va_start(args
, format
);
122 out
.PrintfV(format
, args
);
125 out
.Replace("\t"," ");
126 // under Motif, wxMessageDialog needs a parent window, so we use
127 // wxLog, which is better than nothing
128 ::wxLogMessage("%s", out
.c_str());