#include </home/zeitlin/src/wx/github/interface/wx/html/htmlcell.h>
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.
Public Member Functions | |
wxHtmlCell () | |
Constructor. | |
virtual bool | AdjustPagebreak (int *pagebreak, const wxArrayInt &known_pagebreaks, int pageHeight) const |
This method is used to adjust pagebreak position. | |
virtual void | Draw (wxDC &dc, int x, int y, int view_y1, int view_y2, wxHtmlRenderingInfo &info) |
Renders the cell. | |
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). | |
virtual const wxHtmlCell * | Find (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. | |
int | GetDescent () const |
Returns descent value of the cell (m_Descent member). | |
virtual wxHtmlCell * | GetFirstChild () const |
Returns pointer to the first cell in the list. | |
int | GetHeight () const |
Returns height of the cell (m_Height member). | |
const wxString & | GetId () const |
Returns unique cell identifier if there is any, the empty string otherwise. | |
virtual wxHtmlLinkInfo * | GetLink (int x=0, int y=0) const |
Returns hypertext link if associated with this cell or NULL otherwise. | |
virtual wxCursor | GetMouseCursor (wxHtmlWindowInterface *window) const |
Returns cursor to show when mouse pointer is over the cell. | |
wxHtmlCell * | GetNext () const |
Returns pointer to the next cell in list (see htmlcell.h if you're interested in details). | |
wxHtmlContainerCell * | GetParent () const |
Returns pointer to parent container. | |
int | GetPosX () const |
Returns X position within parent (the value is relative to parent's upper left corner). | |
int | GetPosY () const |
Returns Y position within parent (the value is relative to parent's upper left corner). | |
int | GetWidth () const |
Returns width of the cell (m_Width member). | |
virtual void | Layout (int w) |
Layouts the cell. | |
virtual bool | ProcessMouseClick (wxHtmlWindowInterface *window, const wxPoint &pos, const wxMouseEvent &event) |
This function is simple event handler. | |
void | SetId (const wxString &id) |
Sets unique cell identifier. | |
void | SetLink (const wxHtmlLinkInfo &link) |
Sets the hypertext link associated with this cell. | |
void | SetNext (wxHtmlCell *cell) |
Sets the next cell in the list. | |
void | SetParent (wxHtmlContainerCell *p) |
Sets parent container of this cell. | |
virtual void | SetPos (int x, int y) |
Sets the cell's position within parent container. |
wxHtmlCell::wxHtmlCell | ( | ) |
Constructor.
virtual bool wxHtmlCell::AdjustPagebreak | ( | int * | pagebreak, |
const wxArrayInt & | known_pagebreaks, | ||
int | pageHeight | ||
) | const [virtual] |
This method is used to adjust pagebreak position.
The first parameter is a variable that contains the y-coordinate of the page break (= horizontal line that should not be crossed by words, images etc.). If this cell cannot be divided into two pieces (each one on another page) then it either moves the pagebreak a few pixels up, if possible, or, if the cell cannot fit on the page at all, then the cell is forced to split unconditionally.
Returns true if pagebreak was modified, false otherwise.
pagebreak | position in pixel of the pagebreak. |
known_pagebreaks | the list of the previous pagebreaks |
pageHeight | the height in pixel of the page drawable area |
Usage:
while (container->AdjustPagebreak(&p, kp, ph)) {}
virtual void wxHtmlCell::Draw | ( | wxDC & | dc, |
int | x, | ||
int | y, | ||
int | view_y1, | ||
int | view_y2, | ||
wxHtmlRenderingInfo & | info | ||
) | [virtual] |
Renders the cell.
dc | Device context to which the cell is to be drawn. |
x,y | Coordinates 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_y1 | y-coord of the first line visible in window. This is used to optimize rendering speed. |
view_y2 | y-coord of the last line visible in window. This is used to optimize rendering speed. |
info | Additional information for the rendering of the cell. |
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!
dc | Device context to which the cell is to be drawn. |
x,y | Coordinates 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)
|
info | Additional information for the rendering of the cell. |
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).
condition | Unique integer identifier of condition |
param | Optional parameters |
int wxHtmlCell::GetDescent | ( | ) | const |
Returns descent value of the cell (m_Descent member).
See explanation:
virtual wxHtmlCell* wxHtmlCell::GetFirstChild | ( | ) | const [virtual] |
int wxHtmlCell::GetHeight | ( | ) | const |
Returns height of the cell (m_Height member).
const wxString& wxHtmlCell::GetId | ( | ) | const |
Returns unique cell identifier if there is any, the empty string otherwise.
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).
x,y | Coordinates 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) |
virtual wxCursor wxHtmlCell::GetMouseCursor | ( | wxHtmlWindowInterface * | window | ) | const [virtual] |
Returns cursor to show when mouse pointer is over the cell.
window | interface to the parent HTML window |
wxHtmlCell* wxHtmlCell::GetNext | ( | ) | const |
Returns pointer to the next cell in list (see htmlcell.h if you're interested in details).
wxHtmlContainerCell* wxHtmlCell::GetParent | ( | ) | const |
Returns pointer to parent container.
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!
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!
int wxHtmlCell::GetWidth | ( | ) | const |
Returns width of the cell (m_Width member).
virtual void wxHtmlCell::Layout | ( | int | w | ) | [virtual] |
Layouts the cell.
This method performs two actions:
It must be called before displaying cells structure because m_PosX and m_PosY are undefined (or invalid) before calling Layout().
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.
window | interface to the parent HTML window |
pos | coordinates of mouse click (this is relative to cell's origin |
event | mouse event that triggered the call |
void wxHtmlCell::SetId | ( | const wxString & | id | ) |
Sets unique cell identifier.
Default value is no identifier, i.e. empty string.
void wxHtmlCell::SetLink | ( | const wxHtmlLinkInfo & | link | ) |
Sets the hypertext link associated with this cell.
(Default value is wxHtmlLinkInfo("", "") (no link))
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.
void wxHtmlCell::SetParent | ( | wxHtmlContainerCell * | p | ) |
Sets parent container of this cell.
This is called from wxHtmlContainerCell::InsertCell.
virtual void wxHtmlCell::SetPos | ( | int | x, |
int | y | ||
) | [virtual] |
Sets the cell's position within parent container.