]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msgout.h
fixed compilation if wxUSE_STL=1
[wxWidgets.git] / include / wx / msgout.h
CommitLineData
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 19#include "wx/defs.h"
e3f6cbd9 20#include "wx/chartype.h"
c9f78968 21#include "wx/strvararg.h"
74698d3a 22
98020767
VZ
23// ----------------------------------------------------------------------------
24// wxMessageOutput is a class abstracting formatted output target, i.e.
25// something you can printf() to
26// ----------------------------------------------------------------------------
27
c9f78968
VS
28// NB: VC6 has a bug that causes linker errors if you have template methods
29// in a class using __declspec(dllimport). The solution is to split such
30// class into two classes, one that contains the template methods and does
31// *not* use WXDLLIMPEXP_BASE and another class that contains the rest
32// (with DLL linkage).
33class wxMessageOutputBase
74698d3a
MB
34{
35public:
c9f78968 36 virtual ~wxMessageOutputBase() { }
74698d3a
MB
37
38 // show a message to the user
c9f78968
VS
39 // void Printf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0;
40 WX_DEFINE_VARARG_FUNC_VOID(Printf, DoPrintf)
41
42protected:
43 virtual void DoPrintf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2 = 0;
44};
45
46#ifdef __VISUALC__
47 // "non dll-interface class 'wxStringPrintfMixin' used as base interface
48 // for dll-interface class 'wxString'" -- this is OK in our case
49 #pragma warning (disable:4275)
50#endif
51
52class WXDLLIMPEXP_BASE wxMessageOutput : public wxMessageOutputBase
53{
54public:
55 virtual ~wxMessageOutput() { }
98020767 56
e12a951e
VZ
57 // gets the current wxMessageOutput object (may be NULL during
58 // initialization or shutdown)
74698d3a 59 static wxMessageOutput* Get();
98020767 60
74698d3a
MB
61 // sets the global wxMessageOutput instance; returns the previous one
62 static wxMessageOutput* Set(wxMessageOutput* msgout);
98020767 63
74698d3a
MB
64private:
65 static wxMessageOutput* ms_msgOut;
66};
67
c9f78968
VS
68#ifdef __VISUALC__
69 #pragma warning (default:4275)
70#endif
71
e12a951e
VZ
72// ----------------------------------------------------------------------------
73// implementation showing the message to the user in "best" possible way: uses
74// native message box if available (currently only under Windows) and stderr
75// otherwise; unlike wxMessageOutputMessageBox this class is always safe to use
76// ----------------------------------------------------------------------------
77
78class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutput
79{
80public:
81 wxMessageOutputBest() { }
82
c9f78968
VS
83protected:
84 virtual void DoPrintf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2;
e12a951e
VZ
85};
86
98020767
VZ
87// ----------------------------------------------------------------------------
88// implementation which sends output to stderr
89// ----------------------------------------------------------------------------
90
bddd7a8d 91class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput
74698d3a
MB
92{
93public:
98020767 94 wxMessageOutputStderr() { }
74698d3a 95
c9f78968
VS
96protected:
97 virtual void DoPrintf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2;
74698d3a
MB
98};
99
98020767
VZ
100// ----------------------------------------------------------------------------
101// implementation which shows output in a message box
102// ----------------------------------------------------------------------------
103
74698d3a
MB
104#if wxUSE_GUI
105
bddd7a8d 106class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput
74698d3a
MB
107{
108public:
98020767 109 wxMessageOutputMessageBox() { }
74698d3a 110
c9f78968
VS
111protected:
112 virtual void DoPrintf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2;
74698d3a
MB
113};
114
ef357cda 115#endif // wxUSE_GUI
74698d3a 116
e2478fde
VZ
117// ----------------------------------------------------------------------------
118// implementation using the native way of outputting debug messages
119// ----------------------------------------------------------------------------
120
bddd7a8d 121class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutput
e2478fde
VZ
122{
123public:
124 wxMessageOutputDebug() { }
125
c9f78968
VS
126protected:
127 virtual void DoPrintf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2;
e2478fde
VZ
128};
129
98020767
VZ
130// ----------------------------------------------------------------------------
131// implementation using wxLog (mainly for backwards compatibility)
132// ----------------------------------------------------------------------------
133
bddd7a8d 134class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput
74698d3a
MB
135{
136public:
98020767 137 wxMessageOutputLog() { }
74698d3a 138
c9f78968
VS
139protected:
140 virtual void DoPrintf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2;
74698d3a
MB
141};
142
74698d3a
MB
143#endif
144 // _WX_MSGOUT_H_