.. wxPython Phoenix documentation

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

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

.. include:: headings.inc



.. _wx.ListItem:

==========================================================================================================================================
|phoenix_title|  **wx.ListItem**
==========================================================================================================================================

This class stores information about a :ref:`wx.ListCtrl`  item or column.          

:ref:`wx.ListItem`  is a class which contains information about:

- Zero based item position; see :meth:`~wx.ListItem.SetId`  and :meth:`~wx.ListItem.GetId`. 
- Zero based column index; see :meth:`~wx.ListItem.SetColumn`  and :meth:`~wx.ListItem.GetColumn`. 
- The label (or header for columns); see :meth:`~wx.ListItem.SetText`  and :meth:`~wx.ListItem.GetText`. 
- The zero based index into an image list; see :meth:`~wx.ListItem.GetImage`  and :meth:`~wx.ListItem.SetImage`. 
- Application defined data; see :meth:`~wx.ListItem.SetData`  and :meth:`~wx.ListItem.GetData`. 
- For columns only: the width of the column; see :meth:`~wx.ListItem.SetWidth`  and :meth:`~wx.ListItem.GetWidth`. 
- For columns only: the format of the column; one of  ``LIST_FORMAT_LEFT`` ,   ``LIST_FORMAT_RIGHT`` ,   ``LIST_FORMAT_CENTRE`` . See  :meth:`~wx.ListItem.SetAlign`  and :meth:`~wx.ListItem.GetAlign`. 
- The state of the item; see :meth:`~wx.ListItem.SetState`  and :meth:`~wx.ListItem.GetState`. This is a bitlist of the following flags:

  -  ``LIST_STATE_FOCUSED:``   The item has the focus. 
  -  ``LIST_STATE_SELECTED:``   The item is selected. 
  -  ``LIST_STATE_DONTCARE:``   Don't care what the state is. Win32 only. 
  -  ``LIST_STATE_DROPHILITED:``   The item is highlighted to receive a drop event. Win32 only. 
  -  ``LIST_STATE_CUT:``   The item is in the cut state. Win32 only. 



- A mask indicating which state flags are valid; this is a bitlist of the flags reported above for the item state. See :meth:`~wx.ListItem.SetStateMask`  and GetStateMask(). 
- A mask indicating which fields of this class are valid; see :meth:`~wx.ListItem.SetMask`  and :meth:`~wx.ListItem.GetMask`. This is a bitlist of the following flags:

  -  ``LIST_MASK_STATE:``   The state field is valid. 
  -  ``LIST_MASK_TEXT:``   The label field is valid. 
  -  ``LIST_MASK_IMAGE:``   The image field is valid. 
  -  ``LIST_MASK_DATA:``   The application-defined data field is valid. 
  -  ``LIST_MASK_WIDTH:``   The column width field is valid. 
  -  ``LIST_MASK_FORMAT:``   The column format field is valid. 







The :ref:`wx.ListItem`  object can also contain item-specific colour and font information: for this you need to call one of :meth:`~wx.ListItem.SetTextColour`, :meth:`~wx.ListItem.SetBackgroundColour`  or :meth:`~wx.ListItem.SetFont`  functions on it passing it the colour/font to use. If the colour/font is not specified, the default list control colour/font is used. 







         



.. seealso:: :ref:`wx.ListCtrl`    







|

|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>ListItem</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.ListItem_inheritance.png" alt="Inheritance diagram of ListItem" 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.ListItem.html" title="wx.ListItem" alt="" coords="5,83,99,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="11,5,92,35"/> </map> 
   </p>

|


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

