3
<Ad]:  ã               @   s~   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 ddlmZ ddlmZ ddlmZ ee
ƒG d	d
„ d
eeƒƒZdS )z$ Enthought pyface package component
é    N)ÚEventÚPropertyÚTupleÚUnicodeÚVetoableEventÚprovides)ÚIWindowÚMWindow)ÚKeyPressedEventé   )ÚSystemMetrics)ÚWidgetc               @   sÌ   e Zd ZdZeeƒZeeƒZeZ	e
ZeZe
Ze
ZeZe
Ze
eƒZed$ƒZed'ƒZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Z dd„ Z!dd„ Z"dd„ Z#dd „ Z$d!S )(ÚWindowzp The toolkit specific implementation of a Window.  See the IWindow
    interface for the API documentation.
    r   c             C   s   | j jdƒ | j jƒ  d S )NF)ÚcontrolZIconizeÚRaise)Úself© r   úm/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.6/site-packages/pyface-6.1.2-py3.6.egg/pyface/ui/wx/window.pyÚactivateM   s    zWindow.activatec             C   s   | j j|ƒ d S )N)r   ÚShow)r   Úvisibler   r   r   ÚshowQ   s    zWindow.showc             C   sp   | j jtj| jƒ | j jtj| jƒ | j jtj| jƒ | j jtj	| j
ƒ | j jtj| jƒ | j jtj| jƒ d S )N)r   ÚBindÚwxZEVT_ACTIVATEÚ_wx_on_activateZEVT_SHOWÚ_wx_on_showZ	EVT_CLOSEÚ_wx_on_closeZEVT_SIZEÚ_wx_on_control_sizeZEVT_MOVEÚ_wx_on_control_moveZEVT_CHARÚ_wx_on_char)r   r   r   r   Ú_add_event_listenersX   s    zWindow._add_event_listenersc             C   sX   t jt jB t jB }t j|d| j|| j| jd�}|jt	ƒ j
ƒ |j| jƒ |j| jƒ |S )Nr   )ÚstyleÚsizeÚposéÿÿÿÿ)r   ZDEFAULT_FRAME_STYLEZFRAME_NO_WINDOW_MENUZCLIP_CHILDRENÚFrameÚtitler"   ÚpositionZSetBackgroundColourr   Zdialog_background_colorÚEnableÚenabledr   r   )r   Úparentr!   r   r   r   r   Ú_create_controld   s    
zWindow._create_controlc             C   s   | j S )z Property getter for position. )Ú	_position)r   r   r   r   Ú_get_position~   s    zWindow._get_positionc             C   s4   | j dk	r| j j|ƒ | j}|| _| jd||ƒ dS )z Property setter for position. Nr'   )r   ÚSetPositionr,   Útrait_property_changed)r   r'   Úoldr   r   r   Ú_set_positionƒ   s
    
zWindow._set_positionc             C   s   | j S )z Property getter for size. )Ú_size)r   r   r   r   Ú	_get_sizeŽ   s    zWindow._get_sizec             C   s4   | j dk	r| j j|ƒ | j}|| _| jd||ƒ dS )z Property setter for size. Nr"   )r   ÚSetSizer2   r/   )r   r"   r0   r   r   r   Ú	_set_size“   s
    
zWindow._set_sizec             C   s   | j dk	r| j j|ƒ dS )z Static trait change handler. N)r   ÚSetTitle)r   r&   r   r   r   Ú_title_changedž   s    
zWindow._title_changedc             C   s"   |j ƒ r| | _n| | _|jƒ  dS )z: Called when the frame is being activated or deactivated. N)Z	GetActiveÚ	activatedÚdeactivatedÚSkip)r   Úeventr   r   r   r   ¦   s    zWindow._wx_on_activatec             C   s   |j ƒ | _|jƒ  dS )z: Called when the frame is being activated or deactivated. N)ZIsShownr   r:   )r   r;   r   r   r   r   °   s    
zWindow._wx_on_showc             C   s   | j ƒ  dS )z( Called when the frame is being closed. N)Úclose)r   r;   r   r   r   r   ·   s    zWindow._wx_on_closec             C   s   |j ƒ jƒ | _|jƒ  dS )z$ Called when the window is resized. N)ZGetEventObjectZGetPositionTupler,   r:   )r   r;   r   r   r   r   ¼   s    
zWindow._wx_on_control_movec             C   s&   |j ƒ }|jƒ |jƒ f| _|jƒ  dS )z$ Called when the window is resized. N)ÚGetSizeÚGetWidthÚ	GetHeightr2   r:   )r   r;   Zwxsizer   r   r   r   Ê   s    zWindow._wx_on_control_sizec             C   s4   t |jdk|jdk|jdk|j|d�| _|jƒ  dS )z7 Called when a key is pressed when the tree has focus. r   )Zalt_downZcontrol_downZ
shift_downZkey_coder;   N)r
   Z	m_altDownZm_controlDownZm_shiftDownZ	m_keyCodeÚkey_pressedr:   )r   r;   r   r   r   r   Õ   s    
zWindow._wx_on_charNr$   r$   )r$   r$   r$   r$   )r$   r$   )%Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r'   r"   r   r&   r   Úopenedr   Zopeningr8   ÚclosedÚclosingr9   r
   r@   r,   r2   r   r   r    r+   r-   r1   r3   r5   r7   r   r   r   r   r   r   r   r   r   r   r      s8   
r   )rD   r   Z
traits.apir   r   r   r   r   r   Zpyface.i_windowr   r	   Zpyface.key_pressed_eventr
   Zsystem_metricsr   Zwidgetr   r   r   r   r   r   Ú<module>   s    