]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/helpwin.cpp
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     Help system: native implementation 
   4 // Author:      David Webster 
   8 // Copyright:   (c) David Webster 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  16 #include "wx/os2/helpwin.h" 
  21 #include <wx/os2/private.h> 
  26 #define _MAXPATHLEN 500 
  28 // MAX length of Help descriptor 
  29 #define _MAX_HELP_LEN 500 
  31 IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController
, wxHelpControllerBase
) 
  33 wxWinHelpController::wxWinHelpController() 
  38 wxWinHelpController::~wxWinHelpController() 
  42 bool wxWinHelpController::Initialize(const wxString
& filename
) 
  44     m_helpFile 
= filename
; 
  45     // TODO any other inits 
  49 bool wxWinHelpController::LoadFile(const wxString
& file
) 
  56 bool wxWinHelpController::DisplayContents() 
  58     if (m_helpFile 
== wxT("")) return FALSE
; 
  60     wxString str 
= m_helpFile
; 
  61     size_t len 
= str
.Length(); 
  62     if (!(str
[(size_t)(len
-1)] == wxT('p') && str
[(size_t)(len
-2)] == wxT('l') && str
[(size_t)(len
-3)] == wxT('h') && str
[(size_t)(len
-4)] == wxT('.'))) 
  65     if (wxTheApp
->GetTopWindow()) 
  67     // TODO : display the help 
  73 bool wxWinHelpController::DisplaySection(int section
) 
  76     if (m_helpFile 
== wxT("")) return FALSE
; 
  78     wxString str 
= m_helpFile
; 
  79     size_t len 
= str
.Length(); 
  80     if (!(str
[(size_t)(len
-1)] == wxT('p') && str
[(size_t)(len
-2)] == wxT('l') && str
[(size_t)(len
-3)] == wxT('h') && str
[(size_t)(len
-4)] == wxT('.'))) 
  83     if (wxTheApp
->GetTopWindow()) 
  86     //  WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section); 
  92 bool wxWinHelpController::DisplayBlock(long block
) 
  94     // Use context number -- a very rough equivalent to block id! 
  95     if (m_helpFile 
== wxT("")) return FALSE
; 
  97     wxString str 
= m_helpFile
; 
  98     size_t len 
= str
.Length(); 
  99     if (!(str
[(size_t)(len
-1)] == 'p' && str
[(size_t)(len
-2)] == 'l' && str
[(size_t)(len
-3)] == 'h' && str
[(size_t)(len
-4)] == '.')) 
 102     if (wxTheApp
->GetTopWindow()) 
 105     //  WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block); 
 111 bool wxWinHelpController::KeywordSearch(const wxString
& k
) 
 113     if (m_helpFile 
== "") return FALSE
; 
 115     wxString str 
= m_helpFile
; 
 116     size_t len 
= str
.Length(); 
 117     if (!(str
[(size_t)(len
-1)] == wxT('p') && str
[(size_t)(len
-2)] == wxT('l') && str
[(size_t)(len
-3)] == wxT('h') && str
[(size_t)(len
-4)] == wxT('.'))) 
 120     if (wxTheApp
->GetTopWindow()) 
 123       // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k); 
 129 // Can't close the help window explicitly in WinHelp 
 130 bool wxWinHelpController::Quit() 
 132   if (wxTheApp
->GetTopWindow()) 
 135     // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L); 
 142 void wxWinHelpController::OnQuit()