]> git.saurik.com Git - wxWidgets.git/blob - include/wx/html/helpfrm.h
don't create m_dottedPen with an invalid 0 style which results in an assert under MSW
[wxWidgets.git] / include / wx / html / helpfrm.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 // RCS-ID: $Id$
8 // Copyright: (c) Harm van der Heijden and Vaclav Slavik
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_HELPFRM_H_
13 #define _WX_HELPFRM_H_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_WXHTML_HELP
18
19 #include "wx/helpbase.h"
20 #include "wx/html/helpdata.h"
21 #include "wx/window.h"
22 #include "wx/frame.h"
23 #include "wx/config.h"
24 #include "wx/splitter.h"
25 #include "wx/notebook.h"
26 #include "wx/listbox.h"
27 #include "wx/choice.h"
28 #include "wx/combobox.h"
29 #include "wx/checkbox.h"
30 #include "wx/stattext.h"
31 #include "wx/html/htmlwin.h"
32 #include "wx/html/helpwnd.h"
33 #include "wx/html/htmprint.h"
34
35 class WXDLLIMPEXP_FWD_CORE wxButton;
36 class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
37 class WXDLLIMPEXP_FWD_CORE wxTreeEvent;
38 class WXDLLIMPEXP_FWD_CORE wxTreeCtrl;
39
40
41 // style flags for the Help Frame
42 #define wxHF_TOOLBAR 0x0001
43 #define wxHF_CONTENTS 0x0002
44 #define wxHF_INDEX 0x0004
45 #define wxHF_SEARCH 0x0008
46 #define wxHF_BOOKMARKS 0x0010
47 #define wxHF_OPEN_FILES 0x0020
48 #define wxHF_PRINT 0x0040
49 #define wxHF_FLAT_TOOLBAR 0x0080
50 #define wxHF_MERGE_BOOKS 0x0100
51 #define wxHF_ICONS_BOOK 0x0200
52 #define wxHF_ICONS_BOOK_CHAPTER 0x0400
53 #define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default
54 #define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \
55 wxHF_INDEX | wxHF_SEARCH | \
56 wxHF_BOOKMARKS | wxHF_PRINT)
57 //compatibility:
58 #define wxHF_OPENFILES wxHF_OPEN_FILES
59 #define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR
60 #define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE
61
62 struct wxHtmlHelpMergedIndexItem;
63 class wxHtmlHelpMergedIndex;
64
65 class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase;
66 class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController;
67 class WXDLLIMPEXP_FWD_CORE wxHtmlHelpWindow;
68
69 class WXDLLIMPEXP_HTML wxHtmlHelpFrame : public wxFrame
70 {
71 DECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame)
72
73 public:
74 wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); }
75 wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID,
76 const wxString& title = wxEmptyString,
77 int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL,
78 wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString);
79 bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString,
80 int style = wxHF_DEFAULT_STYLE,
81 wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString);
82 virtual ~wxHtmlHelpFrame();
83
84 /// Returns the data associated with the window.
85 wxHtmlHelpData* GetData() { return m_Data; }
86
87 /// Returns the help controller associated with the window.
88 wxHtmlHelpController* GetController() const { return m_helpController; }
89
90 /// Sets the help controller associated with the window.
91 void SetController(wxHtmlHelpController* controller) { m_helpController = controller; }
92
93 /// Returns the help window.
94 wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; }
95
96 // Sets format of title of the frame. Must contain exactly one "%s"
97 // (for title of displayed HTML page)
98 void SetTitleFormat(const wxString& format);
99
100 // For compatibility
101 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
102
103 // Make the help controller's frame 'modal' if
104 // needed
105 void AddGrabIfNeeded();
106
107 // Override to add custom buttons to the toolbar
108 virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {}
109
110 // we don't want to prevent the app from closing just because a help window
111 // remains opened
112 virtual bool ShouldPreventAppExit() const;
113
114 protected:
115 void Init(wxHtmlHelpData* data = NULL);
116
117 void OnCloseWindow(wxCloseEvent& event);
118 void OnActivate(wxActivateEvent& event);
119
120 #ifdef __WXMAC__
121 void OnClose(wxCommandEvent& event);
122 void OnAbout(wxCommandEvent& event);
123 #endif
124
125 // Images:
126 enum {
127 IMG_Book = 0,
128 IMG_Folder,
129 IMG_Page
130 };
131
132 protected:
133 wxHtmlHelpData* m_Data;
134 bool m_DataCreated; // m_Data created by frame, or supplied?
135 wxString m_TitleFormat; // title of the help frame
136 wxHtmlHelpWindow *m_HtmlHelpWin;
137 wxHtmlHelpController* m_helpController;
138
139 private:
140
141 DECLARE_EVENT_TABLE()
142 DECLARE_NO_COPY_CLASS(wxHtmlHelpFrame)
143 };
144
145 #endif // wxUSE_WXHTML_HELP
146
147 #endif