The browser component is a browser for World Wide Web documents. It extends the web(7) widget with a complete user-interface, including scrollbar, navigation buttons (back, forward, reload, home) and an entrybox with the URL. The browser can be used in application programs as a separate browser, for example to read the online documentation.
Because the browser is based on the web(7) widget it contains a validating SGML parser, that complains about errors in SGML documents. The browser is able to display various document types (e.g. HTML, SGML, VRML, video).
interface browser : public toplevel
{
public:
browser( const char* p, const char* options="" );
browser( const widget* w, const char* p, const char* options="" );
~browser();
void home(const char* url);
void load(const char* url);
};
Because the browser is a widget(4), it contains the standard widget(4) constructors and destructor.
The home function can be used to set the URL that will be loaded whenever the user presses the home button of the browser. To load a document the load function can be called with the URL.
#include <widgets/browser.h>
#include <unistd.h>
#include <hush/session.h>
const char* HUSH_URL = "http://www.cs.vu.nl/~hush/";
const char* HOME_URL = "file:/home/bastiaan/www/ScheuScape/index.html";
class application: public session
{
public:
application(int argc, char* argv[], char* name) :
session(argc, argv, name),
Browser(0) {};
~application() {
if (Browser) delete Browser;
};
int main() {
Browser = new browser(".browser");
Browser->pack();
Browser->home(HOME_URL);
Browser->load(HUSH_URL);
return 0;
}
private:
browser* Browser;
};
int main (int argc, char* argv[])
{
application App(argc, argv, "ScheuScape");
return App.run();
}
web -- file <widgets/browser.h>
See webbugs(7)
Send questions/bugs to bastiaan@cs.vu.nl
|
Hush Online Technology
hush@cs.vu.nl
09/24/99 |
|
|