1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxHtmlHelpController
4 // Notes: Based on htmlhelp.cpp, implementing a monolithic
5 // HTML Help controller class, by Vaclav Slavik
6 // Author: Harm van der Heijden and Vaclav Slavik
8 // Copyright: (c) Harm van der Heijden and Vaclav Slavik
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_HELPCTRL_H_
13 #define _WX_HELPCTRL_H_
18 #pragma interface "helpctrl.h"
23 #include "wx/html/helpfrm.h"
24 #include "wx/helpbase.h"
26 #define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
28 class WXDLLEXPORT wxHtmlHelpController
: public wxHelpControllerBase
// wxEvtHandler
30 DECLARE_DYNAMIC_CLASS(wxHtmlHelpController
)
33 wxHtmlHelpController(int style
= wxHF_DEFAULT_STYLE
);
34 virtual ~wxHtmlHelpController();
36 void SetTitleFormat(const wxString
& format
);
37 void SetTempDir(const wxString
& path
) { m_helpData
.SetTempDir(path
); }
38 bool AddBook(const wxString
& book
, bool show_wait_msg
= FALSE
);
39 bool Display(const wxString
& x
)
41 CreateHelpWindow(); return m_helpFrame
->Display(x
);
45 CreateHelpWindow(); return m_helpFrame
->Display(id
);
47 bool DisplayContents()
49 CreateHelpWindow(); return m_helpFrame
->DisplayContents();
53 CreateHelpWindow(); return m_helpFrame
->DisplayIndex();
55 bool KeywordSearch(const wxString
& keyword
)
57 CreateHelpWindow(); return m_helpFrame
->KeywordSearch(keyword
);
59 wxHtmlHelpFrame
* GetFrame() { return m_helpFrame
; }
60 void UseConfig(wxConfigBase
*config
, const wxString
& rootpath
= wxEmptyString
);
62 // Assigns config object to the Ctrl. This config is then
63 // used in subsequent calls to Read/WriteCustomization of both help
64 // Ctrl and it's wxHtmlWindow
65 virtual void ReadCustomization(wxConfigBase
*cfg
, const wxString
& path
= wxEmptyString
);
66 virtual void WriteCustomization(wxConfigBase
*cfg
, const wxString
& path
= wxEmptyString
);
68 //// Backward compatibility with wxHelpController API
70 virtual bool Initialize(const wxString
& file
, int WXUNUSED(server
) ) { return Initialize(file
); }
71 virtual bool Initialize(const wxString
& file
);
72 virtual void SetViewer(const wxString
& WXUNUSED(viewer
), long WXUNUSED(flags
) = 0) {}
73 virtual bool LoadFile(const wxString
& file
= "");
74 virtual bool DisplaySection(int sectionNo
);
75 virtual bool DisplaySection(const wxString
& section
) { return Display(section
); }
76 virtual bool DisplayBlock(long blockNo
) { return DisplaySection(blockNo
); }
77 virtual bool DisplayTextPopup(const wxString
& text
, const wxPoint
& pos
);
79 virtual void SetFrameParameters(const wxString
& title
,
81 const wxPoint
& pos
= wxDefaultPosition
,
82 bool newFrameEachTime
= FALSE
);
83 /// Obtains the latest settings used by the help frame and the help
85 virtual wxFrame
*GetFrameParameters(wxSize
*size
= NULL
,
87 bool *newFrameEachTime
= NULL
);
89 // Get direct access to help data:
90 wxHtmlHelpData
*GetHelpData() { return &m_helpData
; }
93 virtual void OnQuit() {};
95 void OnCloseFrame(wxCloseEvent
& evt
);
98 virtual wxHtmlHelpFrame
* CreateHelpFrame(wxHtmlHelpData
*data
);
100 virtual void CreateHelpWindow();
101 virtual void DestroyHelpWindow();
103 wxHtmlHelpData m_helpData
;
104 wxHtmlHelpFrame
* m_helpFrame
;
105 wxConfigBase
* m_Config
;
106 wxString m_ConfigRoot
;
107 wxString m_titleFormat
;
109 // DECLARE_EVENT_TABLE()
114 #endif // _WX_HELPCTRL_H_