API Guide Home (Online version only) |

# HtmlLib68K.h File Reference

## Detailed Description

Public 68K include file for HTML shared library.

Definition in file HtmlLib68K.h.

Include dependency graph for HtmlLib68K.h:

Go to the source code of this file.

## Data Structures

- struct HtmlLibFormWidgetProc
    The following are necessary form widget creation/deletion routines that need to get set using HtmlLibSetFormWidgetProc. Please see sample code after looking at HtmlLibSetFormWidgetProc. More...
- struct HtmlLibFocusTargetInfo

## Typedef

- #define htmlTargetImage 0x01
- #define htmlTargetEmbed 0x02
- #define htmlTargetIFrame 0x03
- #define htmlTargetElement 0x04
- #define htmlTargetInputText 0x05
- #define htmlTargetInputPassword 0x06
- #define htmlTargetInputCheckbox 0x07
- #define htmlTargetInputRadio 0x08
- #define htmlTargetInputSubmit 0x09
- #define htmlTargetInputReset 0x0a
- #define htmlTargetInputFile 0x0b
- #define htmlTargetInputButton 0x0c
- #define htmlTargetInputTextarea 0x0d
- #define htmlTargetInputSelect 0x0e
- typedef UInt8 HtmlDisplayMode
- typedef UInt16 HtmlProgressStatus
- typedef UInt32 HtmlSubmitFormMethod
- typedef Int8 HtmlScrollDirection
- typedef Int8 HtmlScrollbarMode
- typedef UInt16 HtmlFocusTargetType

## Defines

- #define htmlErrorClass (appErrorClass)
- #define htmlLibProgressEvent (0x7000)
- #define HtmlLibID 'AsHL'
- #define HtmlLibDBType 'libr'
- #define HtmlLibName "HtmlLibrary"

HtmlLib error codes

- #define htmlErrInUse (htmlErrorClass | 1)
- #define htmlErrOutOfMemory (htmlErrorClass | 2)
- #define htmlErrInvalidParam (htmlErrorClass | 3)
- #define htmlErrNotFound (htmlErrorClass | 4)
- #define htmlErrNotInitialized (htmlErrorClass | 5)
- #define htmlErrCantOpen (htmlErrorClass | 6)

HtmlDisplayMode

- #define htmlHandheldDisplayMode 0x01
- #define htmlFaithfulDisplayMode 0x02

HtmlProgressStatus

- #define htmlProgressDone 0x0001
- #define htmlProgressBusy 0x0002
- #define htmlProgressOutOfMemory 0x0003
- #define htmlProgressError 0x0004

HtmlSubmitFormMethod

- #define htmlHttpMethodGet 0x00000001
- #define htmlHttpMethodPost 0x00000002

HtmlDirections

- #define htmlDirLeft 0x01
- #define htmlDirRight 0x02
- #define htmlDirUp 0x03
- #define htmlDirDown 0x04

HtmlScrollMode

- #define htmlNormalScrollbarMode 0x01
- #define htmlNoPageScrollbarMode 0x02

## Typedefs

Callback Functions

- typedef void HtmlLibLinkSelCallback (MemHandle htmlLibH, Char *url, void *cbData)
- typedef Boolean HtmlLibScanPhoneNumberCallback (MemHandle htmlLibH, Char *buffer, Int32 length, Int32 *patternStart, Int32 *patternEnd)
- typedef void HtmlLibInclusionCallback (MemHandle htmlLibH, Char *url, void *cbData)
- typedef void HtmlLibSubmitFormCallback (MemHandle htmlLibH, Char *url, HtmlSubmitFormMethod method, Char *query, void *cbData)
- typedef Boolean NewControlProc (UInt16 id, UInt16 style, const Char *textP, Coord x, Coord y, Coord width, Coord height, UInt16 font, UInt8 group, Boolean leftAnchor)
- typedef Err NewListProc (UInt16 id, Coord x, Coord y, Coord width, Coord height, UInt16 font, Int16 visibleItems, Int16 triggerId)
- typedef Boolean NewFieldProc (UInt16 id, Coord x, Coord y, Coord width, Coord height, UInt16 font, UInt32 maxChars, UInt16 editable, UInt16 underlined, UInt16 singleLine, UInt16 dynamicSize, UInt16 justification, UInt16 autoShift, UInt16 hasScrollBar, UInt16 numeric)
- typedef void DeleteObjectProc (UInt16 index)

