]>
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"
46 // ===========================================================================
48 // ===========================================================================
50 wxMessageOutput
* wxMessageOutput::ms_msgOut
= 0;
52 wxMessageOutput
* wxMessageOutput::Get()
54 if ( !ms_msgOut
&& wxTheApp
)
56 ms_msgOut
= wxTheApp
->CreateMessageOutput();
62 wxMessageOutput
* wxMessageOutput::Set(wxMessageOutput
* msgout
)
64 wxMessageOutput
* old
= ms_msgOut
;
69 // ----------------------------------------------------------------------------
70 // wxMessageOutputStderr
71 // ----------------------------------------------------------------------------
73 void wxMessageOutputStderr::Printf(const wxChar
* format
, ...)
76 va_start(args
, format
);
79 out
.PrintfV(format
, args
);
82 fprintf(stderr
, "%s", (const char*) out
.mb_str());
85 // ----------------------------------------------------------------------------
86 // wxMessageOutputMessageBox
87 // ----------------------------------------------------------------------------
91 void wxMessageOutputMessageBox::Printf(const wxChar
* format
, ...)
94 va_start(args
, format
);
97 out
.PrintfV(format
, args
);
100 // the native MSW msg box understands the TABs, others don't
102 out
.Replace(wxT("\t"), wxT(" "));
107 title
.Printf(_("%s message"), wxTheApp
->GetAppName().c_str());
109 ::wxMessageBox(out
, title
);
114 // ----------------------------------------------------------------------------
115 // wxMessageOutputLog
116 // ----------------------------------------------------------------------------
118 void wxMessageOutputLog::Printf(const wxChar
* format
, ...)
123 va_start(args
, format
);
125 out
.PrintfV(format
, args
);
128 out
.Replace(wxT("\t"), wxT(" "));
130 ::wxLogMessage(wxT("%s"), out
.c_str());