]>
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
);
54 void wxHtmlHelpController::DestroyHelpWindow()
56 //if (m_Config) WriteCustomization(m_Config, m_ConfigRoot);
58 m_helpFrame
->Destroy();
61 void wxHtmlHelpController::OnCloseFrame(wxCloseEvent
& evt
)
69 void wxHtmlHelpController::SetTitleFormat(const wxString
& title
)
71 m_titleFormat
= title
;
73 m_helpFrame
->SetTitleFormat(title
);
77 bool wxHtmlHelpController::AddBook(const wxString
& book
, bool show_wait_msg
)
81 wxBusyInfo
* busy
= NULL
;
84 info
.Printf(_("Adding book %s"), book
.c_str());
85 busy
= new wxBusyInfo(info
);
88 bool retval
= m_helpData
.AddBook(book
);
98 wxHtmlHelpFrame
*wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData
*data
)
100 return new wxHtmlHelpFrame(data
);
104 void wxHtmlHelpController::CreateHelpWindow()
107 m_helpFrame
->Raise();
111 if (m_Config
== NULL
)
113 m_Config
= wxConfigBase::Get(FALSE
);
114 if (m_Config
!= NULL
)
115 m_ConfigRoot
= _T("wxWindows/wxHtmlHelpController");
118 m_helpFrame
= CreateHelpFrame(&m_helpData
);
119 m_helpFrame
->PushEventHandler(this);
122 m_helpFrame
->UseConfig(m_Config
, m_ConfigRoot
);
124 m_helpFrame
->Create(NULL
, wxID_HTML_HELPFRAME
, wxEmptyString
, m_FrameStyle
);
125 m_helpFrame
->SetTitleFormat(m_titleFormat
);
126 m_helpFrame
->Show(TRUE
);
129 void wxHtmlHelpController::ReadCustomization(wxConfigBase
* cfg
, const wxString
& path
)
131 /* should not be called by the user; call UseConfig, and the controller
132 * will do the rest */
134 m_helpFrame
->ReadCustomization(cfg
, path
);
137 void wxHtmlHelpController::WriteCustomization(wxConfigBase
* cfg
, const wxString
& path
)
139 /* typically called by the controllers OnCloseFrame handler */
141 m_helpFrame
->WriteCustomization(cfg
, path
);