+// ----------------------------------------------------------------------------
+// (background) log window: this class forwards all log messages to the log
+// target which was active when it was instantiated, but also collects them
+// to the log window. This window has it's own menu which allows the user to
+// close it, clear the log contents or save it to the file.
+// ----------------------------------------------------------------------------
+class WXDLLEXPORT wxLogWindow : public wxLog
+{
+public:
+ wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL)
+ const char *szTitle, // the title of the frame
+ bool bShow = TRUE, // show window immediately?
+ bool bPassToOld = TRUE); // pass log messages to the old target?
+ ~wxLogWindow();
+
+ // window operations
+ // show/hide the log window
+ void Show(bool bShow = TRUE);
+ // retrieve the pointer to the frame
+ wxFrame *GetFrame() const;
+
+ // accessors
+ // the previous log target (may be NULL)
+ wxLog *GetOldLog() const { return m_pOldLog; }
+ // are we passing the messages to the previous log target?
+ bool IsPassingMessages() const { return m_bPassMessages; }
+
+ // we can pass the messages to the previous log target (we're in this mode by
+ // default: we collect all messages in the window, but also let the default
+ // processing take place)
+ void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
+
+ // base class virtuals
+ // we don't need it ourselves, but we pass it to the previous logger
+ virtual void Flush();
+
+ // overridables
+ // called immediately after the log frame creation allowing for
+ // any extra initializations
+ virtual void OnFrameCreate(wxFrame *frame);
+ // called right before the log frame is going to be deleted
+ virtual void OnFrameDelete(wxFrame *frame);
+
+protected:
+ virtual void DoLog(wxLogLevel level, const char *szString);
+ virtual void DoLogString(const char *szString);
+
+private:
+ bool m_bPassMessages; // pass messages to m_pOldLog?
+ wxLog *m_pOldLog; // previous log target
+ wxLogFrame *m_pLogFrame; // the log frame
+};
+
+#endif // wxUSE_NOGUI
+