]> git.saurik.com Git - wxWidgets.git/blame - src/msw/wince/helpwce.cpp
cleanup - reformatting; simplified OnPaint
[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
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
25 #include "wx/intl.h"
26#endif
27
28#include "wx/msw/private.h"
29#include "wx/msw/missing.h"
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{
41 if (!file.IsEmpty())
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;
93 wxSplitPath(file, & path, & name, & ext);
94
95 wxString fullName;
96 if (path.IsEmpty())
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{
39fc096d
WS
112 if (m_helpFile.IsEmpty()) return false;
113
7a026580
JS
114 wxString url( wxT("file:") + GetValidFilename(m_helpFile) );
115 if (!topic.IsEmpty())
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
124