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