X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f96b60aa86807f84399dce2fec7d4b68832182d8..045c4fab85bd7bcc59010d663e23ea70dda3c7bc:/samples/help/demo.cpp diff --git a/samples/help/demo.cpp b/samples/help/demo.cpp index f8f5312abf..e138ef8a61 100644 --- a/samples/help/demo.cpp +++ b/samples/help/demo.cpp @@ -17,36 +17,26 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "demo.cpp" - #pragma interface "demo.cpp" -#endif - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop +# pragma hdrstop #endif // for all others, include the necessary headers (this file is usually all you // need because it includes almost all "standard" wxWindows headers #ifndef WX_PRECOMP - #include "wx/wx.h" +# include "wx/wx.h" #endif -// defien this to 1 to use HTML help even under Windows (by default, Windows +// define this to 1 to use HTML help even under Windows (by default, Windows // version will HLP-based help) #define USE_HTML_HELP 1 - #if USE_HTML_HELP - #include "wx/helpbase.h" - #include "wx/generic/helpext.h" - - #define wxHelpController wxExtHelpController - #define sm_classwxHelpController sm_classwxExtHelpController +# include "wx/helpbase.h" #else - #include "wx/help.h" +# include "wx/help.h" #endif // ---------------------------------------------------------------------------- @@ -81,6 +71,8 @@ public: // ctor(s) MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); + wxHelpController& GetHelpController() { return m_help; } + // event handlers (these functions should _not_ be virtual) void OnQuit(wxCommandEvent& event); void OnHelp(wxCommandEvent& event); @@ -157,9 +149,17 @@ bool MyApp::OnInit() frame->Show(TRUE); SetTopWindow(frame); - // success: wxApp::OnRun() will be called which will enter the main message - // loop and the application will run. If we returned FALSE here, the - // application would exit immediately. + + // initialise the help system: this means that we'll use doc.hlp file under + // Windows and that the HTML docs are in the subdirectory doc for platforms + // using HTML help + if ( !frame->GetHelpController().Initialize("doc") ) + { + wxLogError("Cannot initialize the help system, aborting."); + + return FALSE; + } + return TRUE; } @@ -183,11 +183,13 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) menuFile->Append(HelpDemo_Help_Help, "&About Help Demo..."); menuFile->AppendSeparator(); menuFile->Append(HelpDemo_Help_Search, "&Search help..."); -#ifdef __WXGTK__ +#ifndef __WXMSW__ +#if !wxUSE_HTML menuFile->AppendSeparator(); menuFile->Append(HelpDemo_Help_KDE, "Use &KDE"); menuFile->Append(HelpDemo_Help_GNOME, "Use &GNOME"); menuFile->Append(HelpDemo_Help_Netscape, "Use &Netscape"); +#endif #endif menuFile->AppendSeparator(); menuFile->Append(HelpDemo_Quit, "E&xit"); @@ -211,11 +213,6 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) // and a static control whose parent is the panel (void)new wxStaticText(panel, -1, "Hello, world!", wxPoint(10, 10)); - - // initialise the help system: this means that we'll use doc.hlp file under - // Windows and that the HTML docs are in the subdirectory doc for platforms - // using HTML help - m_help.Initialize("doc"); }