X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9df05aab59ad8ff0e3cf5556e8273c72c0fc5203..64ea838d8f4d1853b7d850db93ee565e901d099a:/src/html/helpctrl.cpp?ds=inline diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp index c70f5f24aa..af46650fa4 100644 --- a/src/html/helpctrl.cpp +++ b/src/html/helpctrl.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: helpctrl.cpp +// Name: src/html/helpctrl.cpp // Purpose: wxHtmlHelpController // Notes: Based on htmlhelp.cpp, implementing a monolithic // HTML Help controller class, by Vaclav Slavik @@ -42,20 +42,37 @@ IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxHelpControllerBase) wxHtmlHelpController::wxHtmlHelpController(int style, wxWindow* parentWindow): wxHelpControllerBase(parentWindow) +{ + Init(style); +} + +wxHtmlHelpController::wxHtmlHelpController(wxWindow* parentWindow, int style): + wxHelpControllerBase(parentWindow) +{ + Init(style); +} + +void wxHtmlHelpController::Init(int style) { m_helpWindow = NULL; m_helpFrame = NULL; m_helpDialog = NULL; +#if wxUSE_CONFIG m_Config = NULL; m_ConfigRoot = wxEmptyString; +#endif // wxUSE_CONFIG m_titleFormat = _("Help: %s"); m_FrameStyle = style; + m_shouldPreventAppExit = false; } + wxHtmlHelpController::~wxHtmlHelpController() { +#if wxUSE_CONFIG if (m_Config) WriteCustomization(m_Config, m_ConfigRoot); +#endif // wxUSE_CONFIG if (m_helpWindow) DestroyHelpWindow(); } @@ -85,8 +102,10 @@ void wxHtmlHelpController::DestroyHelpWindow() void wxHtmlHelpController::OnCloseFrame(wxCloseEvent& evt) { +#if wxUSE_CONFIG if (m_Config) WriteCustomization(m_Config, m_ConfigRoot); +#endif // wxUSE_CONFIG evt.Skip(); @@ -99,6 +118,13 @@ void wxHtmlHelpController::OnCloseFrame(wxCloseEvent& evt) m_helpFrame = NULL; } +void wxHtmlHelpController::SetShouldPreventAppExit(bool enable) +{ + m_shouldPreventAppExit = enable; + if ( m_helpFrame ) + m_helpFrame->SetShouldPreventAppExit(enable); +} + void wxHtmlHelpController::SetTitleFormat(const wxString& title) { m_titleFormat = title; @@ -151,8 +177,13 @@ wxHtmlHelpFrame* wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData *data) { wxHtmlHelpFrame* frame = new wxHtmlHelpFrame(data); frame->SetController(this); - frame->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle, m_Config, m_ConfigRoot); + frame->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle +#if wxUSE_CONFIG + , m_Config, m_ConfigRoot +#endif // wxUSE_CONFIG + ); frame->SetTitleFormat(m_titleFormat); + frame->SetShouldPreventAppExit(m_shouldPreventAppExit); m_helpFrame = frame; return frame; } @@ -180,12 +211,14 @@ wxWindow* wxHtmlHelpController::CreateHelpWindow() return m_helpWindow; } +#if wxUSE_CONFIG if (m_Config == NULL) { m_Config = wxConfigBase::Get(false); if (m_Config != NULL) - m_ConfigRoot = _T("wxWindows/wxHtmlHelpController"); + m_ConfigRoot = wxT("wxWindows/wxHtmlHelpController"); } +#endif // wxUSE_CONFIG if (m_FrameStyle & wxHF_DIALOG) { @@ -207,6 +240,7 @@ wxWindow* wxHtmlHelpController::CreateHelpWindow() return m_helpWindow; } +#if wxUSE_CONFIG void wxHtmlHelpController::ReadCustomization(wxConfigBase* cfg, const wxString& path) { /* should not be called by the user; call UseConfig, and the controller @@ -229,6 +263,7 @@ void wxHtmlHelpController::UseConfig(wxConfigBase *config, const wxString& rootp if (m_helpWindow) m_helpWindow->UseConfig(config, rootpath); ReadCustomization(config, rootpath); } +#endif // wxUSE_CONFIG //// Backward compatibility with wxHelpController API @@ -306,12 +341,12 @@ void wxHtmlHelpController::SetHelpWindow(wxHtmlHelpWindow* helpWindow) helpWindow->SetController(this); } -void wxHtmlHelpController::SetFrameParameters(const wxString& title, +void wxHtmlHelpController::SetFrameParameters(const wxString& titleFormat, const wxSize& size, const wxPoint& pos, bool WXUNUSED(newFrameEachTime)) { - SetTitleFormat(title); + SetTitleFormat(titleFormat); wxHtmlHelpFrame* frame = wxDynamicCast(FindTopLevelWindow(), wxHtmlHelpFrame); wxHtmlHelpDialog* dialog = wxDynamicCast(FindTopLevelWindow(), wxHtmlHelpDialog); if (frame)