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.
wx.html.HtmlColourCell, wx.html.HtmlContainerCell, wx.html.HtmlFontCell, wx.html.HtmlWidgetCell, wx.html.HtmlWordCell
__init__ |
Constructor. |
AdjustPagebreak |
This method is used to adjust pagebreak position. |
ConvertToText |
Converts the cell into text representation. |
Draw |
Renders the cell. |
DrawInvisible |
This method is called instead of Draw when the cell is certainly out of the screen (and thus invisible). |
Find |
Returns pointer to itself if this cell matches condition (or if any of the cells following in the list matches), None otherwise. |
GetDescent |
Returns descent value of the cell (m_Descent member). |
GetFirstChild |
Returns pointer to the first cell in the list. |
GetHeight |
Returns height of the cell (m_Height member). |
GetId |
Returns unique cell identifier if there is any, the empty string otherwise. |
GetLink |
Returns hypertext link if associated with this cell or None otherwise. |
GetMouseCursor |
Returns cursor to show when mouse pointer is over the cell. |
GetMouseCursorAt |
Returns cursor to show when mouse pointer is over the specified point. |
GetNext |
Returns pointer to the next cell in list (see htmlcell.h if you’re interested in details). |
GetParent |
Returns pointer to parent container. |
GetPosX |
Returns X position within parent (the value is relative to parent’s upper left corner). |
GetPosY |
Returns Y position within parent (the value is relative to parent’s upper left corner). |
GetWidth |
Returns width of the cell (m_Width member). |
Layout |
Layouts the cell. |
ProcessMouseClick |
This function is simple event handler. |
SetId |
Sets unique cell identifier. |
SetLink |
Sets the hypertext link associated with this cell. |
SetNext |
Sets the next cell in the list. |
SetParent |
Sets parent container of this cell. |
SetPos |
Sets the cell’s position within parent container. |
Descent |
See GetDescent |
FirstChild |
See GetFirstChild |
Height |
See GetHeight |
Id |
See GetId and SetId |
Link |
See GetLink and SetLink |
Next |
See GetNext and SetNext |
Parent |
See GetParent and SetParent |
PosX |
See GetPosX |
PosY |
See GetPosY |
Width |
See GetWidth |
wx.html.
HtmlCell
(Object)¶Possible constructors:
HtmlCell()
Internal data structure.
__init__
(self)¶Constructor.
AdjustPagebreak
(self, pagebreak, known_pagebreaks, pageHeight)¶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.
Parameters: |
|
---|---|
Return type: | tuple |
ret_value, kp = container.AdjustPagebreak(p, kp, ph)
while ret_value:
ret_value, kp = container.AdjustPagebreak(p, kp, ph)
Returns: | ( 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.
Parameters: | sel (wx.html.HtmlSelection) – |
---|---|
Return type: | string |
Draw
(self, dc, x, y, view_y1, view_y2, info)¶Renders the cell.
Parameters: |
|
---|
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!
Parameters: |
|
---|
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).
Parameters: |
|
---|---|
Return type: |
GetDescent
(self)¶Returns descent value of the cell (m_Descent member).
See explanation:
Return type: | 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.
Return type: | wx.html.HtmlCell |
---|
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).
Return type: | int |
---|
GetId
(self)¶Returns unique cell identifier if there is any, the empty string otherwise.
Return type: | 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).
Parameters: |
|
---|---|
Return type: |
GetMouseCursor
(self, window)¶Returns cursor to show when mouse pointer is over the cell.
Parameters: | window (wx.html.HtmlWindowInterface) – interface to the parent HTML window |
---|---|
Return type: | 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.
Parameters: |
|
---|---|
Return type: | 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).
Return type: | wx.html.HtmlCell |
---|
GetParent
(self)¶Returns pointer to parent container.
Return type: | wx.html.HtmlContainerCell |
---|
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!
Return type: | 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!
Return type: | int |
---|
GetWidth
(self)¶Returns width of the cell (m_Width member).
Return type: | int |
---|
Layout
(self, w)¶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
.
Parameters: | 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
.
Parameters: |
|
---|---|
Return type: | bool |
Returns: |
|
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.
Parameters: | id (string) – |
---|
SetLink
(self, link)¶Sets the hypertext link associated with this cell.
(Default value is :ref:`wx.html.HtmlLinkInfo`(“”, “”) (no link))
Parameters: | 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
.
Parameters: | cell (wx.html.HtmlCell) – |
---|
SetParent
(self, p)¶Sets parent container of this cell.
This is called from wx.html.HtmlContainerCell.InsertCell
.
Parameters: | p (wx.html.HtmlContainerCell) – |
---|
SetPos
(self, x, y)¶Sets the cell’s position within parent container.
Parameters: |
|
---|
Descent
¶See GetDescent
FirstChild
¶See GetFirstChild