3
7ßL]ï  ã               @   sr   d Z ddlmZmZmZ ddlmZmZmZm	Z	 ddl
Z
ddlmZmZ ddlmZ e	eƒG dd„ deeƒƒZdS )	z8 The Wx-specific implementation of the text field class é    )Úabsolute_importÚprint_functionÚunicode_literals)ÚAnyÚInstanceÚUnicodeÚprovidesN)ÚIFieldÚMField)ÚWidgetc                   sf   e Zd ZdZeZeZedƒZ	dd„ Z
‡ fdd„Z‡ fdd„Zd	d
„ Zdd„ Zddd„Zdd„ Z‡  ZS )ÚFieldz| The Wxspecific implementation of the field class

    This is an abstract class which is not meant to be instantiated.
    z&pyface.action.menu_manager.MenuManagerc             C   s.   | j j| jƒ | j j| jƒ | j j| jƒ dS )z> Perform any toolkit-specific initialization for the control. N)ÚcontrolÚSetToolTipStringÚtooltipZEnableZenabledZShowZvisible)Úself© r   ú=/tmp/pip-install-5sebvq2j/pyface/pyface/ui/wx/fields/field.pyÚ_initialize_control.   s    zField._initialize_controlc                s   t t| ƒjƒ  | jƒ  d S )N)Úsuperr   Ú_createZ_add_event_listeners)r   )Ú	__class__r   r   r   8   s    zField._createc                s   | j ƒ  tt| ƒjƒ  d S )N)Z_remove_event_listenersr   r   Údestroy)r   )r   r   r   r   <   s    zField.destroyc             C   s
   | j jƒ S )z7 Toolkit specific method to get the control's tooltip. )r   ZGetToolTipString)r   r   r   r   Ú_get_control_tooltipD   s    zField._get_control_tooltipc             C   s   | j j|ƒ dS )z7 Toolkit specific method to set the control's tooltip. N)r   r   )r   r   r   r   r   Ú_set_control_tooltipH   s    zField._set_control_tooltipFc             C   s0   |r| j jtj| jd� n| j jtj| jƒ dS )z> Toolkit specific method to change the control menu observer. )ÚhandlerN)r   ZUnbindÚwxZEVT_CONTEXT_MENUZ_handle_context_menuZBind)r   Úremover   r   r   Ú_observe_control_context_menuL   s    
z#Field._observe_control_context_menuc             C   s2   | j dk	r.| jdk	r.| jj| j ƒ}| j j|ƒ dS )z- Signal handler for displaying context menu. N)r   Úcontext_menuZcreate_menuZ	PopupMenu)r   ÚeventÚmenur   r   r   Ú_handle_control_context_menuT   s    z"Field._handle_control_context_menu)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úvaluer   r   r   r   r   r   r   r   r   r   r!   Ú__classcell__r   r   )r   r   r      s   

r   )r%   Ú
__future__r   r   r   Z
traits.apir   r   r   r   r   Zpyface.fields.i_fieldr	   r
   Zpyface.ui.wx.widgetr   r   r   r   r   r   Ú<module>   s   