[indent=4]
uses 
    Gtk

init 
    Gtk.init (ref args)
    var test = new HtmlViewerWindow ()
    test.show_all ()
    Gtk.main ();

class HtmlViewerWindow : Window
    prop back_button: ToolButton
    prop forward_button: ToolButton
    prop quit_button: ToolButton
    prop moz: MozEmbed
    
    init
        title = "ultra tiny html viewer"
        default_height = 550
        default_width = 550
        window_position = WindowPosition.CENTER
        create_widgets ()
        connect_signals ()
        
    def create_widgets () : void
        var toolbar = new Toolbar ()
        this.quit_button = new ToolButton.from_stock (STOCK_QUIT)
        this.back_button = new ToolButton.from_stock (STOCK_GO_BACK)
        this.forward_button = new ToolButton.from_stock (STOCK_GO_FORWARD)
        toolbar.add (this.quit_button)
        toolbar.add (this.back_button)
        toolbar.add (this.forward_button)
        this.moz = new MozEmbed ()
        moz.load_url("file:///usr/share/doc/index.html")
        var vbox = new VBox (false, 0)
        vbox.pack_start (toolbar, false, true, 0)
        vbox.add (this.moz)
        add (vbox)
        
    def connect_signals () : void
        destroy += Gtk.main_quit
        this.quit_button.clicked += Gtk.main_quit
        this.back_button.clicked += this.moz.go_back
        this.forward_button.clicked += this.moz.go_forward
        
    def private update_buttons () : void
        this.back_button.sensitive = this.moz.can_go_back ()
        this.forward_button.sensitive = this.moz.can_go_forward ()