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 wx.html.HtmlWindow and wx.html.HtmlWinParser 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.
See also
Cells and Containers, wx.html.HtmlContainerCell
wx.html.HtmlColourCell, wx.html.HtmlContainerCell, wx.html.HtmlFontCell, wx.html.HtmlWidgetCell, wx.html.HtmlWordCell
Constructor. |
|
This method is called when paginating HTML, e.g. when printing. |
|
Converts the cell into text representation. |
|
Renders the cell. |
|
This method is called instead of |
|
Returns pointer to itself if this cell matches condition (or if any of the cells following in the list matches), |
|
Find a cell inside this cell positioned at the given coordinates (relative to this’s positions). |
|
Returns descent value of the cell (m_Descent member). |
|
Returns pointer to the first cell in the list. |
|
Returns height of the cell (m_Height member). |
|
Returns unique cell identifier if there is any, the empty string otherwise. |
|
Returns hypertext link if associated with this cell or |
|
Returns cursor to show when mouse pointer is over the cell. |
|
Returns cursor to show when mouse pointer is over the specified point. |
|
Returns pointer to the next cell in list (see htmlcell.h if you’re interested in details). |
|
Returns pointer to parent container. |
|
Returns X position within parent (the value is relative to parent’s upper left corner). |
|
Returns Y position within parent (the value is relative to parent’s upper left corner). |
|
Returns width of the cell (m_Width member). |
|
Layouts the cell. |
|
This function is simple event handler. |
|
Sets unique cell identifier. |
|
Sets the hypertext link associated with this cell. |
|
Sets the next cell in the list. |
|
Sets parent container of this cell. |
|
Sets the cell’s position within parent container. |
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
wx.html.
HtmlCell
(Object)¶Possible constructors:
HtmlCell()
Internal data structure.
__init__
(self)¶Constructor.
AdjustPagebreak
(self, pagebreak, pageHeight)¶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:
ret_value, kp = container.AdjustPagebreak(p, kp, ph)
while ret_value:
ret_value, kp = container.AdjustPagebreak(p, kp, ph)
and less or equal to *pagebreak
for the value of pagebreak on input.
pagebreak (int) – position in pixels of the pagebreak.
pageHeight (int) – the height in pixels of the page drawable area
tuple
( bool, pagebreak )
ConvertToText
(self, sel)¶Converts the cell into text representation.
If sel != None
then only part of the cell inside the selection is converted.
sel (wx.html.HtmlSelection) –
string
Draw
(self, dc, x, y, view_y1, view_y2, info)¶Renders the cell.
dc (wx.DC) – Device context to which the cell is to be drawn.
x (int) –
y (int) – 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 + cell.PosX, y + cell.PosY)
view_y1 (int) – y-coord of the first line visible in window. This is used to optimize rendering speed.
view_y2 (int) – y-coord of the last line visible in window. This is used to optimize rendering speed.
info (wx.html.HtmlRenderingInfo) – Additional information for the rendering of the cell.
DrawInvisible
(self, dc, x, y, info)¶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 wx.html.HtmlColourCell or font setter) must be drawn even if they are invisible!
dc (wx.DC) – Device context to which the cell is to be drawn.
x (int) –
y (int) – 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 + cell.PosX, y + cell.PosY)
info (wx.html.HtmlRenderingInfo) – Additional information for the rendering of the cell.
Find
(self, condition, param)¶Returns pointer to itself if this cell matches condition (or if any of the cells following in the list matches), None
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. HtmlAnchorCell reacts on wx.html.HTML_COND_ISANCHOR
condition).
condition (int) – Unique integer identifier of condition
param (string) – Optional parameters
FindCellByPos
(self, x, y, flags=HTML_FIND_EXACT)¶Find a cell inside this cell positioned at the given coordinates (relative to this’s positions).
Returns None
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].
x (int) –
y (int) –
flags –
GetAbsPos
(self, rootCell=None)¶rootCell (wx.html.HtmlCell) –
Point
GetDescent
(self)¶Returns descent value of the cell (m_Descent member).
See explanation:
int
GetFirstChild
(self)¶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
(self)¶Returns height of the cell (m_Height member).
int
GetId
(self)¶Returns unique cell identifier if there is any, the empty string otherwise.
string
GetLink
(self, x=0, y=0)¶Returns hypertext link if associated with this cell or None
otherwise.
See wx.html.HtmlLinkInfo. (Note: this makes sense only for visible tags).
x (int) –
y (int) – 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)
GetMouseCursor
(self, window)¶Returns cursor to show when mouse pointer is over the cell.
window (wx.html.HtmlWindowInterface) – interface to the parent HTML window
Cursor
See also
GetMouseCursorAt
(self, window, rePos)¶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.
window (wx.html.HtmlWindowInterface) – interface to the parent HTML window
rePos (wx.Point) – Position to show cursor.
Cursor
New in version 3.0.
GetNext
(self)¶Returns pointer to the next cell in list (see htmlcell.h if you’re interested in details).
GetParent
(self)¶Returns pointer to parent container.
GetPosX
(self)¶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
GetPosY
(self)¶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
GetRootCell
(self)¶GetWidth
(self)¶Returns width of the cell (m_Width member).
int
Layout
(self, w)¶Layouts the cell.
This method performs two actions:
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.)
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
.
w (int) –
ProcessMouseClick
(self, window, pos, event)¶This function is simple event handler.
Each time the user clicks mouse button over a cell within wx.html.HtmlWindow this method of that cell is called. Default behaviour is to call wx.html.HtmlWindow.LoadPage
.
window (wx.html.HtmlWindowInterface) – interface to the parent HTML window
pos (wx.Point) – coordinates of mouse click (this is relative to cell’s origin
event (wx.MouseEvent) – mouse event that triggered the call
bool
True
if a link was clicked, False
otherwise.
New in version 2.7.0: (before OnMouseClick() method served a similar purpose).
Note
If you need more “advanced” event handling you should use HtmlBinderCell instead.
SetId
(self, id)¶Sets unique cell identifier.
Default value is no identifier, i.e. empty string.
id (string) –
SetLink
(self, link)¶Sets the hypertext link associated with this cell.
(Default value is :ref:`wx.html.HtmlLinkInfo`(“”, “”) (no link))
link (wx.html.HtmlLinkInfo) –
SetNext
(self, cell)¶Sets the next cell in the list.
This shouldn’t be called by user - it is to be used only by wx.html.HtmlContainerCell.InsertCell
.
cell (wx.html.HtmlCell) –
SetParent
(self, p)¶Sets parent container of this cell.
This is called from wx.html.HtmlContainerCell.InsertCell
.
SetPos
(self, x, y)¶Sets the cell’s position within parent container.
x (int) –
y (int) –
Descent
¶See GetDescent
FirstChild
¶See GetFirstChild
RootCell
¶See GetRootCell