## Functions

- Err HtmlLibOpen (UInt16 refnum)
- Err HtmlLibClose (UInt16 refnum)
- Err HtmlLibSleep (UInt16 refnum)
- Err HtmlLibWake (UInt16 refnum)
- MemHandle HtmlLibInitialize (UInt16 refnum, RectangleType bounds, Err *errP)
- MemHandle HtmlLibInitializeWithHeapSize (UInt16 refnum, RectangleType bounds, Err *errP, UInt32 heapMinSize, UInt32 heapDesiredSize, UInt32 *heapActualSizeP)
- void HtmlLibFinalize (UInt16 refnum, MemHandle htmllibH)
- void HtmlLibResizeScreen (UInt16 refnum, MemHandle htmlLibH, RectangleType newBounds)
- void HtmlLibSetDisplayMode (UInt16 refnum, MemHandle htmlLibH, HtmlDisplayMode mode)
- void HtmlLibSetLinkSelectionCallback (UInt16 refnum, MemHandle htmlLibH, HtmlLibLinkSelCallback *callback, void *cbData)
- void HtmlLibSetScanPhoneNumberCallback (UInt16 refnum, MemHandle htmlLibH, HtmlLibScanPhoneNumberCallback *callback)
- void HtmlLibSetInclusionCallback (UInt16 refnum, MemHandle htmlLibH, HtmlLibInclusionCallback *callback, void *cbData)
- void HtmlLibSetSubmitFormCallback (UInt16 refnum, MemHandle htmlLibH, HtmlLibSubmitFormCallback *callback, void *cbData)
- UInt16 HtmlLibProgress (UInt16 refnum, MemHandle htmlLibH, Int32 stayTime)
- Boolean HtmlLibNotifyUIEvent (UInt16 refnum, MemHandle htmlLibH, EventType *eventP)
- Err HtmlLibFindText (UInt16 refnum, MemHandle htmlLibH, Char *searchString, Boolean wrapSearch)
- Boolean HtmlLibGetTextSelection (UInt16 refnum, MemHandle htmlLibH, Char **selectedText)
- void HtmlLibClearScreen (UInt16 refnum, MemHandle htmlLibH)
- void HtmlLibAbortRenderData (UInt16 refnum, MemHandle htmlLibH)
- MemHandle HtmlLibCreateContentObject (UInt16 refnum, MemHandle htmlLibH)
- void HtmlLibDestroyContentObject (UInt16 refnum, MemHandle contentH)
- Err HtmlLibAddTextData (UInt16 refnum, MemHandle contentH, Char *url, Char *mimeType, Char *charset, void *data, Int32 dataLen)
- Err HtmlLibAddImageData (UInt16 refnum, MemHandle contentH, Char *url, Char *mimeType, void *data, Int32 dataLen)
- void HtmlLibRenderData (UInt16 refnum, MemHandle contentH)
- void HtmlLibRedrawScreen (UInt16 refnum, MemHandle htmlLibH)
- void HtmlLibSetScrollbars (UInt16 refnum, MemHandle htmlLibH, UInt16 *scrollbars, UInt16 size)
- Err HtmlLibGetVScrollPosition (UInt16 refnum, MemHandle htmlLibH, Int16 *valueP)
- Err HtmlLibSetVScrollPosition (UInt16 refnum, MemHandle htmlLibH, Int16 newPosition)
- Boolean HtmlLibCanScroll (UInt16 refnum, MemHandle htmlLibH, HtmlScrollDirection direction)
- Err HtmlLibSetScrollbarMode (UInt16 refnum, MemHandle htmlLibH, HtmlScrollbarMode mode)
- Err HtmlLibSetBiggerFont (UInt16 refnum, MemHandle htmlLibH, Boolean value)
- Boolean HtmlLibResetFocusInfo (UInt16 refnum, MemHandle htmlLibH)
- void HtmlLibSetFocusStatus (UInt16 refnum, MemHandle htmlLibH, Boolean flag, Boolean reset_focus)
- void HtmlLibSetFormWidgetProc (UInt16 refnum, MemHandle htmlLibH, HtmlLibFormWidgetProc *proc)
- Boolean HtmlLibGetTargetInfo (UInt16 refnum, MemHandle htmlLibH, HtmlLibFocusTargetInfo *htmlTargetInfo)
- Err HtmlLibSetImageMemoryLimit (UInt16 renum, MemHandle htmlLibH, Int32 limit)

