PtHtml

PtHtml — An HTML viewer.

Synopsis

class PtHtml PtContainer
{
    html_border_width;         // unsigned short  (Pt_ARG_HTML_BORDER_WIDTH)    
    html_cursor_busy;          // unsigned short  (Pt_ARG_HTML_CURSOR_BUSY)    
    html_cursor_default;       // unsigned short  (Pt_ARG_HTML_CURSOR_DEFAULT)    
    html_cursor_link;          // unsigned short  (Pt_ARG_HTML_CURSOR_LINK)    
    html_fill_color;           // color  (Pt_ARG_HTML_FILL_COLOR)    
    html_flags;                // flag  (Pt_ARG_HTML_FLAGS)    
    html_h1_font;              // string  (Pt_ARG_HTML_H1_FONT)    
    html_h2_font;              // string  (Pt_ARG_HTML_H2_FONT)    
    html_h3_font;              // string  (Pt_ARG_HTML_H3_FONT)    
    html_h4_font;              // string  (Pt_ARG_HTML_H4_FONT)    
    html_h5_font;              // string  (Pt_ARG_HTML_H5_FONT)    
    html_h6_font;              // string  (Pt_ARG_HTML_H6_FONT)    
    html_link_color;           // color  (Pt_ARG_HTML_LINK_COLOR)    
    html_page_bm;              // unsigned short  (Pt_ARG_HTML_PAGE_BM)    
    html_page_h;               // integer  (Pt_ARG_HTML_PAGE_H)    
    html_page_lm;              // unsigned short  (Pt_ARG_HTML_PAGE_LM)    
    html_page_rm;              // unsigned short  (Pt_ARG_HTML_PAGE_RM)    
    html_page_tm;              // unsigned short  (Pt_ARG_HTML_PAGE_TM)    
    html_page_w;               // integer  (Pt_ARG_HTML_PAGE_W)    
    html_page_x;               // integer  (Pt_ARG_HTML_PAGE_X)    
    html_page_y;               // integer  (Pt_ARG_HTML_PAGE_Y)    
    html_scroll_color;         // color  (Pt_ARG_HTML_SCROLL_COLOR)    
    html_scroll_fill_color;    // color  (Pt_ARG_HTML_SCROLL_FILL_COLOR)    
    html_scroll_horizontal;    // unsigned short  (Pt_ARG_HTML_SCROLL_HORIZONTAL)    
    html_scroll_vertical;      // unsigned short  (Pt_ARG_HTML_SCROLL_VERTICAL)    
    html_scroll_width;         // unsigned short  (Pt_ARG_HTML_SCROLL_WIDTH)    
    html_text_font;            // string  (Pt_ARG_HTML_TEXT_FONT)    
    html_url;                  // string  (Pt_ARG_HTML_URL)    
}
		

Base Classes

PtWidget <-- PtBasic <-- PtContainer <-- PtHtml

Description

This widget is a display viewer for HTML files, with horizontal and vertical scrollbars. Designed for creating helpviewers and similar applications, it supports only HTML 1.0, plus simple tables and a few other features. It loads and displays HTML pages from the local file system.

[Note]

For detailed information, please refer to PtHtml in the Photon documentation.

Instance Variables

html_border_width

The width of an internal etched border on the page and scrollbars.

html_cursor_busy

One of the following constants specifying the bitmap image for the cursor when loading a file:

Ph_CURSOR_POINTER
Ph_CURSOR_BIG_POINTER
Ph_CURSOR_CROSSHAIR
Ph_CURSOR_FINGER
Ph_CURSOR_CLOCK (the default)
html_cursor_default

One of the following constants specifying the normal bitmap image for the cursor:

Ph_CURSOR_POINTER (the default)
Ph_CURSOR_BIG_POINTER
Ph_CURSOR_CROSSHAIR
Ph_CURSOR_FINGER
html_cursor_link

One of the following constants specifying the bitmap image for the cursor when over a link:

Ph_CURSOR_POINTER
Ph_CURSOR_BIG_POINTER
Ph_CURSOR_CROSSHAIR
Ph_CURSOR_FINGER (the default)
html_fill_color

A number specifying a color for the background of the display. Default is 0xc0c0c0 (grey).

html_flags

This instance variable determines the behavior of the widget, and may have one of the following values:

ConstantDescription
Pt_HTML_RELOADReloads a page.
Pt_HTML_PAGE_MODEPaginates the page for printing.

html_h1_font

A string specifying the font for a level 1 heading. Default is "helv24".

html_h2_font

Level 2 heading font. Default is "helv18".

html_h3_font

Level 3 heading font. Default is "helv14".

html_h4_font

Level 4 heading font. Default is "helv12".

html_h5_font

Level 5 heading font. Default is "helv10".

html_h6_font

Level 6 heading font. Default is "helv08".

html_link_color

A number specifying the color for links. Default is 0xa0 (dark blue).

html_page_bm, html_page_lm, html_page_rm, html_page_tm

Integers specifying the width in pixels of the bottom, left, right and top margins of the page. Default for each is 5.

html_page_h, html_page_w

Integers indicating the height and width in pixels of the displayed HTML page.

html_page_x, html_page_y

Integers specifying in pixels the horizontal and vertical position of the viewing area with respect to the page. This number changes when the page is scrolled.

html_scroll_color

An integer specifying the color of the handle of the scrollbar. Default is 0xc0c0c0 (grey).

html_scroll_fill_color

An integer specifying the color of the trough of the scrollbar. Default is 0x909090 (dark grey).

html_scroll_horizontal, html_scroll_vertical

These instance variables specify the mode of the horizontal and vertical scrollbars. Each may have one of the following values:

ConstantDescription
Pt_ALWAYSThe scrollbar is always displayed (the default).
Pt_AS_REQUIREDThe scrollbar is displayed only when the page is wider than the viewer.
Pt_ALWAYSThe scrollbar is never displayed.

html_scroll_width

A number specifying the width in pixels of the scrollbars. Default is 15.

html_text_font

A string specifying the body text font. Default is "helv14".

html_url

The URL of the HTML page to display. The path can be relative or absolute, and can include a node and directory.

Callbacks

The following callbacks are associated with this widget:

CallbackDescription
Pt_CB_HTML_FILE_PREThis callback is generated when an HTML file is going to be loaded.
Pt_CB_HTML_FILE_POSTThis callback is generated when an HTML file has been loaded.
Pt_CB_HTML_IMAGEThis callback is generated when an HTML image file is going to be loaded.

Associated Classes

PtHtmlCallback, PtCallbackInfo

Example

This example, ex_PtHtml.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
 * This example demonstrates a PtHtml widget.
 */

if (_os_ == "QNX6")
     princ ("\nThis widget is not available for QNX 6.", "\n\n");
else
{ 
  require_lisp("PhotonWidgets.lsp");
  PtInit(nil);

  win = new(PtWindow);
  html = new(PtHtml);
  
  html.SetDim(700,350);
  html.html_url = "re-pthtml.html";
  
  PtRealizeWidget(win);
  PtMainLoop();
}