]>
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 #if !USE_SHARED_LIBRARY
32 IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController
, wxHelpControllerBase
)
35 wxWinHelpController::wxWinHelpController()
40 wxWinHelpController::~wxWinHelpController()
44 bool wxWinHelpController::Initialize(const wxString
& filename
)
46 m_helpFile
= filename
;
47 // TODO any other inits
51 bool wxWinHelpController::LoadFile(const wxString
& file
)
58 bool wxWinHelpController::DisplayContents()
60 if (m_helpFile
== wxT("")) return FALSE
;
62 wxString str
= m_helpFile
;
63 size_t len
= str
.Length();
64 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('.')))
67 if (wxTheApp
->GetTopWindow())
69 // TODO : display the help
75 bool wxWinHelpController::DisplaySection(int section
)
78 if (m_helpFile
== wxT("")) return FALSE
;
80 wxString str
= m_helpFile
;
81 size_t len
= str
.Length();
82 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('.')))
85 if (wxTheApp
->GetTopWindow())
88 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section);
94 bool wxWinHelpController::DisplayBlock(long block
)
96 // Use context number -- a very rough equivalent to block id!
97 if (m_helpFile
== wxT("")) return FALSE
;
99 wxString str
= m_helpFile
;
100 size_t len
= str
.Length();
101 if (!(str
[(size_t)(len
-1)] == 'p' && str
[(size_t)(len
-2)] == 'l' && str
[(size_t)(len
-3)] == 'h' && str
[(size_t)(len
-4)] == '.'))
104 if (wxTheApp
->GetTopWindow())
107 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block);
113 bool wxWinHelpController::KeywordSearch(const wxString
& k
)
115 if (m_helpFile
== "") return FALSE
;
117 wxString str
= m_helpFile
;
118 size_t len
= str
.Length();
119 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('.')))
122 if (wxTheApp
->GetTopWindow())
125 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k);
131 // Can't close the help window explicitly in WinHelp
132 bool wxWinHelpController::Quit()
134 if (wxTheApp
->GetTopWindow())
137 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L);
144 void wxWinHelpController::OnQuit()