a
    §ˆc}  ã                   @   sb   d Z ddlZddlmZ ddlmZmZ ddlmZm	Z	 ddl
mZ eeƒG dd	„ d	e	eƒƒZdS )
z A Layered panel. é    N)ÚScrolledPanel)ÚIntÚprovides)ÚILayeredPanelÚMLayeredPanelé   )ÚLayoutWidgetc                   @   sN   e Zd ZdZejZedƒZedƒZ	dd„ Z
dd„ Zdd„ Zd	d
„ Zdd„ ZdS )ÚLayeredPanelzÚ A Layered panel.

    A layered panel contains one or more named layers, with only one layer
    visible at any one time (think of a 'tab' control minus the tabs!).  Each
    layer is a toolkit-specific control.

    r   c                 C   sè   | j  ¡ }| |dtj¡ | |d¡ || j|< | jdksD| jdkrä| ¡ du rT|S | ¡  	¡ }d}| 
¡ | jkr€| 
¡ | _d}| ¡ | jkrœ| ¡ | _d}|rä| j  | j| j¡ | j  ¡  ¡  | j  ¡ }| ¡  |¡ | ¡  ¡  |S )z— Adds a layer with the specified name.

        All layers are hidden when they are added.  Use 'show_layer' to make a
        layer visible.

        r   FéÿÿÿÿNT)ÚcontrolÚGetSizerÚAddÚwxZEXPANDÚShowÚ_layersÚ	min_widthÚ
min_heightZCalcMinZGetWidthZ	GetHeightZSetSizeHintsÚLayoutZ	GetParent)ÚselfÚnameÚlayerÚsizerZmin_sizeZneeds_layoutÚparent© r   ú]/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/wx/layered_panel.pyÚ	add_layer-   s,    	




zLayeredPanel.add_layerc                 C   s,   | j dur|  | j ¡ |  || j| ¡}|S )z* Shows the layer with the specified name. N)Úcurrent_layerÚ_hide_layerÚ_show_layerr   )r   r   r   r   r   r   Ú
show_layer^   s    
zLayeredPanel.show_layerc                 C   s<   t |d| jd�}t tj¡}| |¡ | d¡ | ¡  |S )zA Create the toolkit-specific control that represents the widget. r
   )ÚstyleT)r   ÚSTYLEr   ZBoxSizerZVERTICALZSetSizerZSetAutoLayoutZSetupScrolling)r   r   Zpanelr   r   r   r   Ú_create_controln   s    

zLayeredPanel._create_controlc                 C   s"   | j  ¡ }| |d¡ | ¡  dS )z Hides the specified layer. FN)r   r   r   r   )r   r   r   r   r   r   r   y   s    
zLayeredPanel._hide_layerc                 C   s.   | j  ¡ }| |d¡ | ¡  || _|| _|S )z Shows the specified layer. T)r   r   r   r   r   Zcurrent_layer_name)r   r   r   r   r   r   r   r   €   s    
zLayeredPanel._show_layerN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ZCLIP_CHILDRENr!   r   r   r   r   r   r"   r   r   r   r   r   r   r	      s   	1r	   )r&   r   Zwx.lib.scrolledpanelr   Z
traits.apir   r   Zpyface.i_layered_panelr   r   Zlayout_widgetr   r	   r   r   r   r   Ú<module>   s   