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