]> git.saurik.com Git - wxWidgets.git/blob - src/os2/helpwin.cpp
VTK wrapper of vtkRenderWindow for wxPython. Tested on MSW so far.
[wxWidgets.git] / src / os2 / helpwin.cpp
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef WX_PRECOMP
13 #include "wx/defs.h"
14 #endif
15
16 #include "wx/os2/helpwin.h"
17
18 #if wxUSE_HELP
19 #include <time.h>
20
21 #include <wx/os2/private.h>
22
23 #include <string.h>
24
25 // MAX path length
26 #define _MAXPATHLEN 500
27
28 // MAX length of Help descriptor
29 #define _MAX_HELP_LEN 500
30
31 #if !USE_SHARED_LIBRARY
32 IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase)
33 #endif
34
35 wxWinHelpController::wxWinHelpController()
36 {
37 m_helpFile = "";
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 == wxT("")) return FALSE;
61
62 wxString str = m_helpFile;
63 size_t len = str.Length();
64 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('.')))
65 str += wxT(".hlp");
66
67 if (wxTheApp->GetTopWindow())
68 {
69 // TODO : display the help
70 return TRUE;
71 }
72 return FALSE;
73 }
74
75 bool wxWinHelpController::DisplaySection(int section)
76 {
77 // Use context number
78 if (m_helpFile == wxT("")) return FALSE;
79
80 wxString str = m_helpFile;
81 size_t len = str.Length();
82 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('.')))
83 str += wxT(".hlp");
84
85 if (wxTheApp->GetTopWindow())
86 {
87 // TODO ::
88 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section);
89 return TRUE;
90 }
91 return FALSE;
92 }
93
94 bool wxWinHelpController::DisplayBlock(long block)
95 {
96 // Use context number -- a very rough equivalent to block id!
97 if (m_helpFile == wxT("")) return FALSE;
98
99 wxString str = m_helpFile;
100 size_t len = str.Length();
101 if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.'))
102 str += wxT(".hlp");
103
104 if (wxTheApp->GetTopWindow())
105 {
106 // TODO:
107 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block);
108 return TRUE;
109 }
110 return FALSE;
111 }
112
113 bool wxWinHelpController::KeywordSearch(const wxString& k)
114 {
115 if (m_helpFile == "") return FALSE;
116
117 wxString str = m_helpFile;
118 size_t len = str.Length();
119 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('.')))
120 str += wxT(".hlp");
121
122 if (wxTheApp->GetTopWindow())
123 {
124 // TODO:
125 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k);
126 return TRUE;
127 }
128 return FALSE;
129 }
130
131 // Can't close the help window explicitly in WinHelp
132 bool wxWinHelpController::Quit()
133 {
134 if (wxTheApp->GetTopWindow())
135 {
136 // TODO:
137 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L);
138 return TRUE;
139 }
140 else
141 return FALSE;
142 }
143
144 void wxWinHelpController::OnQuit()
145 {
146 }
147 #endif // wxUSE_HELP
148