| Version: 3.1.5

Public Member Functions | List of all members
wxHtmlDCRenderer Class Reference
Class List by Category » HTML

`#include </home/Hamis/wxwidgets-3.1/wxWidgets3.1-3.1.5-1.i686/src/wxWidgets-3.1.5/interface/wx/html/htmprint.h>`

Inheritance diagram for wxHtmlDCRenderer:
[legend]

## Detailed Description

This class can render HTML document into a specified area of a DC.

You can use it in your own printing code, although use of wxHtmlEasyPrinting or wxHtmlPrintout is strongly recommended.

##

Library: wxHTML

<>< =''>:</>&;&;< =''>\ </></>

## Public Member Functions
| wxHtmlDCRenderer ()
| Constructor. More...
int | GetTotalWidth () const
| Returns the width of the HTML text in pixels. More...
int | GetTotalHeight () const
| Returns the height of the HTML text in pixels. More...
int | FindNextPageBreak (int pos) const
| Finds the next page break after the specified (vertical) position. More...
void | Render (int x, int y, int from=0, int to=INT_MAX)
| Renders HTML text to the DC. More...
void | SetDC (wxDC *dc, double pixel_scale=1.0)
| Assign DC instance to the renderer. More...
void | SetFonts (const wxString &normal_face, const wxString &fixed_face, const int *sizes=NULL)
| This function sets font sizes and faces. More...
void | SetStandardFonts (int size=-1, const wxString &normal_face=wxEmptyString, const wxString &fixed_face=wxEmptyString)
| Sets font sizes to be relative to the given size or the system default size; use either specified or default font. More...
void | SetHtmlText (const wxString &html, const wxString &basepath=wxEmptyString, bool isdir=true)
| Assign text to the renderer. More...
void | SetHtmlCell (wxHtmlContainerCell &cell)
| Associate the given HTML contents to the renderer. More...
void | SetSize (int width, int height)
| Set size of output rectangle, in pixels. More...
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data. More...
| wxObject (const wxObject &other)
| Copy ctor. More...
virtual | ~wxObject ()
| Destructor. More...
virtual wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class. More...
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj. More...
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone. More...
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer. More...
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
void | UnShare ()
| This is the same of AllocExclusive() but this method is public. More...
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `WXDEBUG` is defined. More...
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `WXDEBUG` is defined. More...

## Additional Inherited Members
Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object. More...
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data. More...

## Constructor & Destructor Documentation

## ◆ wxHtmlDCRenderer()

wxHtmlDCRenderer::wxHtmlDCRenderer | ( |  | ) |

Constructor.

## Member Function Documentation

## ◆ FindNextPageBreak()

int wxHtmlDCRenderer::FindNextPageBreak | ( | int | pos | ) | const

Finds the next page break after the specified (vertical) position.

An example of using this method:

std::vector<int> pages;
for ( int pos = 0; pos != wxNOT_FOUND; pos = renderer.FindNextPageBreak(pos) )
{
pages.push_back(pos);
}
// "pages" vector now contains all page break positions and, in
// particular, its size() returns the number of pages
wxNOT_FOUND
#define wxNOT_FOUND
Definition: defs.h:488

Parameters

  pos | Absolute position of the last page break. For the initial call of this function, it should be 0 and for the subsequent ones it should be the previous return value.

Returns
  Position of the next page break or `wxNOT_FOUND` if there are no more of them.

Since
  3.1.2

## ◆ GetTotalHeight()

int wxHtmlDCRenderer::GetTotalHeight | ( |  | ) | const

Returns the height of the HTML text in pixels.

If the height of the area used with this renderer (see wxHtmlDCRenderer::SetSize) is smaller that total height, the renderer will produce more than one page of output.

See also
  GetTotalWidth()

## ◆ GetTotalWidth()

int wxHtmlDCRenderer::GetTotalWidth | ( |  | ) | const

Returns the width of the HTML text in pixels.

This can be compared with the width parameter of SetSize() to check if the document being printed fits into the page boundary.

See also
  GetTotalHeight()

