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