## Define Documentation

#define htmlDirDown 0x04

Definition at line 215 of file HtmlLib68K.h.

#define htmlDirLeft 0x01

Definition at line 212 of file HtmlLib68K.h.

#define htmlDirRight 0x02

Definition at line 213 of file HtmlLib68K.h.

#define htmlDirUp 0x03

Definition at line 214 of file HtmlLib68K.h.

#define htmlErrCantOpen (htmlErrorClass | 6)

Definition at line 54 of file HtmlLib68K.h.

#define htmlErrInUse (htmlErrorClass | 1)

Definition at line 49 of file HtmlLib68K.h.

#define htmlErrInvalidParam (htmlErrorClass | 3)

Definition at line 51 of file HtmlLib68K.h.

#define htmlErrNotFound (htmlErrorClass | 4)

Definition at line 52 of file HtmlLib68K.h.

#define htmlErrNotInitialized (htmlErrorClass | 5)

Definition at line 53 of file HtmlLib68K.h.

#define htmlErrorClass (appErrorClass)

Definition at line 39 of file HtmlLib68K.h.

#define htmlErrOutOfMemory (htmlErrorClass | 2)

Definition at line 50 of file HtmlLib68K.h.

#define htmlFaithfulDisplayMode 0x02

Definition at line 187 of file HtmlLib68K.h.

#define htmlHandheldDisplayMode 0x01

Definition at line 186 of file HtmlLib68K.h.

#define htmlHttpMethodGet 0x00000001

Definition at line 204 of file HtmlLib68K.h.

#define htmlHttpMethodPost 0x00000002

Definition at line 205 of file HtmlLib68K.h.

#define HtmlLibDBType 'libr'

Definition at line 64 of file HtmlLib68K.h.

#define HtmlLibID 'AsHL'

Definition at line 63 of file HtmlLib68K.h.

#define HtmlLibName "HtmlLibrary"

Definition at line 65 of file HtmlLib68K.h.

#define htmlLibProgressEvent (0x7000)

Definition at line 57 of file HtmlLib68K.h.

#define htmlNoPageScrollbarMode 0x02

Definition at line 223 of file HtmlLib68K.h.

#define htmlNormalScrollbarMode 0x01

Definition at line 222 of file HtmlLib68K.h.

#define htmlProgressBusy 0x0002

Definition at line 195 of file HtmlLib68K.h.

#define htmlProgressDone 0x0001

Definition at line 194 of file HtmlLib68K.h.

#define htmlProgressError 0x0004

Definition at line 197 of file HtmlLib68K.h.

#define htmlProgressOutOfMemory 0x0003

Definition at line 196 of file HtmlLib68K.h.

#define htmlTargetElement 0x04

Definition at line 87 of file HtmlLib68K.h.

#define htmlTargetEmbed 0x02

Definition at line 85 of file HtmlLib68K.h.

#define htmlTargetIFrame 0x03

Definition at line 86 of file HtmlLib68K.h.

#define htmlTargetImage 0x01

Definition at line 84 of file HtmlLib68K.h.

#define htmlTargetInputButton 0x0c

Definition at line 95 of file HtmlLib68K.h.

#define htmlTargetInputCheckbox 0x07

Definition at line 90 of file HtmlLib68K.h.

#define htmlTargetInputFile 0x0b

Definition at line 94 of file HtmlLib68K.h.

#define htmlTargetInputPassword 0x06

Definition at line 89 of file HtmlLib68K.h.

#define htmlTargetInputRadio 0x08

Definition at line 91 of file HtmlLib68K.h.

#define htmlTargetInputReset 0x0a

Definition at line 93 of file HtmlLib68K.h.

#define htmlTargetInputSelect 0x0e

Definition at line 97 of file HtmlLib68K.h.

#define htmlTargetInputSubmit 0x09

Definition at line 92 of file HtmlLib68K.h.

#define htmlTargetInputText 0x05

Definition at line 88 of file HtmlLib68K.h.

#define htmlTargetInputTextarea 0x0d

Definition at line 96 of file HtmlLib68K.h.

## Typedef Documentation

typedef void DeleteObjectProc(UInt16 index)

