wx.html.HtmlCell

Inheritance diagram for wx.html.HtmlCell:



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 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.

Derived From

Class API

Methods

__init__()
No docstrings available for this method.

ConvertToText(sel)

Parameters:

  • sel (wx.html.HtmlSelection)

Returns:

string


Draw(dc, x, y, view_y1, view_y2, info)

Renders the cell.

Parameters:

  • dc (wx.DC): Device context to which the cell is to be drawn

  • x, y (int): Coordinates of parent’s upper left corner (origin). You must add this to GetPosX, GetPosY when passing coordinates to dc’s methods. Example:

    dc.DrawText("hello", x + self.GetPosX(), y + self.GetPosY())
    
  • 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)


DrawInvisible(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:

  • dc (wx.DC): Device context to which the cell is to be drawn

  • x, y (int): Coordinates of parent’s upper left corner (origin). You must add this to GetPosX, GetPosY when passing coordinates to dc’s methods. Example:

    dc.DrawText("hello", x + self.GetPosX(), y + self.GetPosY())
    
  • info (wx.html.HtmlRenderingInfo)


Find(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. wx.html.HtmlAnchorCell reacts on wx.html.HTML_COND_ISANCHOR condition).

Parameters:

  • condition (int): Unique integer identifier of condition, which may be one of:

    Condition Flag

    Description

    wx.html.HTML_COND_ISANCHOR

    Finds particular anchor. param is a string with name of the anchor.

    wx.html.HTML_COND_USER

    User-defined conditions start from this number.

  • param: Optional parameters.


Returns:

wx.html.HtmlCell


FindCellByPos()
No docstrings available for this method.

GetAbsPos(rootCell=None)

Parameters:


Returns:

wx.Point


GetCursor(window)

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

Parameters:

  • window (wx.html.HtmlWindowInterface): interface to the parent HTML window

Returns:

wx.Cursor

Warning

This method is deprecated. Use GetMouseCursor instead.


GetDepth()
No docstrings available for this method.

GetDescent()

Returns descent value of the cell. See this image for explanation:

../_images/descent.png

Returns:

int


GetFirstChild()

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.


Returns:

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.


GetFirstTerminal()
No docstrings available for this method.

GetHeight()

Returns height of the cell.


Returns:

int


GetId()

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


Returns:

string


GetLastTerminal()
No docstrings available for this method.

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

Parameters:

  • x, 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 GetWidth or GetHeight).

Returns:

wx.html.HtmlLinkInfo

Note

this makes sense only for visible tags.


GetMaxTotalWidth()
No docstrings available for this method.

GetMouseCursor(window)

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

This function is new since wxPython version 2.7.0 (before GetCursor method served a similar purpose, which is now deprecated).

Parameters:

  • window (wx.html.HtmlWindowInterface): interface to the parent HTML window

Returns:

wx.Cursor


GetNext()

Returns pointer to the next cell in list.


Returns:

wx.html.HtmlCell


GetParent()

Returns pointer to parent container.


Returns:

wx.html.HtmlContainerCell


GetPosX()

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!


Returns:

int


GetPosY()

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!


Returns:

int


GetRootCell()
No docstrings available for this method.

GetWidth()

Returns width of the cell.


Returns:

int


IsBefore(cell)

Parameters:


Returns:

bool


IsFormattingCell()
No docstrings available for this method.

IsLinebreakAllowed()
No docstrings available for this method.

IsTerminalCell()
No docstrings available for this method.

Layout(w)

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 based on actual width w.

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

Parameters:

  • w (int)

ProcessMouseClick(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 behavior is to call wx.html.HtmlWindow.LoadPage.

Parameters:

  • 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.

Returns:

bool


SetCanLiveOnPagebreak(can)

Parameters:

  • can (bool)

SetId(id)

Sets unique cell identifier. Default value is no identifier, i.e. empty string.

Parameters:

  • id (string)

Sets the hypertext link associated with this cell.

Default value is wx.html.HtmlLinkInfo (“”, “”) – i.e., no link.

Parameters:


SetNext(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:


SetParent(p)

Sets parent container of this cell.

This is called from wx.html.HtmlContainerCell.InsertCell.

Parameters:


SetPos(x, y)

Sets the cell’s position within parent container.

Parameters:

  • x (int)
  • y (int)

Properties

Cursor
See GetCursor
Depth
See GetDepth
Descent
See GetDescent
FirstChild
See GetFirstChild
FirstTerminal
See GetFirstTerminal
Height
See GetHeight
Id
See GetId and SetId
LastTerminal
See GetLastTerminal
See GetLink and SetLink
MaxTotalWidth
See GetMaxTotalWidth
MouseCursor
See GetMouseCursor
Next
See GetNext and SetNext
Parent
See GetParent and SetParent
PosX
See GetPosX
PosY
See GetPosY
RootCell
See GetRootCell
Width
See GetWidth