]>
git.saurik.com Git - wxWidgets.git/blob - src/html/helpctrl.cpp
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 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #include "wx/html/helpctrl.h"
29 #include "wx/busyinfo.h"
31 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController
, wxEvtHandler
)
33 BEGIN_EVENT_TABLE(wxHtmlHelpController
, wxEvtHandler
)
34 EVT_CLOSE(wxHtmlHelpController::OnCloseFrame
)
37 wxHtmlHelpController::wxHtmlHelpController(int style
)
41 m_ConfigRoot
= wxEmptyString
;
42 m_titleFormat
= _("Help: %s");
46 wxHtmlHelpController::~wxHtmlHelpController()
48 WriteCustomization(m_Config
, m_ConfigRoot
);
53 void wxHtmlHelpController::SetTitleFormat(const wxString
& title
)
55 m_titleFormat
= title
;
57 m_helpFrame
->SetTitleFormat(title
);
61 bool wxHtmlHelpController::AddBook(const wxString
& book
, bool show_wait_msg
)
65 wxBusyInfo
* busy
= NULL
;
68 info
.Printf(_("Adding book %s"), book
.c_str());
69 busy
= new wxBusyInfo(info
);
72 bool retval
= m_helpData
.AddBook(book
);
80 void wxHtmlHelpController::CreateHelpWindow(bool show_progress
)
86 m_helpFrame
= new wxHtmlHelpFrame(&m_helpData
);
88 m_helpFrame
->PushEventHandler(this);
90 m_helpFrame
->UseConfig(m_Config
, m_ConfigRoot
);
91 m_helpFrame
->Create(NULL
, wxID_HTML_HELPFRAME
, wxEmptyString
, m_FrameStyle
);
92 m_helpFrame
->RefreshLists(show_progress
);
93 m_helpFrame
->SetTitleFormat(m_titleFormat
);
94 m_helpFrame
->Show(TRUE
);
97 void wxHtmlHelpController::ReadCustomization(wxConfigBase
* cfg
, const wxString
& path
)
99 /* should not be called by the user; call UseConfig, and the controller
100 * will do the rest */
102 m_helpFrame
->ReadCustomization(cfg
, path
);
105 void wxHtmlHelpController::WriteCustomization(wxConfigBase
* cfg
, const wxString
& path
)
107 /* typically called by the controllers OnCloseFrame handler */
109 m_helpFrame
->WriteCustomization(cfg
, path
);