See also:
  HtmlLibFormWidgetProc

Definition at line 161 of file HtmlLib68K.h.

typedef UInt8 HtmlDisplayMode

Definition at line 76 of file HtmlLib68K.h.

typedef UInt16 HtmlFocusTargetType

Definition at line 99 of file HtmlLib68K.h.

typedef void HtmlLibInclusionCallback(MemHandle htmlLibH, Char *url, void *cbData)

Should be defined and set as the function to be called when rendering a page requires additional content.

HtmlLib calls this callback function with the appropriate arguments (where the url is the url of the additional content the library requires).

Definition at line 124 of file HtmlLib68K.h.

typedef void HtmlLibLinkSelCallback(MemHandle htmlLibH, Char *url, void *cbData)

Should be defined (to handle a link selection) and set as the function to be called when a link (url) is selected.

Definition at line 110 of file HtmlLib68K.h.

typedef Boolean HtmlLibScanPhoneNumberCallback(MemHandle htmlLibH, Char *buffer, Int32 length, Int32 *patternStart, Int32 *patternEnd)

Should be defined and set as the function to be called when it's necessary to determine if a string of numbers contains a phone number.

Here, buffer contains the string of numbers that are being checked, and this is passed in by the library when the library calls this function. Length is the buffer's length, also passed in by the library. The last two arguments (patternStart and patternEnd) should get set in this callback function if the string of numbers passed in is determined to be a phone number (and thus the return value of the function is to be true). Now, patternStart is the place in the buffer that the phone number starts, and patternEnd is the place in the buffer that the pattern ends. For example, if the entire contents of the buffer passed in happened to be a phone number, then the start would be 0 and the end would be "length - 1", and the return value would be true. However, if what was passed in was not determined to be a phone number, then the return value of the callback function should be false, and the last two arguments do not need to be set.

Definition at line 117 of file HtmlLib68K.h.

typedef void HtmlLibSubmitFormCallback(MemHandle htmlLibH, Char *url, HtmlSubmitFormMethod method, Char *query, void *cbData)

Note:
  Forms are not supported; thus, use this at your own risk.

Should be defined and set as the function to be called when a submit is activated.

HtmlLib calls this callback function with the appropriate arguments. The following is an example (included in the sample code):

     void HtmlSubmitFormCallback(MemHandle htmlLibH, Char *url, HtmlSubmitFormMethod method, Char *query, void *cbData)
     {
         FrmCustomAlert(SubmitFormAlert, url,
            (method == htmlHttpMethodPost ? "Post" : "Get"), query);
     }

Definition at line 144 of file HtmlLib68K.h.

typedef UInt16 HtmlProgressStatus

Definition at line 77 of file HtmlLib68K.h.

typedef Int8 HtmlScrollbarMode

Definition at line 80 of file HtmlLib68K.h.

typedef Int8 HtmlScrollDirection

Definition at line 79 of file HtmlLib68K.h.

typedef UInt32 HtmlSubmitFormMethod

Definition at line 78 of file HtmlLib68K.h.

typedef Boolean NewControlProc(UInt16 id, UInt16 style, const Char *textP, Coord x, Coord y, Coord width, Coord height, UInt16 font, UInt8 group, Boolean leftAnchor)

See also:
  HtmlLibFormWidgetProc

Definition at line 146 of file HtmlLib68K.h.

typedef Boolean NewFieldProc(UInt16 id, Coord x, Coord y, Coord width, Coord height, UInt16 font, UInt32 maxChars, UInt16 editable, UInt16 underlined, UInt16 singleLine, UInt16 dynamicSize, UInt16 justification, UInt16 autoShift, UInt16 hasScrollBar, UInt16 numeric)

See also:
  HtmlLibFormWidgetProc

Definition at line 155 of file HtmlLib68K.h.

typedef Err NewListProc(UInt16 id, Coord x, Coord y, Coord width, Coord height, UInt16 font, Int16 visibleItems, Int16 triggerId)

See also:
  HtmlLibFormWidgetProc

Definition at line 151 of file HtmlLib68K.h.

## Function Documentation

void HtmlLibAbortRenderData | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH |
| ) |  |  |

This function aborts rendering of the current content.

Parameters:

  | refNum | IN: the library reference number
  | contentH | IN: Memory Handle of the current content, returned by HtmlLibCreateContentObject

