made wxLogGui more flexible and documented it and added example of customizing it to the dialogs sample

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-09-11 13:58:54 +00:00
parent b2794028de
commit 9ad2fe62d1
5 changed files with 186 additions and 64 deletions

View File

@@ -22,6 +22,7 @@
#include "../sample.xpm"
#include "wx/apptrait.h"
#include "wx/datetime.h"
#include "wx/image.h"
#include "wx/bookctrl.h"
@@ -83,10 +84,7 @@
#include "wx/fdrepdlg.h"
#endif // wxUSE_FINDREPLDLG
#if wxUSE_SPINCTRL
#include "wx/spinctrl.h"
#endif
#include "wx/propdlg.h"
#include "dialogs.h"
@@ -2327,3 +2325,29 @@ void TestMessageBoxDialog::OnClose(wxCommandEvent& WXUNUSED(event))
}
#endif // USE_SETTINGS_DIALOG
#if wxUSE_LOG
// ----------------------------------------------------------------------------
// custom log target
// ----------------------------------------------------------------------------
class MyLogGui : public wxLogGui
{
private:
virtual void DoShowSingleLogMessage(const wxString& message,
const wxString& title,
int style)
{
wxMessageDialog dlg(NULL, message, title, wxOK | style);
dlg.SetExtendedMessage("Note that this is a custom log dialog.");
dlg.ShowModal();
}
};
wxLog *MyAppTraits::CreateLogTarget()
{
return new MyLogGui;
}
#endif // wxUSE_LOG

View File

@@ -98,15 +98,31 @@ of MSW, MAC and OS2
#define USE_SETTINGS_DIALOG 0
#endif
#if wxUSE_LOG
// Custom application traits class which we use to override the default log
// target creation
class MyAppTraits : public wxGUIAppTraits
{
public:
virtual wxLog *CreateLogTarget();
};
#endif // wxUSE_LOG
// Define a new application type
class MyApp: public wxApp
{
public:
bool OnInit();
virtual bool OnInit();
wxFont m_canvasFont;
wxColour m_canvasTextColour;
protected:
#if wxUSE_LOG
virtual wxAppTraits *CreateTraits() { return new MyAppTraits; }
#endif // wxUSE_LOG
};
#if USE_MODAL_PRESENTATION