]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxGUIHtmlBrowser.h
06dbcc9a8c51f961b3d57851cabbe758388b8437
[bbtk.git] / kernel / src / bbtkWxGUIHtmlBrowser.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkWxGUIHtmlBrowser.h,v $
5   Language:  C++
6   Date:      $Date: 2008/07/23 11:46:11 $
7   Version:   $Revision: 1.5 $
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      SetBorders(30);
58     };
59     //    wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,const wxString& url, wxString *redirect);
60 //EED    virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
61
62 //EED2  void OnSize( wxSizeEvent&);
63
64
65   private: 
66     WxGUIHtmlBrowser* mBrowser;
67
68    // any class wishing to process wxWidgets events must use this macro
69 //EED2    DECLARE_EVENT_TABLE()  
70
71   };
72
73   
74   /// Abstract class which defines the callbacks invoked by WxGUIHtmlBrowser
75   class WxGUIHtmlBrowserUser 
76   {
77   public :
78     WxGUIHtmlBrowserUser() {}
79     virtual ~WxGUIHtmlBrowserUser() {}
80     
81     virtual bool WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target) 
82     { return true; }
83   };
84   
85  
86
87   // class WxGUIConsole;
88
89   
90   class BBTK_EXPORT WxGUIHtmlBrowser : public wxPanel
91   {
92   public:
93     WxGUIHtmlBrowser ( wxWindow *parent, wxSize size, 
94                        WxGUIHtmlBrowserUser* = 0 );
95  
96     bool GoTo(std::string&);
97     void GoHome();
98
99     void OnBackButton(wxCommandEvent& );
100     void OnForwardButton(wxCommandEvent& );
101     void OnHomeButton(wxCommandEvent& );
102     void OnReloadButton(wxCommandEvent& );
103     //   void OnRunButton(wxCommandEvent& );
104     void OnLinkClicked(wxHtmlLinkEvent& );
105     void OnURLEnter( wxCommandEvent&);
106     void OnSize( wxSizeEvent&);
107
108     void UpdateURL();
109     //  void OnCell(wxHtmlCellEvent& );
110
111     void SetSize( wxSize );
112
113     std::string GetCurrentPage();
114
115   private:
116     WxHtmlWindow* mwxHtmlWindow;
117     wxTextCtrl* mwxURL;
118     wxButton* mwxBackButton;
119     wxButton* mwxForwardButton;
120     wxButton* mwxHomeButton;
121     wxButton* mwxReloadButton;
122     //    wxButton* mwxRunButton;
123     
124     WxGUIHtmlBrowserUser* mUser;
125     
126    // any class wishing to process wxWidgets events must use this macro
127     DECLARE_EVENT_TABLE()  
128   };
129
130 }
131 #endif
132
133 #endif