]>
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 | ||
e4844687 SN |
19 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__) |
20 | // Some older compilers (such as EMX) cannot handle | |
4e32eea1 | 21 | // #pragma interface/implementation correctly, iff |
e4844687 SN |
22 | // #pragma implementation is used in _two_ translation |
23 | // units (as created by e.g. event.cpp compiled for | |
24 | // libwx_base and event.cpp compiled for libwx_gui_core). | |
25 | // So we must not use those pragmas for those compilers in | |
26 | // such files. | |
74698d3a MB |
27 | #pragma interface "msgout.h" |
28 | #endif | |
29 | ||
30 | #include "wx/defs.h" | |
31 | #include "wx/wxchar.h" | |
32 | ||
98020767 VZ |
33 | // ---------------------------------------------------------------------------- |
34 | // wxMessageOutput is a class abstracting formatted output target, i.e. | |
35 | // something you can printf() to | |
36 | // ---------------------------------------------------------------------------- | |
37 | ||
bddd7a8d | 38 | class WXDLLIMPEXP_BASE wxMessageOutput |
74698d3a MB |
39 | { |
40 | public: | |
98020767 | 41 | virtual ~wxMessageOutput() { } |
74698d3a MB |
42 | |
43 | // show a message to the user | |
44 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0; | |
98020767 | 45 | |
e12a951e VZ |
46 | // gets the current wxMessageOutput object (may be NULL during |
47 | // initialization or shutdown) | |
74698d3a | 48 | static wxMessageOutput* Get(); |
98020767 | 49 | |
74698d3a MB |
50 | // sets the global wxMessageOutput instance; returns the previous one |
51 | static wxMessageOutput* Set(wxMessageOutput* msgout); | |
98020767 | 52 | |
74698d3a MB |
53 | private: |
54 | static wxMessageOutput* ms_msgOut; | |
55 | }; | |
56 | ||
e12a951e VZ |
57 | // ---------------------------------------------------------------------------- |
58 | // implementation showing the message to the user in "best" possible way: uses | |
59 | // native message box if available (currently only under Windows) and stderr | |
60 | // otherwise; unlike wxMessageOutputMessageBox this class is always safe to use | |
61 | // ---------------------------------------------------------------------------- | |
62 | ||
0f8218d7 MW |
63 | #if wxABI_VERSION > 20601 |
64 | ||
e12a951e VZ |
65 | class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutput |
66 | { | |
67 | public: | |
68 | wxMessageOutputBest() { } | |
69 | ||
70 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
71 | }; | |
72 | ||
0f8218d7 MW |
73 | #endif // wxABI_VERSION |
74 | ||
98020767 VZ |
75 | // ---------------------------------------------------------------------------- |
76 | // implementation which sends output to stderr | |
77 | // ---------------------------------------------------------------------------- | |
78 | ||
bddd7a8d | 79 | class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput |
74698d3a MB |
80 | { |
81 | public: | |
98020767 | 82 | wxMessageOutputStderr() { } |
74698d3a MB |
83 | |
84 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
85 | }; | |
86 | ||
98020767 VZ |
87 | // ---------------------------------------------------------------------------- |
88 | // implementation which shows output in a message box | |
89 | // ---------------------------------------------------------------------------- | |
90 | ||
74698d3a MB |
91 | #if wxUSE_GUI |
92 | ||
bddd7a8d | 93 | class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput |
74698d3a MB |
94 | { |
95 | public: | |
98020767 | 96 | wxMessageOutputMessageBox() { } |
74698d3a MB |
97 | |
98 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
99 | }; | |
100 | ||
ef357cda | 101 | #endif // wxUSE_GUI |
74698d3a | 102 | |
e2478fde VZ |
103 | // ---------------------------------------------------------------------------- |
104 | // implementation using the native way of outputting debug messages | |
105 | // ---------------------------------------------------------------------------- | |
106 | ||
bddd7a8d | 107 | class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutput |
e2478fde VZ |
108 | { |
109 | public: | |
110 | wxMessageOutputDebug() { } | |
111 | ||
112 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
113 | }; | |
114 | ||
98020767 VZ |
115 | // ---------------------------------------------------------------------------- |
116 | // implementation using wxLog (mainly for backwards compatibility) | |
117 | // ---------------------------------------------------------------------------- | |
118 | ||
bddd7a8d | 119 | class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput |
74698d3a MB |
120 | { |
121 | public: | |
98020767 | 122 | wxMessageOutputLog() { } |
74698d3a MB |
123 | |
124 | virtual void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2; | |
125 | }; | |
126 | ||
74698d3a MB |
127 | #endif |
128 | // _WX_MSGOUT_H_ |