contents up previous next

wxhelpcontroller

this is a family of classes by which applications may invoke a help viewer to provide on-line help.

a help controller allows an application to display help, at the contents or at a particular topic, and shut the help program down on termination. this avoids proliferation of many instances of the help viewer whenever the user requests a different topic via the application's menus or buttons.

typically, an application will create a help controller instance when it starts, and immediately call initialize to associate a filename with it. the help viewer will only get run, however, just before the first call to display something.

most help controller classes actually derive from wxhelpcontrollerbase and have names of the form wxxxxhelpcontroller or wxhelpcontrollerxxx. an appropriate class is aliased to the name wxhelpcontroller for each platform, as follows:

the remaining help controller classes need to be named explicitly by an application that wishes to make use of them.

there are currently the following help controller classes defined:

derived from

wxhelpcontrollerbase
wxobject

include files

<wx/help.h> (wxwidgets chooses the appropriate help controller class)
<wx/helpbase.h> (wxhelpcontrollerbase class)
<wx/helpwin.h> (windows help controller)
<wx/msw/helpchm.h> (ms html help controller)
<wx/generic/helpext.h> (external html browser controller)
<wx/html/helpctrl.h> (wxhtml based help controller: wxhtmlhelpcontroller)

see also

wxhtmlhelpcontroller, wxhtml

members

wxhelpcontroller::wxhelpcontroller
wxhelpcontroller::~wxhelpcontroller
wxhelpcontroller::initialize
wxhelpcontroller::displayblock
wxhelpcontroller::displaycontents
wxhelpcontroller::displaycontextpopup
wxhelpcontroller::displaysection
wxhelpcontroller::displaytextpopup
wxhelpcontroller::getframeparameters
wxhelpcontroller::getparentwindow
wxhelpcontroller::keywordsearch
wxhelpcontroller::loadfile
wxhelpcontroller::onquit
wxhelpcontroller::setframeparameters
wxhelpcontroller::setparentwindow
wxhelpcontroller::setviewer
wxhelpcontroller::quit


wxhelpcontroller::wxhelpcontroller

wxhelpcontroller(wxwindow* parentwindow = null)

constructs a help instance object, but does not invoke the help viewer.

if you provide a window, it will be used by some help controller classes, such as wxchmhelpcontroller, wxwinhelpcontroller and wxhtmlhelpcontroller, as the parent for the help window instead of the value of wxapp::gettopwindow. you can also change the parent window later with wxhelpcontroller::setparentwindow.


wxhelpcontroller::~wxhelpcontroller

~wxhelpcontroller()

destroys the help instance, closing down the viewer if it is running.


wxhelpcontroller::initialize

virtual bool initialize(const wxstring& file)

virtual bool initialize(const wxstring& file, int server)

initializes the help instance with a help filename, and optionally a server socket number if using wxhelp (now obsolete). does not invoke the help viewer. this must be called directly after the help instance object is created and before any attempts to communicate with the viewer.

you may omit the file extension and a suitable one will be chosen. for wxhtmlhelpcontroller, the extensions zip, htb and hhp will be appended while searching for a suitable file. for winhelp, the hlp extension is appended.


wxhelpcontroller::displayblock

virtual bool displayblock(long blockno)

if the help viewer is not running, runs it and displays the file at the given block number.

winhelp: refers to the context number.

ms html help: refers to the context number.

external html help: the same as for wxhelpcontroller::displaysection.

wxhtmlhelpcontroller: sectionno is an identifier as specified in the .hhc file. see help files format.

this function is for backward compatibility only, and applications should use wxhelpcontroller instead.


wxhelpcontroller::displaycontents

virtual bool displaycontents()

if the help viewer is not running, runs it and displays the contents.


wxhelpcontroller::displaycontextpopup

virtual bool displaycontextpopup(int contextid)

displays the section as a popup window using a context id.

returns false if unsuccessful or not implemented.


