Class: Wx::HelpController
- 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:
- On desktop Windows, CHMHelpController is used (MS HTML Help).
- On all other platforms, Wx::HTML::HtmlHelpController is used if HTML is compiled into wxWidgets; otherwise ExtHelpController is used (for invoking an external browser).
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
Instance Method Summary collapse
-
#display_block(blockNo) ⇒ Boolean
If the help viewer is not running, runs it and displays the file at the given block number.
-
#display_contents ⇒ Boolean
If the help viewer is not running, runs it and displays the contents.
-
#display_context_popup(contextId) ⇒ Boolean
Displays the section as a popup window using a context id.
- #display_section(*args) ⇒ Object
-
#display_text_popup(text, pos) ⇒ Boolean
Displays the text in a popup window, if possible.
-
#get_frame_parameters ⇒ void
Only does something for Wx::HTML::HtmlHelpController.
-
#get_parent_window ⇒ Wx::Window
(also: #parent_window)
Returns the window to be used as the parent for the help window.
-
#init(file) ⇒ Boolean
Initializes the help instance with a help filename.
-
#initialize(parentWindow = nil) ⇒ Wx::HelpController
constructor
Constructs a help instance object, but does not invoke the help viewer.
-
#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.
-
#load_file(file = ('')) ⇒ Boolean
If the help viewer is not running, runs it and loads the given file.
-
#on_quit ⇒ void
Overridable member called when this application's viewer is quit by the user.
-
#quit ⇒ Boolean
If the viewer is running, quits it by disconnecting.
-
#set_frame_parameters(titleFormat, size, pos = Wx::DEFAULT_POSITION, newFrameEachTime = false) ⇒ void
Set the parameters of the frame window.
-
#set_parent_window(parentWindow) ⇒ void
(also: #parent_window=)
Sets the window to be used as the parent for the help window.
-
#set_viewer(viewer, flags = Wx::HTML::HELP_NETSCAPE) ⇒ void
(also: #viewer=)
Sets detailed viewer information.
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.
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.
111 |
# File 'lib/wx/doc/gen/help_controller.rb', line 111 def display_block(blockNo) end |
#display_contents ⇒ Boolean
If the help viewer is not running, runs it and displays the contents.
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.
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
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.
147 |
# File 'lib/wx/doc/gen/help_controller.rb', line 147 def display_text_popup(text, pos) end |
#get_frame_parameters ⇒ void
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_window ⇒ Wx::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.
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.
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.
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.
184 |
# File 'lib/wx/doc/gen/help_controller.rb', line 184 def load_file(file=('')) end |
#on_quit ⇒ void
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 |
#quit ⇒ Boolean
If the viewer is running, quits it by disconnecting.
For Windows Help, the viewer will only close if no other application is using it.
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.
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.
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
232 |
# File 'lib/wx/doc/gen/help_controller.rb', line 232 def set_viewer(viewer, flags=Wx::HTML::HELP_NETSCAPE) end |