]> git.saurik.com Git - wxWidgets.git/blob - src/os2/helpwin.cpp
MSW Caret is now destroyed and recreated when resized.
[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 IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase)
32
33 wxWinHelpController::wxWinHelpController()
34 {
35 m_helpFile = "";
36 }
37
38 wxWinHelpController::~wxWinHelpController()
39 {
40 }
41
42 bool wxWinHelpController::Initialize(const wxString& filename)
43 {
44 m_helpFile = filename;
45 // TODO any other inits
46 return TRUE;
47 }
48
49 bool wxWinHelpController::LoadFile(const wxString& file)
50 {
51 m_helpFile = file;
52 // TODO
53 return TRUE;
54 }
55
56 bool wxWinHelpController::DisplayContents()
57 {
58 if (m_helpFile == wxT("")) return FALSE;
59
60 wxString str = m_helpFile;
61 size_t len = str.Length();
62 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('.')))
63 str += wxT(".hlp");
64
65 if (wxTheApp->GetTopWindow())
66 {
67 // TODO : display the help
68 return TRUE;
69 }
70 return FALSE;
71 }
72
73 bool wxWinHelpController::DisplaySection(int section)
74 {
75 // Use context number
76 if (m_helpFile == wxT("")) return FALSE;
77
78 wxString str = m_helpFile;
79 size_t len = str.Length();
80 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('.')))
81 str += wxT(".hlp");
82
83 if (wxTheApp->GetTopWindow())
84 {
85 // TODO ::
86 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section);
87 return TRUE;
88 }
89 return FALSE;
90 }
91
92 bool wxWinHelpController::DisplayBlock(long block)
93 {
94 // Use context number -- a very rough equivalent to block id!
95 if (m_helpFile == wxT("")) return FALSE;
96
97 wxString str = m_helpFile;
98 size_t len = str.Length();
99 if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.'))
100 str += wxT(".hlp");
101
102 if (wxTheApp->GetTopWindow())
103 {
104 // TODO:
105 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block);
106 return TRUE;
107 }
108 return FALSE;
109 }
110
111 bool wxWinHelpController::KeywordSearch(const wxString& k)
112 {
113 if (m_helpFile == "") return FALSE;
114
115 wxString str = m_helpFile;
116 size_t len = str.Length();
117 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('.')))
118 str += wxT(".hlp");
119
120 if (wxTheApp->GetTopWindow())
121 {
122 // TODO:
123 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k);
124 return TRUE;
125 }
126 return FALSE;
127 }
128
129 // Can't close the help window explicitly in WinHelp
130 bool wxWinHelpController::Quit()
131 {
132 if (wxTheApp->GetTopWindow())
133 {
134 // TODO:
135 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L);
136 return TRUE;
137 }
138 else
139 return FALSE;
140 }
141
142 void wxWinHelpController::OnQuit()
143 {
144 }
145 #endif // wxUSE_HELP
146