1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMessageOutput class. Shows a message to the user
4 // Author: Mattia Barbon
8 // Copyright: (c) Mattia Barbon
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
20 // Some older compilers (such as EMX) cannot handle
21 // #pragma interface/implementation correctly, iff
22 // #pragma implementation is used in _two_ translation
23 // units (as created by e.g. event.cpp compiled for
24 // libwx_base and event.cpp compiled for libwx_gui_core).
25 // So we must not use those pragmas for those compilers in
27 #pragma interface "msgout.h"
31 #include "wx/wxchar.h"
33 // ----------------------------------------------------------------------------
34 // wxMessageOutput is a class abstracting formatted output target, i.e.
35 // something you can printf() to
36 // ----------------------------------------------------------------------------
38 class WXDLLIMPEXP_BASE wxMessageOutput
41 virtual ~wxMessageOutput() { }
43 // show a message to the user
44 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
= 0;
46 // gets the current wxMessageOutput object (may be NULL during
47 // initialization or shutdown)
48 static wxMessageOutput
* Get();
50 // sets the global wxMessageOutput instance; returns the previous one
51 static wxMessageOutput
* Set(wxMessageOutput
* msgout
);
54 static wxMessageOutput
* ms_msgOut
;
57 // ----------------------------------------------------------------------------
58 // implementation showing the message to the user in "best" possible way: uses
59 // native message box if available (currently only under Windows) and stderr
60 // otherwise; unlike wxMessageOutputMessageBox this class is always safe to use
61 // ----------------------------------------------------------------------------
63 #if wxABI_VERSION > 20601
65 class WXDLLIMPEXP_BASE wxMessageOutputBest
: public wxMessageOutput
68 wxMessageOutputBest() { }
70 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;
73 #endif // wxABI_VERSION
75 // ----------------------------------------------------------------------------
76 // implementation which sends output to stderr
77 // ----------------------------------------------------------------------------
79 class WXDLLIMPEXP_BASE wxMessageOutputStderr
: public wxMessageOutput
82 wxMessageOutputStderr() { }
84 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;
87 // ----------------------------------------------------------------------------
88 // implementation which shows output in a message box
89 // ----------------------------------------------------------------------------
93 class WXDLLIMPEXP_CORE wxMessageOutputMessageBox
: public wxMessageOutput
96 wxMessageOutputMessageBox() { }
98 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;
103 // ----------------------------------------------------------------------------
104 // implementation using the native way of outputting debug messages
105 // ----------------------------------------------------------------------------
107 class WXDLLIMPEXP_BASE wxMessageOutputDebug
: public wxMessageOutput
110 wxMessageOutputDebug() { }
112 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;
115 // ----------------------------------------------------------------------------
116 // implementation using wxLog (mainly for backwards compatibility)
117 // ----------------------------------------------------------------------------
119 class WXDLLIMPEXP_BASE wxMessageOutputLog
: public wxMessageOutput
122 wxMessageOutputLog() { }
124 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;