]> git.saurik.com Git - wxWidgets.git/blob - src/msw/wince/helpwce.cpp
multilib mode compilation fix
[wxWidgets.git] / src / msw / wince / helpwce.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: helpwce.h
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "helpwce.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #if wxUSE_HELP
24
25 #include "wx/filefn.h"
26 #include "wx/msw/wince/helpwce.h"
27
28 #ifndef WX_PRECOMP
29 #include "wx/intl.h"
30 #endif
31
32 #include "wx/msw/private.h"
33 #include "wx/msw/missing.h"
34
35 IMPLEMENT_DYNAMIC_CLASS(wxWinceHelpController, wxHelpControllerBase)
36
37 bool wxWinceHelpController::Initialize(const wxString& filename)
38 {
39 m_helpFile = filename;
40 return TRUE;
41 }
42
43 bool wxWinceHelpController::LoadFile(const wxString& file)
44 {
45 if (!file.IsEmpty())
46 m_helpFile = file;
47 return TRUE;
48 }
49
50 bool wxWinceHelpController::DisplayContents()
51 {
52 return ViewURL();
53 }
54
55 // Use topic
56 bool wxWinceHelpController::DisplaySection(const wxString& section)
57 {
58 return ViewURL(section);
59 }
60
61 // Use context number
62 bool wxWinceHelpController::DisplaySection(int section)
63 {
64 return TRUE;
65 }
66
67 bool wxWinceHelpController::DisplayContextPopup(int contextId)
68 {
69 return TRUE;
70 }
71
72 bool wxWinceHelpController::DisplayTextPopup(const wxString& text, const wxPoint& pos)
73 {
74 return TRUE;
75 }
76
77 bool wxWinceHelpController::DisplayBlock(long block)
78 {
79 return TRUE;
80 }
81
82 bool wxWinceHelpController::KeywordSearch(const wxString& k)
83 {
84 return TRUE;
85 }
86
87 bool wxWinceHelpController::Quit()
88 {
89 return TRUE;
90 }
91
92 // Append extension if necessary.
93 wxString wxWinceHelpController::GetValidFilename(const wxString& file) const
94 {
95 wxString path, name, ext;
96 wxSplitPath(file, & path, & name, & ext);
97
98 wxString fullName;
99 if (path.IsEmpty())
100 fullName = name + wxT(".htm");
101 else if (path.Last() == wxT('\\'))
102 fullName = path + name + wxT(".htm");
103 else
104 fullName = path + wxT("\\") + name + wxT(".htm");
105 return fullName;
106 }
107
108 // View URL
109 bool wxWinceHelpController::ViewURL(const wxString& topic)
110 {
111 if (m_helpFile.IsEmpty()) return FALSE;
112
113 wxString url( wxT("file:") + GetValidFilename(m_helpFile) );
114 if (!topic.IsEmpty())
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
123