bbtkWxGUIHtmlBrowser.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkWxGUIHtmlBrowser.h,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:15 $
00006   Version:   $Revision: 1.6 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00031 
00047 #ifdef _USE_WXWIDGETS_
00048 
00049 
00050 #ifndef __bbtkWxGUIHtmlBrowser_h_INCLUDED__
00051 #define __bbtkWxGUIHtmlBrowser_h_INCLUDED__
00052 
00053 #include "bbtkWx.h"
00054 #include <wx/html/htmlwin.h>
00055 
00056 namespace bbtk
00057 {
00058 
00059   class WxGUIHtmlBrowser;
00060 
00061   class WxHtmlWindow : public virtual wxHtmlWindow
00062   {
00063   public:
00064     WxHtmlWindow( wxWindow *parent, int id, WxGUIHtmlBrowser* browser, wxSize size) 
00065       : wxHtmlWindow(parent, id, 
00066                      wxDefaultPosition, 
00067                      size,
00068                      wxHW_SCROLLBAR_AUTO, 
00069                   _T("bbtk::WxGUIHtmlBrowser")),
00070               mBrowser(browser)
00071     {
00072      SetBorders(30);
00073     };
00074     //    wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,const wxString& url, wxString *redirect);
00075 //EED    virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
00076 
00077 //EED2  void OnSize( wxSizeEvent&);
00078 
00079 
00080   private: 
00081     WxGUIHtmlBrowser* mBrowser;
00082 
00083    // any class wishing to process wxWidgets events must use this macro
00084 //EED2    DECLARE_EVENT_TABLE()  
00085 
00086   };
00087 
00088   
00090   class WxGUIHtmlBrowserUser 
00091   {
00092   public :
00093     WxGUIHtmlBrowserUser() {}
00094     virtual ~WxGUIHtmlBrowserUser() {}
00095     
00096     virtual bool WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target) 
00097     { return true; }
00098   };
00099   
00100  
00101 
00102   // class WxGUIConsole;
00103 
00104   
00105   class BBTK_EXPORT WxGUIHtmlBrowser : public wxPanel
00106   {
00107   public:
00108     WxGUIHtmlBrowser ( wxWindow *parent, wxSize size, 
00109                        WxGUIHtmlBrowserUser* = 0 );
00110  
00111     bool GoTo(std::string&);
00112     void GoHome();
00113 
00114     void OnBackButton(wxCommandEvent& );
00115     void OnForwardButton(wxCommandEvent& );
00116     void OnHomeButton(wxCommandEvent& );
00117     void OnReloadButton(wxCommandEvent& );
00118     //   void OnRunButton(wxCommandEvent& );
00119     void OnLinkClicked(wxHtmlLinkEvent& );
00120     void OnURLEnter( wxCommandEvent&);
00121     void OnSize( wxSizeEvent&);
00122 
00123     void UpdateURL();
00124     //  void OnCell(wxHtmlCellEvent& );
00125 
00126     void SetSize( wxSize );
00127 
00128     std::string GetCurrentPage();
00129 
00130   private:
00131     WxHtmlWindow* mwxHtmlWindow;
00132     wxTextCtrl* mwxURL;
00133     wxButton* mwxBackButton;
00134     wxButton* mwxForwardButton;
00135     wxButton* mwxHomeButton;
00136     wxButton* mwxReloadButton;
00137     //    wxButton* mwxRunButton;
00138     
00139     WxGUIHtmlBrowserUser* mUser;
00140     
00141    // any class wishing to process wxWidgets events must use this macro
00142     DECLARE_EVENT_TABLE()  
00143   };
00144 
00145 }
00146 #endif
00147 
00148 #endif

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6