]> git.saurik.com Git - wxWidgets.git/blame - src/msw/wince/helpwce.cpp
Hopefully fixed library names generated by wx-config for OS/2's PM port.
[wxWidgets.git] / src / msw / wince / helpwce.cpp
CommitLineData
7a026580
JS
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
39fc096d 9// Licence: wxWindows licence
7a026580
JS
10/////////////////////////////////////////////////////////////////////////////
11
14f355c2 12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
7a026580
JS
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
35IMPLEMENT_DYNAMIC_CLASS(wxWinceHelpController, wxHelpControllerBase)
36
37bool wxWinceHelpController::Initialize(const wxString& filename)
38{
39 m_helpFile = filename;
665b71b1 40 return true;
7a026580
JS
41}
42
43bool wxWinceHelpController::LoadFile(const wxString& file)
44{
45 if (!file.IsEmpty())
46 m_helpFile = file;
665b71b1 47 return true;
7a026580
JS
48}
49
50bool wxWinceHelpController::DisplayContents()
51{
52 return ViewURL();
53}
54
55// Use topic
56bool wxWinceHelpController::DisplaySection(const wxString& section)
57{
58 return ViewURL(section);
59}
60
61// Use context number
665b71b1 62bool wxWinceHelpController::DisplaySection(int WXUNUSED(section))
7a026580 63{
665b71b1 64 return true;
7a026580
JS
65}
66
665b71b1 67bool wxWinceHelpController::DisplayContextPopup(int WXUNUSED(contextId))
7a026580 68{
665b71b1 69 return true;
7a026580
JS
70}
71
665b71b1 72bool wxWinceHelpController::DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos))
7a026580 73{
665b71b1 74 return true;
7a026580
JS
75}
76
665b71b1 77bool wxWinceHelpController::DisplayBlock(long WXUNUSED(block))
7a026580 78{
665b71b1 79 return true;
7a026580
JS
80}
81
665b71b1
WS
82bool wxWinceHelpController::KeywordSearch(const wxString& WXUNUSED(k),
83 wxHelpSearchMode WXUNUSED(mode))
7a026580 84{
665b71b1 85 return true;
7a026580
JS
86}
87
88bool wxWinceHelpController::Quit()
89{
39fc096d 90 return true;
7a026580
JS
91}
92
93// Append extension if necessary.
94wxString wxWinceHelpController::GetValidFilename(const wxString& file) const
95{
96 wxString path, name, ext;
97 wxSplitPath(file, & path, & name, & ext);
98
99 wxString fullName;
100 if (path.IsEmpty())
101 fullName = name + wxT(".htm");
102 else if (path.Last() == wxT('\\'))
103 fullName = path + name + wxT(".htm");
104 else
105 fullName = path + wxT("\\") + name + wxT(".htm");
45dbd833
JS
106
107 if (!wxFileExists(fullName))
108 fullName = wxT("\\Windows\\") + name + wxT(".htm");
109
7a026580
JS
110 return fullName;
111}
112
113// View URL
114bool wxWinceHelpController::ViewURL(const wxString& topic)
115{
39fc096d
WS
116 if (m_helpFile.IsEmpty()) return false;
117
7a026580
JS
118 wxString url( wxT("file:") + GetValidFilename(m_helpFile) );
119 if (!topic.IsEmpty())
120 url = url + wxT("#") + topic;
121
122 return CreateProcess(wxT("peghelp.exe"),
123 url, NULL, NULL, FALSE, 0, NULL,
124 NULL, NULL, NULL) != 0 ;
125}
126
127#endif // wxUSE_HELP
128