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 // ----------------------------------------------------------------------------
20 #include "wx/wxchar.h"
22 // ----------------------------------------------------------------------------
23 // wxMessageOutput is a class abstracting formatted output target, i.e.
24 // something you can printf() to
25 // ----------------------------------------------------------------------------
27 class WXDLLIMPEXP_BASE wxMessageOutput
30 virtual ~wxMessageOutput() { }
32 // show a message to the user
33 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
= 0;
35 // gets the current wxMessageOutput object (may be NULL during
36 // initialization or shutdown)
37 static wxMessageOutput
* Get();
39 // sets the global wxMessageOutput instance; returns the previous one
40 static wxMessageOutput
* Set(wxMessageOutput
* msgout
);
43 static wxMessageOutput
* ms_msgOut
;
46 // ----------------------------------------------------------------------------
47 // implementation showing the message to the user in "best" possible way: uses
48 // native message box if available (currently only under Windows) and stderr
49 // otherwise; unlike wxMessageOutputMessageBox this class is always safe to use
50 // ----------------------------------------------------------------------------
52 #if wxABI_VERSION > 20601
54 class WXDLLIMPEXP_BASE wxMessageOutputBest
: public wxMessageOutput
57 wxMessageOutputBest() { }
59 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;
62 #endif // wxABI_VERSION
64 // ----------------------------------------------------------------------------
65 // implementation which sends output to stderr
66 // ----------------------------------------------------------------------------
68 class WXDLLIMPEXP_BASE wxMessageOutputStderr
: public wxMessageOutput
71 wxMessageOutputStderr() { }
73 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;
76 // ----------------------------------------------------------------------------
77 // implementation which shows output in a message box
78 // ----------------------------------------------------------------------------
82 class WXDLLIMPEXP_CORE wxMessageOutputMessageBox
: public wxMessageOutput
85 wxMessageOutputMessageBox() { }
87 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;
92 // ----------------------------------------------------------------------------
93 // implementation using the native way of outputting debug messages
94 // ----------------------------------------------------------------------------
96 class WXDLLIMPEXP_BASE wxMessageOutputDebug
: public wxMessageOutput
99 wxMessageOutputDebug() { }
101 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;
104 // ----------------------------------------------------------------------------
105 // implementation using wxLog (mainly for backwards compatibility)
106 // ----------------------------------------------------------------------------
108 class WXDLLIMPEXP_BASE wxMessageOutputLog
: public wxMessageOutput
111 wxMessageOutputLog() { }
113 virtual void Printf(const wxChar
* format
, ...) ATTRIBUTE_PRINTF_2
;