]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/wince/helpwce.cpp
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     Help system: Windows CE help implementation 
   4 // Author:      Julian Smart 
   8 // Copyright:   (c) Julian Smart 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 // For compilers that support precompilation, includes "wx.h". 
  13 #include "wx/wxprec.h" 
  21 #include "wx/filefn.h" 
  22 #include "wx/msw/wince/helpwce.h" 
  28 #include "wx/msw/private.h" 
  29 #include "wx/msw/missing.h" 
  31 IMPLEMENT_DYNAMIC_CLASS(wxWinceHelpController
, wxHelpControllerBase
) 
  33 bool wxWinceHelpController::Initialize(const wxString
& filename
) 
  35     m_helpFile 
= filename
; 
  39 bool wxWinceHelpController::LoadFile(const wxString
& file
) 
  46 bool wxWinceHelpController::DisplayContents() 
  52 bool wxWinceHelpController::DisplaySection(const wxString
& section
) 
  54     return ViewURL(section
); 
  58 bool wxWinceHelpController::DisplaySection(int WXUNUSED(section
)) 
  63 bool wxWinceHelpController::DisplayContextPopup(int WXUNUSED(contextId
)) 
  68 bool wxWinceHelpController::DisplayTextPopup(const wxString
& WXUNUSED(text
), const wxPoint
& WXUNUSED(pos
)) 
  73 bool wxWinceHelpController::DisplayBlock(long WXUNUSED(block
)) 
  78 bool wxWinceHelpController::KeywordSearch(const wxString
& WXUNUSED(k
), 
  79                                wxHelpSearchMode 
WXUNUSED(mode
)) 
  84 bool wxWinceHelpController::Quit() 
  89 // Append extension if necessary. 
  90 wxString 
wxWinceHelpController::GetValidFilename(const wxString
& file
) const 
  92     wxString path
, name
, ext
; 
  93     wxSplitPath(file
, & path
, & name
, & ext
); 
  97         fullName 
= name 
+ wxT(".htm"); 
  98     else if (path
.Last() == wxT('\\')) 
  99         fullName 
= path 
+ name 
+ wxT(".htm"); 
 101         fullName 
= path 
+ wxT("\\") + name 
+ wxT(".htm"); 
 103     if (!wxFileExists(fullName
)) 
 104         fullName 
= wxT("\\Windows\\") + name 
+ wxT(".htm"); 
 110 bool wxWinceHelpController::ViewURL(const wxString
& topic
) 
 112     if (m_helpFile
.IsEmpty()) return false; 
 114     wxString 
url( wxT("file:") + GetValidFilename(m_helpFile
) ); 
 115     if (!topic
.IsEmpty()) 
 116         url 
= url 
+ wxT("#") + topic
; 
 118     return CreateProcess(wxT("peghelp.exe"), 
 119         url
, NULL
, NULL
, FALSE
, 0, NULL
, 
 120         NULL
, NULL
, NULL
) != 0 ;