#include <bbtkWxGUIHtmlBrowser.h>
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 | 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 |
WxGUIHtmlBrowserUser * | mUser |
Definition at line 105 of file bbtkWxGUIHtmlBrowser.h.
bbtk::WxGUIHtmlBrowser::WxGUIHtmlBrowser | ( | wxWindow * | parent, | |
wxSize | size, | |||
WxGUIHtmlBrowserUser * | user = 0 | |||
) |
Definition at line 119 of file bbtkWxGUIHtmlBrowser.cxx.
References _T.
00121 : 00122 wxPanel ( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL), 00123 mUser(user) 00124 00125 { 00126 wxPanel* panel = this; 00127 00128 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00129 00130 00131 wxBoxSizer *bsizer = new wxBoxSizer(wxHORIZONTAL); 00132 00133 mwxBackButton = new wxButton( panel, bwd_id,_T("<"),wxDefaultPosition, 00134 wxDefaultSize,wxBU_EXACTFIT); 00135 bsizer->Add ( mwxBackButton , 0, wxALIGN_CENTRE ); 00136 00137 mwxForwardButton = new wxButton( panel, fwd_id,_T(">"),wxDefaultPosition, 00138 wxDefaultSize,wxBU_EXACTFIT); 00139 bsizer->Add ( mwxForwardButton , 0, wxALIGN_CENTRE ); 00140 00141 mwxHomeButton = new wxButton( panel, home_id,_T("Home"),wxDefaultPosition, 00142 wxDefaultSize,wxBU_EXACTFIT); 00143 bsizer->Add ( mwxHomeButton , 0, wxALIGN_CENTRE ); 00144 00145 mwxReloadButton = new wxButton( panel, reload_id,_T("Reload"),wxDefaultPosition, 00146 wxDefaultSize,wxBU_EXACTFIT); 00147 bsizer->Add ( mwxReloadButton , 0, wxALIGN_CENTRE ); 00148 00149 /* 00150 mwxIncludeFileButton = new wxButton( panel, include_id, 00151 _T("RUN"),wxDefaultPosition, 00152 wxDefaultSize,wxBU_EXACTFIT); 00153 bsizer->Add ( mwxIncludeFileButton , 0, wxALIGN_CENTRE | wxLEFT | wxTOP | wxBOTTOM , 10 ); 00154 */ 00155 00156 mwxURL = new wxTextCtrl(panel,url_id,_T(""), 00157 wxDefaultPosition, 00158 wxDefaultSize, 00159 wxTE_PROCESS_ENTER); 00160 mwxURL->SetLabel(_T("URL")); 00161 bsizer->Add(mwxURL, 1, wxEXPAND); 00162 00163 00164 // mwxHtmlWindow = new WxHtmlWindow(parent,html_id,this,size); 00165 mwxHtmlWindow = new WxHtmlWindow(this,html_id,this,size); 00166 00167 /* 00168 00169 -1, 00170 wxDefaultPosition, 00171 size, 00172 wxHW_SCROLLBAR_AUTO, 00173 "bbtk::WxGUIHtmlBrowser"); 00174 */ 00175 mwxHtmlWindow->SetBorders(5); 00176 // mwxHtmlWindow->FitInside(); 00177 00178 wxStaticBoxSizer* hw = 00179 new wxStaticBoxSizer( new wxStaticBox( this, -1, _T(""), 00180 wxDefaultPosition, 00181 size ), 00182 wxVERTICAL ); 00183 //EED hw->Add ( mwxHtmlWindow, 1, wxGROW ); 00184 hw->Add ( mwxHtmlWindow, 1, wxEXPAND ); 00185 00186 00187 00188 00189 00190 //sizer->Add ( mwxHtmlWindow, 1, wxGROW ); 00191 //EED sizer->Add ( hw, 1, wxGROW ); // | wxLEFT | wxRIGHT | wxBOTTOM, 10 ); 00192 00193 sizer->Add ( bsizer , 0, wxEXPAND ); 00194 sizer->Add ( hw, 1, wxGROW ); // | wxLEFT | wxRIGHT | wxBOTTOM, 10 ); 00195 00196 00197 00198 panel -> SetSizer(sizer); 00199 panel -> SetAutoLayout(true); 00200 panel -> Layout(); 00201 00202 // GoHome(); 00203 00204 }
bool bbtk::WxGUIHtmlBrowser::GoTo | ( | std::string & | file | ) |
Definition at line 209 of file bbtkWxGUIHtmlBrowser.cxx.
References mwxHtmlWindow, bbtk::std2wx(), and UpdateURL().
Referenced by GoHome(), bbtk::WxGUIScriptingInterface::InterpreterUserViewHtmlPage(), and bbtk::WxGUIConsole::InterpreterUserViewHtmlPage().
00210 { 00211 bool r = mwxHtmlWindow->LoadPage(std2wx(file)); 00212 UpdateURL(); 00213 return r; 00214 }
void bbtk::WxGUIHtmlBrowser::GoHome | ( | ) |
Definition at line 234 of file bbtkWxGUIHtmlBrowser.cxx.
References GoTo().
Referenced by OnHomeButton(), and bbtk::WxGUIScriptingInterface::WxGUIScriptingInterface().
00235 { 00236 std::string url = ConfigurationFile::GetInstance().Get_doc_path(); 00237 url += "/help_contents.html"; 00238 GoTo(url); 00239 }
void bbtk::WxGUIHtmlBrowser::OnBackButton | ( | wxCommandEvent & | ) |
Definition at line 218 of file bbtkWxGUIHtmlBrowser.cxx.
References mwxHtmlWindow, and UpdateURL().
00219 { 00220 mwxHtmlWindow->HistoryBack(); 00221 UpdateURL(); 00222 }
void bbtk::WxGUIHtmlBrowser::OnForwardButton | ( | wxCommandEvent & | ) |
Definition at line 226 of file bbtkWxGUIHtmlBrowser.cxx.
References mwxHtmlWindow, and UpdateURL().
00227 { 00228 mwxHtmlWindow->HistoryForward(); 00229 UpdateURL(); 00230 }
void bbtk::WxGUIHtmlBrowser::OnHomeButton | ( | wxCommandEvent & | ) |
Definition at line 243 of file bbtkWxGUIHtmlBrowser.cxx.
References GoHome().
00244 { 00245 GoHome(); 00246 }
void bbtk::WxGUIHtmlBrowser::OnReloadButton | ( | wxCommandEvent & | e | ) |
Definition at line 250 of file bbtkWxGUIHtmlBrowser.cxx.
References OnURLEnter().
00251 { 00252 OnURLEnter(e); 00253 }
void bbtk::WxGUIHtmlBrowser::OnLinkClicked | ( | wxHtmlLinkEvent & | e | ) |
Definition at line 304 of file bbtkWxGUIHtmlBrowser.cxx.
References mUser, mwxHtmlWindow, UpdateURL(), bbtk::wx2std(), and bbtk::WxGUIHtmlBrowserUser::WxGUIHtmlBrowserUserOnLinkClicked().
00305 { 00306 00307 bool go = true; 00308 if (mUser) 00309 { 00310 /* 00311 wxString file = wxPathOnly(mwxURL->GetValue()); 00312 file += std2wx(ConfigurationFile::GetInstance().Get_file_separator()); 00313 file += e.GetLinkInfo().GetHref(); 00314 */ 00315 wxString file = e.GetLinkInfo().GetHref(); 00316 go = mUser->WxGUIHtmlBrowserUserOnLinkClicked( wx2std( file ) ); 00317 } 00318 if (go) 00319 { 00320 mwxHtmlWindow->LoadPage( e.GetLinkInfo().GetHref() ); 00321 UpdateURL(); 00322 // OnURLEnter(e); 00323 // mwxHtmlWindow->LoadPage(mwxURL->GetValue()); 00324 } 00325 00326 // mwxHtmlWindow->LoadPage( mwxURL->GetValue() ); 00327 }
void bbtk::WxGUIHtmlBrowser::OnURLEnter | ( | wxCommandEvent & | ) |
Definition at line 296 of file bbtkWxGUIHtmlBrowser.cxx.
References mwxHtmlWindow, and mwxURL.
Referenced by OnReloadButton().
00297 { 00298 mwxHtmlWindow->LoadPage(mwxURL->GetValue()); 00299 }
void bbtk::WxGUIHtmlBrowser::OnSize | ( | wxSizeEvent & | e | ) |
Definition at line 332 of file bbtkWxGUIHtmlBrowser.cxx.
References _T, mwxHtmlWindow, and mwxURL.
00333 { 00334 mwxHtmlWindow->EnableScrolling(true,true); 00335 if ( mwxURL->GetValue()!=wxString(_T("")) ) 00336 { 00337 // ?????????? No funciona ....????? 00338 //EED2 mwxHtmlWindow->LoadPage(mwxURL->GetValue()); 00339 // printf("EED WxGUIHtmlBrowser::OnSize %s \n", mwxURL->GetValue().c_str() ); 00340 //EED2 mwxHtmlWindow->Scroll( 10, 500); 00341 } else { 00342 // GoHome(); 00343 } 00344 e.Skip(true); 00345 }
void bbtk::WxGUIHtmlBrowser::UpdateURL | ( | ) |
Definition at line 355 of file bbtkWxGUIHtmlBrowser.cxx.
References _T, mwxHtmlWindow, and mwxURL.
Referenced by GoTo(), OnBackButton(), OnForwardButton(), and OnLinkClicked().
00356 { 00357 00358 wxString s = mwxHtmlWindow->GetOpenedPage(); 00359 if (!mwxHtmlWindow->GetOpenedAnchor().IsEmpty()) 00360 { 00361 s += _T("#") + mwxHtmlWindow->GetOpenedAnchor(); 00362 } 00363 mwxURL->Clear(); 00364 mwxURL->AppendText(s); 00365 }
void bbtk::WxGUIHtmlBrowser::SetSize | ( | wxSize | s | ) |
Definition at line 369 of file bbtkWxGUIHtmlBrowser.cxx.
References mwxHtmlWindow.
00370 { 00371 // wxPanel::SetSize(s); 00372 mwxHtmlWindow->SetSize(s); 00373 Fit(); 00374 }
std::string bbtk::WxGUIHtmlBrowser::GetCurrentPage | ( | ) |
Definition at line 256 of file bbtkWxGUIHtmlBrowser.cxx.
References mwxURL, and bbtk::wx2std().
Referenced by bbtk::WxGUIConsole::OnButtonRun().
WxHtmlWindow* bbtk::WxGUIHtmlBrowser::mwxHtmlWindow [private] |
Definition at line 131 of file bbtkWxGUIHtmlBrowser.h.
Referenced by GoTo(), OnBackButton(), OnForwardButton(), OnLinkClicked(), OnSize(), OnURLEnter(), SetSize(), and UpdateURL().
wxTextCtrl* bbtk::WxGUIHtmlBrowser::mwxURL [private] |
Definition at line 132 of file bbtkWxGUIHtmlBrowser.h.
Referenced by GetCurrentPage(), OnSize(), OnURLEnter(), and UpdateURL().
wxButton* bbtk::WxGUIHtmlBrowser::mwxBackButton [private] |
Definition at line 133 of file bbtkWxGUIHtmlBrowser.h.
wxButton* bbtk::WxGUIHtmlBrowser::mwxForwardButton [private] |
Definition at line 134 of file bbtkWxGUIHtmlBrowser.h.
wxButton* bbtk::WxGUIHtmlBrowser::mwxHomeButton [private] |
Definition at line 135 of file bbtkWxGUIHtmlBrowser.h.
wxButton* bbtk::WxGUIHtmlBrowser::mwxReloadButton [private] |
Definition at line 136 of file bbtkWxGUIHtmlBrowser.h.
WxGUIHtmlBrowserUser* bbtk::WxGUIHtmlBrowser::mUser [private] |