]>
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$ | |
99d80019 | 8 | // Copyright: (c) Mattia Barbon |
65571936 | 9 | // Licence: wxWindows licence |
74698d3a MB |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_MSGOUT_H_ | |
13 | #define _WX_MSGOUT_H_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
74698d3a MB |
19 | #include "wx/defs.h" |
20 | #include "wx/wxchar.h" | |
21 | ||
98020767 VZ |
22 | // ---------------------------------------------------------------------------- |
23 | // wxMessageOutput is a class abstracting formatted output target, i.e. | |
24 | // something you can printf() to | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
bddd7a8d | 27 | class WXDLLIMPEXP_BASE wxMessageOutput |
74698d3a MB |
28 | { |
29 | public: | |
98020767 | 30 | virtual ~wxMessageOutput() { } |
74698d3a MB |
31 | |
32 | // show a message to the user | |
33 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0; | |
98020767 | 34 | |
e12a951e VZ |
35 | // gets the current wxMessageOutput object (may be NULL during |
36 | // initialization or shutdown) | |
74698d3a | 37 | static wxMessageOutput* Get(); |
98020767 | 38 | |
74698d3a MB |
39 | // sets the global wxMessageOutput instance; returns the previous one |
40 | static wxMessageOutput* Set(wxMessageOutput* msgout); | |
98020767 | 41 | |
74698d3a MB |
42 | private: |
43 | static wxMessageOutput* ms_msgOut; | |
44 | }; | |
45 | ||
e12a951e VZ |
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 | // ---------------------------------------------------------------------------- | |
51 | ||
0f8218d7 MW |
52 | #if wxABI_VERSION > 20601 |
53 | ||
e12a951e VZ |
54 | class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutput |
55 | { | |
56 | public: | |
57 | wxMessageOutputBest() { } | |
58 | ||
59 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
60 | }; | |
61 | ||
0f8218d7 MW |
62 | #endif // wxABI_VERSION |
63 | ||
98020767 VZ |
64 | // ---------------------------------------------------------------------------- |
65 | // implementation which sends output to stderr | |
66 | // ---------------------------------------------------------------------------- | |
67 | ||
bddd7a8d | 68 | class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput |
74698d3a MB |
69 | { |
70 | public: | |
98020767 | 71 | wxMessageOutputStderr() { } |
74698d3a MB |
72 | |
73 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
74 | }; | |
75 | ||
98020767 VZ |
76 | // ---------------------------------------------------------------------------- |
77 | // implementation which shows output in a message box | |
78 | // ---------------------------------------------------------------------------- | |
79 | ||
74698d3a MB |
80 | #if wxUSE_GUI |
81 | ||
bddd7a8d | 82 | class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput |
74698d3a MB |
83 | { |
84 | public: | |
98020767 | 85 | wxMessageOutputMessageBox() { } |
74698d3a MB |
86 | |
87 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
88 | }; | |
89 | ||
ef357cda | 90 | #endif // wxUSE_GUI |
74698d3a | 91 | |
e2478fde VZ |
92 | // ---------------------------------------------------------------------------- |
93 | // implementation using the native way of outputting debug messages | |
94 | // ---------------------------------------------------------------------------- | |
95 | ||
bddd7a8d | 96 | class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutput |
e2478fde VZ |
97 | { |
98 | public: | |
99 | wxMessageOutputDebug() { } | |
100 | ||
101 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
102 | }; | |
103 | ||
98020767 VZ |
104 | // ---------------------------------------------------------------------------- |
105 | // implementation using wxLog (mainly for backwards compatibility) | |
106 | // ---------------------------------------------------------------------------- | |
107 | ||
bddd7a8d | 108 | class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput |
74698d3a MB |
109 | { |
110 | public: | |
98020767 | 111 | wxMessageOutputLog() { } |
74698d3a MB |
112 | |
113 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
114 | }; | |
115 | ||
74698d3a MB |
116 | #endif |
117 | // _WX_MSGOUT_H_ |