Err HtmlLibAddImageData | ( | UInt16 | refnum,
|  | MemHandle | contentH,
|  | Char * | url,
|  | Char * | mimeType,
|  | void * | data,
|  | Int32 | dataLen |
| ) |  |  |

This function adds images to HtmlLib. (You can use this to respond to Inclusion callback - please see section 2.1 Image Rendering).

Parameters:

  | refNum | IN: the library reference number
  | contentH | IN: Memory Handle returned by HtmlLibCreateContentObject
  | url | IN: url of the image
  | mimeType | IN: mime type of the image (for example, "image/jpeg")
  | data | IN: image data
  | dataLen | IN: image data size

Returns:
  Error code.

Err HtmlLibAddTextData | ( | UInt16 | refnum,
|  | MemHandle | contentH,
|  | Char * | url,
|  | Char * | mimeType,
|  | Char * | charset,
|  | void * | data,
|  | Int32 | dataLen |
| ) |  |  |

This function adds text data to the content data object created by HtmlLibCreateContentObject. Application should call HtmlLibRenderData when it has finished adding text data, for the data to be rendered.

Note:
  There is a limit of 64K of text data per content object (and not just per call of HtmlLibAddTextData).

Parameters:

  | refNum | IN: the library reference number
  | contentH | IN: Memory Handle returned by HtmlLibCreateContentObject
  | url | IN: url of the page you are adding to (unique, to make sure nothing is written over)
  | mimeType | IN: mime type of the text (such as "text/plain", "text/html")
  | charset | IN: the character set (such as "us-ascii")
  | data | IN: a reference to the text data to be added
  | dataLen | IN: length of the data

Returns:
  This function returns an error code (returns errNone if successful).

Boolean HtmlLibCanScroll | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | HtmlScrollDirection | direction |
| ) |  |  |

This function lets you know whether scrolling is possible in the indicated direction.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | direction | IN: htmlDirLeft, htmlDirRight, htmlDirUp, htmlDirDown

Returns:
  Function outputs true if scrolling in the indicated direction is possible.

void HtmlLibClearScreen | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH |
| ) |  |  |

This function clears the rendering screen. It must be called before content object is destroyed.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize

Err HtmlLibClose | ( | UInt16 | refnum | ) |

Standard library close routine.

Parameters:

  | refun | IN: the library reference number

Returns:
  Error code.

MemHandle HtmlLibCreateContentObject | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH |
| ) |  |  |

Creates a content object (structure in memory that contains content to be rendered).

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize

Returns:
  This function returns the memory handle of a content data object.

void HtmlLibDestroyContentObject | ( | UInt16 | refnum,
|  | MemHandle | contentH |
| ) |  |  |

This function destroys the content data object created by HtmlLibCreateContentObject.

Note:
  Be cautious when destroying a content object - make sure it is not busy doing something else, like rendering data. You can use HtmlLibProgress to check for the status (busy or not), or you can call HtmlLibAbortRenderData first.

Parameters:

  | refNum | IN: the library reference number
  | contentH | IN: Memory Handle returned by HtmlLibCreateContentObject

void HtmlLibFinalize | ( | UInt16 | refnum,
|  | MemHandle | htmllibH |
| ) |  |  |

Finalizes the library when you are done using it

Note:
  If you need to use the library again after it has been finalized, you will need to re-initialize it.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize

Err HtmlLibFindText | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | Char * | searchString,
|  | Boolean | wrapSearch |
| ) |  |  |

Applications should call this function to find a given text string on the page. Page will automatically scroll to show search result.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | searchString | IN: the given text string we are looking for on the page
  | wrapSearch | IN: true if you would like to wrap search

Returns:
  Error code (errNone, htmlErrNotFound).

Boolean HtmlLibGetTargetInfo | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | HtmlLibFocusTargetInfo * | htmlTargetInfo |
| ) |  |  |

Boolean HtmlLibGetTextSelection | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | Char ** | selectedText |
| ) |  |  |

Applications should use this function to retrieve the current selected text. Caller application must free the pointer returned in selectedText using MemPtrFree.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | selectedText | IN: the selected text that we are retrieving

Returns:
  This function returns false if no current selection, otherwise returns true.

Err HtmlLibGetVScrollPosition | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | Int16 * | valueP |
| ) |  |  |

