X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d5bb85a0a4f28df1b966481de9a320806bbb1471..da6af900f1e5c9e80be4cfdaf5a94f4254261c67:/src/html/helpctrl.cpp?ds=sidebyside diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp index 51de63e771..d51344199c 100644 --- a/src/html/helpctrl.cpp +++ b/src/html/helpctrl.cpp @@ -47,9 +47,25 @@ wxHtmlHelpController::~wxHtmlHelpController() { WriteCustomization(m_Config, m_ConfigRoot); if (m_helpFrame) - m_helpFrame->Close(); + DestroyHelpWindow(); } + +void wxHtmlHelpController::DestroyHelpWindow() +{ + //if (m_Config) WriteCustomization(m_Config, m_ConfigRoot); + if (m_helpFrame) + m_helpFrame->Destroy(); +} + +void wxHtmlHelpController::OnCloseFrame(wxCloseEvent& evt) +{ + evt.Skip(); + + m_helpFrame = NULL; +} + + void wxHtmlHelpController::SetTitleFormat(const wxString& title) { m_titleFormat = title; @@ -77,19 +93,35 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) return retval; } -void wxHtmlHelpController::CreateHelpWindow(bool show_progress) + + +wxHtmlHelpFrame *wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData *data) +{ + return new wxHtmlHelpFrame(data); +} + + +void wxHtmlHelpController::CreateHelpWindow() { if (m_helpFrame) { m_helpFrame->Raise(); return ; } - m_helpFrame = new wxHtmlHelpFrame(&m_helpData); + if (m_Config == NULL) + { + m_Config = wxConfigBase::Get(FALSE); + if (m_Config != NULL) + m_ConfigRoot = _T("wxWindows/wxHtmlHelpController"); + } + + m_helpFrame = CreateHelpFrame(&m_helpData); m_helpFrame->PushEventHandler(this); + if (m_Config) m_helpFrame->UseConfig(m_Config, m_ConfigRoot); + m_helpFrame->Create(NULL, wxID_HTML_HELPFRAME, wxEmptyString, m_FrameStyle); - m_helpFrame->RefreshLists(show_progress); m_helpFrame->SetTitleFormat(m_titleFormat); m_helpFrame->Show(TRUE); } @@ -109,4 +141,13 @@ void wxHtmlHelpController::WriteCustomization(wxConfigBase* cfg, const wxString& m_helpFrame->WriteCustomization(cfg, path); } +void wxHtmlHelpController::UseConfig(wxConfigBase *config, const wxString& rootpath) +{ + m_Config = config; + m_ConfigRoot = rootpath; + if (m_helpFrame) m_helpFrame -> UseConfig(config, rootpath); + ReadCustomization(config, rootpath); +} + + #endif