]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxGUIHtmlBrowser.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkWxGUIHtmlBrowser.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkWxGUIHtmlBrowser.h,v $
5   Language:  C++
6   Date:      $Date: 2008/03/21 14:59:39 $
7   Version:   $Revision: 1.2 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*//**
18  * \brief Short description in one line
19  * 
20  * Long description which 
21  * can span multiple lines
22  */
23 /**
24  * \file 
25  * \brief 
26  */
27 /**
28  * \class bbtk::
29  * \brief 
30  */
31
32 #ifdef _USE_WXWIDGETS_
33
34
35 #ifndef __bbtkWxGUIHtmlBrowser_h_INCLUDED__
36 #define __bbtkWxGUIHtmlBrowser_h_INCLUDED__
37
38 #include "bbtkWx.h"
39 #include <wx/html/htmlwin.h>
40
41 namespace bbtk
42 {
43
44   class WxGUIHtmlBrowser;
45
46   class WxHtmlWindow : public virtual wxHtmlWindow
47   {
48   public:
49     WxHtmlWindow( wxWindow *parent, int id, WxGUIHtmlBrowser* browser, wxSize size) 
50       : wxHtmlWindow(parent, id, 
51                      wxDefaultPosition, 
52                      size,
53                      wxHW_SCROLLBAR_AUTO, 
54                   _T("bbtk::WxGUIHtmlBrowser")),
55               mBrowser(browser)
56     {
57      
58     }
59     //    wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,const wxString& url, wxString *redirect);
60 //EED    virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
61
62   private: 
63     WxGUIHtmlBrowser* mBrowser;
64
65
66   };
67
68   
69   /// Abstract class which defines the callbacks invoked by WxGUIHtmlBrowser
70   class WxGUIHtmlBrowserUser 
71   {
72   public :
73     WxGUIHtmlBrowserUser() {}
74     ~WxGUIHtmlBrowserUser() {}
75     
76     virtual bool WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target) 
77     { return true; }
78   };
79   
80  
81
82   // class WxGUIConsole;
83
84   
85   class WxGUIHtmlBrowser : public wxPanel
86   {
87   public:
88     WxGUIHtmlBrowser ( wxWindow *parent, wxSize size, 
89                        WxGUIHtmlBrowserUser* = 0 );
90  
91     bool GoTo(std::string&);
92     void GoHome();
93
94     void OnBackButton(wxCommandEvent& );
95     void OnForwardButton(wxCommandEvent& );
96     void OnHomeButton(wxCommandEvent& );
97     void OnReloadButton(wxCommandEvent& );
98     //   void OnRunButton(wxCommandEvent& );
99     void OnLinkClicked(wxHtmlLinkEvent& );
100     void OnURLEnter( wxCommandEvent&);
101     void UpdateURL();
102     //  void OnCell(wxHtmlCellEvent& );
103
104     void SetSize( wxSize );
105
106     std::string GetCurrentPage();
107
108   private:
109     WxHtmlWindow* mwxHtmlWindow;
110     wxTextCtrl* mwxURL;
111     wxButton* mwxBackButton;
112     wxButton* mwxForwardButton;
113     wxButton* mwxHomeButton;
114     wxButton* mwxReloadButton;
115     //    wxButton* mwxRunButton;
116     
117     WxGUIHtmlBrowserUser* mUser;
118     
119    // any class wishing to process wxWidgets events must use this macro
120     DECLARE_EVENT_TABLE()  
121   };
122
123 }
124 #endif
125
126 #endif