Class: Wx::HelpController

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/help_controller.rb,
lib/wx/doc/help_controller.rb

Overview

This is an alias for one of a family of help controller classes which is most appropriate for the current platform.

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 HelpControllerBase and have names of the form XXXHelpController or HelpControllerXXX. An appropriate class is aliased to the name HelpController 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. The following help controller classes are defined:

  • WinHelpController, for controlling Windows Help.
  • CHMHelpController, for controlling MS HTML Help. To use this, you need to set Setup::USE_MS_HTML_HELP to 1 in setup.h and have the htmlhelp.h header from Microsoft's HTML Help kit. (You don't need the VC++-specific htmlhelp.lib because wxWidgets loads necessary DLL at runtime and so it works with all compilers.)
  • BestHelpController, for controlling MS HTML Help or, if Microsoft's runtime is not available, Wx::HTML::HtmlHelpController. You need to provide both CHM and HTB versions of the help file. For WXMSW only.
  • ExtHelpController, for controlling external browsers under Unix. The default browser is Netscape Navigator. The 'help' sample shows its use.
  • Wx::HTML::HtmlHelpController, a sophisticated help controller using HTML, in a similar style to the Microsoft HTML Help viewer and using some of the same files. Although it has an API compatible with other help controllers, it has more advanced features, so it is recommended that you use the specific API for this class instead. Note that in Ruby the required filesystem handlers for .zip or .htb books are always loaded.

Category: HELP

See Also:

Requires:

  • USE_HELP

Instance Method Summary collapse

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initialize(parentWindow = nil) ⇒ Wx::HelpController

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 CHMHelpController, WinHelpController and Wx::HTML::HtmlHelpController, as the parent for the help window instead of the value of App#get_top_window. You can also change the parent window later with #set_parent_window.

Parameters:



100
# File 'lib/wx/doc/gen/help_controller.rb', line 100

def initialize(parentWindow=nil) end

Instance Method Details

#display_block(blockNo) ⇒ Boolean

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 #display_section.
  • Wx::HTML::HtmlHelpController: sectionNo is an identifier as specified in the .hhc file. See Help Files Format. DeprecatedThis function is for backward compatibility only, and applications should use #display_section instead.

Parameters:

  • blockNo (Integer)

Returns:

  • (Boolean)


111
# File 'lib/wx/doc/gen/help_controller.rb', line 111

def display_block(blockNo) end

#display_contentsBoolean

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

Returns:

  • (Boolean)


115
# File 'lib/wx/doc/gen/help_controller.rb', line 115

def display_contents; end

#display_context_popup(contextId) ⇒ Boolean

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

Returns false if unsuccessful or not implemented.

Parameters:

  • contextId (Integer)

Returns:

  • (Boolean)


122
# File 'lib/wx/doc/gen/help_controller.rb', line 122

def display_context_popup(contextId) end

#display_section(section) ⇒ Boolean #display_section(sectionNo) ⇒ Boolean

Overloads:

  • #display_section(section) ⇒ Boolean

    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, Wx::HTML help and external HTML help, if section has a .htm or .html extension, that HTML file will be displayed; otherwise a keyword search is done.

    Parameters:

    • section (String)

    Returns:

    • (Boolean)
  • #display_section(sectionNo) ⇒ Boolean

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

    • WinHelp, MS HTML Help sectionNo is a context id.
    • MS HTML Help: Pass -1 in sectionNo to display the index.
    • External HTML help: ExtHelpController implements sectionNo as an id in a map file, which is of the form:
    • Wx::HTML::HtmlHelpController: 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.

    Parameters:

    • sectionNo (Integer)

    Returns:

    • (Boolean)


139
# File 'lib/wx/doc/gen/help_controller.rb', line 139

def display_section(*args) end

#display_text_popup(text, pos) ⇒ Boolean

Displays the text in a popup window, if possible.

Returns false if unsuccessful or not implemented.

Parameters:

  • text (String)
  • pos (Array(Integer, Integer), Wx::Point)

Returns:

  • (Boolean)


147
# File 'lib/wx/doc/gen/help_controller.rb', line 147

def display_text_popup(text, pos) end

#get_frame_parametersvoid

This method returns an undefined value.

Returns Only does something for Wx::HTML::HtmlHelpController.



13
# File 'lib/wx/doc/help_controller.rb', line 13

def get_frame_parameters; end

#get_parent_windowWx::Window Also known as: parent_window

