]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/msw/wince/helpwce.cpp
Add some version checks to help compiling on OSX.
[wxWidgets.git] / src / msw / wince / helpwce.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/msw/wince/helpwce.cpp
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// 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
25 #include "wx/msw/missing.h"
26 #include "wx/intl.h"
27#endif
28
29#include "wx/msw/private.h"
30
31IMPLEMENT_DYNAMIC_CLASS(wxWinceHelpController, wxHelpControllerBase)
32
33bool wxWinceHelpController::Initialize(const wxString& filename)
34{
35 m_helpFile = filename;
36 return true;
37}
38
39bool wxWinceHelpController::LoadFile(const wxString& file)
40{
41 if (!file.empty())
42 m_helpFile = file;
43 return true;
44}
45
46bool wxWinceHelpController::DisplayContents()
47{
48 return ViewURL();
49}
50
51// Use topic
52bool wxWinceHelpController::DisplaySection(const wxString& section)
53{
54 return ViewURL(section);
55}
56
57// Use context number
58bool wxWinceHelpController::DisplaySection(int WXUNUSED(section))
59{
60 return true;
61}
62
63bool wxWinceHelpController::DisplayContextPopup(int WXUNUSED(contextId))
64{
65 return true;
66}
67
68bool wxWinceHelpController::DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos))
69{
70 return true;
71}
72
73bool wxWinceHelpController::DisplayBlock(long WXUNUSED(block))
74{
75 return true;
76}
77
78bool wxWinceHelpController::KeywordSearch(const wxString& WXUNUSED(k),
79 wxHelpSearchMode WXUNUSED(mode))
80{
81 return true;
82}
83
84bool wxWinceHelpController::Quit()
85{
86 return true;
87}
88
89// Append extension if necessary.
90wxString wxWinceHelpController::GetValidFilename(const wxString& file) const
91{
92 wxString path, name, ext;
93 wxFileName::SplitPath(file, & path, & name, & ext);
94
95 wxString fullName;
96 if (path.empty())
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");
102
103 if (!wxFileExists(fullName))
104 fullName = wxT("\\Windows\\") + name + wxT(".htm");
105
106 return fullName;
107}
108
109// View URL
110bool wxWinceHelpController::ViewURL(const wxString& topic)
111{
112 if (m_helpFile.empty()) return false;
113
114 wxString url( wxT("file:") + GetValidFilename(m_helpFile) );
115 if (!topic.empty())
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