]>
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()
41 m_ConfigRoot
= wxEmptyString
;
42 m_titleFormat
= _("Help: %s");
45 wxHtmlHelpController::~wxHtmlHelpController()
47 WriteCustomization(m_Config
, m_ConfigRoot
);
52 void wxHtmlHelpController::SetTitleFormat(const wxString
& title
)
54 m_titleFormat
= title
;
56 m_helpFrame
->SetTitleFormat(title
);
59 bool wxHtmlHelpController::AddBook(const wxString
& book
, bool show_wait_msg
)
63 wxBusyInfo
* busy
= NULL
;
66 info
.Printf(_("Adding book %s"), book
.c_str());
67 busy
= new wxBusyInfo(info
);
70 bool retval
= m_helpData
.AddBook(book
);
78 void wxHtmlHelpController::CreateHelpWindow(bool show_progress
)
84 m_helpFrame
= new wxHtmlHelpFrame(&m_helpData
);
85 m_helpFrame
->PushEventHandler(this);
87 m_helpFrame
->UseConfig(m_Config
, m_ConfigRoot
);
88 m_helpFrame
->Create(NULL
, wxID_HTML_HELPFRAME
);
89 m_helpFrame
->RefreshLists(show_progress
);
90 m_helpFrame
->SetTitleFormat(m_titleFormat
);
91 m_helpFrame
->Show(TRUE
);
94 void wxHtmlHelpController::ReadCustomization(wxConfigBase
* cfg
, const wxString
& path
)
96 /* should not be called by the user; call UseConfig, and the controller
99 m_helpFrame
->ReadCustomization(cfg
, path
);
102 void wxHtmlHelpController::WriteCustomization(wxConfigBase
* cfg
, const wxString
& path
)
104 /* typically called by the controllers OnCloseFrame handler */
106 m_helpFrame
->WriteCustomization(cfg
, path
);