3
7ßL]  ã               @   sV   d Z ddlZddl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! Mix-in class for split widgets.
é    N)ÚCallableÚEnumÚFloatÚ	HasTraitsÚprovides)ÚISplitWidgetÚMSplitWidgetc               @   sL   e Zd ZdZedddƒZedƒZeZ	e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.
    ÚverticalZ
horizontalg      à?c             C   s°   t jt jƒ}t j|dt jd�}|j|ƒ |jdƒ |jdƒ | j|ƒ}|j	|dt j
ƒ | j|ƒ}|j	|dt j
ƒ |j|ƒ | jdkr’|j||ƒ n|j||ƒ t j|| jƒ |S )zA Create the toolkit-specific control that represents the widget. é   )ÚstyleTé2   r
   éÿÿÿÿ)ÚwxZBoxSizerZVERTICALZSplitterWindowZCLIP_CHILDRENZSetSizerZSetAutoLayoutZSetMinimumPaneSizeÚ_create_lhsÚAddZEXPANDÚ_create_rhsZFitÚ	directionZSplitVerticallyZSplitHorizontallyZEVT_SIZEÚ_on_size)ÚselfÚparentZsizerÚsplitterÚlhsÚrhs© r   ú=/tmp/pip-install-5sebvq2j/pyface/pyface/ui/wx/split_widget.pyÚ_create_splitter3   s    






zSplitWidget._create_splitterc             C   sp   | j dk	rL| j |ƒ}ttdƒr8t|tjtjfƒsJ|j}qlt|tjƒsl|j}n tj|dƒ}|jdƒ |j	dƒ |S )	z= Creates the left hand/top panel depending on the direction. NÚ	WindowPtrr   Zyellowé,  éÈ   r   )r   r   )
r   Úhasattrr   Ú
isinstanceÚWindowr   ÚcontrolÚPanelÚSetBackgroundColourÚSetSize)r   r   r   r   r   r   r   Z   s    




zSplitWidget._create_lhsc             C   sp   | j dk	rL| j |ƒ}ttdƒr8t|tjtjfƒsJ|j}qlt|tjƒsl|j}n tj|dƒ}|jdƒ |j	dƒ |S )	zA Creates the right hand/bottom panel depending on the direction. Nr   r   Zgreenéd   r   r   )r'   r   )
r   r    r   r!   r"   r   r#   r$   r%   r&   )r   r   r   r   r   r   r   o   s    




zSplitWidget._create_rhsc             C   sJ   |j ƒ }|jƒ \}}| jdkr.t|| j ƒ}nt|| j ƒ}|j|ƒ dS )z# Called when the frame is resized. r
   N)ZGetEventObjectZGetSizer   ÚintÚratioZSetSashPosition)r   Úeventr   ÚwidthÚheightÚpositionr   r   r   r   Š   s    

zSplitWidget._on_sizeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r)   r   r   r   r   r   r   r   r   r   r   r   r	      s   'r	   )r1   r   Z
traits.apir   r   r   r   r   Zpyface.i_split_widgetr   r   r	   r   r   r   r   Ú<module>   s
   