]> git.saurik.com Git - wxWidgets.git/blob - src/msw/wince/helpwce.cpp
fix ParseFormat("%d") to set the date it finds (#10002)
[wxWidgets.git] / src / msw / wince / helpwce.cpp
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
31 IMPLEMENT_DYNAMIC_CLASS(wxWinceHelpController, wxHelpControllerBase)
32
33 bool wxWinceHelpController::Initialize(const wxString& filename)
34 {
35 m_helpFile = filename;
36 return true;
37 }
38
39 bool wxWinceHelpController::LoadFile(const wxString& file)
40 {
41 if (!file.empty())
42 m_helpFile = file;
43 return true;
44 }
45
46 bool wxWinceHelpController::DisplayContents()
47 {
48 return ViewURL();
49 }
50
51 // Use topic
52 bool wxWinceHelpController::DisplaySection(const wxString& section)
53 {
54 return ViewURL(section);
55 }
56
57 // Use context number
58 bool wxWinceHelpController::DisplaySection(int WXUNUSED(section))
59 {
60 return true;
61 }
62
63 bool wxWinceHelpController::DisplayContextPopup(int WXUNUSED(contextId))
64 {
65 return true;
66 }
67
68 bool wxWinceHelpController::DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos))
69 {
70 return true;
71 }
72
73 bool wxWinceHelpController::DisplayBlock(long WXUNUSED(block))
74 {
75 return true;
76 }
77
78 bool wxWinceHelpController::KeywordSearch(const wxString& WXUNUSED(k),
79 wxHelpSearchMode WXUNUSED(mode))
80 {
81 return true;
82 }
83
84 bool wxWinceHelpController::Quit()
85 {
86 return true;
87 }
88
89 // Append extension if necessary.
90 wxString 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.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
110 bool 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