2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: html/helpwnd.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxHtmlHelpWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxHtmlHelpWindow
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-23 09:55:07 -04:00
|
|
|
This class is used by wxHtmlHelpController to display help within a frame or
|
|
|
|
dialog, but you can use it yourself to create an embedded HTML help window.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
For example:
|
|
|
|
@code
|
2008-10-23 09:55:07 -04:00
|
|
|
// m_embeddedHelpWindow is a wxHtmlHelpWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
// m_embeddedHtmlHelp is a wxHtmlHelpController
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
// Create embedded HTML Help window
|
|
|
|
m_embeddedHelpWindow = new wxHtmlHelpWindow;
|
2008-10-23 09:55:07 -04:00
|
|
|
m_embeddedHtmlHelp.UseConfig(config, rootPath); // Set your own config object here
|
2008-03-08 09:43:31 -05:00
|
|
|
m_embeddedHtmlHelp.SetHelpWindow(m_embeddedHelpWindow);
|
2008-10-23 09:55:07 -04:00
|
|
|
m_embeddedHelpWindow->Create(this, wxID_ANY, wxDefaultPosition, GetClientSize(),
|
|
|
|
wxTAB_TRAVERSAL|wxBORDER_NONE, wxHF_DEFAULT_STYLE);
|
2008-03-08 08:52:38 -05:00
|
|
|
m_embeddedHtmlHelp.AddBook(wxFileName(_T("doc.zip")));
|
|
|
|
@endcode
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
You should pass the style wxHF_EMBEDDED to the style parameter of
|
2008-10-23 09:55:07 -04:00
|
|
|
wxHtmlHelpController to allow the embedded window to be destroyed
|
|
|
|
independently of the help controller.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxhtml}
|
2008-10-23 09:55:07 -04:00
|
|
|
@category{help,html}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxHtmlHelpWindow : public wxWindow
|
|
|
|
{
|
|
|
|
public:
|
2008-10-23 09:55:07 -04:00
|
|
|
wxHtmlHelpWindow(wxHtmlHelpData* data = NULL);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructor.
|
2008-10-23 09:55:07 -04:00
|
|
|
|
|
|
|
For the values of @a helpStyle, please see the documentation for
|
2008-03-08 08:52:38 -05:00
|
|
|
wxHtmlHelpController.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxHtmlHelpWindow(wxWindow* parent, int wxWindowID,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& pos = wxDefaultSize,
|
|
|
|
int style = wxTAB_TRAVERSAL|wxBORDER_NONE,
|
|
|
|
int helpStyle = wxHF_DEFAULT_STYLE,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxHtmlHelpData* data = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-23 09:55:07 -04:00
|
|
|
Creates the help window. See @ref wxHtmlHelpWindow() "the constructor"
|
2008-03-08 08:52:38 -05:00
|
|
|
for a description of the parameters.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-10-29 11:34:31 -04:00
|
|
|
const wxSize& size = wxDefaultSize, int style = wxTAB_TRAVERSAL|wxBORDER_NONE,
|
|
|
|
int helpStyle = wxHF_DEFAULT_STYLE);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-23 09:55:07 -04:00
|
|
|
Displays page x.
|
|
|
|
If not found it will give the user the choice of searching books.
|
2008-03-08 08:52:38 -05:00
|
|
|
Looking for the page runs in these steps:
|
2008-10-23 09:55:07 -04:00
|
|
|
-# try to locate file named x (if x is for example "doc/howto.htm")
|
|
|
|
-# try to open starting page of book x
|
|
|
|
-# try to find x in contents (if x is for example "How To ...")
|
|
|
|
-# try to find x in index (if x is for example "How To ...")
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Display(const wxString& x);
|
2008-10-23 09:55:07 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
@overload
|
|
|
|
|
|
|
|
This form takes numeric ID as the parameter (uses an extension to MS format,
|
|
|
|
param name="ID" value=id).
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
bool Display(const int id);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Displays contents panel.
|
|
|
|
*/
|
|
|
|
bool DisplayContents();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Displays index panel.
|
|
|
|
*/
|
|
|
|
bool DisplayIndex();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the wxHtmlHelpData object, which is usually a pointer to the
|
|
|
|
controller's data.
|
|
|
|
*/
|
|
|
|
wxHtmlHelpData* GetData();
|
|
|
|
|
|
|
|
/**
|
2008-10-23 09:55:07 -04:00
|
|
|
Search for given keyword. Optionally it searches through the index
|
|
|
|
(mode = @c wxHELP_SEARCH_INDEX), default the content (mode = @c wxHELP_SEARCH_ALL).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool KeywordSearch(const wxString& keyword,
|
|
|
|
wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
|
|
|
|
|
|
|
|
/**
|
2008-10-23 09:55:07 -04:00
|
|
|
Reads the user's settings for this window.
|
|
|
|
|
|
|
|
@see wxHtmlHelpController::ReadCustomization
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void ReadCustomization(wxConfigBase* cfg,
|
|
|
|
const wxString& path = wxEmptyString);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Associates a wxConfig object with the help window. It is recommended that you
|
|
|
|
use wxHtmlHelpController::UseConfig instead.
|
|
|
|
*/
|
|
|
|
void UseConfig(wxConfigBase* config,
|
|
|
|
const wxString& rootpath = wxEmptyString);
|
|
|
|
|
|
|
|
/**
|
2008-10-23 09:55:07 -04:00
|
|
|
Saves the user's settings for this window.
|
|
|
|
|
|
|
|
@see wxHtmlHelpController::WriteCustomization
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void WriteCustomization(wxConfigBase* cfg,
|
|
|
|
const wxString& path = wxEmptyString);
|
2008-10-23 09:55:07 -04:00
|
|
|
|
2008-10-29 14:55:57 -04:00
|
|
|
/**
|
|
|
|
Refresh all panels. This is necessary if a new book was added.
|
|
|
|
*/
|
|
|
|
void RefreshLists();
|
|
|
|
|
2008-10-23 09:55:07 -04:00
|
|
|
protected:
|
|
|
|
|
2008-10-29 14:55:57 -04:00
|
|
|
/**
|
|
|
|
Creates search panel.
|
|
|
|
*/
|
|
|
|
void CreateSearch();
|
|
|
|
|
|
|
|
/**
|
|
|
|
You may override this virtual method to add more buttons to the help window's
|
|
|
|
toolbar. @a toolBar is a pointer to the toolbar and @a style is the style
|
|
|
|
flag as passed to the Create() method.
|
|
|
|
|
|
|
|
wxToolBar::Realize is called immediately after returning from this function.
|
|
|
|
See @c samples/html/helpview for an example.
|
|
|
|
*/
|
|
|
|
virtual void AddToolbarButtons(wxToolBar* toolBar, int style);
|
|
|
|
|
2008-10-23 09:55:07 -04:00
|
|
|
/**
|
|
|
|
Creates contents panel. (May take some time.)
|
|
|
|
*/
|
|
|
|
void CreateContents();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Creates index panel. (May take some time.)
|
|
|
|
*/
|
|
|
|
void CreateIndex();
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|