]>
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
9 // Copyright: (c) Harm van der Heijden and Vaclav Slavik
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
14 #pragma implementation "helpctrl.h"
17 // For compilers that support precompilation, includes "wx.h".
18 #include "wx/wxprec.h"
28 #include "wx/html/helpctrl.h"
30 #include "wx/busyinfo.h"
32 BEGIN_EVENT_TABLE(wxHtmlHelpController
, wxEvtHandler
)
33 EVT_CLOSE(wxHtmlHelpController::OnCloseFrame
)
36 wxHtmlHelpController::wxHtmlHelpController()
40 m_ConfigRoot
= wxEmptyString
;
41 m_titleFormat
= _("Help: %s");
44 wxHtmlHelpController::~wxHtmlHelpController()
46 WriteCustomization(m_Config
, m_ConfigRoot
);
51 void wxHtmlHelpController::SetTitleFormat(const wxString
& title
)
53 m_titleFormat
= title
;
55 m_helpFrame
->SetTitleFormat(title
);
58 bool wxHtmlHelpController::AddBook(const wxString
& book
, bool show_wait_msg
)
65 info
.Printf(_("Adding book %s"), book
.c_str());
66 busy
= new wxBusyInfo(info
);
69 bool retval
= m_helpData
.AddBook(book
);
77 void wxHtmlHelpController::CreateHelpWindow(bool show_progress
)
83 m_helpFrame
= new wxHtmlHelpFrame(&m_helpData
);
84 m_helpFrame
->PushEventHandler(this);
86 m_helpFrame
->UseConfig(m_Config
, m_ConfigRoot
);
87 m_helpFrame
->Create(NULL
, wxID_HTML_HELPFRAME
);
88 m_helpFrame
->RefreshLists(show_progress
);
89 m_helpFrame
->SetTitleFormat(m_titleFormat
);
90 m_helpFrame
->Show(TRUE
);
93 void wxHtmlHelpController::ReadCustomization(wxConfigBase
* cfg
, const wxString
& path
)
95 /* should not be called by the user; call UseConfig, and the controller
98 m_helpFrame
->ReadCustomization(cfg
, path
);
101 void wxHtmlHelpController::WriteCustomization(wxConfigBase
* cfg
, const wxString
& path
)
103 /* typically called by the controllers OnCloseFrame handler */
105 m_helpFrame
->WriteCustomization(cfg
, path
);