]>
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 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController
, wxEvtHandler
)
34 BEGIN_EVENT_TABLE(wxHtmlHelpController
, wxEvtHandler
)
35 EVT_CLOSE(wxHtmlHelpController::OnCloseFrame
)
38 wxHtmlHelpController::wxHtmlHelpController()
42 m_ConfigRoot
= wxEmptyString
;
43 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
);
60 bool wxHtmlHelpController::AddBook(const wxString
& book
, bool show_wait_msg
)
67 info
.Printf(_("Adding book %s"), book
.c_str());
68 busy
= new wxBusyInfo(info
);
71 bool retval
= m_helpData
.AddBook(book
);
79 void wxHtmlHelpController::CreateHelpWindow(bool show_progress
)
85 m_helpFrame
= new wxHtmlHelpFrame(&m_helpData
);
86 m_helpFrame
->PushEventHandler(this);
88 m_helpFrame
->UseConfig(m_Config
, m_ConfigRoot
);
89 m_helpFrame
->Create(NULL
, wxID_HTML_HELPFRAME
);
90 m_helpFrame
->RefreshLists(show_progress
);
91 m_helpFrame
->SetTitleFormat(m_titleFormat
);
92 m_helpFrame
->Show(TRUE
);
95 void wxHtmlHelpController::ReadCustomization(wxConfigBase
* cfg
, const wxString
& path
)
97 /* should not be called by the user; call UseConfig, and the controller
100 m_helpFrame
->ReadCustomization(cfg
, path
);
103 void wxHtmlHelpController::WriteCustomization(wxConfigBase
* cfg
, const wxString
& path
)
105 /* typically called by the controllers OnCloseFrame handler */
107 m_helpFrame
->WriteCustomization(cfg
, path
);