]>
Commit | Line | Data |
---|---|---|
7a026580 | 1 | ///////////////////////////////////////////////////////////////////////////// |
57bd4c60 | 2 | // Name: src/msw/wince/helpwce.cpp |
7a026580 JS |
3 | // Purpose: Help system: Windows CE help implementation |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 2003-07-12 | |
7a026580 | 7 | // Copyright: (c) Julian Smart |
39fc096d | 8 | // Licence: wxWindows licence |
7a026580 JS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
7a026580 JS |
11 | // For compilers that support precompilation, includes "wx.h". |
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #ifdef __BORLANDC__ | |
15 | #pragma hdrstop | |
16 | #endif | |
17 | ||
18 | #if wxUSE_HELP | |
19 | ||
20 | #include "wx/filefn.h" | |
21 | #include "wx/msw/wince/helpwce.h" | |
22 | ||
23 | #ifndef WX_PRECOMP | |
57bd4c60 | 24 | #include "wx/msw/missing.h" |
7a026580 JS |
25 | #include "wx/intl.h" |
26 | #endif | |
27 | ||
28 | #include "wx/msw/private.h" | |
7a026580 JS |
29 | |
30 | IMPLEMENT_DYNAMIC_CLASS(wxWinceHelpController, wxHelpControllerBase) | |
31 | ||
32 | bool wxWinceHelpController::Initialize(const wxString& filename) | |
33 | { | |
34 | m_helpFile = filename; | |
665b71b1 | 35 | return true; |
7a026580 JS |
36 | } |
37 | ||
38 | bool wxWinceHelpController::LoadFile(const wxString& file) | |
39 | { | |
57bd4c60 | 40 | if (!file.empty()) |
7a026580 | 41 | m_helpFile = file; |
665b71b1 | 42 | return true; |
7a026580 JS |
43 | } |
44 | ||
45 | bool wxWinceHelpController::DisplayContents() | |
46 | { | |
47 | return ViewURL(); | |
48 | } | |
49 | ||
50 | // Use topic | |
51 | bool wxWinceHelpController::DisplaySection(const wxString& section) | |
52 | { | |
53 | return ViewURL(section); | |
54 | } | |
55 | ||
56 | // Use context number | |
665b71b1 | 57 | bool wxWinceHelpController::DisplaySection(int WXUNUSED(section)) |
7a026580 | 58 | { |
665b71b1 | 59 | return true; |
7a026580 JS |
60 | } |
61 | ||
665b71b1 | 62 | bool wxWinceHelpController::DisplayContextPopup(int WXUNUSED(contextId)) |
7a026580 | 63 | { |
665b71b1 | 64 | return true; |
7a026580 JS |
65 | } |
66 | ||
665b71b1 | 67 | bool wxWinceHelpController::DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) |
7a026580 | 68 | { |
665b71b1 | 69 | return true; |
7a026580 JS |
70 | } |
71 | ||
665b71b1 | 72 | bool wxWinceHelpController::DisplayBlock(long WXUNUSED(block)) |
7a026580 | 73 | { |
665b71b1 | 74 | return true; |
7a026580 JS |
75 | } |
76 | ||
665b71b1 WS |
77 | bool wxWinceHelpController::KeywordSearch(const wxString& WXUNUSED(k), |
78 | wxHelpSearchMode WXUNUSED(mode)) | |
7a026580 | 79 | { |
665b71b1 | 80 | return true; |
7a026580 JS |
81 | } |
82 | ||
83 | bool wxWinceHelpController::Quit() | |
84 | { | |
39fc096d | 85 | return true; |
7a026580 JS |
86 | } |
87 | ||
88 | // Append extension if necessary. | |
89 | wxString wxWinceHelpController::GetValidFilename(const wxString& file) const | |
90 | { | |
91 | wxString path, name, ext; | |
bd365871 | 92 | wxFileName::SplitPath(file, & path, & name, & ext); |
7a026580 JS |
93 | |
94 | wxString fullName; | |
57bd4c60 | 95 | if (path.empty()) |
7a026580 JS |
96 | fullName = name + wxT(".htm"); |
97 | else if (path.Last() == wxT('\\')) | |
98 | fullName = path + name + wxT(".htm"); | |
99 | else | |
100 | fullName = path + wxT("\\") + name + wxT(".htm"); | |
45dbd833 JS |
101 | |
102 | if (!wxFileExists(fullName)) | |
103 | fullName = wxT("\\Windows\\") + name + wxT(".htm"); | |
104 | ||
7a026580 JS |
105 | return fullName; |
106 | } | |
107 | ||
108 | // View URL | |
109 | bool wxWinceHelpController::ViewURL(const wxString& topic) | |
110 | { | |
57bd4c60 | 111 | if (m_helpFile.empty()) return false; |
39fc096d | 112 | |
7a026580 | 113 | wxString url( wxT("file:") + GetValidFilename(m_helpFile) ); |
57bd4c60 | 114 | if (!topic.empty()) |
7a026580 JS |
115 | url = url + wxT("#") + topic; |
116 | ||
117 | return CreateProcess(wxT("peghelp.exe"), | |
118 | url, NULL, NULL, FALSE, 0, NULL, | |
119 | NULL, NULL, NULL) != 0 ; | |
120 | } | |
121 | ||
122 | #endif // wxUSE_HELP |