1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/html/helpfrm.h
3 // Purpose: wxHtmlHelpFrame
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 // Copyright: (c) Harm van der Heijden and Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_HELPFRM_H_
12 #define _WX_HELPFRM_H_
18 #include "wx/helpbase.h"
19 #include "wx/html/helpdata.h"
20 #include "wx/window.h"
22 #include "wx/config.h"
23 #include "wx/splitter.h"
24 #include "wx/notebook.h"
25 #include "wx/listbox.h"
26 #include "wx/choice.h"
27 #include "wx/combobox.h"
28 #include "wx/checkbox.h"
29 #include "wx/stattext.h"
30 #include "wx/html/htmlwin.h"
31 #include "wx/html/helpwnd.h"
32 #include "wx/html/htmprint.h"
34 class WXDLLIMPEXP_FWD_CORE wxButton
;
35 class WXDLLIMPEXP_FWD_CORE wxTextCtrl
;
36 class WXDLLIMPEXP_FWD_CORE wxTreeEvent
;
37 class WXDLLIMPEXP_FWD_CORE wxTreeCtrl
;
40 // style flags for the Help Frame
41 #define wxHF_TOOLBAR 0x0001
42 #define wxHF_CONTENTS 0x0002
43 #define wxHF_INDEX 0x0004
44 #define wxHF_SEARCH 0x0008
45 #define wxHF_BOOKMARKS 0x0010
46 #define wxHF_OPEN_FILES 0x0020
47 #define wxHF_PRINT 0x0040
48 #define wxHF_FLAT_TOOLBAR 0x0080
49 #define wxHF_MERGE_BOOKS 0x0100
50 #define wxHF_ICONS_BOOK 0x0200
51 #define wxHF_ICONS_BOOK_CHAPTER 0x0400
52 #define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default
53 #define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \
54 wxHF_INDEX | wxHF_SEARCH | \
55 wxHF_BOOKMARKS | wxHF_PRINT)
57 #define wxHF_OPENFILES wxHF_OPEN_FILES
58 #define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR
59 #define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE
61 struct wxHtmlHelpMergedIndexItem
;
62 class wxHtmlHelpMergedIndex
;
64 class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase
;
65 class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController
;
66 class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow
;
68 class WXDLLIMPEXP_HTML wxHtmlHelpFrame
: public wxFrame
70 DECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame
)
73 wxHtmlHelpFrame(wxHtmlHelpData
* data
= NULL
) { Init(data
); }
74 wxHtmlHelpFrame(wxWindow
* parent
, wxWindowID wxWindowID
,
75 const wxString
& title
= wxEmptyString
,
76 int style
= wxHF_DEFAULT_STYLE
, wxHtmlHelpData
* data
= NULL
78 , wxConfigBase
*config
=NULL
, const wxString
& rootpath
= wxEmptyString
79 #endif // wxUSE_CONFIG
81 bool Create(wxWindow
* parent
, wxWindowID id
, const wxString
& title
= wxEmptyString
,
82 int style
= wxHF_DEFAULT_STYLE
84 , wxConfigBase
*config
=NULL
, const wxString
& rootpath
= wxEmptyString
85 #endif // wxUSE_CONFIG
87 virtual ~wxHtmlHelpFrame();
89 /// Returns the data associated with the window.
90 wxHtmlHelpData
* GetData() { return m_Data
; }
92 /// Returns the help controller associated with the window.
93 wxHtmlHelpController
* GetController() const { return m_helpController
; }
95 /// Sets the help controller associated with the window.
96 void SetController(wxHtmlHelpController
* controller
);
98 /// Returns the help window.
99 wxHtmlHelpWindow
* GetHelpWindow() const { return m_HtmlHelpWin
; }
101 // Sets format of title of the frame. Must contain exactly one "%s"
102 // (for title of displayed HTML page)
103 void SetTitleFormat(const wxString
& format
);
107 void UseConfig(wxConfigBase
*config
, const wxString
& rootpath
= wxEmptyString
);
108 #endif // wxUSE_CONFIG
110 // Make the help controller's frame 'modal' if
112 void AddGrabIfNeeded();
114 // Override to add custom buttons to the toolbar
115 virtual void AddToolbarButtons(wxToolBar
* WXUNUSED(toolBar
), int WXUNUSED(style
)) {}
117 void SetShouldPreventAppExit(bool enable
);
119 // we don't want to prevent the app from closing just because a help window
121 virtual bool ShouldPreventAppExit() const { return m_shouldPreventAppExit
; }
124 void Init(wxHtmlHelpData
* data
= NULL
);
126 void OnCloseWindow(wxCloseEvent
& event
);
127 void OnActivate(wxActivateEvent
& event
);
130 void OnClose(wxCommandEvent
& event
);
131 void OnAbout(wxCommandEvent
& event
);
142 wxHtmlHelpData
* m_Data
;
143 bool m_DataCreated
; // m_Data created by frame, or supplied?
144 wxString m_TitleFormat
; // title of the help frame
145 wxHtmlHelpWindow
*m_HtmlHelpWin
;
146 wxHtmlHelpController
* m_helpController
;
147 bool m_shouldPreventAppExit
;
151 DECLARE_EVENT_TABLE()
152 wxDECLARE_NO_COPY_CLASS(wxHtmlHelpFrame
);
155 #endif // wxUSE_WXHTML_HELP