Show how the file history can be saved to and restored from wxConfig.
This makes it much easier to test file history related stuff as the history
doesn't need to be recreated during every sample run.
It is also closer to what real applications using docview framework do as the
file history is relatively useless if it's not saved.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68332
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "view.h"
#include "wx/cmdline.h"
#include "view.h"
#include "wx/cmdline.h"
#ifdef __WXMAC__
#include "wx/filename.h"
#ifdef __WXMAC__
#include "wx/filename.h"
::wxInitAllImageHandlers();
::wxInitAllImageHandlers();
- SetAppName("DocView Sample");
+ // Fill in the application information fields before creating wxConfig.
+ SetVendorName("wxWidgets");
+ SetAppName("wx_docview_sample");
+ SetAppDisplayName("wxWidgets DocView Sample");
//// Create a document manager
wxDocManager *docManager = new wxDocManager;
//// Create a document manager
wxDocManager *docManager = new wxDocManager;
// A nice touch: a history of files visited. Use this menu.
docManager->FileHistoryUseMenu(menuFile);
// A nice touch: a history of files visited. Use this menu.
docManager->FileHistoryUseMenu(menuFile);
+#if wxUSE_CONFIG
+ docManager->FileHistoryLoad(*wxConfig::Get());
+#endif // wxUSE_CONFIG
+
if ( m_mode == Mode_Single )
{
if ( m_mode == Mode_Single )
{
- delete wxDocManager::GetDocumentManager();
+ wxDocManager * const manager = wxDocManager::GetDocumentManager();
+#if wxUSE_CONFIG
+ manager->FileHistorySave(*wxConfig::Get());
+#endif // wxUSE_CONFIG
+ delete manager;
return wxApp::OnExit();
}
return wxApp::OnExit();
}