This function obtains the current scroll position in pixels from the top of the page.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | valueP | IN: at function's return, this contains the position in pixels from the top of the page

Returns:
  Error code.

MemHandle HtmlLibInitialize | ( | UInt16 | refnum,
|  | RectangleType | bounds,
|  | Err * | errP |
| ) |  |  |

Html Library initialization function. Initializes the library, after the library has been loaded.

Parameters:

  | refNum | IN: the library reference number
  | bounds | IN: the screen area the library will draw the rendered content (bounds within 160 x 160 grid)
  | errP | IN: error code if library fails to initialize. The error code can be one of (htmlErrInUse, htmlErrOutOfMemory, htmlErrInvalidParam, htmlErrInUse, htmlErrCantOpen)

Returns:
  A memory handle to the HTML library context.

MemHandle HtmlLibInitializeWithHeapSize | ( | UInt16 | refnum,
|  | RectangleType | bounds,
|  | Err * | errP,
|  | UInt32 | heapMinSize,
|  | UInt32 | heapDesiredSize,
|  | UInt32 * | heapActualSizeP |
| ) |  |  |

Boolean HtmlLibNotifyUIEvent | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | EventType * | eventP |
| ) |  |  |

Applications should call this function to notify HTML library of a UI event (any event that your application gets that the library should handle, such as a screen tap, or a key press). It is worth noting that you may create your own events and call this function for the library to handle it. By the same token, you can filter which events to pass to this function - you do not have to pass through every event.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | eventP | IN: the event you would like the library to handle

Returns:
  True if the library considers this event handled.

Err HtmlLibOpen | ( | UInt16 | refnum | ) |

Standard library open routine.

Parameters:

  | refun | IN: the library reference number

Returns:
  Error code.

UInt16 HtmlLibProgress | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | Int32 | stayTime |
| ) |  |  |

Applications should call this function to allow HTML library to process content and draw to screen.

Note:
  The Html Library will run only if you call this!

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | stayTime | IN: maximum time (in milliseconds) for HTML library to do processing. (At least 1300 is recommend.)

Returns:
  Status - htmlProgressDone, htmlProgressBusy, htmlProgressOutOfMemory, and other error codes.

void HtmlLibRedrawScreen | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH |
| ) |  |  |

This redraws the HtmlLib rendering screen (for example, when application receives a frmUpdate event).

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize

void HtmlLibRenderData | ( | UInt16 | refnum,
|  | MemHandle | contentH |
| ) |  |  |

Applications should call this function after adding text data by HtmlLibAddTextData (or image data by HtmlLibAddImageData, see section 2.1 Image Rendering) to have HTML library start rendering the content.

Parameters:

  | refNum | IN: the library reference number
  | contentH | IN: Memory Handle returned by HtmlLibCreateContentObject that contains the text data to be rendered

Boolean HtmlLibResetFocusInfo | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH |
| ) |  |  |

This function reinitializes the focus to point to nothing.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: htmlLib handle

Returns:
  True if the focus was reset to point to nothing.

void HtmlLibResizeScreen | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | RectangleType | newBounds |
| ) |  |  |

Resize the screen area.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | newBounds | IN: the new bounds of the screen area (bounds within 160 x 160 grid)

Returns:
  errNone if resize is successful, otherwise returns an error code (errInvalidParam)

Err HtmlLibSetBiggerFont | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | Boolean | value |
| ) |  |  |

This function will control the size of the font used by HtmlLib.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: htmlLib handle
  | value | IN: true if you would like bigger font (bigger font corresponds to the Large font option in Blazer), and false otherwise (false would correspond to the Small font option in Blazer).

Returns:
  Error code.

void HtmlLibSetDisplayMode | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | HtmlDisplayMode | mode |
| ) |  |  |

Sets the display mode (faithful rendering, which corresponds to Blazer's Wide Page Mode, or handheld wrapped, which corresponds to Blazer's Optimized Mode).

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | mode | IN: display mode (htmlFaithfulDisplayMode or htmlHandheldDisplayMode)

void HtmlLibSetFocusStatus | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | Boolean | flag,
|  | Boolean | reset_focus |
| ) |  |  |

This function sets the focus according to the condition flags passed in.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: htmlLib handle
  | flag | - Enables (true) or Disables (false) focus handling
  | reset_focus | - if flag is true: if reset_focus is true, then the code tries to set the next focus onto the next target in the event focus walk chain. If false, it again sets the focus to the current event target.

