1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/logg.h
3 // Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs)
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
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 // ----------------------------------------------------------------------------
25 // log everything to a text window (GUI only of course)
26 class WXDLLIMPEXP_CORE wxLogTextCtrl
: public wxLog
29 wxLogTextCtrl(wxTextCtrl
*pTextCtrl
);
32 // implement sink function
33 virtual void DoLogString(const wxString
& szString
, time_t t
);
35 wxSUPPRESS_DOLOGSTRING_HIDE_WARNING()
39 wxTextCtrl
*m_pTextCtrl
;
41 DECLARE_NO_COPY_CLASS(wxLogTextCtrl
)
44 #endif // wxUSE_TEXTCTRL
46 // ----------------------------------------------------------------------------
47 // GUI log target, the default one for wxWidgets programs
48 // ----------------------------------------------------------------------------
52 class WXDLLIMPEXP_CORE wxLogGui
: public wxLog
58 // show all messages that were logged since the last Flush()
62 virtual void DoLog(wxLogLevel level
, const wxString
& szString
, time_t t
);
64 wxSUPPRESS_DOLOG_HIDE_WARNING()
69 wxArrayString m_aMessages
; // the log message texts
70 wxArrayInt m_aSeverity
; // one of wxLOG_XXX values
71 wxArrayLong m_aTimes
; // the time of each message
72 bool m_bErrors
, // do we have any errors?
73 m_bWarnings
, // any warnings?
74 m_bHasMessages
; // any messages at all?
78 #endif // wxUSE_LOGGUI
80 // ----------------------------------------------------------------------------
81 // (background) log window: this class forwards all log messages to the log
82 // target which was active when it was instantiated, but also collects them
83 // to the log window. This window has it's own menu which allows the user to
84 // close it, clear the log contents or save it to the file.
85 // ----------------------------------------------------------------------------
89 class WXDLLIMPEXP_CORE wxLogWindow
: public wxLogPassThrough
92 wxLogWindow(wxWindow
*pParent
, // the parent frame (can be NULL)
93 const wxString
& szTitle
, // the title of the frame
94 bool bShow
= true, // show window immediately?
95 bool bPassToOld
= true); // pass messages to the old target?
97 virtual ~wxLogWindow();
100 // show/hide the log window
101 void Show(bool bShow
= true);
102 // retrieve the pointer to the frame
103 wxFrame
*GetFrame() const;
106 // called immediately after the log frame creation allowing for
107 // any extra initializations
108 virtual void OnFrameCreate(wxFrame
*frame
);
109 // called if the user closes the window interactively, will not be
110 // called if it is destroyed for another reason (such as when program
111 // exits) - return true from here to allow the frame to close, false
112 // to prevent this from happening
113 virtual bool OnFrameClose(wxFrame
*frame
);
114 // called right before the log frame is going to be deleted: will
115 // always be called unlike OnFrameClose()
116 virtual void OnFrameDelete(wxFrame
*frame
);
119 virtual void DoLog(wxLogLevel level
, const wxString
& szString
, time_t t
);
120 virtual void DoLogString(const wxString
& szString
, time_t t
);
122 wxSUPPRESS_DOLOG_HIDE_WARNING()
123 wxSUPPRESS_DOLOGSTRING_HIDE_WARNING()
126 wxLogFrame
*m_pLogFrame
; // the log frame
128 DECLARE_NO_COPY_CLASS(wxLogWindow
)
131 #endif // wxUSE_LOGWINDOW
135 #endif // _WX_LOGG_H_