]>
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"
47 // ===========================================================================
49 // ===========================================================================
51 wxMessageOutput
* wxMessageOutput::ms_msgOut
= 0;
53 wxMessageOutput
* wxMessageOutput::Get()
55 if ( !ms_msgOut
&& wxTheApp
)
57 ms_msgOut
= wxTheApp
->CreateMessageOutput();
63 wxMessageOutput
* wxMessageOutput::Set(wxMessageOutput
* msgout
)
65 wxMessageOutput
* old
= ms_msgOut
;
70 // ----------------------------------------------------------------------------
71 // wxMessageOutputStderr
72 // ----------------------------------------------------------------------------
74 void wxMessageOutputStderr::Printf(const wxChar
* format
, ...)
77 va_start(args
, format
);
80 out
.PrintfV(format
, args
);
83 fprintf(stderr
, "%s", (const char*) out
.mb_str());
86 // ----------------------------------------------------------------------------
87 // wxMessageOutputMessageBox
88 // ----------------------------------------------------------------------------
92 void wxMessageOutputMessageBox::Printf(const wxChar
* format
, ...)
95 va_start(args
, format
);
98 out
.PrintfV(format
, args
);
101 // the native MSW msg box understands the TABs, others don't
103 out
.Replace(wxT("\t"), wxT(" "));
108 title
.Printf(_("%s message"), wxTheApp
->GetAppName().c_str());
110 ::wxMessageBox(out
, title
);
115 // ----------------------------------------------------------------------------
116 // wxMessageOutputLog
117 // ----------------------------------------------------------------------------
119 void wxMessageOutputLog::Printf(const wxChar
* format
, ...)
124 va_start(args
, format
);
126 out
.PrintfV(format
, args
);
129 out
.Replace(wxT("\t"), wxT(" "));
131 ::wxLogMessage(wxT("%s"), out
.c_str());