Version: 3.2.7
wxHtmlCell Class Reference

#include <wx/html/htmlcell.h>

+ Inheritance diagram for wxHtmlCell:

Detailed Description

Internal data structure.

It represents fragments of parsed HTML page, the so-called cell - a word, picture, table, horizontal line and so on. It is used by wxHtmlWindow and wxHtmlWinParser to represent HTML page in memory.

You can divide cells into two groups : visible cells with non-zero width and height and helper cells (usually with zero width and height) that perform special actions such as color or font change.

Library:  wxHTML
Category:  HTML
See also
Cells and Containers, wxHtmlContainerCell

Public Member Functions

 wxHtmlCell ()
 Constructor. More...
 
virtual bool AdjustPagebreak (int *pagebreak, int pageHeight) const
 This method is called when paginating HTML, e.g. when printing. More...
 
virtual void Draw (wxDC &dc, int x, int y, int view_y1, int view_y2, wxHtmlRenderingInfo &info)
 Renders the cell. More...
 
virtual void DrawInvisible (wxDC &dc, int x, int y, wxHtmlRenderingInfo &info)
 This method is called instead of Draw() when the cell is certainly out of the screen (and thus invisible). More...
 
virtual const wxHtmlCellFind (int condition, const void *param) const
 Returns pointer to itself if this cell matches condition (or if any of the cells following in the list matches), NULL otherwise. More...
 
