.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.html.HtmlWinParser:

==========================================================================================================================================
|phoenix_title|  **wx.html.HtmlWinParser**
==========================================================================================================================================

This class is derived from :ref:`wx.html.HtmlParser`  and its main goal is to parse HTML input so that it can be displayed in :ref:`wx.html.HtmlWindow`.          

It uses a special :ref:`wx.html.HtmlWinTagHandler`. 







         



.. note:: 

   The product of parsing is a :ref:`wx.html.HtmlCell`  (resp. HtmlContainer) object.  







.. seealso:: :ref:`Tag Handlers <tag handlers>`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>HtmlWinParser</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.html.HtmlWinParser_inheritance.png" alt="Inheritance diagram of HtmlWinParser" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.html.HtmlParser.html" title="wx.html.HtmlParser" alt="" coords="16,5,163,35"/> <area shape="rect" id="node2" href="wx.html.HtmlWinParser.html" title="wx.html.HtmlWinParser" alt="" coords="5,83,173,112"/> </map> 
   </p>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.html.HtmlWinParser.__init__`                                          Constructor.
:meth:`~wx.html.HtmlWinParser.CloseContainer`                                    Closes the container, sets actual container to the parent one and returns pointer to it (see :ref:`Cells and Containers <cells and containers>`).
:meth:`~wx.html.HtmlWinParser.CreateCurrentFont`                                 Creates font based on current setting (see :meth:`~HtmlWinParser.SetFontSize` , :meth:`~HtmlWinParser.SetFontBold` , :meth:`~HtmlWinParser.SetFontItalic` , :meth:`~HtmlWinParser.SetFontFixed` , :meth:`wx.html.HtmlWinParser.SetFontUnderlined` ) and returns pointer to it.
:meth:`~wx.html.HtmlWinParser.GetActualColor`                                    Returns actual text colour.
:meth:`~wx.html.HtmlWinParser.GetAlign`                                          Returns default horizontal alignment.
:meth:`~wx.html.HtmlWinParser.GetCharHeight`                                     Returns (average) int height in standard font.
:meth:`~wx.html.HtmlWinParser.GetCharWidth`                                      Returns average int width in standard font.
:meth:`~wx.html.HtmlWinParser.GetContainer`                                      Returns pointer to the currently opened container (see :ref:`Cells and Containers <cells and containers>`).
:meth:`~wx.html.HtmlWinParser.GetDC`                                             Returns pointer to the DC used during parsing.
:meth:`~wx.html.HtmlWinParser.GetFontBold`                                       Returns ``True`` if actual font is bold, ``False`` otherwise.
:meth:`~wx.html.HtmlWinParser.GetFontFace`                                       Returns actual font face name.
:meth:`~wx.html.HtmlWinParser.GetFontFixed`                                      Returns ``True`` if actual font is fixed face, ``False`` otherwise.
:meth:`~wx.html.HtmlWinParser.GetFontItalic`                                     Returns ``True`` if actual font is italic, ``False`` otherwise.
:meth:`~wx.html.HtmlWinParser.GetFontSize`                                       Returns actual font size (HTML size varies from -2 to +4)
:meth:`~wx.html.HtmlWinParser.GetFontUnderlined`                                 Returns ``True`` if actual font is underlined, ``False`` otherwise.
:meth:`~wx.html.HtmlWinParser.GetLink`                                           Returns actual hypertext link.
:meth:`~wx.html.HtmlWinParser.GetLinkColor`                                      Returns the colour of hypertext link text.
:meth:`~wx.html.HtmlWinParser.GetWindowInterface`                                Returns associated window (:ref:`wx.html.HtmlWindow`).
:meth:`~wx.html.HtmlWinParser.OpenContainer`                                     Opens new container and returns pointer to it (see :ref:`Cells and Containers <cells and containers>`).
:meth:`~wx.html.HtmlWinParser.SetActualColor`                                    Sets actual text colour.
:meth:`~wx.html.HtmlWinParser.SetAlign`                                          Sets default horizontal alignment (see :meth:`wx.html.HtmlContainerCell.SetAlignHor` ).
:meth:`~wx.html.HtmlWinParser.SetContainer`                                      Allows you to directly set opened container.
:meth:`~wx.html.HtmlWinParser.SetDC`                                             Sets the DC.
:meth:`~wx.html.HtmlWinParser.SetFontBold`                                       Sets bold flag of actualfont.
:meth:`~wx.html.HtmlWinParser.SetFontFace`                                       Sets current font face to `face`.
:meth:`~wx.html.HtmlWinParser.SetFontFixed`                                      Sets fixed face flag of actualfont.
:meth:`~wx.html.HtmlWinParser.SetFontItalic`                                     Sets italic flag of actualfont.
:meth:`~wx.html.HtmlWinParser.SetFontSize`                                       Sets actual font size (HTML size varies from 1 to 7).
:meth:`~wx.html.HtmlWinParser.SetFontUnderlined`                                 Sets underlined flag of actualfont.
:meth:`~wx.html.HtmlWinParser.SetFonts`                                          Sets fonts.
:meth:`~wx.html.HtmlWinParser.SetLink`                                           Sets actual hypertext link.
:meth:`~wx.html.HtmlWinParser.SetLinkColor`                                      Sets colour of hypertext link.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.html.HtmlWinParser.ActualColor`                                       See :meth:`~wx.html.HtmlWinParser.GetActualColor` and :meth:`~wx.html.HtmlWinParser.SetActualColor`
:attr:`~wx.html.HtmlWinParser.Align`                                             See :meth:`~wx.html.HtmlWinParser.GetAlign` and :meth:`~wx.html.HtmlWinParser.SetAlign`
:attr:`~wx.html.HtmlWinParser.CharHeight`                                        See :meth:`~wx.html.HtmlWinParser.GetCharHeight`
:attr:`~wx.html.HtmlWinParser.CharWidth`                                         See :meth:`~wx.html.HtmlWinParser.GetCharWidth`
:attr:`~wx.html.HtmlWinParser.Container`                                         See :meth:`~wx.html.HtmlWinParser.GetContainer` and :meth:`~wx.html.HtmlWinParser.SetContainer`
:attr:`~wx.html.HtmlWinParser.DC`                                                See :meth:`~wx.html.HtmlWinParser.GetDC` and :meth:`~wx.html.HtmlWinParser.SetDC`
:attr:`~wx.html.HtmlWinParser.FontBold`                                          See :meth:`~wx.html.HtmlWinParser.GetFontBold` and :meth:`~wx.html.HtmlWinParser.SetFontBold`
:attr:`~wx.html.HtmlWinParser.FontFace`                                          See :meth:`~wx.html.HtmlWinParser.GetFontFace` and :meth:`~wx.html.HtmlWinParser.SetFontFace`
:attr:`~wx.html.HtmlWinParser.FontFixed`                                         See :meth:`~wx.html.HtmlWinParser.GetFontFixed` and :meth:`~wx.html.HtmlWinParser.SetFontFixed`
:attr:`~wx.html.HtmlWinParser.FontItalic`                                        See :meth:`~wx.html.HtmlWinParser.GetFontItalic` and :meth:`~wx.html.HtmlWinParser.SetFontItalic`
:attr:`~wx.html.HtmlWinParser.FontSize`                                          See :meth:`~wx.html.HtmlWinParser.GetFontSize` and :meth:`~wx.html.HtmlWinParser.SetFontSize`
:attr:`~wx.html.HtmlWinParser.FontUnderlined`                                    See :meth:`~wx.html.HtmlWinParser.GetFontUnderlined` and :meth:`~wx.html.HtmlWinParser.SetFontUnderlined`
:attr:`~wx.html.HtmlWinParser.Link`                                              See :meth:`~wx.html.HtmlWinParser.GetLink` and :meth:`~wx.html.HtmlWinParser.SetLink`
:attr:`~wx.html.HtmlWinParser.LinkColor`                                         See :meth:`~wx.html.HtmlWinParser.GetLinkColor` and :meth:`~wx.html.HtmlWinParser.SetLinkColor`
:attr:`~wx.html.HtmlWinParser.WindowInterface`                                   See :meth:`~wx.html.HtmlWinParser.GetWindowInterface`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.html.HtmlWinParser(HtmlParser)

   **Possible constructors**::

       HtmlWinParser(wndIface=None)
       
   
   This class is derived from HtmlParser and its main goal is to parse
   HTML input so that it can be displayed in HtmlWindow.



   .. method:: __init__(self, wndIface=None)

      Constructor.                  

      Don't use the default one, use the constructor with `wndIface`  parameter (`wndIface`  is a pointer to interface object for the associated :ref:`wx.html.HtmlWindow`  or other HTML rendering window such as :ref:`wx.html.HtmlListBox`).                  


      :param `wndIface`: 
      :type `wndIface`: wx.html.HtmlWindowInterface







   .. method:: CloseContainer(self)

      Closes the container, sets actual container to the parent one and returns pointer to it (see :ref:`Cells and Containers <cells and containers>`).                  

      :rtype: :ref:`wx.html.HtmlContainerCell`








   .. method:: CreateCurrentFont(self)

      Creates font based on current setting (see :meth:`SetFontSize` , :meth:`SetFontBold` , :meth:`SetFontItalic` , :meth:`SetFontFixed` , :meth:`wx.html.HtmlWinParser.SetFontUnderlined` ) and returns pointer to it.                  

      If the font was already created only a pointer is returned.                  

      :rtype: :ref:`Font`








   .. method:: GetActualColor(self)

      Returns actual text colour.                  

      :rtype: :ref:`Colour`








   .. method:: GetAlign(self)

      Returns default horizontal alignment.                  

      :rtype: `int`








   .. method:: GetCharHeight(self)

      Returns (average) int height in standard font.                  

      It is used as DC-independent metrics. 

                

      :rtype: `int`







      .. note:: 

         This function doesn't return the `actual`  height. If you want to know the height of the current font, call  GetDC->:meth:`GetCharHeight` .    








   .. method:: GetCharWidth(self)

      Returns average int width in standard font.                  

      It is used as DC-independent metrics. 

                

      :rtype: `int`







      .. note:: 

         This function doesn't return the `actual`  width. If you want to know the height of the current font, call  GetDC->:meth:`GetCharWidth` .    








   .. method:: GetContainer(self)

      Returns pointer to the currently opened container (see :ref:`Cells and Containers <cells and containers>`).                  

      Common use: ::

          self.WParser.GetContainer().InsertCell(html_cell)

                 

      :rtype: :ref:`wx.html.HtmlContainerCell`








   .. method:: GetDC(self)

      Returns pointer to the DC used during parsing.                  

      :rtype: :ref:`DC`








   .. method:: GetFontBold(self)

      Returns ``True`` if actual font is bold, ``False`` otherwise.                  

      :rtype: `int`








   .. method:: GetFontFace(self)

      Returns actual font face name.                  

      :rtype: `string`








   .. method:: GetFontFixed(self)

      Returns ``True`` if actual font is fixed face, ``False`` otherwise.                  

      :rtype: `int`








   .. method:: GetFontItalic(self)

      Returns ``True`` if actual font is italic, ``False`` otherwise.                  

      :rtype: `int`








   .. method:: GetFontSize(self)

      Returns actual font size (HTML size varies from -2 to +4)                  

      :rtype: `int`








   .. method:: GetFontUnderlined(self)

      Returns ``True`` if actual font is underlined, ``False`` otherwise.                  

      :rtype: `int`








   .. method:: GetLink(self)

      Returns actual hypertext link.                  

      (This value has a non-empty :meth:`wx.html.HtmlLinkInfo.GetHref`   Href string if the parser is between <A> and </A> tags, EmptyString otherwise.)                  

      :rtype: :ref:`wx.html.HtmlLinkInfo`








   .. method:: GetLinkColor(self)

      Returns the colour of hypertext link text.                  

      :rtype: :ref:`Colour`








   .. method:: GetWindowInterface(self)

      Returns associated window (:ref:`wx.html.HtmlWindow`).                  

      This may be ``None``! (You should always test if it is non-NULL. For example  ``TITLE``   handler sets window title only if some window is associated, otherwise it does nothing.                   

      :rtype: :ref:`wx.html.HtmlWindowInterface`








   .. method:: OpenContainer(self)

      Opens new container and returns pointer to it (see :ref:`Cells and Containers <cells and containers>`).                  

      :rtype: :ref:`wx.html.HtmlContainerCell`








   .. method:: SetActualColor(self, clr)

      Sets actual text colour.                  

      Note: this DOESN'T change the colour! You must create :ref:`wx.html.HtmlColourCell`  yourself.                  


      :param `clr`: 
      :type `clr`: wx.Colour







   .. method:: SetAlign(self, a)

      Sets default horizontal alignment (see :meth:`wx.html.HtmlContainerCell.SetAlignHor` ).                  

      Alignment of newly opened container is set to this value.                  


      :param `a`: 
      :type `a`: int







   .. method:: SetContainer(self, c)

      Allows you to directly set opened container.                  

      This is not recommended - you should use :meth:`OpenContainer`   wherever possible.                  


      :param `c`: 
      :type `c`: wx.html.HtmlContainerCell




      :rtype: :ref:`wx.html.HtmlContainerCell`








   .. method:: SetDC(self, dc, pixel_scale=1.0e+0)

      Sets the DC.                  

      This must be called before :meth:`wx.html.HtmlParser.Parse` ! 

      `pixel_scale`  can be used when rendering to high-resolution DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in HTML are given in pixels                  


      :param `dc`: 
      :type `dc`: wx.DC
      :param `pixel_scale`: 
      :type `pixel_scale`: float







   .. method:: SetFontBold(self, x)

      Sets bold flag of actualfont.                  

      `x`  is either ``True`` of ``False``.                  


      :param `x`: 
      :type `x`: int







   .. method:: SetFontFace(self, face)

      Sets current font face to `face`.                  

      This affects either fixed size font or proportional, depending on context (whether the parser is inside  ``<TT>``   tag or not).                   


      :param `face`: 
      :type `face`: string







   .. method:: SetFontFixed(self, x)

      Sets fixed face flag of actualfont.                  

      `x`  is either ``True`` of ``False``.                  


      :param `x`: 
      :type `x`: int







   .. method:: SetFontItalic(self, x)

      Sets italic flag of actualfont.                  

      `x`  is either ``True`` of ``False``.                  


      :param `x`: 
      :type `x`: int







   .. method:: SetFontSize(self, s)

      Sets actual font size (HTML size varies from 1 to 7).                  


      :param `s`: 
      :type `s`: int







   .. method:: SetFontUnderlined(self, x)

      Sets underlined flag of actualfont.                  

      `x`  is either ``True`` of ``False``.                  


      :param `x`: 
      :type `x`: int







   .. method:: SetFonts(self, normal_face, fixed_face, sizes)

      Sets fonts.                  

      See :meth:`wx.html.HtmlWindow.SetFonts`   for detailed description.                  


      :param `normal_face`: 
      :type `normal_face`: string
      :param `fixed_face`: 
      :type `fixed_face`: string
      :param `sizes`: 
      :type `sizes`: list of integers







   .. method:: SetLink(self, link)

      Sets actual hypertext link.                  

      Empty link is represented by :ref:`wx.html.HtmlLinkInfo`  with `Href`  equal to EmptyString.                  


      :param `link`: 
      :type `link`: wx.html.HtmlLinkInfo







   .. method:: SetLinkColor(self, clr)

      Sets colour of hypertext link.                  


      :param `clr`: 
      :type `clr`: wx.Colour







   .. attribute:: ActualColor

      See :meth:`~wx.html.HtmlWinParser.GetActualColor` and :meth:`~wx.html.HtmlWinParser.SetActualColor`


   .. attribute:: Align

      See :meth:`~wx.html.HtmlWinParser.GetAlign` and :meth:`~wx.html.HtmlWinParser.SetAlign`


   .. attribute:: CharHeight

      See :meth:`~wx.html.HtmlWinParser.GetCharHeight`


   .. attribute:: CharWidth

      See :meth:`~wx.html.HtmlWinParser.GetCharWidth`


   .. attribute:: Container

      See :meth:`~wx.html.HtmlWinParser.GetContainer` and :meth:`~wx.html.HtmlWinParser.SetContainer`


   .. attribute:: DC

      See :meth:`~wx.html.HtmlWinParser.GetDC` and :meth:`~wx.html.HtmlWinParser.SetDC`


   .. attribute:: FontBold

      See :meth:`~wx.html.HtmlWinParser.GetFontBold` and :meth:`~wx.html.HtmlWinParser.SetFontBold`


   .. attribute:: FontFace

      See :meth:`~wx.html.HtmlWinParser.GetFontFace` and :meth:`~wx.html.HtmlWinParser.SetFontFace`


   .. attribute:: FontFixed

      See :meth:`~wx.html.HtmlWinParser.GetFontFixed` and :meth:`~wx.html.HtmlWinParser.SetFontFixed`


   .. attribute:: FontItalic

      See :meth:`~wx.html.HtmlWinParser.GetFontItalic` and :meth:`~wx.html.HtmlWinParser.SetFontItalic`


   .. attribute:: FontSize

      See :meth:`~wx.html.HtmlWinParser.GetFontSize` and :meth:`~wx.html.HtmlWinParser.SetFontSize`


   .. attribute:: FontUnderlined

      See :meth:`~wx.html.HtmlWinParser.GetFontUnderlined` and :meth:`~wx.html.HtmlWinParser.SetFontUnderlined`


   .. attribute:: Link

      See :meth:`~wx.html.HtmlWinParser.GetLink` and :meth:`~wx.html.HtmlWinParser.SetLink`


   .. attribute:: LinkColor

      See :meth:`~wx.html.HtmlWinParser.GetLinkColor` and :meth:`~wx.html.HtmlWinParser.SetLinkColor`


   .. attribute:: WindowInterface

      See :meth:`~wx.html.HtmlWinParser.GetWindowInterface`

