The web is a widget(4) intended to retrieve and display World Wide Web documents. It is able to follow links and has simple built-in history features. It is based on the viewer(7) widget, capable of displaying various types of documents and the client(7) component, capable of retrieving data using various protocols.
Special features of the web component include:
interface web : public frame {
public:
web(const char* p, const char* options="");
web(const widget* w, const char* p, const char* options="");
~web();
bool load(const char* url);
bool back();
bool forward();
void reload();
void set(entry* e);
void set(message* m);
void set(scrollbar* s);
};
The constructors and destructor of the web class are the standard widget(4) constructors and destructor.
The web widget contains four functions in the C++ interface to navigate throught the Web. load can be used to retrieve a document pointed to by a URL. To go back and forward in the history of followed links, the methods back and forward can be used. To load a page again, use reload.
The set function offered by the web can be used to set up the communication between some external widgets and the web widget. An entry(5) can be installed that shows the URL of the current document. A message(5) can be installed that shows the status of the browser, e.g. parsing or ready. A scrollbar(5) can be installed to scroll the web widget vertically.
#include <hush/session.h>
#include <widgets/scrollbar.h>
#include <widgets/web/web.h>
class application: public session
{
public:
application(int argc, char* argv[], char* name):
session(argc, argv, name) {};
void prelude() {
www = new web(".www");
scroll = new scrollbar(".scroll");
www->set(scroll);
}
int main() {
www->pack("-side left -fill both -expand 1 -padx 20");
www->configure("-relief flat");
scroll->pack("-side left -fill y");
www->load("http://www.cs.vu.nl/~hush/");
return 0;
}
private:
web *www;
scrollbar* scroll;
};
int main(int argc, char* argv[])
{
application App(argc, argv, "Simple Web Demo");
return App.run();
}
web -- file <widgets/web/web.h>
See webbugs(7)
Send questions/bugs to bastiaan@cs.vu.nl
|
Hush Online Technology
hush@cs.vu.nl
09/24/99 |
|
|