tbx  0.7.6
stronghelp.h
1 /*
2  * tbx RISC OS toolbox library
3  *
4  * Copyright (C) 2014 Alan Buckley All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 
25 #ifndef TBX_EXT_STRONGHELP_H_
26 #define TBX_EXT_STRONGHELP_H_
27 
28 #include <string>
29 
30 namespace tbx {
31 namespace ext {
32 
33 class StrongHelpNotFoundHandler;
34 
41  class StrongHelp
42  {
43  std::string _path;
44  static std::string _default_path;
45 
46  public:
47  StrongHelp();
48  StrongHelp(const std::string &path);
49  StrongHelp(const StrongHelp &other);
50 
51  static void default_path(const std::string &path);
52  static void standard_default_path();
56  static const std::string &default_path() {return _default_path;}
60  const std::string &path() const {return _path;}
61 
62  static bool run_stronghelp();
63  bool run_path();
64 
65  void lookup(const std::string &page, StrongHelpNotFoundHandler *handler= 0);
66  void search(const std::string &text, StrongHelpNotFoundHandler *handler= 0);
67 
68  };
69 
75  {
76  public:
77  virtual ~StrongHelpNotFoundHandler() {};
78  virtual bool stronghelp_not_found(StrongHelp &help, const std::string &page_or_text);
79  virtual void stronghelp_not_running(StrongHelp &help, const std::string &page_or_text);
80  };
81 }
82 }
83 
84 #endif /* TBX_EXT_STRONGHELP_H_ */
tbx
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
tbx::ext::StrongHelpNotFoundHandler
interface to customise handling of StrongHelp or lookup not found message.
Definition: stronghelp.h:75
tbx::ext::StrongHelp
class to show help from StrongHelp help files
Definition: stronghelp.h:42
tbx::ext::StrongHelp::run_stronghelp
static bool run_stronghelp()
Attempt to start the strong help program.
Definition: stronghelp.cc:103
tbx::ext::StrongHelp::StrongHelp
StrongHelp()
Construct class to control StrongHelp application.
Definition: stronghelp.cc:46
tbx::ext::StrongHelp::lookup
void lookup(const std::string &page, StrongHelpNotFoundHandler *handler=0)
Lookup a page in the strong help path.
Definition: stronghelp.cc:324
tbx::ext::StrongHelp::default_path
static const std::string & default_path()
Get the default path set for the application.
Definition: stronghelp.h:56
tbx::ext::StrongHelp::path
const std::string & path() const
Get the path used by this instance.
Definition: stronghelp.h:60
tbx::ext::StrongHelp::search
void search(const std::string &text, StrongHelpNotFoundHandler *handler=0)
Open the free text search window.
Definition: stronghelp.cc:336
tbx::ext::StrongHelp::standard_default_path
static void standard_default_path()
Set the static default path for the no argument constructor to be the standard !Help file for the app...
Definition: stronghelp.cc:80
tbx::ext::StrongHelp::run_path
bool run_path()
Attempt to run the file name in path.
Definition: stronghelp.cc:136
tbx::ext::StrongHelpNotFoundHandler::stronghelp_not_running
virtual void stronghelp_not_running(StrongHelp &help, const std::string &page_or_text)
Handler for if the StrongHelp program could not be run.
Definition: stronghelp.cc:175
tbx::ext::StrongHelpNotFoundHandler::stronghelp_not_found
virtual bool stronghelp_not_found(StrongHelp &help, const std::string &page_or_text)
Handler for if the page or text could not be found by StrongHelp.
Definition: stronghelp.cc:162