a
    §ˆcú  ã                   @   sD   d Z ddlZddlmZ ddlmZmZ eeƒG dd„ deƒƒZdS )z! Mix-in class for split widgets.
é    N)Úprovides)ÚISplitWidgetÚMSplitWidgetc                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚSplitWidgetzz The toolkit specific implementation of a SplitWidget.  See the
    ISPlitWidget interface for the API documentation.
    c                 C   s²   t  t j¡}t j|dt jd�}| |¡ | d¡ | d¡ |  |¡}| 	|dt j
¡ |  |¡}| 	|dt j
¡ | |¡ | jdkr’| ||¡ n| ||¡ | t j| j¡ |S )zA Create the toolkit-specific control that represents the widget. éÿÿÿÿ)ÚstyleTé2   é   Úvertical)ÚwxZBoxSizerZVERTICALZSplitterWindowZCLIP_CHILDRENZSetSizerZSetAutoLayoutZSetMinimumPaneSizeÚ_create_lhsÚAddZEXPANDÚ_create_rhsZFitÚ	directionZSplitVerticallyZSplitHorizontallyZBindZEVT_SIZEÚ_on_size)ÚselfÚparentZsizerÚsplitterÚlhsÚrhs© r   ú\/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/wx/split_widget.pyÚ_create_splitter    s    






zSplitWidget._create_splitterc                 C   sL   | j dur(|   |¡}t|tjƒsH|j}n t |d¡}| d¡ | d¡ |S )z= Creates the left hand/top panel depending on the direction. Nr   Zyellow)i,  éÈ   )r   Ú
isinstancer   ÚWindowÚcontrolÚPanelÚSetBackgroundColourÚSetSize)r   r   r   r   r   r   r   G   s    



zSplitWidget._create_lhsc                 C   sL   | j dur(|   |¡}t|tjƒsH|j}n t |d¡}| d¡ | d¡ |S )zA Creates the right hand/bottom panel depending on the direction. Nr   Zgreen)éd   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   W   s    



zSplitWidget._create_rhsc                 C   sN   |  ¡ }| ¡  ¡ \}}| jdkr2t|| j ƒ}nt|| j ƒ}| |¡ dS )z# Called when the frame is resized. r
   N)ZGetEventObjectZGetSizeZGetr   ÚintZratioZSetSashPosition)r   Úeventr   ÚwidthÚheightÚpositionr   r   r   r   m   s    

zSplitWidget._on_sizeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r      s
   'r   )r)   r   Z
traits.apir   Zpyface.i_split_widgetr   r   r   r   r   r   r   Ú<module>   s
   