A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://wxpython.org/Phoenix/docs/html/wx.html.HtmlCell.html below:

wx.html.HtmlCell — wxPython Phoenix 4.2.4a1 documentation

wx.html.HtmlCell¶

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.

Class Hierarchy¶

Inheritance diagram for class

HtmlCell

:

Known Subclasses¶

wx.html.HtmlColourCell, wx.html.HtmlContainerCell, wx.html.HtmlFontCell, wx.html.HtmlWidgetCell, wx.html.HtmlWordCell

Methods Summary¶

__init__

Constructor.

AdjustPagebreak

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

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.

FindCellByPos

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

GetAbsPos

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

GetRootCell

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.

Properties Summary¶ Class API¶
class wx.html.HtmlCell(Object)¶

Possible constructors:

Internal data structure.


Methods¶
__init__(self)¶

Constructor.

Return type:

None


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.

Parameters:
  • pagebreak (int) – position in pixels of the pagebreak.

  • pageHeight (int) – the height in pixels of the page drawable area

Return type:

Tuple[bool, int]

Returns:

True if pagebreak was modified, False otherwise.


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:

str


Draw(self, 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 (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.

Return type:

None


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

Return type:

None


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:
  • condition (int) – Unique integer identifier of condition

  • param (string) – Optional parameters

Return type:

wx.html.HtmlCell


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

Parameters:
  • x (int)

  • y (int)

  • flags

Return type:

wx.html.HtmlCell


GetAbsPos(self, rootCell=None)¶
Parameters:

rootCell (wx.html.HtmlCell)

Return type:

Point


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:

str


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:
  • 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)

Return type:

wx.html.HtmlLinkInfo


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


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

Added 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


GetRootCell(self)¶
Return type:

wx.html.HtmlCell


GetWidth(self)¶

Returns width of the cell (m_Width member).

Return type:

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 .

Parameters:

w (int)

Return type:

None


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:

True if a link was clicked, False otherwise.

Added 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)

Return type:

None


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)

Return type:

None


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)

Return type:

None


SetParent(self, p)¶

Sets parent container of this cell.

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

Parameters:

p (wx.html.HtmlContainerCell)

Return type:

None


SetPos(self, x, y)¶

Sets the cell’s position within parent container.

Parameters:
  • x (int)

  • y (int)

Return type:

None


Properties¶
AbsPos¶

See GetAbsPos


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


RootCell¶

See GetRootCell


Width¶

See GetWidth


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4