1999-09-12 13:45:34 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: helpctrl.h
|
|
|
|
// Purpose: wxHtmlHelpController
|
1999-09-13 01:27:36 -04:00
|
|
|
// Notes: Based on htmlhelp.cpp, implementing a monolithic
|
1999-09-12 13:45:34 -04:00
|
|
|
// HTML Help controller class, by Vaclav Slavik
|
|
|
|
// Author: Harm van der Heijden and Vaclav Slavik
|
1999-10-02 14:19:46 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-09-12 13:45:34 -04:00
|
|
|
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-09-12 13:45:34 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_HELPCTRL_H_
|
|
|
|
#define _WX_HELPCTRL_H_
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2001-07-04 21:27:19 -04:00
|
|
|
#if wxUSE_WXHTML_HELP
|
1999-09-12 13:45:34 -04:00
|
|
|
|
2000-03-09 15:05:52 -05:00
|
|
|
#include "wx/helpbase.h"
|
2003-09-09 13:29:11 -04:00
|
|
|
#include "wx/html/helpfrm.h"
|
1999-09-12 13:45:34 -04:00
|
|
|
|
2001-05-05 14:05:57 -04:00
|
|
|
#define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
|
|
|
|
|
2006-01-09 08:42:57 -05:00
|
|
|
// This style indicates that the window is
|
|
|
|
// embedded in the application and must not be
|
|
|
|
// destroyed by the help controller.
|
|
|
|
#define wxHF_EMBEDDED 0x00008000
|
|
|
|
|
|
|
|
// Create a dialog for the help window.
|
|
|
|
#define wxHF_DIALOG 0x00010000
|
|
|
|
|
|
|
|
// Create a frame for the help window.
|
|
|
|
#define wxHF_FRAME 0x00020000
|
|
|
|
|
|
|
|
// Make the dialog modal when displaying help.
|
|
|
|
#define wxHF_MODAL 0x00040000
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog;
|
|
|
|
class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow;
|
|
|
|
class WXDLLIMPEXP_FWD_HTML wxHtmlHelpFrame;
|
|
|
|
class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog;
|
2006-01-09 08:42:57 -05:00
|
|
|
|
2003-07-04 09:04:05 -04:00
|
|
|
class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler
|
1999-09-12 13:45:34 -04:00
|
|
|
{
|
2001-04-29 13:57:59 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
|
|
|
|
|
|
|
|
public:
|
2005-10-26 05:32:10 -04:00
|
|
|
wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL);
|
2001-04-29 13:57:59 -04:00
|
|
|
virtual ~wxHtmlHelpController();
|
|
|
|
|
|
|
|
void SetTitleFormat(const wxString& format);
|
|
|
|
void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
|
2004-09-27 15:06:39 -04:00
|
|
|
bool AddBook(const wxString& book_url, bool show_wait_msg = false);
|
|
|
|
bool AddBook(const wxFileName& book_file, bool show_wait_msg = false);
|
2002-06-18 17:46:42 -04:00
|
|
|
|
|
|
|
bool Display(const wxString& x);
|
|
|
|
bool Display(int id);
|
|
|
|
bool DisplayContents();
|
|
|
|
bool DisplayIndex();
|
2003-09-09 13:29:11 -04:00
|
|
|
bool KeywordSearch(const wxString& keyword,
|
|
|
|
wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
|
2002-06-18 17:46:42 -04:00
|
|
|
|
2006-01-09 08:42:57 -05:00
|
|
|
wxHtmlHelpWindow* GetHelpWindow() { return m_helpWindow; }
|
|
|
|
void SetHelpWindow(wxHtmlHelpWindow* helpWindow);
|
|
|
|
|
2006-01-11 04:08:31 -05:00
|
|
|
wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
|
|
|
|
wxHtmlHelpDialog* GetDialog() { return m_helpDialog; }
|
2006-01-11 03:59:17 -05:00
|
|
|
|
2001-04-29 13:57:59 -04:00
|
|
|
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
|
|
|
|
|
|
|
|
// Assigns config object to the Ctrl. This config is then
|
|
|
|
// used in subsequent calls to Read/WriteCustomization of both help
|
|
|
|
// Ctrl and it's wxHtmlWindow
|
|
|
|
virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
|
|
|
|
virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
|
|
|
|
|
|
|
|
//// Backward compatibility with wxHelpController API
|
|
|
|
|
|
|
|
virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); }
|
|
|
|
virtual bool Initialize(const wxString& file);
|
|
|
|
virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
|
2002-12-04 09:11:26 -05:00
|
|
|
virtual bool LoadFile(const wxString& file = wxT(""));
|
2001-04-29 13:57:59 -04:00
|
|
|
virtual bool DisplaySection(int sectionNo);
|
|
|
|
virtual bool DisplaySection(const wxString& section) { return Display(section); }
|
|
|
|
virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); }
|
|
|
|
virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
|
|
|
|
|
|
|
|
virtual void SetFrameParameters(const wxString& title,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2004-09-27 15:06:39 -04:00
|
|
|
bool newFrameEachTime = false);
|
2001-04-29 13:57:59 -04:00
|
|
|
/// Obtains the latest settings used by the help frame and the help
|
|
|
|
/// frame.
|
|
|
|
virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
|
|
|
|
wxPoint *pos = NULL,
|
|
|
|
bool *newFrameEachTime = NULL);
|
|
|
|
|
2001-05-04 19:52:46 -04:00
|
|
|
// Get direct access to help data:
|
|
|
|
wxHtmlHelpData *GetHelpData() { return &m_helpData; }
|
2001-04-29 13:57:59 -04:00
|
|
|
|
|
|
|
virtual bool Quit() ;
|
2004-10-13 10:04:19 -04:00
|
|
|
virtual void OnQuit() {}
|
2001-04-29 13:57:59 -04:00
|
|
|
|
|
|
|
void OnCloseFrame(wxCloseEvent& evt);
|
|
|
|
|
2002-06-18 17:46:42 -04:00
|
|
|
// Make the help controller's frame 'modal' if
|
|
|
|
// needed
|
2006-01-09 08:42:57 -05:00
|
|
|
void MakeModalIfNeeded();
|
|
|
|
|
|
|
|
// Find the top-most parent window
|
|
|
|
wxWindow* FindTopLevelWindow();
|
2002-06-18 17:46:42 -04:00
|
|
|
|
2001-04-29 13:57:59 -04:00
|
|
|
protected:
|
2006-01-09 08:42:57 -05:00
|
|
|
virtual wxWindow* CreateHelpWindow();
|
2001-04-29 13:57:59 -04:00
|
|
|
virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data);
|
2006-01-09 08:42:57 -05:00
|
|
|
virtual wxHtmlHelpDialog* CreateHelpDialog(wxHtmlHelpData *data);
|
2001-04-29 13:57:59 -04:00
|
|
|
virtual void DestroyHelpWindow();
|
|
|
|
|
|
|
|
wxHtmlHelpData m_helpData;
|
2006-01-09 08:42:57 -05:00
|
|
|
wxHtmlHelpWindow* m_helpWindow;
|
2001-04-29 13:57:59 -04:00
|
|
|
wxConfigBase * m_Config;
|
|
|
|
wxString m_ConfigRoot;
|
|
|
|
wxString m_titleFormat;
|
|
|
|
int m_FrameStyle;
|
2006-01-11 03:59:17 -05:00
|
|
|
wxHtmlHelpFrame* m_helpFrame;
|
|
|
|
wxHtmlHelpDialog* m_helpDialog;
|
2003-01-02 18:38:11 -05:00
|
|
|
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxHtmlHelpController);
|
1999-09-12 13:45:34 -04:00
|
|
|
};
|
|
|
|
|
2006-01-09 08:42:57 -05:00
|
|
|
/*
|
|
|
|
* wxHtmlModalHelp
|
|
|
|
* A convenience class particularly for use on wxMac,
|
|
|
|
* where you can only show modal dialogs from a modal
|
|
|
|
* dialog.
|
|
|
|
*
|
|
|
|
* Use like this:
|
|
|
|
*
|
|
|
|
* wxHtmlModalHelp help(parent, filename, topic);
|
|
|
|
*
|
|
|
|
* If topic is empty, the help contents is displayed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_HTML wxHtmlModalHelp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile, const wxString& topic = wxEmptyString,
|
|
|
|
int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL);
|
|
|
|
};
|
|
|
|
|
2001-07-04 21:27:19 -04:00
|
|
|
#endif // wxUSE_WXHTML_HELP
|
1999-09-12 13:45:34 -04:00
|
|
|
|
|
|
|
#endif // _WX_HELPCTRL_H_
|