]>
Commit | Line | Data |
---|---|---|
74698d3a MB |
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 | ||
af49c4b8 | 19 | #if defined(__GNUG__) && !defined(__APPLE__) |
74698d3a MB |
20 | #pragma interface "msgout.h" |
21 | #endif | |
22 | ||
23 | #include "wx/defs.h" | |
24 | #include "wx/wxchar.h" | |
25 | ||
98020767 VZ |
26 | // ---------------------------------------------------------------------------- |
27 | // wxMessageOutput is a class abstracting formatted output target, i.e. | |
28 | // something you can printf() to | |
29 | // ---------------------------------------------------------------------------- | |
30 | ||
bddd7a8d | 31 | class WXDLLIMPEXP_BASE wxMessageOutput |
74698d3a MB |
32 | { |
33 | public: | |
98020767 | 34 | virtual ~wxMessageOutput() { } |
74698d3a MB |
35 | |
36 | // show a message to the user | |
37 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0; | |
98020767 | 38 | |
74698d3a MB |
39 | // gets the current wxMessageOutput object |
40 | static wxMessageOutput* Get(); | |
98020767 | 41 | |
74698d3a MB |
42 | // sets the global wxMessageOutput instance; returns the previous one |
43 | static wxMessageOutput* Set(wxMessageOutput* msgout); | |
98020767 | 44 | |
74698d3a MB |
45 | private: |
46 | static wxMessageOutput* ms_msgOut; | |
47 | }; | |
48 | ||
98020767 VZ |
49 | // ---------------------------------------------------------------------------- |
50 | // implementation which sends output to stderr | |
51 | // ---------------------------------------------------------------------------- | |
52 | ||
bddd7a8d | 53 | class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput |
74698d3a MB |
54 | { |
55 | public: | |
98020767 | 56 | wxMessageOutputStderr() { } |
74698d3a MB |
57 | |
58 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
59 | }; | |
60 | ||
98020767 VZ |
61 | // ---------------------------------------------------------------------------- |
62 | // implementation which shows output in a message box | |
63 | // ---------------------------------------------------------------------------- | |
64 | ||
74698d3a MB |
65 | #if wxUSE_GUI |
66 | ||
bddd7a8d | 67 | class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput |
74698d3a MB |
68 | { |
69 | public: | |
98020767 | 70 | wxMessageOutputMessageBox() { } |
74698d3a MB |
71 | |
72 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
73 | }; | |
74 | ||
ef357cda | 75 | #endif // wxUSE_GUI |
74698d3a | 76 | |
e2478fde VZ |
77 | // ---------------------------------------------------------------------------- |
78 | // implementation using the native way of outputting debug messages | |
79 | // ---------------------------------------------------------------------------- | |
80 | ||
bddd7a8d | 81 | class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutput |
e2478fde VZ |
82 | { |
83 | public: | |
84 | wxMessageOutputDebug() { } | |
85 | ||
86 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
87 | }; | |
88 | ||
98020767 VZ |
89 | // ---------------------------------------------------------------------------- |
90 | // implementation using wxLog (mainly for backwards compatibility) | |
91 | // ---------------------------------------------------------------------------- | |
92 | ||
bddd7a8d | 93 | class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput |
74698d3a MB |
94 | { |
95 | public: | |
98020767 | 96 | wxMessageOutputLog() { } |
74698d3a MB |
97 | |
98 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
99 | }; | |
100 | ||
74698d3a MB |
101 | #endif |
102 | // _WX_MSGOUT_H_ |