a
    §ˆc`  ã                   @   sZ   d Z ddlZddlmZmZmZmZmZmZ ddl	m
Z
mZ ee
ƒG dd„ deeƒƒZdS )z$ Enthought pyface package component
é    N)ÚAnyÚBoolÚ	HasTraitsÚInstanceÚStrÚprovides)ÚIWidgetÚMWidgetc                       sŒ   e Zd ZdZeƒ Zeƒ ZedƒZedƒZ	e
ƒ ZedƒZdd„ Zdd„ Zdd	„ Zd
d„ Z‡ fdd„Zdd„ Zdd„ Zddd„Zdd„ Z‡  ZS )ÚWidgetzp The toolkit specific implementation of a Widget.  See the IWidget
    interface for the API documentation.
    Tz&pyface.action.menu_manager.MenuManagerc                 C   s    || _ | jdur| j |¡ dS )z¤ Show or hide the widget.

        Parameter
        ---------
        visible : bool
            Visible should be ``True`` if the widget should be shown.
        N)ÚvisibleÚcontrolZShow)Úselfr   © r   úV/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/wx/widget.pyÚshow4   s    
zWidget.showc                 C   s    || _ | jdur| j |¡ dS )z— Enable or disable the widget.

        Parameter
        ---------
        enabled : bool
            The enabled state to set the widget to.
        N)Úenabledr   ZEnable)r   r   r   r   r   Úenable@   s    
zWidget.enablec                 C   s   | j dur| j  ¡  dS )z0 Set the keyboard focus to this widget.
        N)r   ZSetFocus©r   r   r   r   ÚfocusL   s    
zWidget.focusc                 C   s   | j duo| j  ¡ S )z® Does the widget currently have keyboard focus?

        Returns
        -------
        focus_state : bool
            Whether or not the widget has keyboard focus.
        N)r   ZHasFocusr   r   r   r   Ú	has_focusR   s    	
þzWidget.has_focusc                    s&   | j d ur"| j }tƒ  ¡  | ¡  d S )N)r   ÚsuperÚdestroyZDestroy)r   r   ©Ú	__class__r   r   r   _   s    

zWidget.destroyc                 C   s
   | j  ¡ S )z7 Toolkit specific method to get the control's tooltip. )r   ZGetToolTipTextr   r   r   r   Ú_get_control_tooltipi   s    zWidget._get_control_tooltipc                 C   s   | j  |¡ dS )z7 Toolkit specific method to set the control's tooltip. N)r   Z
SetToolTip)r   Útooltipr   r   r   Ú_set_control_tooltipm   s    zWidget._set_control_tooltipFc                 C   s0   |r| j jtj| jd� n| j  tj| j¡ dS )z> Toolkit specific method to change the control menu observer. )ÚhandlerN)r   ZUnbindÚwxZEVT_CONTEXT_MENUÚ_handle_control_context_menuZBind)r   Úremover   r   r   Ú_observe_control_context_menuq   s    ÿÿz$Widget._observe_control_context_menuc                 C   s2   | j dur.| jdur.| j | j ¡}| j  |¡ dS )z- Signal handler for displaying context menu. N)r   Úcontext_menuZcreate_menuZ	PopupMenu)r   ÚeventÚmenur   r   r   r   |   s    z#Widget._handle_control_context_menu)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úparentr   r   r   r   r   r   r"   r   r   r   r   r   r   r   r!   r   Ú__classcell__r   r   r   r   r
      s    

r
   )r(   r   Z
traits.apir   r   r   r   r   r   Zpyface.i_widgetr   r	   r
   r   r   r   r   Ú<module>   s
    