bbtk::WxGUIHtmlBrowser Class Reference

#include <bbtkWxGUIHtmlBrowser.h>

Collaboration diagram for bbtk::WxGUIHtmlBrowser:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 WxGUIHtmlBrowser (wxWindow *parent, wxSize size, WxGUIHtmlBrowserUser *=0)
bool GoTo (std::string &)
void GoHome ()
void OnBackButton (wxCommandEvent &)
void OnForwardButton (wxCommandEvent &)
void OnHomeButton (wxCommandEvent &)
void OnReloadButton (wxCommandEvent &)
void OnLinkClicked (wxHtmlLinkEvent &)
void OnLinkClicked2 (const wxHtmlLinkInfo &)
void OnURLEnter (wxCommandEvent &)
void OnSize (wxSizeEvent &)
void UpdateURL ()
void SetSize (wxSize)
std::string GetCurrentPage ()

Private Attributes

wxHtmlWindow * mwxHtmlWindow
wxTextCtrl * mwxURL
wxButton * mwxBackButton
wxButton * mwxForwardButton
wxButton * mwxHomeButton
wxButton * mwxReloadButton
WxGUIHtmlBrowserUsermUser


Detailed Description

Definition at line 111 of file bbtkWxGUIHtmlBrowser.h.


Constructor & Destructor Documentation

bbtk::WxGUIHtmlBrowser::WxGUIHtmlBrowser ( wxWindow *  parent,
wxSize  size,
WxGUIHtmlBrowserUser user = 0 
)

Definition at line 111 of file bbtkWxGUIHtmlBrowser.cxx.

References _T.

