CS35 Lab9:

Improving the HTML viewer

Due 11:59pm Wednesday, November 17

This page describes some slight modifications you can make to your browser to replace wxHtmlWindow with something a bit more pretty called a wxWebControl provided by an extension to WX called wxWebConnect.

add a wxWebControl to the MyFrame class
  1. add #include <webconnect/webcontrol.h> to the top of your browser code
  2. add wxWebControl *m_browser; as a private member variable in your MyFrame class.
  3. You will need to modify the Makefile too to find the location of the wxWebControl code. Add the following line to your Makefile before the all target.
    WCLIBS = `wx-config --libs` -L/usr/local/lib/ -lwebconnect
    
  4. replace `wx-config --libs` in your Makefile with $(WCLIBS)
  5. run make clean, then make to check if you completed this phase properly.
Using the wxWebControl in the GUI
If the previous step compiles, you can start integrating the wxWebControl into your browser.
  1. Create an ID for the wxWebControl by adding const int ID_WEB=6; to the list of widget IDs near the top of the program.
  2. Add wxWebControl::InitEngine(wxT("/usr/lib/xulrunner-1.9.2.10")); to the MyApp::OnInit() method before constructing the frame.
  3. Add the following lines to the MyFrame constructor.
    m_browser = new wxWebControl(this, ID_WEB, wxPoint(0,0), wxSize(800,600));
    m_browser->OpenURI(wxT("http://web.cs.swarthmore.edu/~adanner/"));
    
  4. Change your sizer to add m_browser instead of m_Html
run make to see that the web site should look prettier.
Updating event handlers
Modify event handlers to use m_browser instead of m_html.
  1. change m_Html->LoadPage to m_browser->OpenURI
  2. change m_Html->HistoryBack() to m_browser->GoBack();
  3. change HistoryForward.
run make. Test that new handlers work. Finally go back and remove m_Html. You have converted to the wxWebControl class.
Helpful wxWidgets classes
wxApp | wxFrame | wxPanel
wxString | wxButton | wxTextCtrl
wxStaticText | wxGauge | wxCheckBox
wxHtmlWindow | wxBoxSizer
Submit
Once you are satisfied with your code, hand it in by typing handin35. This will copy the code from your cs35/labs/09 to my grading directory. You may run handin35 as many times as you like, and only the most recent submission will be recorded. If you worked with a partner, only one of you needs to handin the code.