]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/helpwin.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/helpwin.cpp
3 // Purpose: Help system: native implementation
4 // Author: David Webster
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
19 #include "wx/os2/helpwin.h"
23 #include "wx/os2/private.h"
28 #define _MAXPATHLEN 500
30 // MAX length of Help descriptor
31 #define _MAX_HELP_LEN 500
33 IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController
, wxHelpControllerBase
)
35 wxWinHelpController::wxWinHelpController()
37 m_helpFile
= wxEmptyString
;
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
.empty())
63 wxString str
= m_helpFile
;
64 size_t len
= str
.length();
65 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('.')))
68 if (wxTheApp
->GetTopWindow())
70 // TODO : display the help
76 bool wxWinHelpController::DisplaySection(int WXUNUSED(section
))
79 if (m_helpFile
.empty())
82 wxString str
= m_helpFile
;
83 size_t len
= str
.length();
84 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('.')))
87 if (wxTheApp
->GetTopWindow())
90 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section);
97 bool wxWinHelpController::DisplayBlock(long WXUNUSED(block
))
99 // Use context number -- a very rough equivalent to block id!
100 if (m_helpFile
.empty())
103 wxString str
= m_helpFile
;
104 size_t len
= str
.length();
105 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('.')))
108 if (wxTheApp
->GetTopWindow())
111 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block);
117 bool wxWinHelpController::KeywordSearch(const wxString
& WXUNUSED(k
),
118 wxHelpSearchMode
WXUNUSED(mode
))
120 if (m_helpFile
== wxEmptyString
) return false;
122 wxString str
= m_helpFile
;
123 size_t len
= str
.length();
124 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('.')))
127 if (wxTheApp
->GetTopWindow())
130 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k);
136 // Can't close the help window explicitly in WinHelp
137 bool wxWinHelpController::Quit()
139 if (wxTheApp
->GetTopWindow())
142 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L);
149 void wxWinHelpController::OnQuit()