]> git.saurik.com Git - wxWidgets.git/blob - src/os2/helpwin.cpp
wxGTK1 : wx/private/eventloopsourcesmanager.h was missing in evtloop.cpp
[wxWidgets.git] / src / os2 / helpwin.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/helpwin.cpp
3 // Purpose: Help system: native implementation
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/09/99
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #if wxUSE_HELP
15
16 #ifndef WX_PRECOMP
17 #endif
18
19 #include "wx/os2/helpwin.h"
20
21 #include <time.h>
22
23 #include "wx/os2/private.h"
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
33 IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase)
34
35 wxWinHelpController::wxWinHelpController()
36 {
37 m_helpFile = wxEmptyString;
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
48 return true;
49 }
50
51 bool wxWinHelpController::LoadFile(const wxString& file)
52 {
53 m_helpFile = file;
54 // TODO
55 return true;
56 }
57
58 bool wxWinHelpController::DisplayContents()
59 {
60 if (m_helpFile.empty())
61 return false;
62
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('.')))
66 str += wxT(".hlp");
67
68 if (wxTheApp->GetTopWindow())
69 {
70 // TODO : display the help
71 return true;
72 }
73 return false;
74 }
75
76 bool wxWinHelpController::DisplaySection(int WXUNUSED(section))
77 {
78 // Use context number
79 if (m_helpFile.empty())
80 return false;
81
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('.')))
85 str += wxT(".hlp");
86
87 if (wxTheApp->GetTopWindow())
88 {
89 // TODO ::
90 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section);
91 return true;
92 }
93
94 return false;
95 }
96
97 bool wxWinHelpController::DisplayBlock(long WXUNUSED(block))
98 {
99 // Use context number -- a very rough equivalent to block id!
100 if (m_helpFile.empty())
101 return false;
102
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('.')))
106 str += wxT(".hlp");
107
108 if (wxTheApp->GetTopWindow())
109 {
110 // TODO:
111 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block);
112 return true;
113 }
114 return false;
115 }
116
117 bool wxWinHelpController::KeywordSearch(const wxString& WXUNUSED(k),
118 wxHelpSearchMode WXUNUSED(mode))
119 {
120 if (m_helpFile == wxEmptyString) return false;
121
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('.')))
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);
131 return true;
132 }
133 return false;
134 }
135
136 // Can't close the help window explicitly in WinHelp
137 bool wxWinHelpController::Quit()
138 {
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;
147 }
148
149 void wxWinHelpController::OnQuit()
150 {
151 }
152
153 #endif // wxUSE_HELP