void HtmlLibSetFormWidgetProc | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | HtmlLibFormWidgetProc * | proc |
| ) |  |  |

This function sets the function pointers of some necessary form widget creation/deletion routines. The following is sufficient for most purposes (and included in the sample application):

      static HtmlLibFormWidgetProc *widgetProc = NULL;

        widgetProc = MemPtrNew(sizeof(HtmlLibFormWidgetProc));
        if (widgetProc) {
          //functions defined in sample code
            widgetProc->newControlProc = RendererNewControlProc;
            widgetProc->newFieldProc = RendererNewFieldProc;
            widgetProc->newListProc = RendererNewListProc;
            widgetProc->deleteObjectProc = RendererDeleteObjectProc;
        }

        HtmlLibSetFormWidgetProc(refNum, htmlLibH, widgetProc);

A standard example of the necessary form widget creation/deletion routines are provided below, and can be found in the sample code.

     static Boolean
     RendererNewControlProc(UInt16 ID,
           UInt16 style, const Char *textP,
           Coord x, Coord y, Coord width, Coord height,
           UInt16 font, UInt8 group, Boolean leftAnchor)

      {
           ControlType *ctlP;
           FormType *formP = FrmGetActiveForm();
           ctlP = CtlNewControl((void**)&formP, ID, style, textP, x, y, width, height, font, group, leftAnchor);
           if (ctlP) {
               return true;
           }
           return false;
      }

      static Boolean
      RendererNewFieldProc(UInt16 id,
           Coord x, Coord y, Coord width, Coord height,
           UInt16 font, UInt32 maxChars, UInt16 editable, UInt16 underlined,
           UInt16 singleLine, UInt16 dynamicSize, UInt16 justification,
           UInt16 autoShift, UInt16 hasScrollBar, UInt16 numeric)

      {
           FieldType *fieldP;
           FormType *formP = FrmGetActiveForm();
           fieldP = FldNewField((void**)&formP, id, x, y, width, height, (FontID)font,
                           maxChars, (Boolean)editable, (Boolean)underlined, (Boolean)singleLine,
                           (Boolean)dynamicSize, (JustificationType)justification, (Boolean)autoShift,
                           (Boolean)hasScrollBar, (Boolean)numeric);
           if (fieldP) {
               return true;
           }
           return false;
      }

      static Err
      RendererNewListProc(UInt16 id,
           Coord x, Coord y, Coord width, Coord height,
           UInt16 font, Int16 visibleItems, Int16 triggerId)
      {
           FormType *formP = FrmGetActiveForm();
           return LstNewList((void**)&formP, id, x, y, width, height, font,
                               visibleItems, triggerId);
      }

      static void
      RendererDeleteObjectProc(UInt16 index)
      {
           FormType *formP = FrmGetActiveForm();
           FrmRemoveObject(&formP, index);
      }

Parameters:

  | refNum | IN: HTML library reference number
  | htmlLibH | IN: htmlLib handle
  | proc | IN: function pointers of form widget creation/deletion routines.

Err HtmlLibSetImageMemoryLimit | ( | UInt16 | renum,
|  | MemHandle | htmlLibH,
|  | Int32 | limit |
| ) |  |  |

void HtmlLibSetInclusionCallback | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | HtmlLibInclusionCallback * | callback,
|  | void * | cbData |
| ) |  |  |

Specify the function that you want the library to call when rendering a page requires additional content (an image that hasn't been added, an external style sheet, etc).

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | callback | IN: a pointer to the function you want called when rendering a page that requires additional content.
  | cbData | I/O: the library does nothing with this parameter except pass it on as one of the arguments to your callback function. To not take advantage of this feature, just pass in NULL.

Note:
  : The callback function should be in the following form: void HtmlLibInclusionCallback(MemHandle htmlLibH, Char *url, void *cbData);

HtmlLib calls this callback function with the appropriate arguments (where the url is the url of the additional content the library requires).

See also:
  HtmlLibInclusionCallback

void HtmlLibSetLinkSelectionCallback | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | HtmlLibLinkSelCallback * | callback,
|  | void * | cbData |
| ) |  |  |

