.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.html.HtmlCell: ========================================================================================================================================== |phoenix_title| **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 :ref:`wx.html.HtmlWindow` and :ref:`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. .. seealso:: :ref:`Cells and Containers `, :ref:`wx.html.HtmlContainerCell` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class HtmlCell:
| |sub_classes| Known Subclasses ============================== :ref:`wx.html.HtmlColourCell`, :ref:`wx.html.HtmlContainerCell`, :ref:`wx.html.HtmlFontCell`, :ref:`wx.html.HtmlWidgetCell`, :ref:`wx.html.HtmlWordCell` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.html.HtmlCell.__init__` Constructor. :meth:`~wx.html.HtmlCell.AdjustPagebreak` This method is called when paginating HTML, e.g. when printing. :meth:`~wx.html.HtmlCell.ConvertToText` Converts the cell into text representation. :meth:`~wx.html.HtmlCell.Draw` Renders the cell. :meth:`~wx.html.HtmlCell.DrawInvisible` This method is called instead of :meth:`~HtmlCell.Draw` when the cell is certainly out of the screen (and thus invisible). :meth:`~wx.html.HtmlCell.Find` Returns pointer to itself if this cell matches condition (or if any of the cells following in the list matches), ``None`` otherwise. :meth:`~wx.html.HtmlCell.FindCellByPos` Find a cell inside this cell positioned at the given coordinates (relative to this's positions). :meth:`~wx.html.HtmlCell.GetAbsPos` :meth:`~wx.html.HtmlCell.GetDescent` Returns descent value of the cell (m_Descent member). :meth:`~wx.html.HtmlCell.GetFirstChild` Returns pointer to the first cell in the list. :meth:`~wx.html.HtmlCell.GetHeight` Returns height of the cell (m_Height member). :meth:`~wx.html.HtmlCell.GetId` Returns unique cell identifier if there is any, the empty string otherwise. :meth:`~wx.html.HtmlCell.GetLink` Returns hypertext link if associated with this cell or ``None`` otherwise. :meth:`~wx.html.HtmlCell.GetMouseCursor` Returns cursor to show when mouse pointer is over the cell. :meth:`~wx.html.HtmlCell.GetMouseCursorAt` Returns cursor to show when mouse pointer is over the specified point. :meth:`~wx.html.HtmlCell.GetNext` Returns pointer to the next cell in list (see `htmlcell.h` if you're interested in details). :meth:`~wx.html.HtmlCell.GetParent` Returns pointer to parent container. :meth:`~wx.html.HtmlCell.GetPosX` Returns X position within parent (the value is relative to parent's upper left corner). :meth:`~wx.html.HtmlCell.GetPosY` Returns Y position within parent (the value is relative to parent's upper left corner). :meth:`~wx.html.HtmlCell.GetRootCell` :meth:`~wx.html.HtmlCell.GetWidth` Returns width of the cell (m_Width member). :meth:`~wx.html.HtmlCell.Layout` Layouts the cell. :meth:`~wx.html.HtmlCell.ProcessMouseClick` This function is simple event handler. :meth:`~wx.html.HtmlCell.SetId` Sets unique cell identifier. :meth:`~wx.html.HtmlCell.SetLink` Sets the hypertext link associated with this cell. :meth:`~wx.html.HtmlCell.SetNext` Sets the next cell in the list. :meth:`~wx.html.HtmlCell.SetParent` Sets parent container of this cell. :meth:`~wx.html.HtmlCell.SetPos` Sets the cell's position within parent container. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.html.HtmlCell.AbsPos` See :meth:`~wx.html.HtmlCell.GetAbsPos` :attr:`~wx.html.HtmlCell.Descent` See :meth:`~wx.html.HtmlCell.GetDescent` :attr:`~wx.html.HtmlCell.FirstChild` See :meth:`~wx.html.HtmlCell.GetFirstChild` :attr:`~wx.html.HtmlCell.Height` See :meth:`~wx.html.HtmlCell.GetHeight` :attr:`~wx.html.HtmlCell.Id` See :meth:`~wx.html.HtmlCell.GetId` and :meth:`~wx.html.HtmlCell.SetId` :attr:`~wx.html.HtmlCell.Link` See :meth:`~wx.html.HtmlCell.GetLink` and :meth:`~wx.html.HtmlCell.SetLink` :attr:`~wx.html.HtmlCell.Next` See :meth:`~wx.html.HtmlCell.GetNext` and :meth:`~wx.html.HtmlCell.SetNext` :attr:`~wx.html.HtmlCell.Parent` See :meth:`~wx.html.HtmlCell.GetParent` and :meth:`~wx.html.HtmlCell.SetParent` :attr:`~wx.html.HtmlCell.PosX` See :meth:`~wx.html.HtmlCell.GetPosX` :attr:`~wx.html.HtmlCell.PosY` See :meth:`~wx.html.HtmlCell.GetPosY` :attr:`~wx.html.HtmlCell.RootCell` See :meth:`~wx.html.HtmlCell.GetRootCell` :attr:`~wx.html.HtmlCell.Width` See :meth:`~wx.html.HtmlCell.GetWidth` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.html.HtmlCell(Object) **Possible constructors**:: HtmlCell() Internal data structure. .. method:: __init__(self) Constructor. .. method:: 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. :param `pagebreak`: position in pixels of the pagebreak. :type `pagebreak`: int :param `pageHeight`: the height in pixels of the page drawable area :type `pageHeight`: int :rtype: `tuple` :returns: ( `bool`, `pagebreak` ) .. method:: ConvertToText(self, sel) Converts the cell into text representation. If sel != ``None`` then only part of the cell inside the selection is converted. :param `sel`: :type `sel`: wx.html.HtmlSelection :rtype: `string` .. method:: Draw(self, dc, x, y, view_y1, view_y2, info) Renders the cell. :param `dc`: Device context to which the cell is to be drawn. :type `dc`: wx.DC :param `x`: :type `x`: int :param `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 + cell.PosX, y + cell.PosY) :type `y`: int :param `view_y1`: y-coord of the first line visible in window. This is used to optimize rendering speed. :type `view_y1`: int :param `view_y2`: y-coord of the last line visible in window. This is used to optimize rendering speed. :type `view_y2`: int :param `info`: Additional information for the rendering of the cell. :type `info`: wx.html.HtmlRenderingInfo .. method:: DrawInvisible(self, dc, x, y, info) This method is called instead of :meth:`Draw` when the cell is certainly out of the screen (and thus invisible). This is not nonsense - some tags (like :ref:`wx.html.HtmlColourCell` or font setter) must be drawn even if they are invisible! :param `dc`: Device context to which the cell is to be drawn. :type `dc`: wx.DC :param `x`: :type `x`: int :param `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 + cell.PosX, y + cell.PosY) :type `y`: int :param `info`: Additional information for the rendering of the cell. :type `info`: wx.html.HtmlRenderingInfo .. method:: 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 :meth:`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). :param `condition`: Unique integer identifier of condition :type `condition`: int :param `param`: Optional parameters :type `param`: string :rtype: :ref:`wx.html.HtmlCell` .. method:: 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]. :param `x`: :type `x`: int :param `y`: :type `y`: int :param `flags`: :rtype: :ref:`wx.html.HtmlCell` .. method:: GetAbsPos(self, rootCell=None) :param `rootCell`: :type `rootCell`: wx.html.HtmlCell :rtype: `Point` .. method:: GetDescent(self) Returns descent value of the cell (m_Descent member). See explanation: .. figure:: _static\images\overviews\htmlcell_descent.png :align: center | :rtype: `int` .. method:: GetFirstChild(self) Returns pointer to the first cell in the list. You can then use child's :meth:`GetNext` method to obtain pointer to the next cell in list. :rtype: :ref:`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 :meth:`Find` method instead. .. method:: GetHeight(self) Returns height of the cell (m_Height member). :rtype: `int` .. method:: GetId(self) Returns unique cell identifier if there is any, the empty string otherwise. :rtype: `string` .. method:: GetLink(self, x=0, y=0) Returns hypertext link if associated with this cell or ``None`` otherwise. See :ref:`wx.html.HtmlLinkInfo`. (Note: this makes sense only for visible tags). :param `x`: :type `x`: int :param `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) :type `y`: int :rtype: :ref:`wx.html.HtmlLinkInfo` .. method:: GetMouseCursor(self, window) Returns cursor to show when mouse pointer is over the cell. :param `window`: interface to the parent HTML window :type `window`: wx.html.HtmlWindowInterface :rtype: `Cursor` .. seealso:: :meth:`GetMouseCursorAt` .. method:: GetMouseCursorAt(self, window, rePos) Returns cursor to show when mouse pointer is over the specified point. This function should be overridden instead of :meth:`GetMouseCursorAt` if the cursor should depend on the exact position of the mouse in the window. :param `window`: interface to the parent HTML window :type `window`: wx.html.HtmlWindowInterface :param `rePos`: Position to show cursor. :type `rePos`: wx.Point :rtype: `Cursor` .. versionadded:: 3.0 .. method:: GetNext(self) Returns pointer to the next cell in list (see `htmlcell.h` if you're interested in details). :rtype: :ref:`wx.html.HtmlCell` .. method:: GetParent(self) Returns pointer to parent container. :rtype: :ref:`wx.html.HtmlContainerCell` .. method:: 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 :meth:`Layout` was called before! :rtype: `int` .. method:: 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 :meth:`Layout` was called before! :rtype: `int` .. method:: GetRootCell(self) :rtype: :ref:`wx.html.HtmlCell` .. method:: GetWidth(self) Returns width of the cell (m_Width member). :rtype: `int` .. method:: 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 :meth:`Layout` . :param `w`: :type `w`: int .. method:: ProcessMouseClick(self, window, pos, event) This function is simple event handler. Each time the user clicks mouse button over a cell within :ref:`wx.html.HtmlWindow` this method of that cell is called. Default behaviour is to call :meth:`wx.html.HtmlWindow.LoadPage` . :param `window`: interface to the parent HTML window :type `window`: wx.html.HtmlWindowInterface :param `pos`: coordinates of mouse click (this is relative to cell's origin :type `pos`: wx.Point :param `event`: mouse event that triggered the call :type `event`: wx.MouseEvent :rtype: `bool` :returns: ``True`` if a link was clicked, ``False`` otherwise. .. versionadded:: 2.7.0 (before OnMouseClick() method served a similar purpose). .. note:: If you need more "advanced" event handling you should use HtmlBinderCell instead. .. method:: SetId(self, id) Sets unique cell identifier. Default value is no identifier, i.e. empty string. :param `id`: :type `id`: string .. method:: SetLink(self, link) Sets the hypertext link associated with this cell. (Default value is :ref:`wx.html.HtmlLinkInfo`("", "") (no link)) :param `link`: :type `link`: wx.html.HtmlLinkInfo .. method:: SetNext(self, cell) Sets the next cell in the list. This shouldn't be called by user - it is to be used only by :meth:`wx.html.HtmlContainerCell.InsertCell` . :param `cell`: :type `cell`: wx.html.HtmlCell .. method:: SetParent(self, p) Sets parent container of this cell. This is called from :meth:`wx.html.HtmlContainerCell.InsertCell` . :param `p`: :type `p`: wx.html.HtmlContainerCell .. method:: SetPos(self, x, y) Sets the cell's position within parent container. :param `x`: :type `x`: int :param `y`: :type `y`: int .. attribute:: AbsPos See :meth:`~wx.html.HtmlCell.GetAbsPos` .. attribute:: Descent See :meth:`~wx.html.HtmlCell.GetDescent` .. attribute:: FirstChild See :meth:`~wx.html.HtmlCell.GetFirstChild` .. attribute:: Height See :meth:`~wx.html.HtmlCell.GetHeight` .. attribute:: Id See :meth:`~wx.html.HtmlCell.GetId` and :meth:`~wx.html.HtmlCell.SetId` .. attribute:: Link See :meth:`~wx.html.HtmlCell.GetLink` and :meth:`~wx.html.HtmlCell.SetLink` .. attribute:: Next See :meth:`~wx.html.HtmlCell.GetNext` and :meth:`~wx.html.HtmlCell.SetNext` .. attribute:: Parent See :meth:`~wx.html.HtmlCell.GetParent` and :meth:`~wx.html.HtmlCell.SetParent` .. attribute:: PosX See :meth:`~wx.html.HtmlCell.GetPosX` .. attribute:: PosY See :meth:`~wx.html.HtmlCell.GetPosY` .. attribute:: RootCell See :meth:`~wx.html.HtmlCell.GetRootCell` .. attribute:: Width See :meth:`~wx.html.HtmlCell.GetWidth`