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