]>
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
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
20 #include "wx/os2/helpwin.h"
24 #include "wx/os2/private.h"
29 #define _MAXPATHLEN 500
31 // MAX length of Help descriptor
32 #define _MAX_HELP_LEN 500
34 IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController
, wxHelpControllerBase
)
36 wxWinHelpController::wxWinHelpController()
38 m_helpFile
= wxEmptyString
;
41 wxWinHelpController::~wxWinHelpController()
45 bool wxWinHelpController::Initialize(const wxString
& filename
)
47 m_helpFile
= filename
;
48 // TODO any other inits
52 bool wxWinHelpController::LoadFile(const wxString
& file
)
59 bool wxWinHelpController::DisplayContents()
61 if (m_helpFile
.empty())
64 wxString str
= m_helpFile
;
65 size_t len
= str
.length();
66 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('.')))
69 if (wxTheApp
->GetTopWindow())
71 // TODO : display the help
77 bool wxWinHelpController::DisplaySection(int WXUNUSED(section
))
80 if (m_helpFile
.empty())
83 wxString str
= m_helpFile
;
84 size_t len
= str
.length();
85 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('.')))
88 if (wxTheApp
->GetTopWindow())
91 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section);
98 bool wxWinHelpController::DisplayBlock(long WXUNUSED(block
))
100 // Use context number -- a very rough equivalent to block id!
101 if (m_helpFile
.empty())
104 wxString str
= m_helpFile
;
105 size_t len
= str
.length();
106 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('.')))
109 if (wxTheApp
->GetTopWindow())
112 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block);
118 bool wxWinHelpController::KeywordSearch(const wxString
& WXUNUSED(k
),
119 wxHelpSearchMode
WXUNUSED(mode
))
121 if (m_helpFile
== wxEmptyString
) return false;
123 wxString str
= m_helpFile
;
124 size_t len
= str
.length();
125 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('.')))
128 if (wxTheApp
->GetTopWindow())
131 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k);
137 // Can't close the help window explicitly in WinHelp
138 bool wxWinHelpController::Quit()
140 if (wxTheApp
->GetTopWindow())
143 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L);
150 void wxWinHelpController::OnQuit()