]> git.saurik.com Git - wxWidgets.git/blame - src/msw/wince/helpwce.cpp
Add some version checks to help compiling on OSX.
[wxWidgets.git] / src / msw / wince / helpwce.cpp
CommitLineData
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
31IMPLEMENT_DYNAMIC_CLASS(wxWinceHelpController, wxHelpControllerBase)
32
33bool wxWinceHelpController::Initialize(const wxString& filename)
34{
35 m_helpFile = filename;
665b71b1 36 return true;
7a026580
JS
37}
38
39bool wxWinceHelpController::LoadFile(const wxString& file)
40{
57bd4c60 41 if (!file.empty())
7a026580 42 m_helpFile = file;
665b71b1 43 return true;
7a026580
JS
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
665b71b1 58bool wxWinceHelpController::DisplaySection(int WXUNUSED(section))
7a026580 59{
665b71b1 60 return true;
7a026580
JS
61}
62
665b71b1 63bool wxWinceHelpController::DisplayContextPopup(int WXUNUSED(contextId))
7a026580 64{
665b71b1 65 return true;
7a026580
JS
66}
67
665b71b1 68bool wxWinceHelpController::DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos))
7a026580 69{
665b71b1 70 return true;
7a026580
JS
71}
72
665b71b1 73bool wxWinceHelpController::DisplayBlock(long WXUNUSED(block))
7a026580 74{
665b71b1 75 return true;
7a026580
JS
76}
77
665b71b1
WS
78bool wxWinceHelpController::KeywordSearch(const wxString& WXUNUSED(k),
79 wxHelpSearchMode WXUNUSED(mode))
7a026580 80{
665b71b1 81 return true;
7a026580
JS
82}
83
84bool wxWinceHelpController::Quit()
85{
39fc096d 86 return true;
7a026580
JS
87}
88
89// Append extension if necessary.
90wxString wxWinceHelpController::GetValidFilename(const wxString& file) const
91{
92 wxString path, name, ext;
bd365871 93 wxFileName::SplitPath(file, & path, & name, & ext);
7a026580
JS
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
110bool 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