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