]> git.saurik.com Git - wxWidgets.git/blob - include/wx/html/helpctrl.h
avoid a bug in Carbon headers
[wxWidgets.git] / include / wx / html / helpctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: helpctrl.h
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
7 // RCS-ID: $Id$
8 // Copyright: (c) Harm van der Heijden and Vaclav Slavik
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_HELPCTRL_H_
13 #define _WX_HELPCTRL_H_
14
15 #include "wx/defs.h"
16
17 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
18 #pragma interface "helpctrl.h"
19 #endif
20
21 #if wxUSE_WXHTML_HELP
22
23 #include "wx/html/helpfrm.h"
24 #include "wx/helpbase.h"
25
26 #define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
27
28 class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler
29 {
30 DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
31
32 public:
33 wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE);
34 virtual ~wxHtmlHelpController();
35
36 void SetTitleFormat(const wxString& format);
37 void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
38 bool AddBook(const wxString& book_url, bool show_wait_msg = FALSE);
39 bool AddBook(const wxFileName& book_file, bool show_wait_msg = FALSE);
40
41 bool Display(const wxString& x);
42 bool Display(int id);
43 bool DisplayContents();
44 bool DisplayIndex();
45 bool KeywordSearch(const wxString& keyword);
46
47 wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
48 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
49
50 // Assigns config object to the Ctrl. This config is then
51 // used in subsequent calls to Read/WriteCustomization of both help
52 // Ctrl and it's wxHtmlWindow
53 virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
54 virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
55
56 //// Backward compatibility with wxHelpController API
57
58 virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); }
59 virtual bool Initialize(const wxString& file);
60 virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
61 virtual bool LoadFile(const wxString& file = wxT(""));
62 virtual bool DisplaySection(int sectionNo);
63 virtual bool DisplaySection(const wxString& section) { return Display(section); }
64 virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); }
65 virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
66
67 virtual void SetFrameParameters(const wxString& title,
68 const wxSize& size,
69 const wxPoint& pos = wxDefaultPosition,
70 bool newFrameEachTime = FALSE);
71 /// Obtains the latest settings used by the help frame and the help
72 /// frame.
73 virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
74 wxPoint *pos = NULL,
75 bool *newFrameEachTime = NULL);
76
77 // Get direct access to help data:
78 wxHtmlHelpData *GetHelpData() { return &m_helpData; }
79
80 virtual bool Quit() ;
81 virtual void OnQuit() {};
82
83 void OnCloseFrame(wxCloseEvent& evt);
84
85 // Make the help controller's frame 'modal' if
86 // needed
87 void AddGrabIfNeeded();
88
89 protected:
90 virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data);
91
92 virtual void CreateHelpWindow();
93 virtual void DestroyHelpWindow();
94
95 wxHtmlHelpData m_helpData;
96 wxHtmlHelpFrame* m_helpFrame;
97 wxConfigBase * m_Config;
98 wxString m_ConfigRoot;
99 wxString m_titleFormat;
100 int m_FrameStyle;
101 // DECLARE_EVENT_TABLE()
102
103 DECLARE_NO_COPY_CLASS(wxHtmlHelpController)
104 };
105
106 #endif // wxUSE_WXHTML_HELP
107
108 #endif // _WX_HELPCTRL_H_