]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/logg.h
disable dialup manager for MGL, it doesn't link as there is no DOS implementation...
[wxWidgets.git] / include / wx / generic / logg.h
CommitLineData
7e8c564c
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/logg.h
3// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs)
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 29/01/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 9// Licence: wxWindows licence
7e8c564c
VS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_LOGG_H_
13#define _WX_LOGG_H_
14
7e8c564c
VS
15#if wxUSE_GUI
16
17// ----------------------------------------------------------------------------
18// the following log targets are only compiled in if the we're compiling the
19// GUI part (andnot just the base one) of the library, they're implemented in
20// src/generic/logg.cpp *and not src/common/log.cpp unlike all the rest)
21// ----------------------------------------------------------------------------
22
23#if wxUSE_TEXTCTRL
24
25// log everything to a text window (GUI only of course)
26class WXDLLEXPORT wxLogTextCtrl : public wxLog
27{
28public:
29 wxLogTextCtrl(wxTextCtrl *pTextCtrl);
30
6f02a879 31protected:
7e8c564c
VS
32 // implement sink function
33 virtual void DoLogString(const wxChar *szString, time_t t);
34
6f02a879 35private:
7e8c564c
VS
36 // the control we use
37 wxTextCtrl *m_pTextCtrl;
38
39 DECLARE_NO_COPY_CLASS(wxLogTextCtrl)
40};
41
42#endif // wxUSE_TEXTCTRL
43
44// ----------------------------------------------------------------------------
77ffb593 45// GUI log target, the default one for wxWidgets programs
7e8c564c
VS
46// ----------------------------------------------------------------------------
47
48#if wxUSE_LOGGUI
49
50class WXDLLEXPORT wxLogGui : public wxLog
51{
52public:
53 // ctor
54 wxLogGui();
55
56 // show all messages that were logged since the last Flush()
57 virtual void Flush();
58
59protected:
60 virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t);
61
62 // empty everything
63 void Clear();
64
65 wxArrayString m_aMessages; // the log message texts
66 wxArrayInt m_aSeverity; // one of wxLOG_XXX values
67 wxArrayLong m_aTimes; // the time of each message
68 bool m_bErrors, // do we have any errors?
69 m_bWarnings, // any warnings?
70 m_bHasMessages; // any messages at all?
71
72};
73
74#endif // wxUSE_LOGGUI
75
76// ----------------------------------------------------------------------------
77// (background) log window: this class forwards all log messages to the log
78// target which was active when it was instantiated, but also collects them
79// to the log window. This window has it's own menu which allows the user to
80// close it, clear the log contents or save it to the file.
81// ----------------------------------------------------------------------------
82
83#if wxUSE_LOGWINDOW
84
85class WXDLLEXPORT wxLogWindow : public wxLogPassThrough
86{
87public:
55c9a186 88 wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL)
7e8c564c 89 const wxChar *szTitle, // the title of the frame
dabbc6a5
DS
90 bool bShow = true, // show window immediately?
91 bool bPassToOld = true); // pass messages to the old target?
7e8c564c 92
d3c7fc99 93 virtual ~wxLogWindow();
7e8c564c
VS
94
95 // window operations
96 // show/hide the log window
dabbc6a5 97 void Show(bool bShow = true);
7e8c564c
VS
98 // retrieve the pointer to the frame
99 wxFrame *GetFrame() const;
100
101 // overridables
102 // called immediately after the log frame creation allowing for
103 // any extra initializations
104 virtual void OnFrameCreate(wxFrame *frame);
105 // called if the user closes the window interactively, will not be
106 // called if it is destroyed for another reason (such as when program
dabbc6a5 107 // exits) - return true from here to allow the frame to close, false
7e8c564c
VS
108 // to prevent this from happening
109 virtual bool OnFrameClose(wxFrame *frame);
110 // called right before the log frame is going to be deleted: will
111 // always be called unlike OnFrameClose()
112 virtual void OnFrameDelete(wxFrame *frame);
113
114protected:
115 virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t);
116 virtual void DoLogString(const wxChar *szString, time_t t);
117
118private:
119 wxLogFrame *m_pLogFrame; // the log frame
120
121 DECLARE_NO_COPY_CLASS(wxLogWindow)
122};
123
124#endif // wxUSE_LOGWINDOW
125
126#endif // wxUSE_GUI
127
128#endif // _WX_LOGG_H_
129