Added wxMessageOutput as per the discussion on wx-dev.
[wxWidgets.git] / include / wx / msgout.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msgout.h
3 // Purpose: wxMessageOutput class. Shows a message to the user
4 // Author: Mattia Barbon
5 // Modified by:
6 // Created: 17.07.02
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MSGOUT_H_
13 #define _WX_MSGOUT_H_
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #ifdef __GNUG__
20 #pragma interface "msgout.h"
21 #endif
22
23 #include "wx/defs.h"
24 #include "wx/wxchar.h"
25
26 class WXDLLEXPORT wxMessageOutput
27 {
28 public:
29 virtual ~wxMessageOutput() {};
30
31 // show a message to the user
32 virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0;
33 // gets the current wxMessageOutput object
34 static wxMessageOutput* Get();
35 // sets the global wxMessageOutput instance; returns the previous one
36 static wxMessageOutput* Set(wxMessageOutput* msgout);
37 private:
38 static wxMessageOutput* ms_msgOut;
39 };
40
41 // sends output to stderr
42 class WXDLLEXPORT wxMessageOutputStderr : public wxMessageOutput
43 {
44 public:
45 wxMessageOutputStderr() {};
46
47 virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2;
48 };
49
50 #if wxUSE_GUI
51
52 // shows output in a message box
53 class WXDLLEXPORT wxMessageOutputMessageBox : public wxMessageOutput
54 {
55 public:
56 wxMessageOutputMessageBox() {};
57
58 virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2;
59 };
60
61 #ifdef __WXMOTIF__
62
63 // use wxLog; this is only required for wxMotif, so we put this code
64 // inside wxUSE_GUI; it will work even without GUI
65 class WXDLLEXPORT wxMessageOutputLog : public wxMessageOutput
66 {
67 public:
68 wxMessageOutputLog() {};
69
70 virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2;
71 };
72
73 #endif // __WXMOTIF__
74
75 #endif // wxUSE_GUI
76
77 #endif
78 // _WX_MSGOUT_H_