wxhelpcontroller::displaysection

virtual bool displaysection(const wxstring& section)

if the help viewer is not running, runs it and displays the given section.

the interpretation of section differs between help viewers. for most viewers, this call is equivalent to keywordsearch. for ms html help, wxhtml help and external html help, if section has a .htm or .php extension, that html file will be displayed; otherwise a keyword search is done.

virtual bool displaysection(int sectionno)

if the help viewer is not running, runs it and displays the given section.

winhelp, ms html help sectionno is a context id.

external html help: wxexthelpcontroller implements sectionno as an id in a map file, which is of the form:

0  wx.php             ; index
1  wx34.php#classref  ; class reference
2  wx204.php          ; function reference
wxhtmlhelpcontroller: sectionno is an identifier as specified in the .hhc file. see help files format.

see also the help sample for notes on how to specify section numbers for various help file formats.


wxhelpcontroller::displaytextpopup

virtual bool displaytextpopup(const wxstring& text, const wxpoint& pos)

displays the text in a popup window, if possible.

returns false if unsuccessful or not implemented.


wxhelpcontroller::getframeparameters

virtual wxframe * getframeparameters(const wxsize * size = null, const wxpoint * pos = null, bool *newframeeachtime = null)

wxhtmlhelpcontroller returns the frame, size and position.

for all other help controllers, this function does nothing and just returns null.

parameters

viewer

flags


wxhelpcontroller::getparentwindow

virtual wxwindow* getparentwindow() const

returns the window to be used as the parent for the help window. this window is used by wxchmhelpcontroller, wxwinhelpcontroller and wxhtmlhelpcontroller.


wxhelpcontroller::keywordsearch

virtual bool keywordsearch(const wxstring& keyword, wxhelpsearchmode mode = wxhelp_search_all)

if the help viewer is not running, runs it, and searches for sections matching the given keyword. if one match is found, the file is displayed at this section. the optional parameter allows the search the index (wxhelp_search_index) but this currently only supported by the wxhtmlhelpcontroller.

winhelp, ms html help: if more than one match is found, the first topic is displayed.

external html help, simple wxhtml help: if more than one match is found, a choice of topics is displayed.

wxhtmlhelpcontroller: see wxhtmlhelpcontroller::keywordsearch.


wxhelpcontroller::loadfile

virtual bool loadfile(const wxstring& file = "")

if the help viewer is not running, runs it and loads the given file. if the filename is not supplied or is empty, the file specified in initialize is used. if the viewer is already displaying the specified file, it will not be reloaded. this member function may be used before each display call in case the user has opened another file.

wxhtmlhelpcontroller ignores this call.


wxhelpcontroller::onquit

virtual bool onquit()

overridable member called when this application's viewer is quit by the user.

this does not work for all help controllers.


wxhelpcontroller::setframeparameters

virtual void setframeparameters(const wxstring & title, const wxsize & size, const wxpoint & pos = wxdefaultposition, bool newframeeachtime = false)

for wxhtmlhelpcontroller, the title is set (again with %s indicating the page title) and also the size and position of the frame if the frame is already open. newframeeachtime is ignored.

for all other help controllers this function has no effect.


wxhelpcontroller::setparentwindow

virtual void setparentwindow(wxwindow* parentwindow)

sets the window to be used as the parent for the help window. this is used by wxchmhelpcontroller, wxwinhelpcontroller and wxhtmlhelpcontroller.


wxhelpcontroller::setviewer

virtual void setviewer(const wxstring& viewer, long flags)

sets detailed viewer information. so far this is only relevant to wxexthelpcontroller.

some examples of usage:

  m_help.setviewer("kdehelp");
  m_help.setviewer("gnome-help-browser");
  m_help.setviewer("netscape", wxhelp_netscape);

wxhelpcontroller::quit

virtual bool quit()

if the viewer is running, quits it by disconnecting.

for windows help, the viewer will only close if no other application is using it.