virtual wxHtmlCellFindCellByPos (wxCoord x, wxCoord y, unsigned flags=wxHTML_FIND_EXACT) const
 Find a cell inside this cell positioned at the given coordinates (relative to this's positions). More...
 
int GetDescent () const
 Returns descent value of the cell (m_Descent member). More...
 
virtual wxHtmlCellGetFirstChild () const
 Returns pointer to the first cell in the list. More...
 
int GetHeight () const
 Returns height of the cell (m_Height member). More...
 
const wxStringGetId () const
 Returns unique cell identifier if there is any, the empty string otherwise. More...
 
virtual wxHtmlLinkInfoGetLink (int x=0, int y=0) const
 Returns hypertext link if associated with this cell or NULL otherwise. More...
 
virtual wxCursor GetMouseCursor (wxHtmlWindowInterface *window) const
 Returns cursor to show when mouse pointer is over the cell. More...
 
virtual wxCursor GetMouseCursorAt (wxHtmlWindowInterface *window, const wxPoint &rePos) const
 Returns cursor to show when mouse pointer is over the specified point. More...
 
wxHtmlCellGetNext () const
 Returns pointer to the next cell in list (see htmlcell.h if you're interested in details). More...
 
wxHtmlContainerCellGetParent () const
 Returns pointer to parent container. More...
 
int GetPosX () const
 Returns X position within parent (the value is relative to parent's upper left corner). More...
 
int GetPosY () const
 Returns Y position within parent (the value is relative to parent's upper left corner). More...
 
int GetWidth () const
 Returns width of the cell (m_Width member). More...
 
virtual void Layout (int w)
 Layouts the cell. More...
 
virtual bool ProcessMouseClick (wxHtmlWindowInterface *window, const wxPoint &pos, const wxMouseEvent &event)
 This function is simple event handler. More...
 
void SetId (const wxString &id)
 Sets unique cell identifier. More...
 
void SetLink (const wxHtmlLinkInfo &link)
 Sets the hypertext link associated with this cell. More...
 
void SetNext (wxHtmlCell *cell)
 Sets the next cell in the list. More...
 
void SetParent (wxHtmlContainerCell *p)
 Sets parent container of this cell. More...
 
virtual void SetPos (int x, int y)
 Sets the cell's position within parent container. More...
 
virtual wxString ConvertToText (wxHtmlSelection *sel) const
 Converts the cell into text representation. 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 wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
 
wxObjectRefDataGetRefData () 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 wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
 
virtual wxObjectRefDataCloneRefData (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
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Constructor & Destructor Documentation

◆ wxHtmlCell()

wxHtmlCell::wxHtmlCell ( )

Constructor.

Member Function Documentation

◆ AdjustPagebreak()

virtual bool wxHtmlCell::AdjustPagebreak ( int *  pagebreak,
int  pageHeight 
) const
virtual

This method is called when paginating HTML, e.g. when printing.

User code should never call this function, but may need to override it in custom HTML cell classes with any specific page breaking requirements.

On input, pagebreak contains y-coordinate of page break (i.e. the horizontal line that should not be crossed by words, images etc.) relative to the parent cell on entry and may be modified to request a page break at a position before it if this cell cannot be divided into two pieces (each one on its own page).

Note that page break must still happen on the current page, i.e. the returned value must be strictly greater than

*pagebreak -
pageHeight

and less or equal to *pagebreak for the value of pagebreak on input.

Parameters
pagebreakposition in pixels of the pagebreak.
pageHeightthe height in pixels of the page drawable area
Returns
true if pagebreak was modified, false otherwise.

◆ ConvertToText()

virtual wxString wxHtmlCell::ConvertToText ( wxHtmlSelection sel) const
virtual

Converts the cell into text representation.

If sel != NULL then only part of the cell inside the selection is converted.

◆ Draw()

virtual void wxHtmlCell::Draw ( wxDC dc,
int  x,
int  y,
int  view_y1,
int  view_y2,
wxHtmlRenderingInfo info 
)
virtual

Renders the cell.

Parameters
dcDevice context to which the cell is to be drawn.
x,yCoordinates of parent's upper left corner (origin). You must add this to m_PosX,m_PosY when passing coordinates to dc's methods Example:
dc->DrawText("hello", x + m_PosX, y + m_PosY)
view_y1y-coord of the first line visible in window. This is used to optimize rendering speed.
view_y2y-coord of the last line visible in window. This is used to optimize rendering speed.
infoAdditional information for the rendering of the cell.

◆ DrawInvisible()

virtual void wxHtmlCell::DrawInvisible ( wxDC dc,
int  x,
int  y,
wxHtmlRenderingInfo info 
)
virtual

This method is called instead of Draw() when the cell is certainly out of the screen (and thus invisible).

This is not nonsense - some tags (like wxHtmlColourCell or font setter) must be drawn even if they are invisible!

Parameters
dcDevice context to which the cell is to be drawn.
x,yCoordinates of parent's upper left corner. You must add this to m_PosX,m_PosY when passing coordinates to dc's methods Example:
dc->DrawText("hello", x + m_PosX, y + m_PosY)
infoAdditional information for the rendering of the cell.

◆ Find()

virtual const wxHtmlCell* wxHtmlCell::Find ( int  condition,
const void *  param 
) const
virtual

Returns pointer to itself if this cell matches condition (or if any of the cells following in the list matches), NULL otherwise.

(In other words if you call top-level container's Find() it will return pointer to the first cell that matches the condition)

It is recommended way how to obtain pointer to particular cell or to cell of some type (e.g. wxHtmlAnchorCell reacts on wxHTML_COND_ISANCHOR condition).

Parameters
conditionUnique integer identifier of condition
paramOptional parameters

◆ FindCellByPos()

virtual wxHtmlCell* wxHtmlCell::FindCellByPos ( wxCoord  x,
wxCoord  y,
unsigned  flags = wxHTML_FIND_EXACT 
) const
virtual

Find a cell inside this cell positioned at the given coordinates (relative to this's positions).

Returns NULL if no such cell exists. The flag can be used to specify whether to look for terminal or nonterminal cells or both. In either case, returned cell is deepest cell in cells tree that contains [x,y].

◆ GetDescent()

int wxHtmlCell::GetDescent ( ) const

Returns descent value of the cell (m_Descent member).

See explanation:

◆ GetFirstChild()

virtual wxHtmlCell* wxHtmlCell::GetFirstChild ( ) const
virtual

Returns pointer to the first cell in the list.

You can then use child's GetNext() method to obtain pointer to the next cell in list.

Note
This shouldn't be used by the end user. If you need some way of finding particular cell in the list, try Find() method instead.

◆ GetHeight()

int wxHtmlCell::GetHeight ( ) const

Returns height of the cell (m_Height member).

◆ GetId()

const wxString& wxHtmlCell::GetId ( ) const

Returns unique cell identifier if there is any, the empty string otherwise.

◆ GetLink()

virtual wxHtmlLinkInfo* wxHtmlCell::GetLink ( int  x = 0,
int  y = 0 
) const
virtual

Returns hypertext link if associated with this cell or NULL otherwise.

See wxHtmlLinkInfo. (Note: this makes sense only for visible tags).

Parameters
x,yCoordinates of position where the user pressed mouse button. These coordinates are used e.g. by COLORMAP. Values are relative to the upper left corner of THIS cell (i.e. from 0 to m_Width or m_Height)

◆ GetMouseCursor()

virtual wxCursor wxHtmlCell::GetMouseCursor ( wxHtmlWindowInterface window) const
virtual

Returns cursor to show when mouse pointer is over the cell.

Parameters
windowinterface to the parent HTML window
See also
GetMouseCursorAt()

◆ GetMouseCursorAt()

virtual wxCursor wxHtmlCell::GetMouseCursorAt ( wxHtmlWindowInterface window,
const wxPoint rePos 
) const
virtual

Returns cursor to show when mouse pointer is over the specified point.

This function should be overridden instead of GetMouseCursorAt() if the cursor should depend on the exact position of the mouse in the window.

Parameters
windowinterface to the parent HTML window
rePosPosition to show cursor.
Since
3.0

◆ GetNext()

wxHtmlCell* wxHtmlCell::GetNext ( ) const

Returns pointer to the next cell in list (see htmlcell.h if you're interested in details).

◆ GetParent()

wxHtmlContainerCell* wxHtmlCell::GetParent ( ) const

Returns pointer to parent container.

◆ GetPosX()

int wxHtmlCell::GetPosX ( ) const

Returns X position within parent (the value is relative to parent's upper left corner).

The returned value is meaningful only if parent's Layout() was called before!

◆ GetPosY()

int wxHtmlCell::GetPosY ( ) const

Returns Y position within parent (the value is relative to parent's upper left corner).

The returned value is meaningful only if parent's Layout() was called before!

◆ GetWidth()

int wxHtmlCell::GetWidth ( ) const

Returns width of the cell (m_Width member).

◆ Layout()

virtual void wxHtmlCell::Layout ( int  w)
virtual

Layouts the cell.

This method performs two actions:

  1. adjusts the cell's width according to the fact that maximal possible width is w (this has sense when working with horizontal lines, tables etc.)
  2. prepares layout (=fill-in m_PosX, m_PosY (and sometimes m_Height) members) based on actual width w

It must be called before displaying cells structure because m_PosX and m_PosY are undefined (or invalid) before calling Layout().

◆ ProcessMouseClick()

virtual bool wxHtmlCell::ProcessMouseClick ( wxHtmlWindowInterface window,
const wxPoint pos,
const wxMouseEvent event 
)
virtual

This function is simple event handler.

Each time the user clicks mouse button over a cell within wxHtmlWindow this method of that cell is called. Default behaviour is to call wxHtmlWindow::LoadPage.

Parameters
windowinterface to the parent HTML window
poscoordinates of mouse click (this is relative to cell's origin
eventmouse event that triggered the call
Returns
true if a link was clicked, false otherwise.
Since
2.7.0 (before OnMouseClick() method served a similar purpose).
Note
If you need more "advanced" event handling you should use wxHtmlBinderCell instead.

◆ SetId()

void wxHtmlCell::SetId ( const wxString id)

Sets unique cell identifier.

Default value is no identifier, i.e. empty string.

◆ SetLink()

void wxHtmlCell::SetLink ( const wxHtmlLinkInfo link)

Sets the hypertext link associated with this cell.

(Default value is wxHtmlLinkInfo("", "") (no link))

◆ SetNext()

void wxHtmlCell::SetNext ( wxHtmlCell cell)

Sets the next cell in the list.

This shouldn't be called by user - it is to be used only by wxHtmlContainerCell::InsertCell.

◆ SetParent()

void wxHtmlCell::SetParent ( wxHtmlContainerCell p)

Sets parent container of this cell.

This is called from wxHtmlContainerCell::InsertCell.

◆ SetPos()

virtual void wxHtmlCell::SetPos ( int  x,
int  y 
)
virtual

Sets the cell's position within parent container.