]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/logg.h
extract setters from wxHeaderColumnBase into a separate wxSettableHeaderColumn class...
[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)
53a2db12 26class WXDLLIMPEXP_CORE wxLogTextCtrl : public wxLog
7e8c564c
VS
27{
28public:
29 wxLogTextCtrl(wxTextCtrl *pTextCtrl);
30
6f02a879 31protected:
7e8c564c 32 // implement sink function
5a20d2ce 33 virtual void DoLogString(const wxString& szString, time_t t);
7e8c564c 34
b99891b0
VZ
35 wxSUPPRESS_DOLOGSTRING_HIDE_WARNING()
36
6f02a879 37private:
7e8c564c
VS
38 // the control we use
39 wxTextCtrl *m_pTextCtrl;
40
41 DECLARE_NO_COPY_CLASS(wxLogTextCtrl)
42};
43
44#endif // wxUSE_TEXTCTRL
45
46// ----------------------------------------------------------------------------
77ffb593 47// GUI log target, the default one for wxWidgets programs
7e8c564c
VS
48// ----------------------------------------------------------------------------
49
50#if wxUSE_LOGGUI
51
53a2db12 52class WXDLLIMPEXP_CORE wxLogGui : public wxLog
7e8c564c
VS
53{
54public:
55 // ctor
56 wxLogGui();
57
58 // show all messages that were logged since the last Flush()
59 virtual void Flush();
60
61protected:
5a20d2ce 62 virtual void DoLog(wxLogLevel level, const wxString& szString, time_t t);
7e8c564c 63
b99891b0
VZ
64 wxSUPPRESS_DOLOG_HIDE_WARNING()
65
9ad2fe62
VZ
66 // return the title to be used for the log dialog, depending on m_bErrors
67 // and m_bWarnings values
68 wxString GetTitle() const;
69
70 // return the icon (one of wxICON_XXX constants) to be used for the dialog
71 // depending on m_bErrors/m_bWarnings
72 int GetSeverityIcon() const;
73
7e8c564c
VS
74 // empty everything
75 void Clear();
76
9ad2fe62 77
7e8c564c
VS
78 wxArrayString m_aMessages; // the log message texts
79 wxArrayInt m_aSeverity; // one of wxLOG_XXX values
80 wxArrayLong m_aTimes; // the time of each message
81 bool m_bErrors, // do we have any errors?
82 m_bWarnings, // any warnings?
83 m_bHasMessages; // any messages at all?
84
9ad2fe62
VZ
85private:
86 // this method is called to show a single log message, it uses
87 // wxMessageBox() by default
88 virtual void DoShowSingleLogMessage(const wxString& message,
89 const wxString& title,
90 int style);
91
92 // this method is called to show multiple log messages, it uses wxLogDialog
93 virtual void DoShowMultipleLogMessages(const wxArrayString& messages,
94 const wxArrayInt& severities,
95 const wxArrayLong& times,
96 const wxString& title,
97 int style);
7e8c564c
VS
98};
99
100#endif // wxUSE_LOGGUI
101
102// ----------------------------------------------------------------------------
103// (background) log window: this class forwards all log messages to the log
104// target which was active when it was instantiated, but also collects them
105// to the log window. This window has it's own menu which allows the user to
106// close it, clear the log contents or save it to the file.
107// ----------------------------------------------------------------------------
108
109#if wxUSE_LOGWINDOW
110
53a2db12 111class WXDLLIMPEXP_CORE wxLogWindow : public wxLogPassThrough
7e8c564c
VS
112{
113public:
46ff9bd5
VS
114 wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL)
115 const wxString& szTitle, // the title of the frame
dabbc6a5
DS
116 bool bShow = true, // show window immediately?
117 bool bPassToOld = true); // pass messages to the old target?
7e8c564c 118
d3c7fc99 119 virtual ~wxLogWindow();
7e8c564c
VS
120
121 // window operations
122 // show/hide the log window
dabbc6a5 123 void Show(bool bShow = true);
7e8c564c
VS
124 // retrieve the pointer to the frame
125 wxFrame *GetFrame() const;
126
127 // overridables
128 // called immediately after the log frame creation allowing for
129 // any extra initializations
130 virtual void OnFrameCreate(wxFrame *frame);
131 // called if the user closes the window interactively, will not be
132 // called if it is destroyed for another reason (such as when program
dabbc6a5 133 // exits) - return true from here to allow the frame to close, false
7e8c564c
VS
134 // to prevent this from happening
135 virtual bool OnFrameClose(wxFrame *frame);
136 // called right before the log frame is going to be deleted: will
137 // always be called unlike OnFrameClose()
138 virtual void OnFrameDelete(wxFrame *frame);
139
140protected:
5a20d2ce
VS
141 virtual void DoLog(wxLogLevel level, const wxString& szString, time_t t);
142 virtual void DoLogString(const wxString& szString, time_t t);
7e8c564c 143
b99891b0
VZ
144 wxSUPPRESS_DOLOG_HIDE_WARNING()
145 wxSUPPRESS_DOLOGSTRING_HIDE_WARNING()
146
7e8c564c
VS
147private:
148 wxLogFrame *m_pLogFrame; // the log frame
149
150 DECLARE_NO_COPY_CLASS(wxLogWindow)
151};
152
153#endif // wxUSE_LOGWINDOW
154
155#endif // wxUSE_GUI
156
157#endif // _WX_LOGG_H_
158