00113       : 
00114       wxPanel ( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
00115       mUser(user)
00116 
00117   {
00118     wxPanel* panel = this;
00119 
00120     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
00121     
00122     
00123     wxBoxSizer *bsizer = new wxBoxSizer(wxHORIZONTAL);
00124     
00125     mwxBackButton = new wxButton( panel, bwd_id,_T("<"),wxDefaultPosition,
00126                                   wxDefaultSize,wxBU_EXACTFIT);
00127     bsizer->Add ( mwxBackButton , 0, wxALIGN_CENTRE );
00128     
00129     mwxForwardButton = new wxButton( panel, fwd_id,_T(">"),wxDefaultPosition,
00130                                      wxDefaultSize,wxBU_EXACTFIT);
00131     bsizer->Add ( mwxForwardButton  , 0, wxALIGN_CENTRE );
00132     
00133     mwxHomeButton = new wxButton( panel, home_id,_T("Home"),wxDefaultPosition,
00134                                   wxDefaultSize,wxBU_EXACTFIT);
00135     bsizer->Add ( mwxHomeButton , 0, wxALIGN_CENTRE );
00136     
00137     mwxReloadButton = new wxButton( panel, reload_id,_T("Reload"),wxDefaultPosition,
00138                                     wxDefaultSize,wxBU_EXACTFIT);
00139     bsizer->Add ( mwxReloadButton  , 0, wxALIGN_CENTRE );
00140     
00141     /*
00142     mwxIncludeFileButton = new wxButton( panel, include_id,
00143                                        _T("RUN"),wxDefaultPosition,
00144                                        wxDefaultSize,wxBU_EXACTFIT);
00145     bsizer->Add ( mwxIncludeFileButton , 0, wxALIGN_CENTRE |  wxLEFT | wxTOP | wxBOTTOM , 10 );
00146     */
00147 
00148     mwxURL = new wxTextCtrl(panel,url_id,_T(""),
00149                             wxDefaultPosition,
00150                             wxDefaultSize,
00151                             wxTE_PROCESS_ENTER);
00152     mwxURL->SetLabel(_T("URL"));
00153     bsizer->Add(mwxURL, 1, wxEXPAND);
00154 
00155 
00156 //    mwxHtmlWindow = new WxHtmlWindow(this,html_id,this,size);
00157 
00158           mwxHtmlWindow = new wxHtmlWindow(this,html_id,
00159                                                                          wxDefaultPosition, 
00160                                                                          size,
00161                                                                          wxHW_SCROLLBAR_AUTO, 
00162                                                                          _T("bbtk::WxGUIHtmlBrowser"));
00163 
00164     /*
00165 
00166 -1, 
00167                                      wxDefaultPosition, 
00168                                      size,
00169                                      wxHW_SCROLLBAR_AUTO, 
00170                                      "bbtk::WxGUIHtmlBrowser");
00171     */
00172     mwxHtmlWindow->SetBorders(5);
00173     //  mwxHtmlWindow->FitInside();
00174 
00175         sizer->Add ( bsizer , 0, wxEXPAND );
00176           
00177 // EED: This have a problem in macOS
00178 //    wxStaticBoxSizer* hw = 
00179 //          new wxStaticBoxSizer( 
00180 //                                                         new wxStaticBox( this, -1, _T(""),  wxDefaultPosition,  size ), 
00181 //                                                        wxVERTICAL 
00182 //                               );
00183 //        hw->Add ( mwxHtmlWindow, 1, wxEXPAND  );        
00184 //EED    sizer->Add ( hw, 1, wxGROW ); // | wxLEFT | wxRIGHT | wxBOTTOM, 10 );
00185           
00186     sizer->Add ( mwxHtmlWindow, 1, wxGROW ); // | wxLEFT | wxRIGHT | wxBOTTOM, 10 );
00187 
00188     panel       -> SetSizer(sizer);
00189 
00190     panel       -> SetAutoLayout(true);
00191     panel       -> Layout();
00192 
00193 //    GoHome();
00194 
00195    }


Member Function Documentation

std::string bbtk::WxGUIHtmlBrowser::GetCurrentPage (  ) 

Definition at line 247 of file bbtkWxGUIHtmlBrowser.cxx.

References mwxURL, and bbtk::wx2std().

Referenced by bbtk::WxGUIConsole::OnButtonRun().

00248   {
00249     return wx2std(mwxURL->GetValue());
00250   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::WxGUIHtmlBrowser::GoHome (  ) 

Definition at line 225 of file bbtkWxGUIHtmlBrowser.cxx.

References bbtk::ConfigurationFile::Get_doc_path(), bbtk::ConfigurationFile::GetInstance(), and GoTo().

Referenced by OnHomeButton(), and bbtk::WxGUIScriptingInterface::WxGUIScriptingInterface().

00226   {
00227     std::string url = ConfigurationFile::GetInstance().Get_doc_path();
00228     url += "/help_contents.html";
00229     GoTo(url);
00230   }

Here is the call graph for this function:

Here is the caller graph for this function:

bool bbtk::WxGUIHtmlBrowser::GoTo ( std::string &  file  ) 

Definition at line 200 of file bbtkWxGUIHtmlBrowser.cxx.

References mwxHtmlWindow, bbtk::std2wx(), and UpdateURL().

Referenced by GoHome(), bbtk::WxGUIScriptingInterface::InterpreterUserViewHtmlPage(), and bbtk::WxGUIConsole::InterpreterUserViewHtmlPage().

00201   { 
00202     bool r = mwxHtmlWindow->LoadPage(std2wx(file));
00203     UpdateURL();
00204     return r;
00205   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::WxGUIHtmlBrowser::OnBackButton ( wxCommandEvent &   ) 

Definition at line 209 of file bbtkWxGUIHtmlBrowser.cxx.

References mwxHtmlWindow, and UpdateURL().

00210   {
00211     mwxHtmlWindow->HistoryBack();
00212     UpdateURL();
00213   }

Here is the call graph for this function:

void bbtk::WxGUIHtmlBrowser::OnForwardButton ( wxCommandEvent &   ) 

Definition at line 217 of file bbtkWxGUIHtmlBrowser.cxx.

References mwxHtmlWindow, and UpdateURL().

00218   {
00219     mwxHtmlWindow->HistoryForward();
00220     UpdateURL();
00221   }

Here is the call graph for this function:

void bbtk::WxGUIHtmlBrowser::OnHomeButton ( wxCommandEvent &   ) 

Definition at line 234 of file bbtkWxGUIHtmlBrowser.cxx.

References GoHome().

00235   {
00236     GoHome();
00237   }

Here is the call graph for this function:

void bbtk::WxGUIHtmlBrowser::OnLinkClicked ( wxHtmlLinkEvent &  e  ) 

Definition at line 313 of file bbtkWxGUIHtmlBrowser.cxx.

References mUser, mwxHtmlWindow, UpdateURL(), bbtk::wx2std(), and bbtk::WxGUIHtmlBrowserUser::WxGUIHtmlBrowserUserOnLinkClicked().

00314   { 
00315     //    std::cout << "OLK"<<std::endl;
00316     bool go = true;
00317     if (mUser) 
00318       {
00319                   /*
00320         wxString file = wxPathOnly(mwxURL->GetValue());
00321         file += std2wx(ConfigurationFile::GetInstance().Get_file_separator());
00322         file += e.GetLinkInfo().GetHref();
00323         */
00324                 wxString file = e.GetLinkInfo().GetHref();
00325                 go = mUser->WxGUIHtmlBrowserUserOnLinkClicked( wx2std( file ) );
00326       }
00327     if (go) 
00328       {
00329         mwxHtmlWindow->LoadPage( e.GetLinkInfo().GetHref() );
00330         UpdateURL();
00331         //      OnURLEnter(e);
00332         //      mwxHtmlWindow->LoadPage(mwxURL->GetValue());
00333      }
00334 
00335     //    mwxHtmlWindow->LoadPage( mwxURL->GetValue() );
00336    }

Here is the call graph for this function:

void bbtk::WxGUIHtmlBrowser::OnLinkClicked2 ( const wxHtmlLinkInfo &  info  ) 

Definition at line 294 of file bbtkWxGUIHtmlBrowser.cxx.

References mUser, mwxHtmlWindow, UpdateURL(), bbtk::wx2std(), and bbtk::WxGUIHtmlBrowserUser::WxGUIHtmlBrowserUserOnLinkClicked().

00295         {
00296           //            std::cout << "OLK2"<<std::endl;
00297                 bool go = true;
00298                 if (mUser) 
00299                 {
00300                         wxString file = info.GetHref();
00301                         go = mUser->WxGUIHtmlBrowserUserOnLinkClicked( wx2std( file ) );
00302                 }
00303                 if (go) 
00304                 {
00305                         mwxHtmlWindow->LoadPage( info.GetHref() );
00306                         UpdateURL();
00307                 }
00308                 
00309                 
00310         }

Here is the call graph for this function:

void bbtk::WxGUIHtmlBrowser::OnReloadButton ( wxCommandEvent &  e  ) 

Definition at line 241 of file bbtkWxGUIHtmlBrowser.cxx.

References OnURLEnter().

00242   {
00243     OnURLEnter(e);
00244   }

Here is the call graph for this function:

void bbtk::WxGUIHtmlBrowser::OnSize ( wxSizeEvent &  e  ) 

Definition at line 341 of file bbtkWxGUIHtmlBrowser.cxx.

References _T, mwxHtmlWindow, and mwxURL.

00342   { 
00343           mwxHtmlWindow->EnableScrolling(true,true);
00344           if   (  mwxURL->GetValue()!=wxString(_T(""))  )
00345           {
00346 // ??????????   No funciona ....?????
00347 //EED2          mwxHtmlWindow->LoadPage(mwxURL->GetValue());
00348 //              printf("EED WxGUIHtmlBrowser::OnSize %s \n", mwxURL->GetValue().c_str() );
00349 //EED2          mwxHtmlWindow->Scroll( 10,  500);
00350           } else {
00351 //              GoHome();
00352           }
00353           e.Skip(true);
00354   }

void bbtk::WxGUIHtmlBrowser::OnURLEnter ( wxCommandEvent &   ) 

Definition at line 287 of file bbtkWxGUIHtmlBrowser.cxx.

References mwxHtmlWindow, and mwxURL.

Referenced by OnReloadButton().

00288   { 
00289     mwxHtmlWindow->LoadPage(mwxURL->GetValue());
00290   }

Here is the caller graph for this function:

void bbtk::WxGUIHtmlBrowser::SetSize ( wxSize  s  ) 

Definition at line 377 of file bbtkWxGUIHtmlBrowser.cxx.

References mwxHtmlWindow.

00378   {
00379     //    wxPanel::SetSize(s);
00380     mwxHtmlWindow->SetSize(s);
00381     Fit();
00382   }

void bbtk::WxGUIHtmlBrowser::UpdateURL (  ) 

Definition at line 364 of file bbtkWxGUIHtmlBrowser.cxx.

References _T, mwxHtmlWindow, and mwxURL.

Referenced by GoTo(), OnBackButton(), OnForwardButton(), OnLinkClicked(), and OnLinkClicked2().

00365   {
00366     wxString s = mwxHtmlWindow->GetOpenedPage();
00367     if (!mwxHtmlWindow->GetOpenedAnchor().IsEmpty())
00368     {
00369             s += _T("#") + mwxHtmlWindow->GetOpenedAnchor();
00370     }
00371     mwxURL->Clear();
00372     mwxURL->AppendText(s);
00373   }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 146 of file bbtkWxGUIHtmlBrowser.h.

Referenced by OnLinkClicked(), and OnLinkClicked2().

Definition at line 140 of file bbtkWxGUIHtmlBrowser.h.

Definition at line 141 of file bbtkWxGUIHtmlBrowser.h.

Definition at line 142 of file bbtkWxGUIHtmlBrowser.h.

wxHtmlWindow* bbtk::WxGUIHtmlBrowser::mwxHtmlWindow [private]

Definition at line 143 of file bbtkWxGUIHtmlBrowser.h.

wxTextCtrl* bbtk::WxGUIHtmlBrowser::mwxURL [private]

Definition at line 139 of file bbtkWxGUIHtmlBrowser.h.

Referenced by GetCurrentPage(), OnSize(), OnURLEnter(), and UpdateURL().


The documentation for this class was generated from the following files:

Generated on Thu May 31 14:15:23 2012 for BBTK by  doxygen 1.5.7.1