Since
  2.9.0

## ◆ Render()

void wxHtmlDCRenderer::Render | ( | int | x,
|  | int | y,
|  | int | from = `0`,
|  | int | to = `INT_MAX`
| ) |  |

Renders HTML text to the DC.

When using multi-page documents, FindNextPageBreak() can be used to find the values for from and to, which should be the consecutive page breaks returned by that function.

Parameters

  x,y | position of upper-left corner of printing rectangle (see SetSize()).
  from | y-coordinate of the very first visible cell.
  to | y-coordinate of the last visible cell or `INT_MAX` to use the full page height.

Note
  The following three methods must always be called before any call to Render(), in this order:
  - SetDC()
  - SetSize()
  - SetHtmlText()

## ◆ SetDC()

void wxHtmlDCRenderer::SetDC | ( | wxDC * | dc,
|  | double | pixel_scale = `1.0`
| ) |  |

Assign DC instance to the renderer.

pixel_scale can be used when rendering to high-resolution DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in HTML are given in pixels – e.g. image sizes. 300x300 image would be only one inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)

## ◆ SetFonts()

void wxHtmlDCRenderer::SetFonts | ( | const wxString & | normal_face,
|  | const wxString & | fixed_face,
|  | const int * | sizes = `NULL`
| ) |  |

This function sets font sizes and faces.

Parameters

  normal_face | This is face name for normal (i.e. non-fixed) font. It can be either empty string (then the default face is chosen) or platform-specific face name. Examples are "helvetica" under Unix or "Times New Roman" under Windows.
  fixed_face | The same thing for fixed face ( <TT>..</TT> )
  sizes | This is an array of 7 items of int type. The values represent size of font with HTML size from -2 to +4 ( <FONT SIZE=-2> to <FONT SIZE=+4> ). Default sizes are used if sizes is NULL.

Default font sizes are defined by constants wxHTML_FONT_SIZE_1, wxHTML_FONT_SIZE_2, ..., wxHTML_FONT_SIZE_7. Note that they differ among platforms. Default face names are empty strings.

See also
  SetSize()

## ◆ SetHtmlCell()

void wxHtmlDCRenderer::SetHtmlCell | ( | wxHtmlContainerCell & | cell | ) |

Associate the given HTML contents to the renderer.

This is similar to SetHtmlText(), but is more efficient as the text can be parsed only once, using wxHtmlParser::Parse(), and then passed to wxHtmlDCRenderer multiple times or already reused for other purposes.

Note that cell will be modified (e.g. laid out) by this function.

Since
  3.1.2

## ◆ SetHtmlText()

void wxHtmlDCRenderer::SetHtmlText | ( | const wxString & | html,
|  | const wxString & | basepath = `wxEmptyString`,
|  | bool | isdir = `true`
| ) |  |

Assign text to the renderer.

Render() then draws the text onto DC.

Parameters

  html | HTML text. This is not a filename.
  basepath | base directory (html string would be stored there if it was in file). It is used to determine path for loading images, for example.
  isdir | false if basepath is filename, true if it is directory name (see wxFileSystem for detailed explanation).

## ◆ SetSize()

void wxHtmlDCRenderer::SetSize | ( | int | width,
|  | int | height
| ) |  |

Set size of output rectangle, in pixels.

Note that you can't change width of the rectangle between calls to Render() ! (You can freely change height.)

## ◆ SetStandardFonts()

void wxHtmlDCRenderer::SetStandardFonts | ( | int | size = `-1`,
|  | const wxString & | normal_face = `wxEmptyString`,
|  | const wxString & | fixed_face = `wxEmptyString`
| ) |  |

Sets font sizes to be relative to the given size or the system default size; use either specified or default font.

Parameters

  size | Point size of the default HTML text
  normal_face | This is face name for normal (i.e. non-fixed) font. It can be either empty string (then the default face is chosen) or platform-specific face name. Examples are "helvetica" under Unix or "Times New Roman" under Windows.
  fixed_face | The same thing for fixed face ( <TT>..</TT> )

See also
  SetSize()