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/11/24 15:45:48 $
00006   Version:   $Revision: 1.7 $
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 
00062   class WxHtmlWindow : public virtual wxHtmlWindow
00063   {
00064   public:
00065     WxHtmlWindow( wxWindow *parent, int id, WxGUIHtmlBrowser* browser, wxSize size) 
00066       : wxHtmlWindow(parent, id, 
00067                      wxDefaultPosition, 
00068                      size,
00069                      wxHW_SCROLLBAR_AUTO, 
00070                   _T("bbtk::WxGUIHtmlBrowser")),
00071               mBrowser(browser)
00072     {
00073                 std::cout << "ctor"<<std::endl;
00074      SetBorders(30);
00075     };
00076     //    wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,const wxString& url, wxString *redirect);
00077 //   virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
00078 
00079 //EED2  void OnSize( wxSizeEvent&);
00080 
00081 
00082   private: 
00083     WxGUIHtmlBrowser* mBrowser;
00084 
00085    // any class wishing to process wxWidgets events must use this macro
00086 //EED2    DECLARE_EVENT_TABLE()  
00087 
00088   };
00089 
00090 //      typedef wxHtmlWindow WxHtmlWindow;
00091   
00092         
00093 #define THE_HTML_WINDOW_CLASS wxHtmlWindow
00094         
00096   class WxGUIHtmlBrowserUser 
00097   {
00098   public :
00099     WxGUIHtmlBrowserUser() {}
00100     virtual ~WxGUIHtmlBrowserUser() {}
00101     
00102     virtual bool WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target) 
00103     { return true; }
00104   };
00105   
00106  
00107 
00108   // class WxGUIConsole;
00109 
00110   
00111   class BBTK_EXPORT WxGUIHtmlBrowser : public wxPanel
00112   {
00113   public:
00114     WxGUIHtmlBrowser ( wxWindow *parent, wxSize size, 
00115                        WxGUIHtmlBrowserUser* = 0 );
00116  
00117     bool GoTo(std::string&);
00118     void GoHome();
00119 
00120     void OnBackButton(wxCommandEvent& );
00121     void OnForwardButton(wxCommandEvent& );
00122     void OnHomeButton(wxCommandEvent& );
00123     void OnReloadButton(wxCommandEvent& );
00124     //   void OnRunButton(wxCommandEvent& );
00125     void OnLinkClicked(wxHtmlLinkEvent& );
00126         void OnLinkClicked2(const wxHtmlLinkInfo& );
00127     void OnURLEnter( wxCommandEvent&);
00128     void OnSize( wxSizeEvent&);
00129 
00130     void UpdateURL();
00131     //  void OnCell(wxHtmlCellEvent& );
00132 
00133     void SetSize( wxSize );
00134 
00135     std::string GetCurrentPage();
00136 
00137   private:
00138     THE_HTML_WINDOW_CLASS * mwxHtmlWindow;
00139     wxTextCtrl* mwxURL;
00140     wxButton* mwxBackButton;
00141     wxButton* mwxForwardButton;
00142     wxButton* mwxHomeButton;
00143     wxButton* mwxReloadButton;
00144     //    wxButton* mwxRunButton;
00145     
00146     WxGUIHtmlBrowserUser* mUser;
00147     
00148    // any class wishing to process wxWidgets events must use this macro
00149     DECLARE_EVENT_TABLE()  
00150   };
00151 
00152 }
00153 #endif
00154 
00155 #endif

Generated on Thu May 31 14:12:03 2012 for BBTK by  doxygen 1.5.7.1