================================================================================ ================================================================================
:meth:`~wx.ListItem.__init__`                                                    Constructor.
:meth:`~wx.ListItem.Clear`                                                       Resets the item state to the default.
:meth:`~wx.ListItem.GetAlign`                                                    Returns the alignment for this item.
:meth:`~wx.ListItem.GetBackgroundColour`                                         Returns the background colour for this item.
:meth:`~wx.ListItem.GetColumn`                                                   Returns the zero-based column; meaningful only in report mode.
:meth:`~wx.ListItem.GetData`                                                     Returns client data associated with the control.
:meth:`~wx.ListItem.GetFont`                                                     Returns the font used to display the item.
:meth:`~wx.ListItem.GetId`                                                       Returns the zero-based item position.
:meth:`~wx.ListItem.GetImage`                                                    Returns the zero-based index of the image associated with the item into the image list.
:meth:`~wx.ListItem.GetMask`                                                     Returns a bit mask indicating which fields of the structure are valid.
:meth:`~wx.ListItem.GetState`                                                    Returns a bit field representing the state of the item.
:meth:`~wx.ListItem.GetText`                                                     Returns the label/header text.
:meth:`~wx.ListItem.GetTextColour`                                               Returns the text colour.
:meth:`~wx.ListItem.GetWidth`                                                    Meaningful only for column headers in report mode.
:meth:`~wx.ListItem.SetAlign`                                                    Sets the alignment for the item.
:meth:`~wx.ListItem.SetBackgroundColour`                                         Sets the background colour for the item.
:meth:`~wx.ListItem.SetColumn`                                                   Sets the zero-based column.
:meth:`~wx.ListItem.SetData`                                                     Sets client data for the item.
:meth:`~wx.ListItem.SetFont`                                                     Sets the font for the item.
:meth:`~wx.ListItem.SetId`                                                       Sets the zero-based item position.
:meth:`~wx.ListItem.SetImage`                                                    Sets the zero-based index of the image associated with the item into the image list.
:meth:`~wx.ListItem.SetMask`                                                     Sets the mask of valid fields.
:meth:`~wx.ListItem.SetState`                                                    Sets the item state flags (note that the valid state flags are influenced by the value of the state mask, see :meth:`wx.ListItem.SetStateMask` ).
:meth:`~wx.ListItem.SetStateMask`                                                Sets the bitmask that is used to determine which of the state flags are to be set.
:meth:`~wx.ListItem.SetText`                                                     Sets the text label for the item.
:meth:`~wx.ListItem.SetTextColour`                                               Sets the text colour for the item.
:meth:`~wx.ListItem.SetWidth`                                                    Meaningful only for column headers in report mode.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.ListItem.Align`                                                       See :meth:`~wx.ListItem.GetAlign` and :meth:`~wx.ListItem.SetAlign`
:attr:`~wx.ListItem.BackgroundColour`                                            See :meth:`~wx.ListItem.GetBackgroundColour` and :meth:`~wx.ListItem.SetBackgroundColour`
:attr:`~wx.ListItem.Column`                                                      See :meth:`~wx.ListItem.GetColumn` and :meth:`~wx.ListItem.SetColumn`
:attr:`~wx.ListItem.Data`                                                        See :meth:`~wx.ListItem.GetData` and :meth:`~wx.ListItem.SetData`
:attr:`~wx.ListItem.Font`                                                        See :meth:`~wx.ListItem.GetFont` and :meth:`~wx.ListItem.SetFont`
:attr:`~wx.ListItem.Id`                                                          See :meth:`~wx.ListItem.GetId` and :meth:`~wx.ListItem.SetId`
:attr:`~wx.ListItem.Image`                                                       See :meth:`~wx.ListItem.GetImage` and :meth:`~wx.ListItem.SetImage`
:attr:`~wx.ListItem.Mask`                                                        See :meth:`~wx.ListItem.GetMask` and :meth:`~wx.ListItem.SetMask`
:attr:`~wx.ListItem.State`                                                       See :meth:`~wx.ListItem.GetState` and :meth:`~wx.ListItem.SetState`
:attr:`~wx.ListItem.Text`                                                        See :meth:`~wx.ListItem.GetText` and :meth:`~wx.ListItem.SetText`
:attr:`~wx.ListItem.TextColour`                                                  See :meth:`~wx.ListItem.GetTextColour` and :meth:`~wx.ListItem.SetTextColour`
:attr:`~wx.ListItem.Width`                                                       See :meth:`~wx.ListItem.GetWidth` and :meth:`~wx.ListItem.SetWidth`
================================================================================ ================================================================================


|


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


.. class:: wx.ListItem(Object)

   **Possible constructors**::

       ListItem()
       
   
   This class stores information about a ListCtrl item or column.



   .. method:: __init__(self)

      Constructor.                   





   .. method:: Clear(self)

      Resets the item state to the default.                   





   .. method:: GetAlign(self)

      Returns the alignment for this item.                  

      Can be one of  ``LIST_FORMAT_LEFT`` ,   ``LIST_FORMAT_RIGHT``   or   ``LIST_FORMAT_CENTRE`` .                   

      :rtype: :ref:`wx.ListColumnFormat`








   .. method:: GetBackgroundColour(self)

      Returns the background colour for this item.                  

      :rtype: :ref:`wx.Colour`








   .. method:: GetColumn(self)

      Returns the zero-based column; meaningful only in report mode.                  

      :rtype: `int`








   .. method:: GetData(self)

      Returns client data associated with the control.                  

      Please note that client data is associated with the item and not with subitems.                  

      :rtype: `long`








   .. method:: GetFont(self)

      Returns the font used to display the item.                  

      :rtype: :ref:`wx.Font`








   .. method:: GetId(self)

      Returns the zero-based item position.                  

      :rtype: `long`








   .. method:: GetImage(self)

      Returns the zero-based index of the image associated with the item into the image list.                  

      :rtype: `int`








   .. method:: GetMask(self)

      Returns a bit mask indicating which fields of the structure are valid.                  

      Can be any combination of the following values:

      - ``wx.LIST_MASK_STATE``: **GetState**  is valid. 
      - ``wx.LIST_MASK_TEXT``: **GetText**  is valid. 
      - ``wx.LIST_MASK_IMAGE``: **GetImage**  is valid. 
      - ``wx.LIST_MASK_DATA``: **GetData**  is valid. 
      - ``wx.LIST_MASK_WIDTH``: **GetWidth**  is valid. 
      - ``wx.LIST_MASK_FORMAT``: **GetFormat**  is valid.  


                 

      :rtype: `long`








   .. method:: GetState(self)

      Returns a bit field representing the state of the item.                  

      Can be any combination of:

      - ``wx.LIST_STATE_DONTCARE``: Don't care what the state is. Win32 only. 
      - ``wx.LIST_STATE_DROPHILITED``: The item is highlighted to receive a drop event. Win32 only. 
      - ``wx.LIST_STATE_FOCUSED``: The item has the focus. 
      - ``wx.LIST_STATE_SELECTED``: The item is selected. 
      - ``wx.LIST_STATE_CUT``: The item is in the cut state. Win32 only.  


                 

      :rtype: `long`








   .. method:: GetText(self)

      Returns the label/header text.                  

      :rtype: `string`








   .. method:: GetTextColour(self)

      Returns the text colour.                  

      :rtype: :ref:`wx.Colour`








   .. method:: GetWidth(self)

      Meaningful only for column headers in report mode.                  

      Returns the column width.                  

      :rtype: `int`








   .. method:: SetAlign(self, align)

      Sets the alignment for the item.                  

      See also :meth:`GetAlign`                    


      :param `align`: 
      :type `align`: wx.ListColumnFormat







   .. method:: SetBackgroundColour(self, colBack)

      Sets the background colour for the item.                  


      :param `colBack`: 
      :type `colBack`: wx.Colour







   .. method:: SetColumn(self, col)

      Sets the zero-based column.                  

      Meaningful only in report mode.                  


      :param `col`: 
      :type `col`: int







   .. method:: SetData(self, data)

      Sets client data for the item.                  

      Please note that client data is associated with the item and not with subitems.                  


      :param `data`: 
      :type `data`: long







   .. method:: SetFont(self, font)

      Sets the font for the item.                  


      :param `font`: 
      :type `font`: wx.Font







   .. method:: SetId(self, id)

      Sets the zero-based item position.                  


      :param `id`: 
      :type `id`: long







   .. method:: SetImage(self, image)

      Sets the zero-based index of the image associated with the item into the image list.                  


      :param `image`: 
      :type `image`: int







   .. method:: SetMask(self, mask)

      Sets the mask of valid fields.                  

      See :meth:`GetMask` .                  


      :param `mask`: 
      :type `mask`: long







   .. method:: SetState(self, state)

      Sets the item state flags (note that the valid state flags are influenced by the value of the state mask, see :meth:`wx.ListItem.SetStateMask` ).                  

      See :meth:`GetState`   for valid flag values.                  


      :param `state`: 
      :type `state`: long







   .. method:: SetStateMask(self, stateMask)

      Sets the bitmask that is used to determine which of the state flags are to be set.                  

      See also :meth:`SetState` .                  


      :param `stateMask`: 
      :type `stateMask`: long







   .. method:: SetText(self, text)

      Sets the text label for the item.                  


      :param `text`: 
      :type `text`: string







   .. method:: SetTextColour(self, colText)

      Sets the text colour for the item.                  


      :param `colText`: 
      :type `colText`: wx.Colour







   .. method:: SetWidth(self, width)

      Meaningful only for column headers in report mode.                  

      Sets the column width.                  


      :param `width`: 
      :type `width`: int







   .. attribute:: Align

      See :meth:`~wx.ListItem.GetAlign` and :meth:`~wx.ListItem.SetAlign`


   .. attribute:: BackgroundColour

      See :meth:`~wx.ListItem.GetBackgroundColour` and :meth:`~wx.ListItem.SetBackgroundColour`


   .. attribute:: Column

      See :meth:`~wx.ListItem.GetColumn` and :meth:`~wx.ListItem.SetColumn`


   .. attribute:: Data

      See :meth:`~wx.ListItem.GetData` and :meth:`~wx.ListItem.SetData`


   .. attribute:: Font

      See :meth:`~wx.ListItem.GetFont` and :meth:`~wx.ListItem.SetFont`


   .. attribute:: Id

      See :meth:`~wx.ListItem.GetId` and :meth:`~wx.ListItem.SetId`


   .. attribute:: Image

      See :meth:`~wx.ListItem.GetImage` and :meth:`~wx.ListItem.SetImage`


   .. attribute:: Mask

      See :meth:`~wx.ListItem.GetMask` and :meth:`~wx.ListItem.SetMask`


   .. attribute:: State

      See :meth:`~wx.ListItem.GetState` and :meth:`~wx.ListItem.SetState`


   .. attribute:: Text

      See :meth:`~wx.ListItem.GetText` and :meth:`~wx.ListItem.SetText`


   .. attribute:: TextColour

      See :meth:`~wx.ListItem.GetTextColour` and :meth:`~wx.ListItem.SetTextColour`


   .. attribute:: Width

      See :meth:`~wx.ListItem.GetWidth` and :meth:`~wx.ListItem.SetWidth`

