]>
git.saurik.com Git - wxWidgets.git/blob - samples/html/helpview/helpview.cpp
a0b28929ed7f3ed1743d6b7de55c9ab728397588
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     wxHtml sample: help browser 
   8 // Copyright:   (c) wxWidgets team 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 // Please note: see utils/helpview for a more fully-featured 
  13 // standalone help browser. 
  15 // For compilers that support precompilation, includes "wx/wx.h". 
  16 #include "wx/wxprec.h" 
  22 // for all others, include the necessary headers (this file is usually all you 
  23 // need because it includes almost all "standard" wxWidgets headers 
  29 #include "wx/wxhtml.h" 
  30 #include "wx/fs_zip.h" 
  32 #include "wx/filedlg.h" 
  35 // ---------------------------------------------------------------------------- 
  37 // ---------------------------------------------------------------------------- 
  39 // Define a new application type, each program should derive a class from wxApp 
  40 class MyApp 
: public wxApp
 
  43     // override base class virtuals 
  44     // ---------------------------- 
  46     // this one is called on application startup and is a good place for the app 
  47     // initialization (doing it here and not in the ctor allows to have an error 
  48     // return: if OnInit() returns false, the application terminates) 
  50     virtual bool OnInit(); 
  54     wxHtmlHelpController 
*help
; 
  64     delete wxLog::SetActiveTarget(new wxLogStderr
); // So dialog boxes aren't used 
  67     wxInitAllImageHandlers(); 
  68     wxFileSystem::AddHandler(new wxZipFSHandler
); 
  70     SetVendorName(wxT("wxWidgets")); 
  71     SetAppName(wxT("wxHTMLHelp")); 
  72     wxConfig::Get(); // create an instance 
  74     help 
= new wxHtmlHelpController
; 
  77         wxLogError(wxT("Usage : helpview <helpfile> [<more helpfiles>]")); 
  78         wxLogError(wxT("  helpfile may be .hhp, .zip or .htb")); 
  82     for (int i 
= 1; i 
< argc
; i
++) 
  83         help
->AddBook(wxFileName(argv
[i
])); 
  86     delete wxLog::SetActiveTarget(new wxLogGui
); 
  89     help 
-> DisplayContents(); 
  97     delete wxConfig::Set(NULL
);