HTML::HTMLDOC Class Reference

#include <mi32/htmldoc.h>

Inheritance diagram for HTML::HTMLDOC:
Inheritance graph
[legend]

List of all members.

Public Types

typedef
fastdelegate::FastDelegate
< void(const DRECT2D &clip)> 
DELEGATE_REDRAW

Public Member Functions

 HTMLDOC ()
virtual ~HTMLDOC ()
void AddInlineImage (const MISTRING &key, MGD::DEVICE *Device, bool bTakeOwnership)
void DoLayout (MGD::CONTEXT *context, double MaxWidth)
void Draw (MGD::CONTEXT *context, const DPOINT2D *offset=0, const DRECT2D *cliprect=0, bool bDrawAll=true)
ELEMENTFindElement (const DPOINT2D &pt)
const ELEMENTFindElement (const DPOINT2D &pt) const
bool GetAccurateZoom () const
void GetDirtyRegion (REGION2D &region)
bool GetFullRedraw () const
double GetHeight () const
bool GetLink (const DPOINT2D &pt, MISTRING &href) const
void GetTitleOrFirstLine (MISTRING &string, int maxlen=80) const
bool GetTooltip (const DPOINT2D &pt, MISTRING &tooltip) const
double GetWidth () const
double GetZoom () const
ERRVALUE Parse (const UINT8 *buffer)
ERRVALUE Read (const FILEPATH &filepath)
void SetAccurateZoom (bool val=true)
void SetDefaultTextStyle (const TEXTSTYLE &Style)
void SetDelegateRedraw (DELEGATE_REDRAW delegate)
void SetSourceFile (const FILEPATH &url)
void SetSourceURL (const MISTRING &url)
void SetTransAffine (const TRANS2D_AFFINE &trans)
void SetZoom (double zoom)

Member Typedef Documentation

typedef fastdelegate::FastDelegate<void(const DRECT2D& clip)> HTML::HTMLDOC::DELEGATE_REDRAW

Constructor & Destructor Documentation

HTML::HTMLDOC::HTMLDOC (  ) 
virtual HTML::HTMLDOC::~HTMLDOC (  )  [virtual]

Member Function Documentation

void HTML::HTMLDOC::AddInlineImage ( const MISTRING key,
MGD::DEVICE Device,
bool  bTakeOwnership 
)

Add an inline image that can be rendered using an <img> tag with <img src='inline:tag'>.

If you bTakeOwnership is true, then the HTMLDOC will "own" the device and will delete it when it's done. If not, the HTMLDOC will copy the device (not terribly efficient)

void HTML::HTMLDOC::DoLayout ( MGD::CONTEXT context,
double  MaxWidth 
)

Compute the size of the HTML document.

Call GetHeight()/GetWidth() after computing the size.

Parameters:
context MGD context -- needed for size calculations
MaxWidth Maximum width in pixels
void HTML::HTMLDOC::Draw ( MGD::CONTEXT context,
const DPOINT2D offset = 0,
const DRECT2D cliprect = 0,
bool  bDrawAll = true 
)

Draws the document in the given MGD context.

Parameters:
offset If not NULL, the coordinate of the upper-left corner of the document
cliprect If not NULL, the portion of the document to draw
bDrawAll If false, only draw elements marked as needing to be redrawn
ELEMENT* HTML::HTMLDOC::FindElement ( const DPOINT2D pt  ) 

Find an element at a given point (non-const).

const ELEMENT* HTML::HTMLDOC::FindElement ( const DPOINT2D pt  )  const

Find an element at a given point (const).

bool HTML::HTMLDOC::GetAccurateZoom (  )  const

Determine if the document requires accurate zooming.

The default is false unless SetAccurateZoom() has been called.

void HTML::HTMLDOC::GetDirtyRegion ( REGION2D region  ) 
bool HTML::HTMLDOC::GetFullRedraw (  )  const

Get the value of the bFullRedraw parameter to the last Draw call Used by elements during a redraw.

double HTML::HTMLDOC::GetHeight (  )  const [inline]

Get the height of the document in pixels Note: you must call DoLayout() after parsing before calling GetHeight().

If the affine transformation includes rotation, the height is of the unrotated content.

bool HTML::HTMLDOC::GetLink ( const DPOINT2D pt,
MISTRING href 
) const

Check to see if there is a hyper link at a given point.

Returns true if the point is a hyper link and returns the URL in the href parameter.

void HTML::HTMLDOC::GetTitleOrFirstLine ( MISTRING string,
int  maxlen = 80 
) const

Gets the contents of the <title> tag (if any) or the first line of text.

The maxlen parameter controls how much of the body text to get if there is no title tag.

bool HTML::HTMLDOC::GetTooltip ( const DPOINT2D pt,
MISTRING tooltip 
) const

Check to see if there is a tooltip for a given point.

Returns true if the point is over an element with a title attribute or an image with an alt attribute. Returns the tooltip text in the tooltip parameter.

double HTML::HTMLDOC::GetWidth (  )  const [inline]

Get the width of the document in pixels Note: you must call DoLayout() after parsing before calling GetWidth(); If the affine transformation includes rotation, the width is of the unrotated content.

double HTML::HTMLDOC::GetZoom (  )  const [inline]
ERRVALUE HTML::HTMLDOC::Parse ( const UINT8 buffer  ) 

Parse an in-memory HTML document The buffer is assumed to be UTF8.

Reimplemented from XMLDOC.

ERRVALUE HTML::HTMLDOC::Read ( const FILEPATH filepath  ) 

Read and parse an HTML file.

Reimplemented from XMLDOC.

void HTML::HTMLDOC::SetAccurateZoom ( bool  val = true  ) 

Set accurate zooming.

If set, the CSS measurement 1px will be assumed to be approx 1/100th of an inch regardless of the actual device resolution. If not set, 1px == 1 device pixel. This must be called BEFORE DoLayout()

void HTML::HTMLDOC::SetDefaultTextStyle ( const TEXTSTYLE Style  ) 

Set the default text style for the body.

void HTML::HTMLDOC::SetDelegateRedraw ( DELEGATE_REDRAW  delegate  )  [inline]

Set a delegate to call when things need to be redrawn.

The delegate will be given a DRECT2D with the absolute extents of the area to be redrawn

void HTML::HTMLDOC::SetSourceFile ( const FILEPATH url  ) 

Set the source file.

The source file is used if the HTML refers to other files using relative paths. This can be used if the source was read into memory and parsed using Parse() instead of Read()

void HTML::HTMLDOC::SetSourceURL ( const MISTRING url  ) 

Set the source URL The source URL is used if the HTML refers to other files using relative paths.

void HTML::HTMLDOC::SetTransAffine ( const TRANS2D_AFFINE trans  ) 

Set an affine transformation for rendering the output.

NOTE: Currently the only transformation supported is scale, and it assumes that xscale == yscale All scaling is applied when doing the layout. Offset and Rotation are only applied on Draw() Note: calling this method forces accurate zooming (See SetAccurateZoom() for details)

void HTML::HTMLDOC::SetZoom ( double  zoom  ) 

Set the zoom factor of the document Default zoom is 1.0.

This forces offset and rotation to 0. Note: setting zoom forces accurate zooming (See SetAccurateZoom() for details)


The documentation for this class was generated from the following file:

Generated on Sun Oct 7 21:35:01 2012 for TNTsdk 2012 by  doxygen 1.6.1