X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/20a8b34e2c6d43140cb8b38482536a49ed7e0e7a..f41cb81efc453b1da2e29078ef95c64016532cf3:/src/generic/helpwxht.cpp diff --git a/src/generic/helpwxht.cpp b/src/generic/helpwxht.cpp index 2dc02e2b10..9218355067 100644 --- a/src/generic/helpwxht.cpp +++ b/src/generic/helpwxht.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: helpext.cpp -// Purpose: an external help controller for wxWindows +// Name: helpwxht.cpp +// Purpose: A help controller using the wxHTML classes // Author: Karsten Ballueder // Modified by: // Created: 04/01/98 @@ -19,14 +19,16 @@ # pragma hdrstop #endif -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifndef WX_PRECOMP -# include "wx/string.h" -# include "wx/utils.h" -# include "wx/list.h" -# include "wx/intl.h" -# include "wx/layout.h" + #include "wx/string.h" + #include "wx/utils.h" + #include "wx/list.h" + #include "wx/intl.h" + #include "wx/layout.h" + #include "wx/combobox.h" + #include "wx/button.h" #endif #include "wx/helpbase.h" @@ -35,9 +37,11 @@ #include #include +#ifndef __MWERKS__ #include +#endif -#ifndef __WINDOWS__ +#if !defined(__WINDOWS__) && !defined(__OS2__) # include #endif @@ -52,22 +56,22 @@ IMPLEMENT_CLASS(wxHelpControllerHtml, wxHTMLHelpControllerBase) class wxForceHtmlFilter : public wxHtmlFilter { public: - virtual wxString ReadFile(const wxFSFile& file) + virtual wxString ReadFile(const wxFSFile& file) const { wxInputStream *s = file.GetStream(); char *src; wxString doc; if (s == NULL) return wxEmptyString; - src = new char[s -> StreamSize()+1]; - src[s -> StreamSize()] = 0; - s -> Read(src, s -> StreamSize()); + src = new char[s -> GetSize()+1]; + src[s -> GetSize()] = 0; + s -> Read(src, s -> GetSize()); doc = src; delete [] src; return doc; } - - virtual bool CanRead(const wxFSFile& file) + + virtual bool CanRead(const wxFSFile& file) const { wxString filename = file.GetLocation(); if(filename.Length() >= 5 && @@ -155,7 +159,7 @@ wxHelpFrame::wxHelpFrame(wxWindow *parent, int id, wxButton *btn_contents = new wxButton(this, m_IdContents, _("Contents")); m_combo = new wxComboBox(this, m_IdCombo); wxButton *btn_search = new wxButton(this, m_IdSearch, _("Search")); - + m_filter = new wxForceHtmlFilter; wxLayoutConstraints *c; @@ -173,7 +177,7 @@ wxHelpFrame::wxHelpFrame(wxWindow *parent, int id, c->top.SameAs(this, wxTop, 2*LAYOUT_Y_MARGIN); c->height.AsIs(); btn_fwd->SetConstraints(c); - + c = new wxLayoutConstraints; c->left.SameAs(btn_fwd, wxRight, 2*LAYOUT_X_MARGIN); c->width.Absolute(BUTTON_WIDTH); @@ -204,11 +208,18 @@ wxHelpFrame::wxHelpFrame(wxWindow *parent, int id, m_htmlwin->SetConstraints(c); SetAutoLayout(TRUE); CreateStatusBar(); - + m_htmlwin->SetRelatedFrame(this, title); m_htmlwin->SetRelatedStatusBar(0); m_htmlwin->AddFilter(m_filter); +#ifdef __WXMOTIF__ + // Motif needs a nudge to get it to resize properly + // when shown + wxSizeEvent event(size, GetId()); + GetEventHandler()->ProcessEvent(event); +#endif + Show(TRUE); } @@ -217,7 +228,7 @@ wxHelpFrame::~wxHelpFrame() } void -wxHelpFrame::OnClose(wxCloseEvent &ev) +wxHelpFrame::OnClose(wxCloseEvent &WXUNUSED(ev)) { wxASSERT(m_controller); m_controller->m_Frame = NULL; @@ -256,7 +267,7 @@ wxHelpControllerHtml::~wxHelpControllerHtml(void) #endif bool -wxHelpControllerHtml::DisplayHelp(wxString const &relativeURL) +wxHelpControllerHtml::DisplayHelp(const wxString &relativeURL) { wxBusyCursor b; // display a busy cursor @@ -293,14 +304,15 @@ wxHelpControllerHtml::SetFrameParameters(const wxString &title, m_NewFrameEachTime = newFrame; } -void -wxHelpControllerHtml::GetFrameParameters(wxSize *size = NULL, - wxPoint *pos = NULL, - bool *newframe = NULL) +wxFrame * +wxHelpControllerHtml::GetFrameParameters(wxSize *size, + wxPoint *pos, + bool *newframe) { if(size) *size = m_FrameSize; if(pos) *pos = m_FramePosition; if(newframe) *newframe = m_NewFrameEachTime; + return m_Frame; } #endif // wxUSE_HTML