+// frame constructor
+MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size),
+ help(wxHF_DEFAULT_STYLE | wxHF_OPEN_FILES)
+{
+ SetIcon(wxICON(sample));
+
+ // create a menu bar
+ wxMenu *menuFile = new wxMenu;
+
+ menuFile->Append(Minimal_Help, _("&Help"));
+ menuFile->Append(Minimal_Quit, _("E&xit"));
+
+ // now append the freshly created menu to the menu bar...
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(menuFile, _("&File"));
+
+ // ... and attach this menu bar to the frame
+ SetMenuBar(menuBar);
+
+ help.UseConfig(wxConfig::Get());
+ bool ret;
+ help.SetTempDir(wxT("."));
+ ret = help.AddBook(wxFileName(wxT("helpfiles/testing.hhp"), wxPATH_UNIX));
+ if (! ret)
+ wxMessageBox(wxT("Failed adding book helpfiles/testing.hhp"));
+ ret = help.AddBook(wxFileName(wxT("helpfiles/another.hhp"), wxPATH_UNIX));
+ if (! ret)
+ wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
+}
+
+
+// event handlers
+
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+{
+ // true is to force the frame to close
+ Close(true);
+}
+
+void MyFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
+{
+ help.Display(wxT("Test HELPFILE"));
+}
+
+void MyFrame::OnClose(wxCloseEvent& event)
+{
+ // Close the help frame; this will cause the config data to
+ // get written.
+ if ( help.GetFrame() ) // returns NULL if no help frame active
+ help.GetFrame()->Close(true);
+ // now we can safely delete the config pointer
+ event.Skip();
+ delete wxConfig::Set(NULL);
+}