Specify the function that you want the library to call when a link is followed.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | callback | IN: a pointer to the function you want called when a link is followed.
  | cbData | I/O: the library does nothing with this parameter except pass it on as one of the arguments to your callback function. To not take advantage of this feature, just pass in NULL.

Note:
  The callback function should be in the following form: void HtmlLinkSelCallback(MemHandle htmlLibH, Char *url, void *cbData); The library will call this function, supplying the appropriate arguments (where the url is the url of the link which was selected).

See also:
  HtmlLibLinkSelCallback

void HtmlLibSetScanPhoneNumberCallback | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | HtmlLibScanPhoneNumberCallback * | callback |
| ) |  |  |

Specify the function that you want the library to call to determine whether some string of numbers contains a phone number.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | callback | IN: a pointer to the function that HtmlLib will call to determine whether a string of numbers is a phone number, and should be handled as such.

Note:
  The callback function should be in the following form: Boolean HtmlLibScanPhoneNumberCallback(MemHandle htmlLibH, Char *buffer, Int32 length, Int32 *patternStart, Int32 *patternEnd);

See also:
  HtmlLibScanPhoneNumberCallback

Err HtmlLibSetScrollbarMode | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | HtmlScrollbarMode | mode |
| ) |  |  |

This function sets the page's scrollbar mode, without affecting the scrollbars of a textarea. A reason to use htmlNoPageScrollbarMode and not htmlNormalScrollbarMode is if you would like to use your own scrollbars, and use HtmlLib(Set/Get)VScrollPosition to do so.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | mode | IN: scrollbar mode (htmlNormalScrollbarMode to enable scrolling or htmlNoPageScrollbarMode for no scrolling)

Returns:
  Error code. (htmlErrNotInitialized, htmlErrInUse)

void HtmlLibSetScrollbars | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | UInt16 * | scrollbars,
|  | UInt16 | size |
| ) |  |  |

This function passes an array of scrollbars to HtmlLib. Html library will not display any scrollbar if application does not call this function (scrollbars cannot be added dynamically). Application is recommended to pass no less than 4 (or at the very least 2) scrollbars, and up to 9 scrollbars. For example (after defining RenderScroll0ScrollBar and RenderScroll1ScrollBar):

      UInt16 scrollbars[2] = {RenderScroll0ScrollBar, RenderScroll1ScrollBar};
      HtmlLibSetScrollbars(gRefNum, gHtmlLibH, scrollbars, 2);

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | scrollbars | IN: array of scrollbars
  | size | IN: size of the array of scrollbars

void HtmlLibSetSubmitFormCallback | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | HtmlLibSubmitFormCallback * | callback,
|  | void * | cbData |
| ) |  |  |

Note:
  : Forms are not supported; thus, use this at your own risk.

This functions lets you specify the function that you want the library to call when a "submit" is activated.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | callback | IN: a pointer to the function you want called when a "submit" is activated
  | cbData | I/O: the library does nothing with this parameter except pass it on as one of the arguments to your callback function. To not take advantage of this feature, just pass in NULL.

Note:
  The callback function should be in the following form:

HtmlLibSubmitFormCallback(MemHandle htmlLibH, Char *url, HtmlSubmitFormMethod method, Char *query, void *cbData);

HtmlLib calls this callback function with the appropriate arguments.

See also:
  HtmlLibSubmitFormCallback

Err HtmlLibSetVScrollPosition | ( | UInt16 | refnum,
|  | MemHandle | htmlLibH,
|  | Int16 | newPosition |
| ) |  |  |

This function sets the current scroll position in pixels from the top of the page. If the total page height of the current page is less than this, this scrolls the page to the bottom.

Parameters:

  | refNum | IN: the library reference number
  | htmlLibH | IN: the memory handle returned by HtmlLibInitialize
  | newPosition | IN: the position in pixels from the top of the page

Returns:
  Error code.

Err HtmlLibSleep | ( | UInt16 | refnum | ) |

Standard library sleep routine.

Parameters:

  | refun | IN: the library reference number

Returns:
  Error code.

Err HtmlLibWake | ( | UInt16 | refnum | ) |

Standard library wake routine.

Parameters:

  | refun | IN: the library reference number

Returns:
  Error code.

Top | Palm Developer Network © 2004-2008, Palm, Inc. All rights reserved. Generated on Fri Jun 13 10:07:34 2008 for Palm API Guide