]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msgout.h
added new wxCONTROL_FLAT bit (see discussion of patch 1691478)
[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:
5b077ec7
VS
43 void DoPrintf(const wxChar* format, ...) ATTRIBUTE_PRINTF_2;
44 virtual void Output(const wxString& str) = 0;
c9f78968
VS
45};
46
47#ifdef __VISUALC__
48 // "non dll-interface class 'wxStringPrintfMixin' used as base interface
49 // for dll-interface class 'wxString'" -- this is OK in our case
50 #pragma warning (disable:4275)
51#endif
52
53class WXDLLIMPEXP_BASE wxMessageOutput : public wxMessageOutputBase
54{
55public:
56 virtual ~wxMessageOutput() { }
98020767 57
e12a951e
VZ
58 // gets the current wxMessageOutput object (may be NULL during
59 // initialization or shutdown)
74698d3a 60 static wxMessageOutput* Get();
98020767 61
74698d3a
MB
62 // sets the global wxMessageOutput instance; returns the previous one
63 static wxMessageOutput* Set(wxMessageOutput* msgout);
98020767 64
74698d3a
MB
65private:
66 static wxMessageOutput* ms_msgOut;
67};
68
c9f78968
VS
69#ifdef __VISUALC__
70 #pragma warning (default:4275)
71#endif
72
e12a951e
VZ
73// ----------------------------------------------------------------------------
74// implementation showing the message to the user in "best" possible way: uses
75// native message box if available (currently only under Windows) and stderr
76// otherwise; unlike wxMessageOutputMessageBox this class is always safe to use
77// ----------------------------------------------------------------------------
78
79class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutput
80{
81public:
82 wxMessageOutputBest() { }
83
c9f78968 84protected:
5b077ec7 85 virtual void Output(const wxString& str);
e12a951e
VZ
86};
87
98020767
VZ
88// ----------------------------------------------------------------------------
89// implementation which sends output to stderr
90// ----------------------------------------------------------------------------
91
bddd7a8d 92class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput
74698d3a
MB
93{
94public:
98020767 95 wxMessageOutputStderr() { }
74698d3a 96
c9f78968 97protected:
5b077ec7 98 virtual void Output(const wxString& str);
74698d3a
MB
99};
100
98020767
VZ
101// ----------------------------------------------------------------------------
102// implementation which shows output in a message box
103// ----------------------------------------------------------------------------
104
74698d3a
MB
105#if wxUSE_GUI
106
bddd7a8d 107class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput
74698d3a
MB
108{
109public:
98020767 110 wxMessageOutputMessageBox() { }
74698d3a 111
c9f78968 112protected:
5b077ec7 113 virtual void Output(const wxString& str);
74698d3a
MB
114};
115
ef357cda 116#endif // wxUSE_GUI
74698d3a 117
e2478fde
VZ
118// ----------------------------------------------------------------------------
119// implementation using the native way of outputting debug messages
120// ----------------------------------------------------------------------------
121
bddd7a8d 122class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutput
e2478fde
VZ
123{
124public:
125 wxMessageOutputDebug() { }
126
c9f78968 127protected:
5b077ec7 128 virtual void Output(const wxString& str);
e2478fde
VZ
129};
130
98020767
VZ
131// ----------------------------------------------------------------------------
132// implementation using wxLog (mainly for backwards compatibility)
133// ----------------------------------------------------------------------------
134
bddd7a8d 135class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput
74698d3a
MB
136{
137public:
98020767 138 wxMessageOutputLog() { }
74698d3a 139
c9f78968 140protected:
5b077ec7 141 virtual void Output(const wxString& str);
74698d3a
MB
142};
143
74698d3a
MB
144#endif
145 // _WX_MSGOUT_H_