]> git.saurik.com Git - wxWidgets.git/blame - src/os2/helpwin.cpp
Generate key events in generic wxDataViewCtrl implementation.
[wxWidgets.git] / src / os2 / helpwin.cpp
CommitLineData
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
7// RCS-ID: $Id$
8// Copyright: (c) David Webster
65571936 9// Licence: wxWindows licence
fb9010ed
DW
10/////////////////////////////////////////////////////////////////////////////
11
6670f564
WS
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
7520f3da
WS
15#if wxUSE_HELP
16
fb9010ed 17#ifndef WX_PRECOMP
fb9010ed
DW
18#endif
19
20#include "wx/os2/helpwin.h"
21
fb9010ed
DW
22#include <time.h>
23
7ec69821 24#include "wx/os2/private.h"
fb9010ed
DW
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
fb9010ed 34IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase)
fb9010ed
DW
35
36wxWinHelpController::wxWinHelpController()
37{
0fba44b4 38 m_helpFile = wxEmptyString;
fb9010ed
DW
39}
40
41wxWinHelpController::~wxWinHelpController()
42{
43}
44
45bool wxWinHelpController::Initialize(const wxString& filename)
46{
47 m_helpFile = filename;
48 // TODO any other inits
6670f564 49 return true;
fb9010ed
DW
50}
51
52bool wxWinHelpController::LoadFile(const wxString& file)
53{
54 m_helpFile = file;
55 // TODO
6670f564 56 return true;
fb9010ed
DW
57}
58
59bool wxWinHelpController::DisplayContents()
60{
7ec69821 61 if (m_helpFile.empty())
6670f564 62 return false;
fb9010ed
DW
63
64 wxString str = m_helpFile;
7ec69821 65 size_t len = str.length();
fb9010ed 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('.')))
6670f564 67 str += wxT(".hlp");
fb9010ed
DW
68
69 if (wxTheApp->GetTopWindow())
70 {
6670f564
WS
71 // TODO : display the help
72 return true;
fb9010ed 73 }
7ec69821 74 return false;
fb9010ed
DW
75}
76
6670f564 77bool wxWinHelpController::DisplaySection(int WXUNUSED(section))
fb9010ed
DW
78{
79 // Use context number
7ec69821 80 if (m_helpFile.empty())
6670f564 81 return false;
fb9010ed
DW
82
83 wxString str = m_helpFile;
7ec69821 84 size_t len = str.length();
fb9010ed
DW
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())
6670f564
WS
89 {
90 // TODO ::
91 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section);
92 return true;
93 }
94
95 return false;
fb9010ed
DW
96}
97
6670f564 98bool wxWinHelpController::DisplayBlock(long WXUNUSED(block))
fb9010ed
DW
99{
100 // Use context number -- a very rough equivalent to block id!
7ec69821 101 if (m_helpFile.empty())
6670f564 102 return false;
fb9010ed
DW
103
104 wxString str = m_helpFile;
7ec69821 105 size_t len = str.length();
0fba44b4 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('.')))
fb9010ed
DW
107 str += wxT(".hlp");
108
109 if (wxTheApp->GetTopWindow())
6670f564
WS
110 {
111 // TODO:
112 // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block);
113 return true;
114 }
115 return false;
fb9010ed
DW
116}
117
6670f564 118bool wxWinHelpController::KeywordSearch(const wxString& WXUNUSED(k),
69b5cec2 119 wxHelpSearchMode WXUNUSED(mode))
fb9010ed 120{
7ec69821 121 if (m_helpFile == wxEmptyString) return false;
fb9010ed
DW
122
123 wxString str = m_helpFile;
7ec69821 124 size_t len = str.length();
fb9010ed
DW
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);
6670f564 132 return true;
fb9010ed 133 }
7ec69821 134 return false;
fb9010ed
DW
135}
136
137// Can't close the help window explicitly in WinHelp
138bool wxWinHelpController::Quit()
139{
6670f564
WS
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;
fb9010ed
DW
148}
149
150void wxWinHelpController::OnQuit()
151{
152}
7520f3da 153
fb9010ed 154#endif // wxUSE_HELP