Returns the window to be used as the parent for the help window.

This window is used by CHMHelpController, WinHelpController and Wx::HTML::HtmlHelpController.

Returns:



153
# File 'lib/wx/doc/gen/help_controller.rb', line 153

def get_parent_window; end

#init(file) ⇒ Boolean

Initializes the help instance with a help filename.

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 Wx::HTML::HtmlHelpController, the extensions zip, htb and hhp will be appended while searching for a suitable file. For WinHelp, the hlp extension is appended.

Parameters:

  • file (String)

Returns:

  • (Boolean)


162
# File 'lib/wx/doc/gen/help_controller.rb', line 162

def init(file) end

#keyword_search(keyWord, mode = Wx::HelpSearchMode::HELP_SEARCH_ALL) ⇒ Boolean

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 searching the index (Wx::HelpSearchMode::HELP_SEARCH_INDEX) but this currently is only supported by the Wx::HTML::HtmlHelpController.

  • WinHelp, MS HTML Help: If more than one match is found, the first topic is displayed.
  • MS HTML Help: Pass an empty string to display the search page.
  • External HTML help, simple Wx::HTML help: If more than one match is found, a choice of topics is displayed.
  • Wx::HTML::HtmlHelpController: see Wx::HTML::HtmlHelpController::KeywordSearch.

Parameters:

  • keyWord (String)
  • mode (Wx::HelpSearchMode) (defaults to: Wx::HelpSearchMode::HELP_SEARCH_ALL)

Returns:

  • (Boolean)


175
# File 'lib/wx/doc/gen/help_controller.rb', line 175

def keyword_search(keyWord, mode=Wx::HelpSearchMode::HELP_SEARCH_ALL) end

#load_file(file = ('')) ⇒ Boolean

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. Wx::HTML::HtmlHelpController ignores this call.

Parameters:

  • file (String) (defaults to: (''))

Returns:

  • (Boolean)


184
# File 'lib/wx/doc/gen/help_controller.rb', line 184

def load_file(file=('')) end

#on_quitvoid

This method returns an undefined value.

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

This does not work for all help controllers.



190
# File 'lib/wx/doc/gen/help_controller.rb', line 190

def on_quit; end

#quitBoolean

If the viewer is running, quits it by disconnecting.

For Windows Help, the viewer will only close if no other application is using it.

Returns:

  • (Boolean)


196
# File 'lib/wx/doc/gen/help_controller.rb', line 196

def quit; end

#set_frame_parameters(titleFormat, size, pos = Wx::DEFAULT_POSITION, newFrameEachTime = false) ⇒ void

This method returns an undefined value.

Set the parameters of the frame window.

For Wx::HTML::HtmlHelpController, titleFormat specifies the title string format (with s being replaced by the actual page title) and size and position specify the geometry of the frame. For all other help controllers this function has no effect. Finally, newFrameEachTime is always ignored currently.

Parameters:

  • titleFormat (String)
  • size (Array(Integer, Integer), Wx::Size)
  • pos (Array(Integer, Integer), Wx::Point) (defaults to: Wx::DEFAULT_POSITION)
  • newFrameEachTime (Boolean) (defaults to: false)


208
# File 'lib/wx/doc/gen/help_controller.rb', line 208

def set_frame_parameters(titleFormat, size, pos=Wx::DEFAULT_POSITION, newFrameEachTime=false) end

#set_parent_window(parentWindow) ⇒ void Also known as: parent_window=

This method returns an undefined value.

Sets the window to be used as the parent for the help window.

This is used by CHMHelpController, WinHelpController and Wx::HTML::HtmlHelpController.

Parameters:



215
# File 'lib/wx/doc/gen/help_controller.rb', line 215

def set_parent_window(parentWindow) end

#set_viewer(viewer, flags = Wx::HTML::HELP_NETSCAPE) ⇒ void Also known as: viewer=

This method returns an undefined value.

Sets detailed viewer information.

So far this is only relevant to ExtHelpController. Some examples of usage:

  @help.set_viewer('kdehelp')
  @help.set_viewer('gnome-help-browser')
  @help.set_viewer('netscape', Wx::HELP_NETSCAPE)

Todomodernize this function with LaunchDefaultBrowser

Parameters:



232
# File 'lib/wx/doc/gen/help_controller.rb', line 232

def set_viewer(viewer, flags=Wx::HTML::HELP_NETSCAPE) end