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