.. 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.propgrid.ImageFileProperty:

==========================================================================================================================================
|phoenix_title|  **wx.propgrid.ImageFileProperty**
==========================================================================================================================================

Property representing image file(name). 
         

**Supported special attributes:**

- ``PG_DIALOG_TITLE``: Sets a specific title for the file dialog (since 3.1.3). 
- ``PG_FILE_DIALOG_STYLE``: Sets a specific :ref:`wx.FileDialog`  style for the file dialog. 
- ``PG_FILE_WILDCARD``: Sets wildcard (see :ref:`wx.FileDialog`  for format details), "All
files..." is default. 
- ``PG_FILE_SHOW_FULL_PATH``: Default ``True``. When ``False``, only the file name is shown (i.e. drive and directory are hidden). 
- ``PG_FILE_SHOW_RELATIVE_PATH``: If set, then the filename is shown relative to the given path string. 
- ``PG_FILE_INITIAL_PATH``: Sets the initial path of where to look for files.  



          




|

|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>ImageFileProperty</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.propgrid.ImageFileProperty_inheritance.svg" alt="Inheritance diagram of ImageFileProperty" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.propgrid.ImageFileProperty.html" title="Property representing image file(name)." alt="" coords="14,313,261,341"/> <area shape="rect" id="node2" href="wx.propgrid.FileProperty.html" title="Like wx.propgrid.LongStringProperty, but the button triggers file selector instead." alt="" coords="36,236,239,265"/> <area shape="rect" id="node3" href="wx.propgrid.EditorDialogProperty.html" title="This is an abstract class which serves as a base class for the properties having a button triggering an editor dialog, like e.g." alt="" coords="5,159,270,188"/> <area shape="rect" id="node4" href="wx.propgrid.PGProperty.html" title="wx.propgrid.PGProperty  is base class for all wx.propgrid.PropertyGrid  properties and as such it is not intended to be instantiated directly." alt="" coords="38,82,237,111"/> <area shape="rect" id="node5" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="88,5,187,34"/> </map> 
   </p>
   </div>

|


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

================================================================================ ================================================================================
:meth:`~wx.propgrid.ImageFileProperty.__init__`                                  
:meth:`~wx.propgrid.ImageFileProperty.OnCustomPaint`                             Override to paint an image in front of the property value text or drop-down list item (but only if :meth:`wx.propgrid.PGProperty.OnMeasureImage`   is overridden as well).
:meth:`~wx.propgrid.ImageFileProperty.OnMeasureImage`                            Returns size of the custom painted image in front of property.
:meth:`~wx.propgrid.ImageFileProperty.OnSetValue`                                This virtual function is called after m_value has been set.
================================================================================ ================================================================================


|


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


.. class:: wx.propgrid.ImageFileProperty(FileProperty)

   **Possible constructors**::

       ImageFileProperty(label=PG_LABEL, name=PG_LABEL, value='') -> None
       
   
   Property representing image file(name).



   .. method:: __init__(self, label=PG_LABEL, name=PG_LABEL, value='')




      :param `label`: 
      :type `label`: string
      :param `name`: 
      :type `name`: string
      :param `value`: 
      :type `value`: string




      :rtype: `None`     








   .. method:: OnCustomPaint(self, dc, rect, paintdata)

      Override to paint an image in front of the property value text or drop-down list item (but only if :meth:`wx.propgrid.PGProperty.OnMeasureImage`   is overridden as well). 
                 

      If property's :meth:`OnMeasureImage`   returns size that has height != 0 but less than row height ( < 0 has special meanings), :ref:`wx.propgrid.PropertyGrid`  calls this method to draw a custom image in a limited area in front of the editor control or value text/graphics, and if control has drop-down list, then the image is drawn there as well (even in the case :meth:`OnMeasureImage`   returned higher height than row height). 

      ``NOTE``: Following applies when :meth:`OnMeasureImage`   returns a "flexible" height ( using  ``PG_FLEXIBLE_SIZE(W,H)``   macro), which implies variable height items: If (rect.x+rect.width) is < 0, then this is a measure item call, which means that dc is invalid and only thing that should be done is to set paintdata.m_drawnHeight to the height of the image of item at index paintdata.m_choiceItem. This call may be done even as often as once every drop-down popup show. 




      :param `dc`: :ref:`wx.DC`  to paint on.   
      :type `dc`: wx.DC
      :param `rect`: Box reserved for custom graphics. Includes surrounding rectangle, if any. If x+width is < 0, then this is a measure item call (see above).   
      :type `rect`: wx.Rect
      :param `paintdata`: :ref:`wx.propgrid.PGPaintData`  structure with much useful data about painted item. ::




      :type `paintdata`: wx.propgrid.PGPaintData










      :rtype: `None`     




                  



      .. note:: 

   

         - You can actually exceed rect width, but if you do so then paintdata.m_drawnWidth must be set to the full width drawn in pixels. 
         - Due to technical reasons, rect's height will be default even if custom height was reported during measure call. 
         - Brush is guaranteed to be default background colour. It has been already used to clear the background of area being painted. It can be modified. 
         - Pen is guaranteed to be 1-wide 'black' (or whatever is the proper colour) pen for drawing framing rectangle. It can be changed as well. 










      .. seealso:: :meth:`~wx.propgrid.FileProperty.ValueToString`     








   .. method:: OnMeasureImage(self, item)

      Returns size of the custom painted image in front of property. 
                 

      This method must be overridden to return non-default value if OnCustomPaint is to be called. 




      :param `item`: Normally -1, but can be an index to the property's list of items.  
      :type `item`: int






      :rtype: `Size`     




                  



      .. note:: 

   

         - Default behaviour is to return :ref:`wx.Size`, which means no image. 
         - Default image width or height is indicated with dimension -1. 
         - You can also return ``PG_DEFAULT_IMAGE_SIZE``  which equals DefaultSize.  











   .. method:: OnSetValue(self)

      This virtual function is called after m_value has been set. 
                 


                

      :rtype: `None`     







      .. note:: 

   

         - If m_value was set to Null variant (i.e. unspecified value), :meth:`OnSetValue`   will not be called. 
         - m_value may be of any variant type. Typically properties internally support only one variant type, and as such :meth:`OnSetValue`   provides a good opportunity to convert supported values into internal type. 
         - Default implementation does nothing.  










