]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/helpwxht.cpp
moved wxDash typedef to gdicmn.h
[wxWidgets.git] / src / generic / helpwxht.cpp
index e6210c9e1339a3243f340112aadb8988c22bd24e..955dcd87e8f2d31fdf5fd018d3390b2c1ef7a0bf 100644 (file)
@@ -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
 // Author:      Karsten Ballueder
 // Modified by:
 // Created:     04/01/98
@@ -27,6 +27,7 @@
 #   include "wx/list.h"
 #   include "wx/intl.h"
 #   include "wx/layout.h"
 #   include "wx/list.h"
 #   include "wx/intl.h"
 #   include "wx/layout.h"
+#   include "wx/combobox.h"
 #endif
 
 #include "wx/helpbase.h"
 #endif
 
 #include "wx/helpbase.h"
 
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>
+#ifndef __MWERKS__
 #include <sys/stat.h>
 #include <sys/stat.h>
+#endif
 
 
-#ifndef __WINDOWS__
+#if !defined(__WINDOWS__) && !defined(__OS2__)
 #   include   <unistd.h>
 #endif
 
 #   include   <unistd.h>
 #endif
 
@@ -52,22 +55,22 @@ IMPLEMENT_CLASS(wxHelpControllerHtml, wxHTMLHelpControllerBase)
 class wxForceHtmlFilter : public wxHtmlFilter
 {
 public:
 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;
       {
          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;
       }
          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 &&
       {
          wxString filename = file.GetLocation();
          if(filename.Length() >= 5 &&
@@ -155,7 +158,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"));
    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;
    m_filter = new wxForceHtmlFilter;
 
    wxLayoutConstraints *c;
@@ -173,7 +176,7 @@ wxHelpFrame::wxHelpFrame(wxWindow *parent, int id,
    c->top.SameAs(this, wxTop, 2*LAYOUT_Y_MARGIN);
    c->height.AsIs();
    btn_fwd->SetConstraints(c);
    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);
    c = new wxLayoutConstraints;
    c->left.SameAs(btn_fwd, wxRight, 2*LAYOUT_X_MARGIN);
    c->width.Absolute(BUTTON_WIDTH);
@@ -204,21 +207,27 @@ wxHelpFrame::wxHelpFrame(wxWindow *parent, int id,
    m_htmlwin->SetConstraints(c);
    SetAutoLayout(TRUE);
    CreateStatusBar();
    m_htmlwin->SetConstraints(c);
    SetAutoLayout(TRUE);
    CreateStatusBar();
+
    m_htmlwin->SetRelatedFrame(this, title);
    m_htmlwin->SetRelatedStatusBar(0);
    m_htmlwin->AddFilter(m_filter);
 
    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);
 }
 
 wxHelpFrame::~wxHelpFrame()
 {
    Show(TRUE);
 }
 
 wxHelpFrame::~wxHelpFrame()
 {
-//   delete m_filter;
 }
 
 void
 }
 
 void
-wxHelpFrame::OnClose(wxCloseEvent &ev)
+wxHelpFrame::OnClose(wxCloseEvent &WXUNUSED(ev))
 {
    wxASSERT(m_controller);
    m_controller->m_Frame = NULL;
 {
    wxASSERT(m_controller);
    m_controller->m_Frame = NULL;
@@ -294,14 +303,15 @@ wxHelpControllerHtml::SetFrameParameters(const wxString &title,
    m_NewFrameEachTime = newFrame;
 }
 
    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;
 {
    if(size) *size = m_FrameSize;
    if(pos) *pos = m_FramePosition;
    if(newframe) *newframe = m_NewFrameEachTime;
+   return m_Frame;
 }
 
 #endif // wxUSE_HTML
 }
 
 #endif // wxUSE_HTML