]>
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 | ||
74698d3a MB |
31 | class WXDLLEXPORT wxMessageOutput |
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 | ||
74698d3a MB |
53 | class WXDLLEXPORT wxMessageOutputStderr : public wxMessageOutput |
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 | ||
74698d3a MB |
67 | class WXDLLEXPORT wxMessageOutputMessageBox : public wxMessageOutput |
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 | |
98020767 VZ |
77 | // ---------------------------------------------------------------------------- |
78 | // implementation using wxLog (mainly for backwards compatibility) | |
79 | // ---------------------------------------------------------------------------- | |
80 | ||
74698d3a MB |
81 | class WXDLLEXPORT wxMessageOutputLog : public wxMessageOutput |
82 | { | |
83 | public: | |
98020767 | 84 | wxMessageOutputLog() { } |
74698d3a MB |
85 | |
86 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
87 | }; | |
88 | ||
74698d3a MB |
89 | #endif |
90 | // _WX_MSGOUT_H_ |