]>
Commit | Line | Data |
---|---|---|
fb9010ed DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: helpwin.cpp | |
3 | // Purpose: Help system: native implementation | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/09/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
65571936 | 9 | // Licence: wxWindows licence |
fb9010ed DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
6670f564 WS |
12 | // For compilers that support precompilation, includes "wx.h". |
13 | #include "wx/wxprec.h" | |
14 | ||
fb9010ed DW |
15 | #ifndef WX_PRECOMP |
16 | #include "wx/defs.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/os2/helpwin.h" | |
20 | ||
21 | #if wxUSE_HELP | |
22 | #include <time.h> | |
23 | ||
24 | #include <wx/os2/private.h> | |
25 | ||
26 | #include <string.h> | |
27 | ||
28 | // MAX path length | |
29 | #define _MAXPATHLEN 500 | |
30 | ||
31 | // MAX length of Help descriptor | |
32 | #define _MAX_HELP_LEN 500 | |
33 | ||
fb9010ed | 34 | IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase) |
fb9010ed DW |
35 | |
36 | wxWinHelpController::wxWinHelpController() | |
37 | { | |
0fba44b4 | 38 | m_helpFile = wxEmptyString; |
fb9010ed DW |
39 | } |
40 | ||
41 | wxWinHelpController::~wxWinHelpController() | |
42 | { | |
43 | } | |
44 | ||
45 | bool wxWinHelpController::Initialize(const wxString& filename) | |
46 | { | |
47 | m_helpFile = filename; | |
48 | // TODO any other inits | |
6670f564 | 49 | return true; |
fb9010ed DW |
50 | } |
51 | ||
52 | bool wxWinHelpController::LoadFile(const wxString& file) | |
53 | { | |
54 | m_helpFile = file; | |
55 | // TODO | |
6670f564 | 56 | return true; |
fb9010ed DW |
57 | } |
58 | ||
59 | bool wxWinHelpController::DisplayContents() | |
60 | { | |
6670f564 WS |
61 | if (m_helpFile == wxT("")) |
62 | return false; | |
fb9010ed DW |
63 | |
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('.'))) | |
6670f564 | 67 | str += wxT(".hlp"); |
fb9010ed DW |
68 | |
69 | if (wxTheApp->GetTopWindow()) | |
70 | { | |
6670f564 WS |
71 | // TODO : display the help |
72 | return true; | |
fb9010ed | 73 | } |
6670f564 | 74 | return FALSE; |
fb9010ed DW |
75 | } |
76 | ||
6670f564 | 77 | bool wxWinHelpController::DisplaySection(int WXUNUSED(section)) |
fb9010ed DW |
78 | { |
79 | // Use context number | |
6670f564 WS |
80 | if (m_helpFile == wxT("")) |
81 | return false; | |
fb9010ed DW |
82 | |
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('.'))) | |
86 | str += wxT(".hlp"); | |
87 | ||
88 | if (wxTheApp->GetTopWindow()) | |
6670f564 WS |
89 | { |
90 | // TODO :: | |
91 | // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section); | |
92 | return true; | |
93 | } | |
94 | ||
95 | return false; | |
fb9010ed DW |
96 | } |
97 | ||
6670f564 | 98 | bool wxWinHelpController::DisplayBlock(long WXUNUSED(block)) |
fb9010ed DW |
99 | { |
100 | // Use context number -- a very rough equivalent to block id! | |
6670f564 WS |
101 | if (m_helpFile == wxT("")) |
102 | return false; | |
fb9010ed DW |
103 | |
104 | wxString str = m_helpFile; | |
105 | size_t len = str.Length(); | |
0fba44b4 | 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('.'))) |
fb9010ed DW |
107 | str += wxT(".hlp"); |
108 | ||
109 | if (wxTheApp->GetTopWindow()) | |
6670f564 WS |
110 | { |
111 | // TODO: | |
112 | // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block); | |
113 | return true; | |
114 | } | |
115 | return false; | |
fb9010ed DW |
116 | } |
117 | ||
6670f564 | 118 | bool wxWinHelpController::KeywordSearch(const wxString& WXUNUSED(k), |
69b5cec2 | 119 | wxHelpSearchMode WXUNUSED(mode)) |
fb9010ed | 120 | { |
0fba44b4 | 121 | if (m_helpFile == wxEmptyString) return FALSE; |
fb9010ed DW |
122 | |
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('.'))) | |
126 | str += wxT(".hlp"); | |
127 | ||
128 | if (wxTheApp->GetTopWindow()) | |
129 | { | |
130 | // TODO: | |
131 | // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k); | |
6670f564 | 132 | return true; |
fb9010ed DW |
133 | } |
134 | return FALSE; | |
135 | } | |
136 | ||
137 | // Can't close the help window explicitly in WinHelp | |
138 | bool wxWinHelpController::Quit() | |
139 | { | |
6670f564 WS |
140 | if (wxTheApp->GetTopWindow()) |
141 | { | |
142 | // TODO: | |
143 | // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L); | |
144 | return true; | |
145 | } | |
146 | ||
147 | return false; | |
fb9010ed DW |
148 | } |
149 | ||
150 | void wxWinHelpController::OnQuit() | |
151 | { | |
152 | } | |
153 | #endif // wxUSE_HELP |